fidl_fuchsia_wlan_minstrel_common/
fidl_fuchsia_wlan_minstrel_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, PartialEq, PartialOrd)]
12pub struct Peer {
13    pub addr: [u8; 6],
14    pub max_tp: u16,
15    pub max_probability: u16,
16    pub basic_highest: u16,
17    pub basic_max_probability: u16,
18    pub probes: u64,
19    pub entries: Vec<StatsEntry>,
20}
21
22impl fidl::Persistable for Peer {}
23
24#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
25pub struct Peers {
26    pub addrs: Vec<[u8; 6]>,
27}
28
29impl fidl::Persistable for Peers {}
30
31#[derive(Clone, Debug, PartialEq, PartialOrd)]
32pub struct StatsEntry {
33    pub tx_vector_idx: u16,
34    pub tx_vec_desc: String,
35    pub success_cur: u64,
36    pub attempts_cur: u64,
37    pub probability: f32,
38    pub cur_tp: f32,
39    pub success_total: u64,
40    pub attempts_total: u64,
41    pub probes_total: u64,
42    pub probe_cycles_skipped: u8,
43}
44
45impl fidl::Persistable for StatsEntry {}
46
47mod internal {
48    use super::*;
49
50    impl fidl::encoding::ValueTypeMarker for Peer {
51        type Borrowed<'a> = &'a Self;
52        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
53            value
54        }
55    }
56
57    unsafe impl fidl::encoding::TypeMarker for Peer {
58        type Owned = Self;
59
60        #[inline(always)]
61        fn inline_align(_context: fidl::encoding::Context) -> usize {
62            8
63        }
64
65        #[inline(always)]
66        fn inline_size(_context: fidl::encoding::Context) -> usize {
67            40
68        }
69    }
70
71    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Peer, D> for &Peer {
72        #[inline]
73        unsafe fn encode(
74            self,
75            encoder: &mut fidl::encoding::Encoder<'_, D>,
76            offset: usize,
77            _depth: fidl::encoding::Depth,
78        ) -> fidl::Result<()> {
79            encoder.debug_check_bounds::<Peer>(offset);
80            // Delegate to tuple encoding.
81            fidl::encoding::Encode::<Peer, D>::encode(
82                (
83                    <fidl::encoding::Array<u8, 6> as fidl::encoding::ValueTypeMarker>::borrow(&self.addr),
84                    <u16 as fidl::encoding::ValueTypeMarker>::borrow(&self.max_tp),
85                    <u16 as fidl::encoding::ValueTypeMarker>::borrow(&self.max_probability),
86                    <u16 as fidl::encoding::ValueTypeMarker>::borrow(&self.basic_highest),
87                    <u16 as fidl::encoding::ValueTypeMarker>::borrow(&self.basic_max_probability),
88                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.probes),
89                    <fidl::encoding::UnboundedVector<StatsEntry> as fidl::encoding::ValueTypeMarker>::borrow(&self.entries),
90                ),
91                encoder, offset, _depth
92            )
93        }
94    }
95    unsafe impl<
96            D: fidl::encoding::ResourceDialect,
97            T0: fidl::encoding::Encode<fidl::encoding::Array<u8, 6>, D>,
98            T1: fidl::encoding::Encode<u16, D>,
99            T2: fidl::encoding::Encode<u16, D>,
100            T3: fidl::encoding::Encode<u16, D>,
101            T4: fidl::encoding::Encode<u16, D>,
102            T5: fidl::encoding::Encode<u64, D>,
103            T6: fidl::encoding::Encode<fidl::encoding::UnboundedVector<StatsEntry>, D>,
104        > fidl::encoding::Encode<Peer, D> for (T0, T1, T2, T3, T4, T5, T6)
105    {
106        #[inline]
107        unsafe fn encode(
108            self,
109            encoder: &mut fidl::encoding::Encoder<'_, D>,
110            offset: usize,
111            depth: fidl::encoding::Depth,
112        ) -> fidl::Result<()> {
113            encoder.debug_check_bounds::<Peer>(offset);
114            // Zero out padding regions. There's no need to apply masks
115            // because the unmasked parts will be overwritten by fields.
116            unsafe {
117                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
118                (ptr as *mut u64).write_unaligned(0);
119            }
120            // Write the fields.
121            self.0.encode(encoder, offset + 0, depth)?;
122            self.1.encode(encoder, offset + 6, depth)?;
123            self.2.encode(encoder, offset + 8, depth)?;
124            self.3.encode(encoder, offset + 10, depth)?;
125            self.4.encode(encoder, offset + 12, depth)?;
126            self.5.encode(encoder, offset + 16, depth)?;
127            self.6.encode(encoder, offset + 24, depth)?;
128            Ok(())
129        }
130    }
131
132    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Peer {
133        #[inline(always)]
134        fn new_empty() -> Self {
135            Self {
136                addr: fidl::new_empty!(fidl::encoding::Array<u8, 6>, D),
137                max_tp: fidl::new_empty!(u16, D),
138                max_probability: fidl::new_empty!(u16, D),
139                basic_highest: fidl::new_empty!(u16, D),
140                basic_max_probability: fidl::new_empty!(u16, D),
141                probes: fidl::new_empty!(u64, D),
142                entries: fidl::new_empty!(fidl::encoding::UnboundedVector<StatsEntry>, D),
143            }
144        }
145
146        #[inline]
147        unsafe fn decode(
148            &mut self,
149            decoder: &mut fidl::encoding::Decoder<'_, D>,
150            offset: usize,
151            _depth: fidl::encoding::Depth,
152        ) -> fidl::Result<()> {
153            decoder.debug_check_bounds::<Self>(offset);
154            // Verify that padding bytes are zero.
155            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(8) };
156            let padval = unsafe { (ptr as *const u64).read_unaligned() };
157            let mask = 0xffff000000000000u64;
158            let maskedval = padval & mask;
159            if maskedval != 0 {
160                return Err(fidl::Error::NonZeroPadding {
161                    padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
162                });
163            }
164            fidl::decode!(fidl::encoding::Array<u8, 6>, D, &mut self.addr, decoder, offset + 0, _depth)?;
165            fidl::decode!(u16, D, &mut self.max_tp, decoder, offset + 6, _depth)?;
166            fidl::decode!(u16, D, &mut self.max_probability, decoder, offset + 8, _depth)?;
167            fidl::decode!(u16, D, &mut self.basic_highest, decoder, offset + 10, _depth)?;
168            fidl::decode!(u16, D, &mut self.basic_max_probability, decoder, offset + 12, _depth)?;
169            fidl::decode!(u64, D, &mut self.probes, decoder, offset + 16, _depth)?;
170            fidl::decode!(
171                fidl::encoding::UnboundedVector<StatsEntry>,
172                D,
173                &mut self.entries,
174                decoder,
175                offset + 24,
176                _depth
177            )?;
178            Ok(())
179        }
180    }
181
182    impl fidl::encoding::ValueTypeMarker for Peers {
183        type Borrowed<'a> = &'a Self;
184        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
185            value
186        }
187    }
188
189    unsafe impl fidl::encoding::TypeMarker for Peers {
190        type Owned = Self;
191
192        #[inline(always)]
193        fn inline_align(_context: fidl::encoding::Context) -> usize {
194            8
195        }
196
197        #[inline(always)]
198        fn inline_size(_context: fidl::encoding::Context) -> usize {
199            16
200        }
201    }
202
203    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Peers, D> for &Peers {
204        #[inline]
205        unsafe fn encode(
206            self,
207            encoder: &mut fidl::encoding::Encoder<'_, D>,
208            offset: usize,
209            _depth: fidl::encoding::Depth,
210        ) -> fidl::Result<()> {
211            encoder.debug_check_bounds::<Peers>(offset);
212            // Delegate to tuple encoding.
213            fidl::encoding::Encode::<Peers, D>::encode(
214                (
215                    <fidl::encoding::UnboundedVector<fidl::encoding::Array<u8, 6>> as fidl::encoding::ValueTypeMarker>::borrow(&self.addrs),
216                ),
217                encoder, offset, _depth
218            )
219        }
220    }
221    unsafe impl<
222            D: fidl::encoding::ResourceDialect,
223            T0: fidl::encoding::Encode<
224                fidl::encoding::UnboundedVector<fidl::encoding::Array<u8, 6>>,
225                D,
226            >,
227        > fidl::encoding::Encode<Peers, D> for (T0,)
228    {
229        #[inline]
230        unsafe fn encode(
231            self,
232            encoder: &mut fidl::encoding::Encoder<'_, D>,
233            offset: usize,
234            depth: fidl::encoding::Depth,
235        ) -> fidl::Result<()> {
236            encoder.debug_check_bounds::<Peers>(offset);
237            // Zero out padding regions. There's no need to apply masks
238            // because the unmasked parts will be overwritten by fields.
239            // Write the fields.
240            self.0.encode(encoder, offset + 0, depth)?;
241            Ok(())
242        }
243    }
244
245    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Peers {
246        #[inline(always)]
247        fn new_empty() -> Self {
248            Self {
249                addrs: fidl::new_empty!(
250                    fidl::encoding::UnboundedVector<fidl::encoding::Array<u8, 6>>,
251                    D
252                ),
253            }
254        }
255
256        #[inline]
257        unsafe fn decode(
258            &mut self,
259            decoder: &mut fidl::encoding::Decoder<'_, D>,
260            offset: usize,
261            _depth: fidl::encoding::Depth,
262        ) -> fidl::Result<()> {
263            decoder.debug_check_bounds::<Self>(offset);
264            // Verify that padding bytes are zero.
265            fidl::decode!(
266                fidl::encoding::UnboundedVector<fidl::encoding::Array<u8, 6>>,
267                D,
268                &mut self.addrs,
269                decoder,
270                offset + 0,
271                _depth
272            )?;
273            Ok(())
274        }
275    }
276
277    impl fidl::encoding::ValueTypeMarker for StatsEntry {
278        type Borrowed<'a> = &'a Self;
279        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
280            value
281        }
282    }
283
284    unsafe impl fidl::encoding::TypeMarker for StatsEntry {
285        type Owned = Self;
286
287        #[inline(always)]
288        fn inline_align(_context: fidl::encoding::Context) -> usize {
289            8
290        }
291
292        #[inline(always)]
293        fn inline_size(_context: fidl::encoding::Context) -> usize {
294            80
295        }
296    }
297
298    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<StatsEntry, D>
299        for &StatsEntry
300    {
301        #[inline]
302        unsafe fn encode(
303            self,
304            encoder: &mut fidl::encoding::Encoder<'_, D>,
305            offset: usize,
306            _depth: fidl::encoding::Depth,
307        ) -> fidl::Result<()> {
308            encoder.debug_check_bounds::<StatsEntry>(offset);
309            // Delegate to tuple encoding.
310            fidl::encoding::Encode::<StatsEntry, D>::encode(
311                (
312                    <u16 as fidl::encoding::ValueTypeMarker>::borrow(&self.tx_vector_idx),
313                    <fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow(
314                        &self.tx_vec_desc,
315                    ),
316                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.success_cur),
317                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.attempts_cur),
318                    <f32 as fidl::encoding::ValueTypeMarker>::borrow(&self.probability),
319                    <f32 as fidl::encoding::ValueTypeMarker>::borrow(&self.cur_tp),
320                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.success_total),
321                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.attempts_total),
322                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.probes_total),
323                    <u8 as fidl::encoding::ValueTypeMarker>::borrow(&self.probe_cycles_skipped),
324                ),
325                encoder,
326                offset,
327                _depth,
328            )
329        }
330    }
331    unsafe impl<
332            D: fidl::encoding::ResourceDialect,
333            T0: fidl::encoding::Encode<u16, D>,
334            T1: fidl::encoding::Encode<fidl::encoding::UnboundedString, D>,
335            T2: fidl::encoding::Encode<u64, D>,
336            T3: fidl::encoding::Encode<u64, D>,
337            T4: fidl::encoding::Encode<f32, D>,
338            T5: fidl::encoding::Encode<f32, D>,
339            T6: fidl::encoding::Encode<u64, D>,
340            T7: fidl::encoding::Encode<u64, D>,
341            T8: fidl::encoding::Encode<u64, D>,
342            T9: fidl::encoding::Encode<u8, D>,
343        > fidl::encoding::Encode<StatsEntry, D> for (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9)
344    {
345        #[inline]
346        unsafe fn encode(
347            self,
348            encoder: &mut fidl::encoding::Encoder<'_, D>,
349            offset: usize,
350            depth: fidl::encoding::Depth,
351        ) -> fidl::Result<()> {
352            encoder.debug_check_bounds::<StatsEntry>(offset);
353            // Zero out padding regions. There's no need to apply masks
354            // because the unmasked parts will be overwritten by fields.
355            unsafe {
356                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
357                (ptr as *mut u64).write_unaligned(0);
358            }
359            unsafe {
360                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(72);
361                (ptr as *mut u64).write_unaligned(0);
362            }
363            // Write the fields.
364            self.0.encode(encoder, offset + 0, depth)?;
365            self.1.encode(encoder, offset + 8, depth)?;
366            self.2.encode(encoder, offset + 24, depth)?;
367            self.3.encode(encoder, offset + 32, depth)?;
368            self.4.encode(encoder, offset + 40, depth)?;
369            self.5.encode(encoder, offset + 44, depth)?;
370            self.6.encode(encoder, offset + 48, depth)?;
371            self.7.encode(encoder, offset + 56, depth)?;
372            self.8.encode(encoder, offset + 64, depth)?;
373            self.9.encode(encoder, offset + 72, depth)?;
374            Ok(())
375        }
376    }
377
378    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for StatsEntry {
379        #[inline(always)]
380        fn new_empty() -> Self {
381            Self {
382                tx_vector_idx: fidl::new_empty!(u16, D),
383                tx_vec_desc: fidl::new_empty!(fidl::encoding::UnboundedString, D),
384                success_cur: fidl::new_empty!(u64, D),
385                attempts_cur: fidl::new_empty!(u64, D),
386                probability: fidl::new_empty!(f32, D),
387                cur_tp: fidl::new_empty!(f32, D),
388                success_total: fidl::new_empty!(u64, D),
389                attempts_total: fidl::new_empty!(u64, D),
390                probes_total: fidl::new_empty!(u64, D),
391                probe_cycles_skipped: fidl::new_empty!(u8, D),
392            }
393        }
394
395        #[inline]
396        unsafe fn decode(
397            &mut self,
398            decoder: &mut fidl::encoding::Decoder<'_, D>,
399            offset: usize,
400            _depth: fidl::encoding::Depth,
401        ) -> fidl::Result<()> {
402            decoder.debug_check_bounds::<Self>(offset);
403            // Verify that padding bytes are zero.
404            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
405            let padval = unsafe { (ptr as *const u64).read_unaligned() };
406            let mask = 0xffffffffffff0000u64;
407            let maskedval = padval & mask;
408            if maskedval != 0 {
409                return Err(fidl::Error::NonZeroPadding {
410                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
411                });
412            }
413            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(72) };
414            let padval = unsafe { (ptr as *const u64).read_unaligned() };
415            let mask = 0xffffffffffffff00u64;
416            let maskedval = padval & mask;
417            if maskedval != 0 {
418                return Err(fidl::Error::NonZeroPadding {
419                    padding_start: offset + 72 + ((mask as u64).trailing_zeros() / 8) as usize,
420                });
421            }
422            fidl::decode!(u16, D, &mut self.tx_vector_idx, decoder, offset + 0, _depth)?;
423            fidl::decode!(
424                fidl::encoding::UnboundedString,
425                D,
426                &mut self.tx_vec_desc,
427                decoder,
428                offset + 8,
429                _depth
430            )?;
431            fidl::decode!(u64, D, &mut self.success_cur, decoder, offset + 24, _depth)?;
432            fidl::decode!(u64, D, &mut self.attempts_cur, decoder, offset + 32, _depth)?;
433            fidl::decode!(f32, D, &mut self.probability, decoder, offset + 40, _depth)?;
434            fidl::decode!(f32, D, &mut self.cur_tp, decoder, offset + 44, _depth)?;
435            fidl::decode!(u64, D, &mut self.success_total, decoder, offset + 48, _depth)?;
436            fidl::decode!(u64, D, &mut self.attempts_total, decoder, offset + 56, _depth)?;
437            fidl::decode!(u64, D, &mut self.probes_total, decoder, offset + 64, _depth)?;
438            fidl::decode!(u8, D, &mut self.probe_cycles_skipped, decoder, offset + 72, _depth)?;
439            Ok(())
440        }
441    }
442}