fidl_fuchsia_storage_blobfs__common/
fidl_fuchsia_storage_blobfs__common.rs1#![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)]
13pub enum OverwriteFormat {
14 NoOverwrite,
19 OverwriteToCompact,
23 OverwriteToPadded,
27 #[doc(hidden)]
28 __SourceBreaking { unknown_ordinal: u32 },
29}
30
31#[macro_export]
33macro_rules! OverwriteFormatUnknown {
34 () => {
35 _
36 };
37}
38
39impl OverwriteFormat {
40 #[inline]
41 pub fn from_primitive(prim: u32) -> Option<Self> {
42 match prim {
43 1 => Some(Self::NoOverwrite),
44 2 => Some(Self::OverwriteToCompact),
45 3 => Some(Self::OverwriteToPadded),
46 _ => None,
47 }
48 }
49
50 #[inline]
51 pub fn from_primitive_allow_unknown(prim: u32) -> Self {
52 match prim {
53 1 => Self::NoOverwrite,
54 2 => Self::OverwriteToCompact,
55 3 => Self::OverwriteToPadded,
56 unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
57 }
58 }
59
60 #[inline]
61 pub fn unknown() -> Self {
62 Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
63 }
64
65 #[inline]
66 pub const fn into_primitive(self) -> u32 {
67 match self {
68 Self::NoOverwrite => 1,
69 Self::OverwriteToCompact => 2,
70 Self::OverwriteToPadded => 3,
71 Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
72 }
73 }
74
75 #[inline]
76 pub fn is_unknown(&self) -> bool {
77 match self {
78 Self::__SourceBreaking { unknown_ordinal: _ } => true,
79 _ => false,
80 }
81 }
82}
83
84#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
85pub struct OverwriteConfigurationSetRequest {
86 pub overwrite_format: OverwriteFormat,
87}
88
89impl fidl::Persistable for OverwriteConfigurationSetRequest {}
90
91pub mod overwrite_configuration_ordinals {
92 pub const SET: u64 = 0x756a2a36396e0e08;
93}
94
95mod internal {
96 use super::*;
97 unsafe impl fidl::encoding::TypeMarker for OverwriteFormat {
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 OverwriteFormat {
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>
130 for OverwriteFormat
131 {
132 #[inline]
133 unsafe fn encode(
134 self,
135 encoder: &mut fidl::encoding::Encoder<'_, D>,
136 offset: usize,
137 _depth: fidl::encoding::Depth,
138 ) -> fidl::Result<()> {
139 encoder.debug_check_bounds::<Self>(offset);
140 encoder.write_num(self.into_primitive(), offset);
141 Ok(())
142 }
143 }
144
145 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for OverwriteFormat {
146 #[inline(always)]
147 fn new_empty() -> Self {
148 Self::unknown()
149 }
150
151 #[inline]
152 unsafe fn decode(
153 &mut self,
154 decoder: &mut fidl::encoding::Decoder<'_, D>,
155 offset: usize,
156 _depth: fidl::encoding::Depth,
157 ) -> fidl::Result<()> {
158 decoder.debug_check_bounds::<Self>(offset);
159 let prim = decoder.read_num::<u32>(offset);
160
161 *self = Self::from_primitive_allow_unknown(prim);
162 Ok(())
163 }
164 }
165
166 impl fidl::encoding::ValueTypeMarker for OverwriteConfigurationSetRequest {
167 type Borrowed<'a> = &'a Self;
168 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
169 value
170 }
171 }
172
173 unsafe impl fidl::encoding::TypeMarker for OverwriteConfigurationSetRequest {
174 type Owned = Self;
175
176 #[inline(always)]
177 fn inline_align(_context: fidl::encoding::Context) -> usize {
178 4
179 }
180
181 #[inline(always)]
182 fn inline_size(_context: fidl::encoding::Context) -> usize {
183 4
184 }
185 }
186
187 unsafe impl<D: fidl::encoding::ResourceDialect>
188 fidl::encoding::Encode<OverwriteConfigurationSetRequest, D>
189 for &OverwriteConfigurationSetRequest
190 {
191 #[inline]
192 unsafe fn encode(
193 self,
194 encoder: &mut fidl::encoding::Encoder<'_, D>,
195 offset: usize,
196 _depth: fidl::encoding::Depth,
197 ) -> fidl::Result<()> {
198 encoder.debug_check_bounds::<OverwriteConfigurationSetRequest>(offset);
199 fidl::encoding::Encode::<OverwriteConfigurationSetRequest, D>::encode(
201 (<OverwriteFormat as fidl::encoding::ValueTypeMarker>::borrow(
202 &self.overwrite_format,
203 ),),
204 encoder,
205 offset,
206 _depth,
207 )
208 }
209 }
210 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<OverwriteFormat, D>>
211 fidl::encoding::Encode<OverwriteConfigurationSetRequest, D> for (T0,)
212 {
213 #[inline]
214 unsafe fn encode(
215 self,
216 encoder: &mut fidl::encoding::Encoder<'_, D>,
217 offset: usize,
218 depth: fidl::encoding::Depth,
219 ) -> fidl::Result<()> {
220 encoder.debug_check_bounds::<OverwriteConfigurationSetRequest>(offset);
221 self.0.encode(encoder, offset + 0, depth)?;
225 Ok(())
226 }
227 }
228
229 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
230 for OverwriteConfigurationSetRequest
231 {
232 #[inline(always)]
233 fn new_empty() -> Self {
234 Self { overwrite_format: fidl::new_empty!(OverwriteFormat, D) }
235 }
236
237 #[inline]
238 unsafe fn decode(
239 &mut self,
240 decoder: &mut fidl::encoding::Decoder<'_, D>,
241 offset: usize,
242 _depth: fidl::encoding::Depth,
243 ) -> fidl::Result<()> {
244 decoder.debug_check_bounds::<Self>(offset);
245 fidl::decode!(
247 OverwriteFormat,
248 D,
249 &mut self.overwrite_format,
250 decoder,
251 offset + 0,
252 _depth
253 )?;
254 Ok(())
255 }
256 }
257}