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<fidl::encoding::Vector<fidl::encoding::BoundedString<100>, 100>, D>,
116        T16: fidl::encoding::Encode<fidl::encoding::Vector<u16, 100>, D>,
117        T17: fidl::encoding::Encode<fidl::encoding::Vector<u32, 100>, D>,
118        T18: fidl::encoding::Encode<fidl::encoding::Vector<u64, 100>, D>,
119        T19: fidl::encoding::Encode<fidl::encoding::Vector<u8, 100>, D>,
120    > fidl::encoding::Encode<Config, D>
121        for (
122            T0,
123            T1,
124            T2,
125            T3,
126            T4,
127            T5,
128            T6,
129            T7,
130            T8,
131            T9,
132            T10,
133            T11,
134            T12,
135            T13,
136            T14,
137            T15,
138            T16,
139            T17,
140            T18,
141            T19,
142        )
143    {
144        #[inline]
145        unsafe fn encode(
146            self,
147            encoder: &mut fidl::encoding::Encoder<'_, D>,
148            offset: usize,
149            depth: fidl::encoding::Depth,
150        ) -> fidl::Result<()> {
151            encoder.debug_check_bounds::<Config>(offset);
152            // Zero out padding regions. There's no need to apply masks
153            // because the unmasked parts will be overwritten by fields.
154            unsafe {
155                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
156                (ptr as *mut u64).write_unaligned(0);
157            }
158            unsafe {
159                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
160                (ptr as *mut u64).write_unaligned(0);
161            }
162            unsafe {
163                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(40);
164                (ptr as *mut u64).write_unaligned(0);
165            }
166            unsafe {
167                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(56);
168                (ptr as *mut u64).write_unaligned(0);
169            }
170            // Write the fields.
171            self.0.encode(encoder, offset + 0, depth)?;
172            self.1.encode(encoder, offset + 2, depth)?;
173            self.2.encode(encoder, offset + 4, depth)?;
174            self.3.encode(encoder, offset + 8, depth)?;
175            self.4.encode(encoder, offset + 16, depth)?;
176            self.5.encode(encoder, offset + 24, depth)?;
177            self.6.encode(encoder, offset + 40, depth)?;
178            self.7.encode(encoder, offset + 44, depth)?;
179            self.8.encode(encoder, offset + 48, depth)?;
180            self.9.encode(encoder, offset + 56, depth)?;
181            self.10.encode(encoder, offset + 64, depth)?;
182            self.11.encode(encoder, offset + 80, depth)?;
183            self.12.encode(encoder, offset + 96, depth)?;
184            self.13.encode(encoder, offset + 112, depth)?;
185            self.14.encode(encoder, offset + 128, depth)?;
186            self.15.encode(encoder, offset + 144, depth)?;
187            self.16.encode(encoder, offset + 160, depth)?;
188            self.17.encode(encoder, offset + 176, depth)?;
189            self.18.encode(encoder, offset + 192, depth)?;
190            self.19.encode(encoder, offset + 208, depth)?;
191            Ok(())
192        }
193    }
194
195    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Config {
196        #[inline(always)]
197        fn new_empty() -> Self {
198            Self {
199                my_flag: fidl::new_empty!(bool, D),
200                my_int16: fidl::new_empty!(i16, D),
201                my_int32: fidl::new_empty!(i32, D),
202                my_int64: fidl::new_empty!(i64, D),
203                my_int8: fidl::new_empty!(i8, D),
204                my_string: fidl::new_empty!(fidl::encoding::BoundedString<100>, D),
205                my_uint16: fidl::new_empty!(u16, D),
206                my_uint32: fidl::new_empty!(u32, D),
207                my_uint64: fidl::new_empty!(u64, D),
208                my_uint8: fidl::new_empty!(u8, D),
209                my_vector_of_flag: fidl::new_empty!(fidl::encoding::Vector<bool, 100>, D),
210                my_vector_of_int16: fidl::new_empty!(fidl::encoding::Vector<i16, 100>, D),
211                my_vector_of_int32: fidl::new_empty!(fidl::encoding::Vector<i32, 100>, D),
212                my_vector_of_int64: fidl::new_empty!(fidl::encoding::Vector<i64, 100>, D),
213                my_vector_of_int8: fidl::new_empty!(fidl::encoding::Vector<i8, 100>, D),
214                my_vector_of_string: fidl::new_empty!(
215                    fidl::encoding::Vector<fidl::encoding::BoundedString<100>, 100>,
216                    D
217                ),
218                my_vector_of_uint16: fidl::new_empty!(fidl::encoding::Vector<u16, 100>, D),
219                my_vector_of_uint32: fidl::new_empty!(fidl::encoding::Vector<u32, 100>, D),
220                my_vector_of_uint64: fidl::new_empty!(fidl::encoding::Vector<u64, 100>, D),
221                my_vector_of_uint8: fidl::new_empty!(fidl::encoding::Vector<u8, 100>, D),
222            }
223        }
224
225        #[inline]
226        unsafe fn decode(
227            &mut self,
228            decoder: &mut fidl::encoding::Decoder<'_, D>,
229            offset: usize,
230            _depth: fidl::encoding::Depth,
231        ) -> fidl::Result<()> {
232            decoder.debug_check_bounds::<Self>(offset);
233            // Verify that padding bytes are zero.
234            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
235            let padval = unsafe { (ptr as *const u64).read_unaligned() };
236            let mask = 0xff00u64;
237            let maskedval = padval & mask;
238            if maskedval != 0 {
239                return Err(fidl::Error::NonZeroPadding {
240                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
241                });
242            }
243            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
244            let padval = unsafe { (ptr as *const u64).read_unaligned() };
245            let mask = 0xffffffffffffff00u64;
246            let maskedval = padval & mask;
247            if maskedval != 0 {
248                return Err(fidl::Error::NonZeroPadding {
249                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
250                });
251            }
252            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(40) };
253            let padval = unsafe { (ptr as *const u64).read_unaligned() };
254            let mask = 0xffff0000u64;
255            let maskedval = padval & mask;
256            if maskedval != 0 {
257                return Err(fidl::Error::NonZeroPadding {
258                    padding_start: offset + 40 + ((mask as u64).trailing_zeros() / 8) as usize,
259                });
260            }
261            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(56) };
262            let padval = unsafe { (ptr as *const u64).read_unaligned() };
263            let mask = 0xffffffffffffff00u64;
264            let maskedval = padval & mask;
265            if maskedval != 0 {
266                return Err(fidl::Error::NonZeroPadding {
267                    padding_start: offset + 56 + ((mask as u64).trailing_zeros() / 8) as usize,
268                });
269            }
270            fidl::decode!(bool, D, &mut self.my_flag, decoder, offset + 0, _depth)?;
271            fidl::decode!(i16, D, &mut self.my_int16, decoder, offset + 2, _depth)?;
272            fidl::decode!(i32, D, &mut self.my_int32, decoder, offset + 4, _depth)?;
273            fidl::decode!(i64, D, &mut self.my_int64, decoder, offset + 8, _depth)?;
274            fidl::decode!(i8, D, &mut self.my_int8, decoder, offset + 16, _depth)?;
275            fidl::decode!(
276                fidl::encoding::BoundedString<100>,
277                D,
278                &mut self.my_string,
279                decoder,
280                offset + 24,
281                _depth
282            )?;
283            fidl::decode!(u16, D, &mut self.my_uint16, decoder, offset + 40, _depth)?;
284            fidl::decode!(u32, D, &mut self.my_uint32, decoder, offset + 44, _depth)?;
285            fidl::decode!(u64, D, &mut self.my_uint64, decoder, offset + 48, _depth)?;
286            fidl::decode!(u8, D, &mut self.my_uint8, decoder, offset + 56, _depth)?;
287            fidl::decode!(fidl::encoding::Vector<bool, 100>, D, &mut self.my_vector_of_flag, decoder, offset + 64, _depth)?;
288            fidl::decode!(fidl::encoding::Vector<i16, 100>, D, &mut self.my_vector_of_int16, decoder, offset + 80, _depth)?;
289            fidl::decode!(fidl::encoding::Vector<i32, 100>, D, &mut self.my_vector_of_int32, decoder, offset + 96, _depth)?;
290            fidl::decode!(fidl::encoding::Vector<i64, 100>, D, &mut self.my_vector_of_int64, decoder, offset + 112, _depth)?;
291            fidl::decode!(fidl::encoding::Vector<i8, 100>, D, &mut self.my_vector_of_int8, decoder, offset + 128, _depth)?;
292            fidl::decode!(
293                fidl::encoding::Vector<fidl::encoding::BoundedString<100>, 100>,
294                D,
295                &mut self.my_vector_of_string,
296                decoder,
297                offset + 144,
298                _depth
299            )?;
300            fidl::decode!(fidl::encoding::Vector<u16, 100>, D, &mut self.my_vector_of_uint16, decoder, offset + 160, _depth)?;
301            fidl::decode!(fidl::encoding::Vector<u32, 100>, D, &mut self.my_vector_of_uint32, decoder, offset + 176, _depth)?;
302            fidl::decode!(fidl::encoding::Vector<u64, 100>, D, &mut self.my_vector_of_uint64, decoder, offset + 192, _depth)?;
303            fidl::decode!(fidl::encoding::Vector<u8, 100>, D, &mut self.my_vector_of_uint8, decoder, offset + 208, _depth)?;
304            Ok(())
305        }
306    }
307}