fidl_fuchsia_fs__common/
fidl_fuchsia_fs__common.rs

1// WARNING: This file is machine generated by fidlgen.
2
3#![warn(clippy::all)]
4#![allow(unused_parens, unused_mut, unused_imports, nonstandard_style)]
5
6use bitflags::bitflags;
7use fidl::encoding::{MessageBufFor, ProxyChannelBox, ResourceDialect};
8use futures::future::{self, MaybeDone, TryFutureExt};
9use zx_status;
10
11#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
12pub enum VfsType {
13    Blobfs,
14    Fatfs,
15    Minfs,
16    Memfs,
17    Factoryfs,
18    Fxfs,
19    F2Fs,
20    #[doc(hidden)]
21    __SourceBreaking {
22        unknown_ordinal: u32,
23    },
24}
25
26/// Pattern that matches an unknown `VfsType` member.
27#[macro_export]
28macro_rules! VfsTypeUnknown {
29    () => {
30        _
31    };
32}
33
34impl VfsType {
35    #[inline]
36    pub fn from_primitive(prim: u32) -> Option<Self> {
37        match prim {
38            2657701153 => Some(Self::Blobfs),
39            3463007521 => Some(Self::Fatfs),
40            1852394785 => Some(Self::Minfs),
41            1047088417 => Some(Self::Memfs),
42            510217505 => Some(Self::Factoryfs),
43            1936095334 => Some(Self::Fxfs),
44            4268313889 => Some(Self::F2Fs),
45            _ => None,
46        }
47    }
48
49    #[inline]
50    pub fn from_primitive_allow_unknown(prim: u32) -> Self {
51        match prim {
52            2657701153 => Self::Blobfs,
53            3463007521 => Self::Fatfs,
54            1852394785 => Self::Minfs,
55            1047088417 => Self::Memfs,
56            510217505 => Self::Factoryfs,
57            1936095334 => Self::Fxfs,
58            4268313889 => Self::F2Fs,
59            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
60        }
61    }
62
63    #[inline]
64    pub fn unknown() -> Self {
65        Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
66    }
67
68    #[inline]
69    pub const fn into_primitive(self) -> u32 {
70        match self {
71            Self::Blobfs => 2657701153,
72            Self::Fatfs => 3463007521,
73            Self::Minfs => 1852394785,
74            Self::Memfs => 1047088417,
75            Self::Factoryfs => 510217505,
76            Self::Fxfs => 1936095334,
77            Self::F2Fs => 4268313889,
78            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
79        }
80    }
81
82    #[inline]
83    pub fn is_unknown(&self) -> bool {
84        match self {
85            Self::__SourceBreaking { unknown_ordinal: _ } => true,
86            _ => false,
87        }
88    }
89}
90
91pub mod admin_ordinals {
92    pub const SHUTDOWN: u64 = 0x5476abc45167ca8e;
93}
94
95mod internal {
96    use super::*;
97    unsafe impl fidl::encoding::TypeMarker for VfsType {
98        type Owned = Self;
99
100        #[inline(always)]
101        fn inline_align(_context: fidl::encoding::Context) -> usize {
102            std::mem::align_of::<u32>()
103        }
104
105        #[inline(always)]
106        fn inline_size(_context: fidl::encoding::Context) -> usize {
107            std::mem::size_of::<u32>()
108        }
109
110        #[inline(always)]
111        fn encode_is_copy() -> bool {
112            false
113        }
114
115        #[inline(always)]
116        fn decode_is_copy() -> bool {
117            false
118        }
119    }
120
121    impl fidl::encoding::ValueTypeMarker for VfsType {
122        type Borrowed<'a> = Self;
123        #[inline(always)]
124        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
125            *value
126        }
127    }
128
129    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for VfsType {
130        #[inline]
131        unsafe fn encode(
132            self,
133            encoder: &mut fidl::encoding::Encoder<'_, D>,
134            offset: usize,
135            _depth: fidl::encoding::Depth,
136        ) -> fidl::Result<()> {
137            encoder.debug_check_bounds::<Self>(offset);
138            encoder.write_num(self.into_primitive(), offset);
139            Ok(())
140        }
141    }
142
143    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for VfsType {
144        #[inline(always)]
145        fn new_empty() -> Self {
146            Self::unknown()
147        }
148
149        #[inline]
150        unsafe fn decode(
151            &mut self,
152            decoder: &mut fidl::encoding::Decoder<'_, D>,
153            offset: usize,
154            _depth: fidl::encoding::Depth,
155        ) -> fidl::Result<()> {
156            decoder.debug_check_bounds::<Self>(offset);
157            let prim = decoder.read_num::<u32>(offset);
158
159            *self = Self::from_primitive_allow_unknown(prim);
160            Ok(())
161        }
162    }
163}