fidl_fuchsia_wlan_internal__common/
fidl_fuchsia_wlan_internal__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
11pub const MAX_ASSOC_BASIC_RATES: u8 = 14;
12
13#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
14#[repr(u32)]
15pub enum BtCoexistenceMode {
16    ModeAuto = 1,
17    ModeOff = 2,
18}
19
20impl BtCoexistenceMode {
21    #[inline]
22    pub fn from_primitive(prim: u32) -> Option<Self> {
23        match prim {
24            1 => Some(Self::ModeAuto),
25            2 => Some(Self::ModeOff),
26            _ => None,
27        }
28    }
29
30    #[inline]
31    pub const fn into_primitive(self) -> u32 {
32        self as u32
33    }
34}
35
36/// Specific absorption rate scenarios that can be applied to WLAN PHY devices.
37#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
38pub enum TxPowerScenario {
39    Default,
40    VoiceCall,
41    HeadCellOff,
42    HeadCellOn,
43    BodyCellOff,
44    BodyCellOn,
45    BodyBtActive,
46    #[doc(hidden)]
47    __SourceBreaking {
48        unknown_ordinal: u32,
49    },
50}
51
52/// Pattern that matches an unknown `TxPowerScenario` member.
53#[macro_export]
54macro_rules! TxPowerScenarioUnknown {
55    () => {
56        _
57    };
58}
59
60impl TxPowerScenario {
61    #[inline]
62    pub fn from_primitive(prim: u32) -> Option<Self> {
63        match prim {
64            0 => Some(Self::Default),
65            1 => Some(Self::VoiceCall),
66            2 => Some(Self::HeadCellOff),
67            3 => Some(Self::HeadCellOn),
68            4 => Some(Self::BodyCellOff),
69            5 => Some(Self::BodyCellOn),
70            6 => Some(Self::BodyBtActive),
71            _ => None,
72        }
73    }
74
75    #[inline]
76    pub fn from_primitive_allow_unknown(prim: u32) -> Self {
77        match prim {
78            0 => Self::Default,
79            1 => Self::VoiceCall,
80            2 => Self::HeadCellOff,
81            3 => Self::HeadCellOn,
82            4 => Self::BodyCellOff,
83            5 => Self::BodyCellOn,
84            6 => Self::BodyBtActive,
85            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
86        }
87    }
88
89    #[inline]
90    pub fn unknown() -> Self {
91        Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
92    }
93
94    #[inline]
95    pub const fn into_primitive(self) -> u32 {
96        match self {
97            Self::Default => 0,
98            Self::VoiceCall => 1,
99            Self::HeadCellOff => 2,
100            Self::HeadCellOn => 3,
101            Self::BodyCellOff => 4,
102            Self::BodyCellOn => 5,
103            Self::BodyBtActive => 6,
104            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
105        }
106    }
107
108    #[inline]
109    pub fn is_unknown(&self) -> bool {
110        match self {
111            Self::__SourceBreaking { unknown_ordinal: _ } => true,
112            _ => false,
113        }
114    }
115}
116
117#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
118#[repr(C)]
119pub struct ChannelSwitchInfo {
120    pub new_channel: u8,
121}
122
123impl fidl::Persistable for ChannelSwitchInfo {}
124
125#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
126#[repr(C)]
127pub struct SignalReportIndication {
128    pub rssi_dbm: i8,
129    pub snr_db: i8,
130}
131
132impl fidl::Persistable for SignalReportIndication {}
133
134/// WFA WMM v1.2, 2.2.2
135#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
136pub struct WmmAcParams {
137    /// Lower bound of contention window in exponential form
138    /// `cw_min = 2^(ecw_min) - 1`. The unit for contention window is "slot time", which
139    /// is different for each standard (e.g. 9 microseconds, 13 microseconds, etc.)
140    pub ecw_min: u8,
141    /// Upper bound of contention window in exponential form
142    /// `cw_max = 2^(ecw_max) - 1`. The unit for contention window is "slot time", which
143    /// is different for each standard (e.g. 9 microseconds, 13 microseconds, etc.)
144    pub ecw_max: u8,
145    /// Arbitration Interframe Spacing Number (control wait time between sending each frame)
146    pub aifsn: u8,
147    /// TXOP limit in unit of 32 microseconds
148    pub txop_limit: u16,
149    /// Whether admission control is mandatory
150    pub acm: bool,
151}
152
153impl fidl::Persistable for WmmAcParams {}
154
155#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
156pub struct WmmStatusResponse {
157    pub apsd: bool,
158    pub ac_be_params: WmmAcParams,
159    pub ac_bk_params: WmmAcParams,
160    pub ac_vi_params: WmmAcParams,
161    pub ac_vo_params: WmmAcParams,
162}
163
164impl fidl::Persistable for WmmStatusResponse {}
165
166mod internal {
167    use super::*;
168    unsafe impl fidl::encoding::TypeMarker for BtCoexistenceMode {
169        type Owned = Self;
170
171        #[inline(always)]
172        fn inline_align(_context: fidl::encoding::Context) -> usize {
173            std::mem::align_of::<u32>()
174        }
175
176        #[inline(always)]
177        fn inline_size(_context: fidl::encoding::Context) -> usize {
178            std::mem::size_of::<u32>()
179        }
180
181        #[inline(always)]
182        fn encode_is_copy() -> bool {
183            true
184        }
185
186        #[inline(always)]
187        fn decode_is_copy() -> bool {
188            false
189        }
190    }
191
192    impl fidl::encoding::ValueTypeMarker for BtCoexistenceMode {
193        type Borrowed<'a> = Self;
194        #[inline(always)]
195        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
196            *value
197        }
198    }
199
200    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
201        for BtCoexistenceMode
202    {
203        #[inline]
204        unsafe fn encode(
205            self,
206            encoder: &mut fidl::encoding::Encoder<'_, D>,
207            offset: usize,
208            _depth: fidl::encoding::Depth,
209        ) -> fidl::Result<()> {
210            encoder.debug_check_bounds::<Self>(offset);
211            encoder.write_num(self.into_primitive(), offset);
212            Ok(())
213        }
214    }
215
216    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for BtCoexistenceMode {
217        #[inline(always)]
218        fn new_empty() -> Self {
219            Self::ModeAuto
220        }
221
222        #[inline]
223        unsafe fn decode(
224            &mut self,
225            decoder: &mut fidl::encoding::Decoder<'_, D>,
226            offset: usize,
227            _depth: fidl::encoding::Depth,
228        ) -> fidl::Result<()> {
229            decoder.debug_check_bounds::<Self>(offset);
230            let prim = decoder.read_num::<u32>(offset);
231
232            *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
233            Ok(())
234        }
235    }
236    unsafe impl fidl::encoding::TypeMarker for TxPowerScenario {
237        type Owned = Self;
238
239        #[inline(always)]
240        fn inline_align(_context: fidl::encoding::Context) -> usize {
241            std::mem::align_of::<u32>()
242        }
243
244        #[inline(always)]
245        fn inline_size(_context: fidl::encoding::Context) -> usize {
246            std::mem::size_of::<u32>()
247        }
248
249        #[inline(always)]
250        fn encode_is_copy() -> bool {
251            false
252        }
253
254        #[inline(always)]
255        fn decode_is_copy() -> bool {
256            false
257        }
258    }
259
260    impl fidl::encoding::ValueTypeMarker for TxPowerScenario {
261        type Borrowed<'a> = Self;
262        #[inline(always)]
263        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
264            *value
265        }
266    }
267
268    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
269        for TxPowerScenario
270    {
271        #[inline]
272        unsafe fn encode(
273            self,
274            encoder: &mut fidl::encoding::Encoder<'_, D>,
275            offset: usize,
276            _depth: fidl::encoding::Depth,
277        ) -> fidl::Result<()> {
278            encoder.debug_check_bounds::<Self>(offset);
279            encoder.write_num(self.into_primitive(), offset);
280            Ok(())
281        }
282    }
283
284    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for TxPowerScenario {
285        #[inline(always)]
286        fn new_empty() -> Self {
287            Self::unknown()
288        }
289
290        #[inline]
291        unsafe fn decode(
292            &mut self,
293            decoder: &mut fidl::encoding::Decoder<'_, D>,
294            offset: usize,
295            _depth: fidl::encoding::Depth,
296        ) -> fidl::Result<()> {
297            decoder.debug_check_bounds::<Self>(offset);
298            let prim = decoder.read_num::<u32>(offset);
299
300            *self = Self::from_primitive_allow_unknown(prim);
301            Ok(())
302        }
303    }
304
305    impl fidl::encoding::ValueTypeMarker for ChannelSwitchInfo {
306        type Borrowed<'a> = &'a Self;
307        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
308            value
309        }
310    }
311
312    unsafe impl fidl::encoding::TypeMarker for ChannelSwitchInfo {
313        type Owned = Self;
314
315        #[inline(always)]
316        fn inline_align(_context: fidl::encoding::Context) -> usize {
317            1
318        }
319
320        #[inline(always)]
321        fn inline_size(_context: fidl::encoding::Context) -> usize {
322            1
323        }
324        #[inline(always)]
325        fn encode_is_copy() -> bool {
326            true
327        }
328
329        #[inline(always)]
330        fn decode_is_copy() -> bool {
331            true
332        }
333    }
334
335    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<ChannelSwitchInfo, D>
336        for &ChannelSwitchInfo
337    {
338        #[inline]
339        unsafe fn encode(
340            self,
341            encoder: &mut fidl::encoding::Encoder<'_, D>,
342            offset: usize,
343            _depth: fidl::encoding::Depth,
344        ) -> fidl::Result<()> {
345            encoder.debug_check_bounds::<ChannelSwitchInfo>(offset);
346            unsafe {
347                // Copy the object into the buffer.
348                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
349                (buf_ptr as *mut ChannelSwitchInfo)
350                    .write_unaligned((self as *const ChannelSwitchInfo).read());
351                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
352                // done second because the memcpy will write garbage to these bytes.
353            }
354            Ok(())
355        }
356    }
357    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u8, D>>
358        fidl::encoding::Encode<ChannelSwitchInfo, D> for (T0,)
359    {
360        #[inline]
361        unsafe fn encode(
362            self,
363            encoder: &mut fidl::encoding::Encoder<'_, D>,
364            offset: usize,
365            depth: fidl::encoding::Depth,
366        ) -> fidl::Result<()> {
367            encoder.debug_check_bounds::<ChannelSwitchInfo>(offset);
368            // Zero out padding regions. There's no need to apply masks
369            // because the unmasked parts will be overwritten by fields.
370            // Write the fields.
371            self.0.encode(encoder, offset + 0, depth)?;
372            Ok(())
373        }
374    }
375
376    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ChannelSwitchInfo {
377        #[inline(always)]
378        fn new_empty() -> Self {
379            Self { new_channel: fidl::new_empty!(u8, D) }
380        }
381
382        #[inline]
383        unsafe fn decode(
384            &mut self,
385            decoder: &mut fidl::encoding::Decoder<'_, D>,
386            offset: usize,
387            _depth: fidl::encoding::Depth,
388        ) -> fidl::Result<()> {
389            decoder.debug_check_bounds::<Self>(offset);
390            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
391            // Verify that padding bytes are zero.
392            // Copy from the buffer into the object.
393            unsafe {
394                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 1);
395            }
396            Ok(())
397        }
398    }
399
400    impl fidl::encoding::ValueTypeMarker for SignalReportIndication {
401        type Borrowed<'a> = &'a Self;
402        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
403            value
404        }
405    }
406
407    unsafe impl fidl::encoding::TypeMarker for SignalReportIndication {
408        type Owned = Self;
409
410        #[inline(always)]
411        fn inline_align(_context: fidl::encoding::Context) -> usize {
412            1
413        }
414
415        #[inline(always)]
416        fn inline_size(_context: fidl::encoding::Context) -> usize {
417            2
418        }
419        #[inline(always)]
420        fn encode_is_copy() -> bool {
421            true
422        }
423
424        #[inline(always)]
425        fn decode_is_copy() -> bool {
426            true
427        }
428    }
429
430    unsafe impl<D: fidl::encoding::ResourceDialect>
431        fidl::encoding::Encode<SignalReportIndication, D> for &SignalReportIndication
432    {
433        #[inline]
434        unsafe fn encode(
435            self,
436            encoder: &mut fidl::encoding::Encoder<'_, D>,
437            offset: usize,
438            _depth: fidl::encoding::Depth,
439        ) -> fidl::Result<()> {
440            encoder.debug_check_bounds::<SignalReportIndication>(offset);
441            unsafe {
442                // Copy the object into the buffer.
443                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
444                (buf_ptr as *mut SignalReportIndication)
445                    .write_unaligned((self as *const SignalReportIndication).read());
446                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
447                // done second because the memcpy will write garbage to these bytes.
448            }
449            Ok(())
450        }
451    }
452    unsafe impl<
453        D: fidl::encoding::ResourceDialect,
454        T0: fidl::encoding::Encode<i8, D>,
455        T1: fidl::encoding::Encode<i8, D>,
456    > fidl::encoding::Encode<SignalReportIndication, D> for (T0, T1)
457    {
458        #[inline]
459        unsafe fn encode(
460            self,
461            encoder: &mut fidl::encoding::Encoder<'_, D>,
462            offset: usize,
463            depth: fidl::encoding::Depth,
464        ) -> fidl::Result<()> {
465            encoder.debug_check_bounds::<SignalReportIndication>(offset);
466            // Zero out padding regions. There's no need to apply masks
467            // because the unmasked parts will be overwritten by fields.
468            // Write the fields.
469            self.0.encode(encoder, offset + 0, depth)?;
470            self.1.encode(encoder, offset + 1, depth)?;
471            Ok(())
472        }
473    }
474
475    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
476        for SignalReportIndication
477    {
478        #[inline(always)]
479        fn new_empty() -> Self {
480            Self { rssi_dbm: fidl::new_empty!(i8, D), snr_db: fidl::new_empty!(i8, D) }
481        }
482
483        #[inline]
484        unsafe fn decode(
485            &mut self,
486            decoder: &mut fidl::encoding::Decoder<'_, D>,
487            offset: usize,
488            _depth: fidl::encoding::Depth,
489        ) -> fidl::Result<()> {
490            decoder.debug_check_bounds::<Self>(offset);
491            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
492            // Verify that padding bytes are zero.
493            // Copy from the buffer into the object.
494            unsafe {
495                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 2);
496            }
497            Ok(())
498        }
499    }
500
501    impl fidl::encoding::ValueTypeMarker for WmmAcParams {
502        type Borrowed<'a> = &'a Self;
503        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
504            value
505        }
506    }
507
508    unsafe impl fidl::encoding::TypeMarker for WmmAcParams {
509        type Owned = Self;
510
511        #[inline(always)]
512        fn inline_align(_context: fidl::encoding::Context) -> usize {
513            2
514        }
515
516        #[inline(always)]
517        fn inline_size(_context: fidl::encoding::Context) -> usize {
518            8
519        }
520    }
521
522    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<WmmAcParams, D>
523        for &WmmAcParams
524    {
525        #[inline]
526        unsafe fn encode(
527            self,
528            encoder: &mut fidl::encoding::Encoder<'_, D>,
529            offset: usize,
530            _depth: fidl::encoding::Depth,
531        ) -> fidl::Result<()> {
532            encoder.debug_check_bounds::<WmmAcParams>(offset);
533            // Delegate to tuple encoding.
534            fidl::encoding::Encode::<WmmAcParams, D>::encode(
535                (
536                    <u8 as fidl::encoding::ValueTypeMarker>::borrow(&self.ecw_min),
537                    <u8 as fidl::encoding::ValueTypeMarker>::borrow(&self.ecw_max),
538                    <u8 as fidl::encoding::ValueTypeMarker>::borrow(&self.aifsn),
539                    <u16 as fidl::encoding::ValueTypeMarker>::borrow(&self.txop_limit),
540                    <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.acm),
541                ),
542                encoder,
543                offset,
544                _depth,
545            )
546        }
547    }
548    unsafe impl<
549        D: fidl::encoding::ResourceDialect,
550        T0: fidl::encoding::Encode<u8, D>,
551        T1: fidl::encoding::Encode<u8, D>,
552        T2: fidl::encoding::Encode<u8, D>,
553        T3: fidl::encoding::Encode<u16, D>,
554        T4: fidl::encoding::Encode<bool, D>,
555    > fidl::encoding::Encode<WmmAcParams, D> for (T0, T1, T2, T3, T4)
556    {
557        #[inline]
558        unsafe fn encode(
559            self,
560            encoder: &mut fidl::encoding::Encoder<'_, D>,
561            offset: usize,
562            depth: fidl::encoding::Depth,
563        ) -> fidl::Result<()> {
564            encoder.debug_check_bounds::<WmmAcParams>(offset);
565            // Zero out padding regions. There's no need to apply masks
566            // because the unmasked parts will be overwritten by fields.
567            unsafe {
568                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(2);
569                (ptr as *mut u16).write_unaligned(0);
570            }
571            unsafe {
572                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(6);
573                (ptr as *mut u16).write_unaligned(0);
574            }
575            // Write the fields.
576            self.0.encode(encoder, offset + 0, depth)?;
577            self.1.encode(encoder, offset + 1, depth)?;
578            self.2.encode(encoder, offset + 2, depth)?;
579            self.3.encode(encoder, offset + 4, depth)?;
580            self.4.encode(encoder, offset + 6, depth)?;
581            Ok(())
582        }
583    }
584
585    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for WmmAcParams {
586        #[inline(always)]
587        fn new_empty() -> Self {
588            Self {
589                ecw_min: fidl::new_empty!(u8, D),
590                ecw_max: fidl::new_empty!(u8, D),
591                aifsn: fidl::new_empty!(u8, D),
592                txop_limit: fidl::new_empty!(u16, D),
593                acm: fidl::new_empty!(bool, D),
594            }
595        }
596
597        #[inline]
598        unsafe fn decode(
599            &mut self,
600            decoder: &mut fidl::encoding::Decoder<'_, D>,
601            offset: usize,
602            _depth: fidl::encoding::Depth,
603        ) -> fidl::Result<()> {
604            decoder.debug_check_bounds::<Self>(offset);
605            // Verify that padding bytes are zero.
606            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(2) };
607            let padval = unsafe { (ptr as *const u16).read_unaligned() };
608            let mask = 0xff00u16;
609            let maskedval = padval & mask;
610            if maskedval != 0 {
611                return Err(fidl::Error::NonZeroPadding {
612                    padding_start: offset + 2 + ((mask as u64).trailing_zeros() / 8) as usize,
613                });
614            }
615            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(6) };
616            let padval = unsafe { (ptr as *const u16).read_unaligned() };
617            let mask = 0xff00u16;
618            let maskedval = padval & mask;
619            if maskedval != 0 {
620                return Err(fidl::Error::NonZeroPadding {
621                    padding_start: offset + 6 + ((mask as u64).trailing_zeros() / 8) as usize,
622                });
623            }
624            fidl::decode!(u8, D, &mut self.ecw_min, decoder, offset + 0, _depth)?;
625            fidl::decode!(u8, D, &mut self.ecw_max, decoder, offset + 1, _depth)?;
626            fidl::decode!(u8, D, &mut self.aifsn, decoder, offset + 2, _depth)?;
627            fidl::decode!(u16, D, &mut self.txop_limit, decoder, offset + 4, _depth)?;
628            fidl::decode!(bool, D, &mut self.acm, decoder, offset + 6, _depth)?;
629            Ok(())
630        }
631    }
632
633    impl fidl::encoding::ValueTypeMarker for WmmStatusResponse {
634        type Borrowed<'a> = &'a Self;
635        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
636            value
637        }
638    }
639
640    unsafe impl fidl::encoding::TypeMarker for WmmStatusResponse {
641        type Owned = Self;
642
643        #[inline(always)]
644        fn inline_align(_context: fidl::encoding::Context) -> usize {
645            2
646        }
647
648        #[inline(always)]
649        fn inline_size(_context: fidl::encoding::Context) -> usize {
650            34
651        }
652    }
653
654    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<WmmStatusResponse, D>
655        for &WmmStatusResponse
656    {
657        #[inline]
658        unsafe fn encode(
659            self,
660            encoder: &mut fidl::encoding::Encoder<'_, D>,
661            offset: usize,
662            _depth: fidl::encoding::Depth,
663        ) -> fidl::Result<()> {
664            encoder.debug_check_bounds::<WmmStatusResponse>(offset);
665            // Delegate to tuple encoding.
666            fidl::encoding::Encode::<WmmStatusResponse, D>::encode(
667                (
668                    <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.apsd),
669                    <WmmAcParams as fidl::encoding::ValueTypeMarker>::borrow(&self.ac_be_params),
670                    <WmmAcParams as fidl::encoding::ValueTypeMarker>::borrow(&self.ac_bk_params),
671                    <WmmAcParams as fidl::encoding::ValueTypeMarker>::borrow(&self.ac_vi_params),
672                    <WmmAcParams as fidl::encoding::ValueTypeMarker>::borrow(&self.ac_vo_params),
673                ),
674                encoder,
675                offset,
676                _depth,
677            )
678        }
679    }
680    unsafe impl<
681        D: fidl::encoding::ResourceDialect,
682        T0: fidl::encoding::Encode<bool, D>,
683        T1: fidl::encoding::Encode<WmmAcParams, D>,
684        T2: fidl::encoding::Encode<WmmAcParams, D>,
685        T3: fidl::encoding::Encode<WmmAcParams, D>,
686        T4: fidl::encoding::Encode<WmmAcParams, D>,
687    > fidl::encoding::Encode<WmmStatusResponse, D> for (T0, T1, T2, T3, T4)
688    {
689        #[inline]
690        unsafe fn encode(
691            self,
692            encoder: &mut fidl::encoding::Encoder<'_, D>,
693            offset: usize,
694            depth: fidl::encoding::Depth,
695        ) -> fidl::Result<()> {
696            encoder.debug_check_bounds::<WmmStatusResponse>(offset);
697            // Zero out padding regions. There's no need to apply masks
698            // because the unmasked parts will be overwritten by fields.
699            unsafe {
700                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
701                (ptr as *mut u16).write_unaligned(0);
702            }
703            // Write the fields.
704            self.0.encode(encoder, offset + 0, depth)?;
705            self.1.encode(encoder, offset + 2, depth)?;
706            self.2.encode(encoder, offset + 10, depth)?;
707            self.3.encode(encoder, offset + 18, depth)?;
708            self.4.encode(encoder, offset + 26, depth)?;
709            Ok(())
710        }
711    }
712
713    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for WmmStatusResponse {
714        #[inline(always)]
715        fn new_empty() -> Self {
716            Self {
717                apsd: fidl::new_empty!(bool, D),
718                ac_be_params: fidl::new_empty!(WmmAcParams, D),
719                ac_bk_params: fidl::new_empty!(WmmAcParams, D),
720                ac_vi_params: fidl::new_empty!(WmmAcParams, D),
721                ac_vo_params: fidl::new_empty!(WmmAcParams, D),
722            }
723        }
724
725        #[inline]
726        unsafe fn decode(
727            &mut self,
728            decoder: &mut fidl::encoding::Decoder<'_, D>,
729            offset: usize,
730            _depth: fidl::encoding::Depth,
731        ) -> fidl::Result<()> {
732            decoder.debug_check_bounds::<Self>(offset);
733            // Verify that padding bytes are zero.
734            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
735            let padval = unsafe { (ptr as *const u16).read_unaligned() };
736            let mask = 0xff00u16;
737            let maskedval = padval & mask;
738            if maskedval != 0 {
739                return Err(fidl::Error::NonZeroPadding {
740                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
741                });
742            }
743            fidl::decode!(bool, D, &mut self.apsd, decoder, offset + 0, _depth)?;
744            fidl::decode!(WmmAcParams, D, &mut self.ac_be_params, decoder, offset + 2, _depth)?;
745            fidl::decode!(WmmAcParams, D, &mut self.ac_bk_params, decoder, offset + 10, _depth)?;
746            fidl::decode!(WmmAcParams, D, &mut self.ac_vi_params, decoder, offset + 18, _depth)?;
747            fidl::decode!(WmmAcParams, D, &mut self.ac_vo_params, decoder, offset + 26, _depth)?;
748            Ok(())
749        }
750    }
751}