fidl_cf_sc_internal_receiverconfig_common/
fidl_cf_sc_internal_receiverconfig_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(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
12pub struct Config {
13    pub my_flag: bool,
14    pub my_int16: i16,
15    pub my_int32: i32,
16    pub my_int64: i64,
17    pub my_int8: i8,
18    pub my_string: String,
19    pub my_uint16: u16,
20    pub my_uint32: u32,
21    pub my_uint64: u64,
22    pub my_uint8: u8,
23    pub my_vector_of_flag: Vec<bool>,
24    pub my_vector_of_int16: Vec<i16>,
25    pub my_vector_of_int32: Vec<i32>,
26    pub my_vector_of_int64: Vec<i64>,
27    pub my_vector_of_int8: Vec<i8>,
28    pub my_vector_of_string: Vec<String>,
29    pub my_vector_of_uint16: Vec<u16>,
30    pub my_vector_of_uint32: Vec<u32>,
31    pub my_vector_of_uint64: Vec<u64>,
32    pub my_vector_of_uint8: Vec<u8>,
33}
34
35impl fidl::Persistable for Config {}
36
37mod internal {
38    use super::*;
39
40    impl fidl::encoding::ValueTypeMarker for Config {
41        type Borrowed<'a> = &'a Self;
42        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
43            value
44        }
45    }
46
47    unsafe impl fidl::encoding::TypeMarker for Config {
48        type Owned = Self;
49
50        #[inline(always)]
51        fn inline_align(_context: fidl::encoding::Context) -> usize {
52            8
53        }
54
55        #[inline(always)]
56        fn inline_size(_context: fidl::encoding::Context) -> usize {
57            224
58        }
59    }
60
61    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Config, D> for &Config {
62        #[inline]
63        unsafe fn encode(
64            self,
65            encoder: &mut fidl::encoding::Encoder<'_, D>,
66            offset: usize,
67            _depth: fidl::encoding::Depth,
68        ) -> fidl::Result<()> {
69            encoder.debug_check_bounds::<Config>(offset);
70            // Delegate to tuple encoding.
71            fidl::encoding::Encode::<Config, D>::encode(
72                (
73                    <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.my_flag),
74                    <i16 as fidl::encoding::ValueTypeMarker>::borrow(&self.my_int16),
75                    <i32 as fidl::encoding::ValueTypeMarker>::borrow(&self.my_int32),
76                    <i64 as fidl::encoding::ValueTypeMarker>::borrow(&self.my_int64),
77                    <i8 as fidl::encoding::ValueTypeMarker>::borrow(&self.my_int8),
78                    <fidl::encoding::BoundedString<100> as fidl::encoding::ValueTypeMarker>::borrow(&self.my_string),
79                    <u16 as fidl::encoding::ValueTypeMarker>::borrow(&self.my_uint16),
80                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.my_uint32),
81                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.my_uint64),
82                    <u8 as fidl::encoding::ValueTypeMarker>::borrow(&self.my_uint8),
83                    <fidl::encoding::Vector<bool, 100> as fidl::encoding::ValueTypeMarker>::borrow(&self.my_vector_of_flag),
84                    <fidl::encoding::Vector<i16, 100> as fidl::encoding::ValueTypeMarker>::borrow(&self.my_vector_of_int16),
85                    <fidl::encoding::Vector<i32, 100> as fidl::encoding::ValueTypeMarker>::borrow(&self.my_vector_of_int32),
86                    <fidl::encoding::Vector<i64, 100> as fidl::encoding::ValueTypeMarker>::borrow(&self.my_vector_of_int64),
87                    <fidl::encoding::Vector<i8, 100> as fidl::encoding::ValueTypeMarker>::borrow(&self.my_vector_of_int8),
88                    <fidl::encoding::Vector<fidl::encoding::BoundedString<100>, 100> as fidl::encoding::ValueTypeMarker>::borrow(&self.my_vector_of_string),
89                    <fidl::encoding::Vector<u16, 100> as fidl::encoding::ValueTypeMarker>::borrow(&self.my_vector_of_uint16),
90                    <fidl::encoding::Vector<u32, 100> as fidl::encoding::ValueTypeMarker>::borrow(&self.my_vector_of_uint32),
91                    <fidl::encoding::Vector<u64, 100> as fidl::encoding::ValueTypeMarker>::borrow(&self.my_vector_of_uint64),
92                    <fidl::encoding::Vector<u8, 100> as fidl::encoding::ValueTypeMarker>::borrow(&self.my_vector_of_uint8),
93                ),
94                encoder, offset, _depth
95            )
96        }
97    }
98    unsafe impl<
99            D: fidl::encoding::ResourceDialect,
100            T0: fidl::encoding::Encode<bool, D>,
101            T1: fidl::encoding::Encode<i16, D>,
102            T2: fidl::encoding::Encode<i32, D>,
103            T3: fidl::encoding::Encode<i64, D>,
104            T4: fidl::encoding::Encode<i8, D>,
105            T5: fidl::encoding::Encode<fidl::encoding::BoundedString<100>, D>,
106            T6: fidl::encoding::Encode<u16, D>,
107            T7: fidl::encoding::Encode<u32, D>,
108            T8: fidl::encoding::Encode<u64, D>,
109            T9: fidl::encoding::Encode<u8, D>,
110            T10: fidl::encoding::Encode<fidl::encoding::Vector<bool, 100>, D>,
111            T11: fidl::encoding::Encode<fidl::encoding::Vector<i16, 100>, D>,
112            T12: fidl::encoding::Encode<fidl::encoding::Vector<i32, 100>, D>,
113            T13: fidl::encoding::Encode<fidl::encoding::Vector<i64, 100>, D>,
114            T14: fidl::encoding::Encode<fidl::encoding::Vector<i8, 100>, D>,
115            T15: fidl::encoding::Encode<
116                fidl::encoding::Vector<fidl::encoding::BoundedString<100>, 100>,
117                D,
118            >,
119            T16: fidl::encoding::Encode<fidl::encoding::Vector<u16, 100>, D>,
120            T17: fidl::encoding::Encode<fidl::encoding::Vector<u32, 100>, D>,
121            T18: fidl::encoding::Encode<fidl::encoding::Vector<u64, 100>, D>,
122            T19: fidl::encoding::Encode<fidl::encoding::Vector<u8, 100>, D>,
123        > fidl::encoding::Encode<Config, D>
124        for (
125            T0,
126            T1,
127            T2,
128            T3,
129            T4,
130            T5,
131            T6,
132            T7,
133            T8,
134            T9,
135            T10,
136            T11,
137            T12,
138            T13,
139            T14,
140            T15,
141            T16,
142            T17,
143            T18,
144            T19,
145        )
146    {
147        #[inline]
148        unsafe fn encode(
149            self,
150            encoder: &mut fidl::encoding::Encoder<'_, D>,
151            offset: usize,
152            depth: fidl::encoding::Depth,
153        ) -> fidl::Result<()> {
154            encoder.debug_check_bounds::<Config>(offset);
155            // Zero out padding regions. There's no need to apply masks
156            // because the unmasked parts will be overwritten by fields.
157            unsafe {
158                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
159                (ptr as *mut u64).write_unaligned(0);
160            }
161            unsafe {
162                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
163                (ptr as *mut u64).write_unaligned(0);
164            }
165            unsafe {
166                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(40);
167                (ptr as *mut u64).write_unaligned(0);
168            }
169            unsafe {
170                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(56);
171                (ptr as *mut u64).write_unaligned(0);
172            }
173            // Write the fields.
174            self.0.encode(encoder, offset + 0, depth)?;
175            self.1.encode(encoder, offset + 2, depth)?;
176            self.2.encode(encoder, offset + 4, depth)?;
177            self.3.encode(encoder, offset + 8, depth)?;
178            self.4.encode(encoder, offset + 16, depth)?;
179            self.5.encode(encoder, offset + 24, depth)?;
180            self.6.encode(encoder, offset + 40, depth)?;
181            self.7.encode(encoder, offset + 44, depth)?;
182            self.8.encode(encoder, offset + 48, depth)?;
183            self.9.encode(encoder, offset + 56, depth)?;
184            self.10.encode(encoder, offset + 64, depth)?;
185            self.11.encode(encoder, offset + 80, depth)?;
186            self.12.encode(encoder, offset + 96, depth)?;
187            self.13.encode(encoder, offset + 112, depth)?;
188            self.14.encode(encoder, offset + 128, depth)?;
189            self.15.encode(encoder, offset + 144, depth)?;
190            self.16.encode(encoder, offset + 160, depth)?;
191            self.17.encode(encoder, offset + 176, depth)?;
192            self.18.encode(encoder, offset + 192, depth)?;
193            self.19.encode(encoder, offset + 208, depth)?;
194            Ok(())
195        }
196    }
197
198    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Config {
199        #[inline(always)]
200        fn new_empty() -> Self {
201            Self {
202                my_flag: fidl::new_empty!(bool, D),
203                my_int16: fidl::new_empty!(i16, D),
204                my_int32: fidl::new_empty!(i32, D),
205                my_int64: fidl::new_empty!(i64, D),
206                my_int8: fidl::new_empty!(i8, D),
207                my_string: fidl::new_empty!(fidl::encoding::BoundedString<100>, D),
208                my_uint16: fidl::new_empty!(u16, D),
209                my_uint32: fidl::new_empty!(u32, D),
210                my_uint64: fidl::new_empty!(u64, D),
211                my_uint8: fidl::new_empty!(u8, D),
212                my_vector_of_flag: fidl::new_empty!(fidl::encoding::Vector<bool, 100>, D),
213                my_vector_of_int16: fidl::new_empty!(fidl::encoding::Vector<i16, 100>, D),
214                my_vector_of_int32: fidl::new_empty!(fidl::encoding::Vector<i32, 100>, D),
215                my_vector_of_int64: fidl::new_empty!(fidl::encoding::Vector<i64, 100>, D),
216                my_vector_of_int8: fidl::new_empty!(fidl::encoding::Vector<i8, 100>, D),
217                my_vector_of_string: fidl::new_empty!(
218                    fidl::encoding::Vector<fidl::encoding::BoundedString<100>, 100>,
219                    D
220                ),
221                my_vector_of_uint16: fidl::new_empty!(fidl::encoding::Vector<u16, 100>, D),
222                my_vector_of_uint32: fidl::new_empty!(fidl::encoding::Vector<u32, 100>, D),
223                my_vector_of_uint64: fidl::new_empty!(fidl::encoding::Vector<u64, 100>, D),
224                my_vector_of_uint8: fidl::new_empty!(fidl::encoding::Vector<u8, 100>, D),
225            }
226        }
227
228        #[inline]
229        unsafe fn decode(
230            &mut self,
231            decoder: &mut fidl::encoding::Decoder<'_, D>,
232            offset: usize,
233            _depth: fidl::encoding::Depth,
234        ) -> fidl::Result<()> {
235            decoder.debug_check_bounds::<Self>(offset);
236            // Verify that padding bytes are zero.
237            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
238            let padval = unsafe { (ptr as *const u64).read_unaligned() };
239            let mask = 0xff00u64;
240            let maskedval = padval & mask;
241            if maskedval != 0 {
242                return Err(fidl::Error::NonZeroPadding {
243                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
244                });
245            }
246            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
247            let padval = unsafe { (ptr as *const u64).read_unaligned() };
248            let mask = 0xffffffffffffff00u64;
249            let maskedval = padval & mask;
250            if maskedval != 0 {
251                return Err(fidl::Error::NonZeroPadding {
252                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
253                });
254            }
255            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(40) };
256            let padval = unsafe { (ptr as *const u64).read_unaligned() };
257            let mask = 0xffff0000u64;
258            let maskedval = padval & mask;
259            if maskedval != 0 {
260                return Err(fidl::Error::NonZeroPadding {
261                    padding_start: offset + 40 + ((mask as u64).trailing_zeros() / 8) as usize,
262                });
263            }
264            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(56) };
265            let padval = unsafe { (ptr as *const u64).read_unaligned() };
266            let mask = 0xffffffffffffff00u64;
267            let maskedval = padval & mask;
268            if maskedval != 0 {
269                return Err(fidl::Error::NonZeroPadding {
270                    padding_start: offset + 56 + ((mask as u64).trailing_zeros() / 8) as usize,
271                });
272            }
273            fidl::decode!(bool, D, &mut self.my_flag, decoder, offset + 0, _depth)?;
274            fidl::decode!(i16, D, &mut self.my_int16, decoder, offset + 2, _depth)?;
275            fidl::decode!(i32, D, &mut self.my_int32, decoder, offset + 4, _depth)?;
276            fidl::decode!(i64, D, &mut self.my_int64, decoder, offset + 8, _depth)?;
277            fidl::decode!(i8, D, &mut self.my_int8, decoder, offset + 16, _depth)?;
278            fidl::decode!(
279                fidl::encoding::BoundedString<100>,
280                D,
281                &mut self.my_string,
282                decoder,
283                offset + 24,
284                _depth
285            )?;
286            fidl::decode!(u16, D, &mut self.my_uint16, decoder, offset + 40, _depth)?;
287            fidl::decode!(u32, D, &mut self.my_uint32, decoder, offset + 44, _depth)?;
288            fidl::decode!(u64, D, &mut self.my_uint64, decoder, offset + 48, _depth)?;
289            fidl::decode!(u8, D, &mut self.my_uint8, decoder, offset + 56, _depth)?;
290            fidl::decode!(fidl::encoding::Vector<bool, 100>, D, &mut self.my_vector_of_flag, decoder, offset + 64, _depth)?;
291            fidl::decode!(fidl::encoding::Vector<i16, 100>, D, &mut self.my_vector_of_int16, decoder, offset + 80, _depth)?;
292            fidl::decode!(fidl::encoding::Vector<i32, 100>, D, &mut self.my_vector_of_int32, decoder, offset + 96, _depth)?;
293            fidl::decode!(fidl::encoding::Vector<i64, 100>, D, &mut self.my_vector_of_int64, decoder, offset + 112, _depth)?;
294            fidl::decode!(fidl::encoding::Vector<i8, 100>, D, &mut self.my_vector_of_int8, decoder, offset + 128, _depth)?;
295            fidl::decode!(
296                fidl::encoding::Vector<fidl::encoding::BoundedString<100>, 100>,
297                D,
298                &mut self.my_vector_of_string,
299                decoder,
300                offset + 144,
301                _depth
302            )?;
303            fidl::decode!(fidl::encoding::Vector<u16, 100>, D, &mut self.my_vector_of_uint16, decoder, offset + 160, _depth)?;
304            fidl::decode!(fidl::encoding::Vector<u32, 100>, D, &mut self.my_vector_of_uint32, decoder, offset + 176, _depth)?;
305            fidl::decode!(fidl::encoding::Vector<u64, 100>, D, &mut self.my_vector_of_uint64, decoder, offset + 192, _depth)?;
306            fidl::decode!(fidl::encoding::Vector<u8, 100>, D, &mut self.my_vector_of_uint8, decoder, offset + 208, _depth)?;
307            Ok(())
308        }
309    }
310}