Skip to main content

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/// WLAN security protocols.
37///
38/// WPA protocols are additionally enumerated by their authentication suite
39/// (i.e., Personal vs. Enterprise).
40#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
41pub enum Protocol {
42    /// Open network security.
43    ///
44    /// This indicates that no security protocol or suite is used by a WLAN; it
45    /// is not to be confused with "open authentication".
46    Open,
47    Wep,
48    Wpa1,
49    Wpa2Personal,
50    Wpa2Enterprise,
51    Wpa3Personal,
52    Wpa3Enterprise,
53    Owe,
54    #[doc(hidden)]
55    __SourceBreaking {
56        unknown_ordinal: u32,
57    },
58}
59
60/// Pattern that matches an unknown `Protocol` member.
61#[macro_export]
62macro_rules! ProtocolUnknown {
63    () => {
64        _
65    };
66}
67
68impl Protocol {
69    #[inline]
70    pub fn from_primitive(prim: u32) -> Option<Self> {
71        match prim {
72            1 => Some(Self::Open),
73            2 => Some(Self::Wep),
74            3 => Some(Self::Wpa1),
75            4 => Some(Self::Wpa2Personal),
76            5 => Some(Self::Wpa2Enterprise),
77            6 => Some(Self::Wpa3Personal),
78            7 => Some(Self::Wpa3Enterprise),
79            8 => Some(Self::Owe),
80            _ => None,
81        }
82    }
83
84    #[inline]
85    pub fn from_primitive_allow_unknown(prim: u32) -> Self {
86        match prim {
87            1 => Self::Open,
88            2 => Self::Wep,
89            3 => Self::Wpa1,
90            4 => Self::Wpa2Personal,
91            5 => Self::Wpa2Enterprise,
92            6 => Self::Wpa3Personal,
93            7 => Self::Wpa3Enterprise,
94            8 => Self::Owe,
95            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
96        }
97    }
98
99    #[inline]
100    pub fn unknown() -> Self {
101        Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
102    }
103
104    #[inline]
105    pub const fn into_primitive(self) -> u32 {
106        match self {
107            Self::Open => 1,
108            Self::Wep => 2,
109            Self::Wpa1 => 3,
110            Self::Wpa2Personal => 4,
111            Self::Wpa2Enterprise => 5,
112            Self::Wpa3Personal => 6,
113            Self::Wpa3Enterprise => 7,
114            Self::Owe => 8,
115            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
116        }
117    }
118
119    #[inline]
120    pub fn is_unknown(&self) -> bool {
121        match self {
122            Self::__SourceBreaking { unknown_ordinal: _ } => true,
123            _ => false,
124        }
125    }
126}
127
128/// Specific absorption rate scenarios that can be applied to WLAN PHY devices.
129#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
130pub enum TxPowerScenario {
131    Default,
132    VoiceCall,
133    HeadCellOff,
134    HeadCellOn,
135    BodyCellOff,
136    BodyCellOn,
137    BodyBtActive,
138    #[doc(hidden)]
139    __SourceBreaking {
140        unknown_ordinal: u32,
141    },
142}
143
144/// Pattern that matches an unknown `TxPowerScenario` member.
145#[macro_export]
146macro_rules! TxPowerScenarioUnknown {
147    () => {
148        _
149    };
150}
151
152impl TxPowerScenario {
153    #[inline]
154    pub fn from_primitive(prim: u32) -> Option<Self> {
155        match prim {
156            0 => Some(Self::Default),
157            1 => Some(Self::VoiceCall),
158            2 => Some(Self::HeadCellOff),
159            3 => Some(Self::HeadCellOn),
160            4 => Some(Self::BodyCellOff),
161            5 => Some(Self::BodyCellOn),
162            6 => Some(Self::BodyBtActive),
163            _ => None,
164        }
165    }
166
167    #[inline]
168    pub fn from_primitive_allow_unknown(prim: u32) -> Self {
169        match prim {
170            0 => Self::Default,
171            1 => Self::VoiceCall,
172            2 => Self::HeadCellOff,
173            3 => Self::HeadCellOn,
174            4 => Self::BodyCellOff,
175            5 => Self::BodyCellOn,
176            6 => Self::BodyBtActive,
177            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
178        }
179    }
180
181    #[inline]
182    pub fn unknown() -> Self {
183        Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
184    }
185
186    #[inline]
187    pub const fn into_primitive(self) -> u32 {
188        match self {
189            Self::Default => 0,
190            Self::VoiceCall => 1,
191            Self::HeadCellOff => 2,
192            Self::HeadCellOn => 3,
193            Self::BodyCellOff => 4,
194            Self::BodyCellOn => 5,
195            Self::BodyBtActive => 6,
196            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
197        }
198    }
199
200    #[inline]
201    pub fn is_unknown(&self) -> bool {
202        match self {
203            Self::__SourceBreaking { unknown_ordinal: _ } => true,
204            _ => false,
205        }
206    }
207}
208
209/// Pairs credentials with a particular security protocol. This type requires
210/// validation, as `Protocol` and `Credentials` may disagree. FIDL APIs that use
211/// this type generally restrict authentication to `protocol`.
212#[derive(Clone, Debug, PartialEq)]
213pub struct Authentication {
214    pub protocol: Protocol,
215    pub credentials: Option<Box<Credentials>>,
216}
217
218impl fidl::Persistable for Authentication {}
219
220#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
221#[repr(C)]
222pub struct ChannelSwitchInfo {
223    pub new_channel: u8,
224}
225
226impl fidl::Persistable for ChannelSwitchInfo {}
227
228#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
229pub struct OwePublicKey {
230    pub group: u16,
231    pub key: Vec<u8>,
232}
233
234impl fidl::Persistable for OwePublicKey {}
235
236#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
237#[repr(C)]
238pub struct SignalReportIndication {
239    pub rssi_dbm: i8,
240    pub snr_db: i8,
241}
242
243impl fidl::Persistable for SignalReportIndication {}
244
245/// WEP credentials.
246#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
247pub struct WepCredentials {
248    /// Unencoded WEP key.
249    ///
250    /// This field is always a binary key; ASCII hexadecimal encoding should not
251    /// be used here.
252    pub key: Vec<u8>,
253}
254
255impl fidl::Persistable for WepCredentials {}
256
257/// WFA WMM v1.2, 2.2.2
258#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
259pub struct WmmAcParams {
260    /// Lower bound of contention window in exponential form
261    /// `cw_min = 2^(ecw_min) - 1`. The unit for contention window is "slot time", which
262    /// is different for each standard (e.g. 9 microseconds, 13 microseconds, etc.)
263    pub ecw_min: u8,
264    /// Upper bound of contention window in exponential form
265    /// `cw_max = 2^(ecw_max) - 1`. The unit for contention window is "slot time", which
266    /// is different for each standard (e.g. 9 microseconds, 13 microseconds, etc.)
267    pub ecw_max: u8,
268    /// Arbitration Interframe Spacing Number (control wait time between sending each frame)
269    pub aifsn: u8,
270    /// TXOP limit in unit of 32 microseconds
271    pub txop_limit: u16,
272    /// Whether admission control is mandatory
273    pub acm: bool,
274}
275
276impl fidl::Persistable for WmmAcParams {}
277
278#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
279pub struct WmmStatusResponse {
280    pub apsd: bool,
281    pub ac_be_params: WmmAcParams,
282    pub ac_bk_params: WmmAcParams,
283    pub ac_vi_params: WmmAcParams,
284    pub ac_vo_params: WmmAcParams,
285}
286
287impl fidl::Persistable for WmmStatusResponse {}
288
289/// Credentials used to authenticate with a WLAN.
290///
291/// The variants of this union describe the credentials supported by a protocol
292/// or protocol suite (i.e., WEP and WPA).
293#[derive(Clone, Debug)]
294pub enum Credentials {
295    Wep(WepCredentials),
296    Wpa(WpaCredentials),
297    #[doc(hidden)]
298    __SourceBreaking {
299        unknown_ordinal: u64,
300    },
301}
302
303/// Pattern that matches an unknown `Credentials` member.
304#[macro_export]
305macro_rules! CredentialsUnknown {
306    () => {
307        _
308    };
309}
310
311// Custom PartialEq so that unknown variants are not equal to themselves.
312impl PartialEq for Credentials {
313    fn eq(&self, other: &Self) -> bool {
314        match (self, other) {
315            (Self::Wep(x), Self::Wep(y)) => *x == *y,
316            (Self::Wpa(x), Self::Wpa(y)) => *x == *y,
317            _ => false,
318        }
319    }
320}
321
322impl Credentials {
323    #[inline]
324    pub fn ordinal(&self) -> u64 {
325        match *self {
326            Self::Wep(_) => 1,
327            Self::Wpa(_) => 2,
328            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
329        }
330    }
331
332    #[inline]
333    pub fn unknown_variant_for_testing() -> Self {
334        Self::__SourceBreaking { unknown_ordinal: 0 }
335    }
336
337    #[inline]
338    pub fn is_unknown(&self) -> bool {
339        match self {
340            Self::__SourceBreaking { .. } => true,
341            _ => false,
342        }
343    }
344}
345
346impl fidl::Persistable for Credentials {}
347
348/// WPA credentials.
349#[derive(Clone, Debug)]
350pub enum WpaCredentials {
351    /// Unencoded pre-shared key (PSK).
352    ///
353    /// This field is always a binary PSK; ASCII hexadecimal encoding should not
354    /// be used here.
355    Psk([u8; 32]),
356    /// UTF-8 encoded passphrase.
357    ///
358    /// This field is expected to use UTF-8 or compatible encoding. This is more
359    /// permissive than the passphrase to PSK mapping specified in IEEE Std
360    /// 802.11-2016 Appendix J.4, but UTF-8 is typically used in practice.
361    Passphrase(Vec<u8>),
362    #[doc(hidden)]
363    __SourceBreaking { unknown_ordinal: u64 },
364}
365
366/// Pattern that matches an unknown `WpaCredentials` member.
367#[macro_export]
368macro_rules! WpaCredentialsUnknown {
369    () => {
370        _
371    };
372}
373
374// Custom PartialEq so that unknown variants are not equal to themselves.
375impl PartialEq for WpaCredentials {
376    fn eq(&self, other: &Self) -> bool {
377        match (self, other) {
378            (Self::Psk(x), Self::Psk(y)) => *x == *y,
379            (Self::Passphrase(x), Self::Passphrase(y)) => *x == *y,
380            _ => false,
381        }
382    }
383}
384
385impl WpaCredentials {
386    #[inline]
387    pub fn ordinal(&self) -> u64 {
388        match *self {
389            Self::Psk(_) => 1,
390            Self::Passphrase(_) => 2,
391            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
392        }
393    }
394
395    #[inline]
396    pub fn unknown_variant_for_testing() -> Self {
397        Self::__SourceBreaking { unknown_ordinal: 0 }
398    }
399
400    #[inline]
401    pub fn is_unknown(&self) -> bool {
402        match self {
403            Self::__SourceBreaking { .. } => true,
404            _ => false,
405        }
406    }
407}
408
409impl fidl::Persistable for WpaCredentials {}
410
411mod internal {
412    use super::*;
413    unsafe impl fidl::encoding::TypeMarker for BtCoexistenceMode {
414        type Owned = Self;
415
416        #[inline(always)]
417        fn inline_align(_context: fidl::encoding::Context) -> usize {
418            std::mem::align_of::<u32>()
419        }
420
421        #[inline(always)]
422        fn inline_size(_context: fidl::encoding::Context) -> usize {
423            std::mem::size_of::<u32>()
424        }
425
426        #[inline(always)]
427        fn encode_is_copy() -> bool {
428            true
429        }
430
431        #[inline(always)]
432        fn decode_is_copy() -> bool {
433            false
434        }
435    }
436
437    impl fidl::encoding::ValueTypeMarker for BtCoexistenceMode {
438        type Borrowed<'a> = Self;
439        #[inline(always)]
440        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
441            *value
442        }
443    }
444
445    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
446        for BtCoexistenceMode
447    {
448        #[inline]
449        unsafe fn encode(
450            self,
451            encoder: &mut fidl::encoding::Encoder<'_, D>,
452            offset: usize,
453            _depth: fidl::encoding::Depth,
454        ) -> fidl::Result<()> {
455            encoder.debug_check_bounds::<Self>(offset);
456            encoder.write_num(self.into_primitive(), offset);
457            Ok(())
458        }
459    }
460
461    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for BtCoexistenceMode {
462        #[inline(always)]
463        fn new_empty() -> Self {
464            Self::ModeAuto
465        }
466
467        #[inline]
468        unsafe fn decode(
469            &mut self,
470            decoder: &mut fidl::encoding::Decoder<'_, D>,
471            offset: usize,
472            _depth: fidl::encoding::Depth,
473        ) -> fidl::Result<()> {
474            decoder.debug_check_bounds::<Self>(offset);
475            let prim = decoder.read_num::<u32>(offset);
476
477            *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
478            Ok(())
479        }
480    }
481    unsafe impl fidl::encoding::TypeMarker for Protocol {
482        type Owned = Self;
483
484        #[inline(always)]
485        fn inline_align(_context: fidl::encoding::Context) -> usize {
486            std::mem::align_of::<u32>()
487        }
488
489        #[inline(always)]
490        fn inline_size(_context: fidl::encoding::Context) -> usize {
491            std::mem::size_of::<u32>()
492        }
493
494        #[inline(always)]
495        fn encode_is_copy() -> bool {
496            false
497        }
498
499        #[inline(always)]
500        fn decode_is_copy() -> bool {
501            false
502        }
503    }
504
505    impl fidl::encoding::ValueTypeMarker for Protocol {
506        type Borrowed<'a> = Self;
507        #[inline(always)]
508        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
509            *value
510        }
511    }
512
513    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for Protocol {
514        #[inline]
515        unsafe fn encode(
516            self,
517            encoder: &mut fidl::encoding::Encoder<'_, D>,
518            offset: usize,
519            _depth: fidl::encoding::Depth,
520        ) -> fidl::Result<()> {
521            encoder.debug_check_bounds::<Self>(offset);
522            encoder.write_num(self.into_primitive(), offset);
523            Ok(())
524        }
525    }
526
527    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Protocol {
528        #[inline(always)]
529        fn new_empty() -> Self {
530            Self::unknown()
531        }
532
533        #[inline]
534        unsafe fn decode(
535            &mut self,
536            decoder: &mut fidl::encoding::Decoder<'_, D>,
537            offset: usize,
538            _depth: fidl::encoding::Depth,
539        ) -> fidl::Result<()> {
540            decoder.debug_check_bounds::<Self>(offset);
541            let prim = decoder.read_num::<u32>(offset);
542
543            *self = Self::from_primitive_allow_unknown(prim);
544            Ok(())
545        }
546    }
547    unsafe impl fidl::encoding::TypeMarker for TxPowerScenario {
548        type Owned = Self;
549
550        #[inline(always)]
551        fn inline_align(_context: fidl::encoding::Context) -> usize {
552            std::mem::align_of::<u32>()
553        }
554
555        #[inline(always)]
556        fn inline_size(_context: fidl::encoding::Context) -> usize {
557            std::mem::size_of::<u32>()
558        }
559
560        #[inline(always)]
561        fn encode_is_copy() -> bool {
562            false
563        }
564
565        #[inline(always)]
566        fn decode_is_copy() -> bool {
567            false
568        }
569    }
570
571    impl fidl::encoding::ValueTypeMarker for TxPowerScenario {
572        type Borrowed<'a> = Self;
573        #[inline(always)]
574        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
575            *value
576        }
577    }
578
579    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
580        for TxPowerScenario
581    {
582        #[inline]
583        unsafe fn encode(
584            self,
585            encoder: &mut fidl::encoding::Encoder<'_, D>,
586            offset: usize,
587            _depth: fidl::encoding::Depth,
588        ) -> fidl::Result<()> {
589            encoder.debug_check_bounds::<Self>(offset);
590            encoder.write_num(self.into_primitive(), offset);
591            Ok(())
592        }
593    }
594
595    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for TxPowerScenario {
596        #[inline(always)]
597        fn new_empty() -> Self {
598            Self::unknown()
599        }
600
601        #[inline]
602        unsafe fn decode(
603            &mut self,
604            decoder: &mut fidl::encoding::Decoder<'_, D>,
605            offset: usize,
606            _depth: fidl::encoding::Depth,
607        ) -> fidl::Result<()> {
608            decoder.debug_check_bounds::<Self>(offset);
609            let prim = decoder.read_num::<u32>(offset);
610
611            *self = Self::from_primitive_allow_unknown(prim);
612            Ok(())
613        }
614    }
615
616    impl fidl::encoding::ValueTypeMarker for Authentication {
617        type Borrowed<'a> = &'a Self;
618        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
619            value
620        }
621    }
622
623    unsafe impl fidl::encoding::TypeMarker for Authentication {
624        type Owned = Self;
625
626        #[inline(always)]
627        fn inline_align(_context: fidl::encoding::Context) -> usize {
628            8
629        }
630
631        #[inline(always)]
632        fn inline_size(_context: fidl::encoding::Context) -> usize {
633            24
634        }
635    }
636
637    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Authentication, D>
638        for &Authentication
639    {
640        #[inline]
641        unsafe fn encode(
642            self,
643            encoder: &mut fidl::encoding::Encoder<'_, D>,
644            offset: usize,
645            _depth: fidl::encoding::Depth,
646        ) -> fidl::Result<()> {
647            encoder.debug_check_bounds::<Authentication>(offset);
648            // Delegate to tuple encoding.
649            fidl::encoding::Encode::<Authentication, D>::encode(
650                (
651                    <Protocol as fidl::encoding::ValueTypeMarker>::borrow(&self.protocol),
652                    <fidl::encoding::OptionalUnion<Credentials> as fidl::encoding::ValueTypeMarker>::borrow(&self.credentials),
653                ),
654                encoder, offset, _depth
655            )
656        }
657    }
658    unsafe impl<
659        D: fidl::encoding::ResourceDialect,
660        T0: fidl::encoding::Encode<Protocol, D>,
661        T1: fidl::encoding::Encode<fidl::encoding::OptionalUnion<Credentials>, D>,
662    > fidl::encoding::Encode<Authentication, D> for (T0, T1)
663    {
664        #[inline]
665        unsafe fn encode(
666            self,
667            encoder: &mut fidl::encoding::Encoder<'_, D>,
668            offset: usize,
669            depth: fidl::encoding::Depth,
670        ) -> fidl::Result<()> {
671            encoder.debug_check_bounds::<Authentication>(offset);
672            // Zero out padding regions. There's no need to apply masks
673            // because the unmasked parts will be overwritten by fields.
674            unsafe {
675                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
676                (ptr as *mut u64).write_unaligned(0);
677            }
678            // Write the fields.
679            self.0.encode(encoder, offset + 0, depth)?;
680            self.1.encode(encoder, offset + 8, depth)?;
681            Ok(())
682        }
683    }
684
685    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Authentication {
686        #[inline(always)]
687        fn new_empty() -> Self {
688            Self {
689                protocol: fidl::new_empty!(Protocol, D),
690                credentials: fidl::new_empty!(fidl::encoding::OptionalUnion<Credentials>, D),
691            }
692        }
693
694        #[inline]
695        unsafe fn decode(
696            &mut self,
697            decoder: &mut fidl::encoding::Decoder<'_, D>,
698            offset: usize,
699            _depth: fidl::encoding::Depth,
700        ) -> fidl::Result<()> {
701            decoder.debug_check_bounds::<Self>(offset);
702            // Verify that padding bytes are zero.
703            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
704            let padval = unsafe { (ptr as *const u64).read_unaligned() };
705            let mask = 0xffffffff00000000u64;
706            let maskedval = padval & mask;
707            if maskedval != 0 {
708                return Err(fidl::Error::NonZeroPadding {
709                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
710                });
711            }
712            fidl::decode!(Protocol, D, &mut self.protocol, decoder, offset + 0, _depth)?;
713            fidl::decode!(
714                fidl::encoding::OptionalUnion<Credentials>,
715                D,
716                &mut self.credentials,
717                decoder,
718                offset + 8,
719                _depth
720            )?;
721            Ok(())
722        }
723    }
724
725    impl fidl::encoding::ValueTypeMarker for ChannelSwitchInfo {
726        type Borrowed<'a> = &'a Self;
727        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
728            value
729        }
730    }
731
732    unsafe impl fidl::encoding::TypeMarker for ChannelSwitchInfo {
733        type Owned = Self;
734
735        #[inline(always)]
736        fn inline_align(_context: fidl::encoding::Context) -> usize {
737            1
738        }
739
740        #[inline(always)]
741        fn inline_size(_context: fidl::encoding::Context) -> usize {
742            1
743        }
744        #[inline(always)]
745        fn encode_is_copy() -> bool {
746            true
747        }
748
749        #[inline(always)]
750        fn decode_is_copy() -> bool {
751            true
752        }
753    }
754
755    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<ChannelSwitchInfo, D>
756        for &ChannelSwitchInfo
757    {
758        #[inline]
759        unsafe fn encode(
760            self,
761            encoder: &mut fidl::encoding::Encoder<'_, D>,
762            offset: usize,
763            _depth: fidl::encoding::Depth,
764        ) -> fidl::Result<()> {
765            encoder.debug_check_bounds::<ChannelSwitchInfo>(offset);
766            unsafe {
767                // Copy the object into the buffer.
768                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
769                (buf_ptr as *mut ChannelSwitchInfo)
770                    .write_unaligned((self as *const ChannelSwitchInfo).read());
771                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
772                // done second because the memcpy will write garbage to these bytes.
773            }
774            Ok(())
775        }
776    }
777    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u8, D>>
778        fidl::encoding::Encode<ChannelSwitchInfo, D> for (T0,)
779    {
780        #[inline]
781        unsafe fn encode(
782            self,
783            encoder: &mut fidl::encoding::Encoder<'_, D>,
784            offset: usize,
785            depth: fidl::encoding::Depth,
786        ) -> fidl::Result<()> {
787            encoder.debug_check_bounds::<ChannelSwitchInfo>(offset);
788            // Zero out padding regions. There's no need to apply masks
789            // because the unmasked parts will be overwritten by fields.
790            // Write the fields.
791            self.0.encode(encoder, offset + 0, depth)?;
792            Ok(())
793        }
794    }
795
796    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ChannelSwitchInfo {
797        #[inline(always)]
798        fn new_empty() -> Self {
799            Self { new_channel: fidl::new_empty!(u8, D) }
800        }
801
802        #[inline]
803        unsafe fn decode(
804            &mut self,
805            decoder: &mut fidl::encoding::Decoder<'_, D>,
806            offset: usize,
807            _depth: fidl::encoding::Depth,
808        ) -> fidl::Result<()> {
809            decoder.debug_check_bounds::<Self>(offset);
810            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
811            // Verify that padding bytes are zero.
812            // Copy from the buffer into the object.
813            unsafe {
814                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 1);
815            }
816            Ok(())
817        }
818    }
819
820    impl fidl::encoding::ValueTypeMarker for OwePublicKey {
821        type Borrowed<'a> = &'a Self;
822        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
823            value
824        }
825    }
826
827    unsafe impl fidl::encoding::TypeMarker for OwePublicKey {
828        type Owned = Self;
829
830        #[inline(always)]
831        fn inline_align(_context: fidl::encoding::Context) -> usize {
832            8
833        }
834
835        #[inline(always)]
836        fn inline_size(_context: fidl::encoding::Context) -> usize {
837            24
838        }
839    }
840
841    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<OwePublicKey, D>
842        for &OwePublicKey
843    {
844        #[inline]
845        unsafe fn encode(
846            self,
847            encoder: &mut fidl::encoding::Encoder<'_, D>,
848            offset: usize,
849            _depth: fidl::encoding::Depth,
850        ) -> fidl::Result<()> {
851            encoder.debug_check_bounds::<OwePublicKey>(offset);
852            // Delegate to tuple encoding.
853            fidl::encoding::Encode::<OwePublicKey, D>::encode(
854                (
855                    <u16 as fidl::encoding::ValueTypeMarker>::borrow(&self.group),
856                    <fidl::encoding::UnboundedVector<u8> as fidl::encoding::ValueTypeMarker>::borrow(&self.key),
857                ),
858                encoder, offset, _depth
859            )
860        }
861    }
862    unsafe impl<
863        D: fidl::encoding::ResourceDialect,
864        T0: fidl::encoding::Encode<u16, D>,
865        T1: fidl::encoding::Encode<fidl::encoding::UnboundedVector<u8>, D>,
866    > fidl::encoding::Encode<OwePublicKey, D> for (T0, T1)
867    {
868        #[inline]
869        unsafe fn encode(
870            self,
871            encoder: &mut fidl::encoding::Encoder<'_, D>,
872            offset: usize,
873            depth: fidl::encoding::Depth,
874        ) -> fidl::Result<()> {
875            encoder.debug_check_bounds::<OwePublicKey>(offset);
876            // Zero out padding regions. There's no need to apply masks
877            // because the unmasked parts will be overwritten by fields.
878            unsafe {
879                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
880                (ptr as *mut u64).write_unaligned(0);
881            }
882            // Write the fields.
883            self.0.encode(encoder, offset + 0, depth)?;
884            self.1.encode(encoder, offset + 8, depth)?;
885            Ok(())
886        }
887    }
888
889    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for OwePublicKey {
890        #[inline(always)]
891        fn new_empty() -> Self {
892            Self {
893                group: fidl::new_empty!(u16, D),
894                key: fidl::new_empty!(fidl::encoding::UnboundedVector<u8>, D),
895            }
896        }
897
898        #[inline]
899        unsafe fn decode(
900            &mut self,
901            decoder: &mut fidl::encoding::Decoder<'_, D>,
902            offset: usize,
903            _depth: fidl::encoding::Depth,
904        ) -> fidl::Result<()> {
905            decoder.debug_check_bounds::<Self>(offset);
906            // Verify that padding bytes are zero.
907            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
908            let padval = unsafe { (ptr as *const u64).read_unaligned() };
909            let mask = 0xffffffffffff0000u64;
910            let maskedval = padval & mask;
911            if maskedval != 0 {
912                return Err(fidl::Error::NonZeroPadding {
913                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
914                });
915            }
916            fidl::decode!(u16, D, &mut self.group, decoder, offset + 0, _depth)?;
917            fidl::decode!(
918                fidl::encoding::UnboundedVector<u8>,
919                D,
920                &mut self.key,
921                decoder,
922                offset + 8,
923                _depth
924            )?;
925            Ok(())
926        }
927    }
928
929    impl fidl::encoding::ValueTypeMarker for SignalReportIndication {
930        type Borrowed<'a> = &'a Self;
931        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
932            value
933        }
934    }
935
936    unsafe impl fidl::encoding::TypeMarker for SignalReportIndication {
937        type Owned = Self;
938
939        #[inline(always)]
940        fn inline_align(_context: fidl::encoding::Context) -> usize {
941            1
942        }
943
944        #[inline(always)]
945        fn inline_size(_context: fidl::encoding::Context) -> usize {
946            2
947        }
948        #[inline(always)]
949        fn encode_is_copy() -> bool {
950            true
951        }
952
953        #[inline(always)]
954        fn decode_is_copy() -> bool {
955            true
956        }
957    }
958
959    unsafe impl<D: fidl::encoding::ResourceDialect>
960        fidl::encoding::Encode<SignalReportIndication, D> for &SignalReportIndication
961    {
962        #[inline]
963        unsafe fn encode(
964            self,
965            encoder: &mut fidl::encoding::Encoder<'_, D>,
966            offset: usize,
967            _depth: fidl::encoding::Depth,
968        ) -> fidl::Result<()> {
969            encoder.debug_check_bounds::<SignalReportIndication>(offset);
970            unsafe {
971                // Copy the object into the buffer.
972                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
973                (buf_ptr as *mut SignalReportIndication)
974                    .write_unaligned((self as *const SignalReportIndication).read());
975                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
976                // done second because the memcpy will write garbage to these bytes.
977            }
978            Ok(())
979        }
980    }
981    unsafe impl<
982        D: fidl::encoding::ResourceDialect,
983        T0: fidl::encoding::Encode<i8, D>,
984        T1: fidl::encoding::Encode<i8, D>,
985    > fidl::encoding::Encode<SignalReportIndication, D> for (T0, T1)
986    {
987        #[inline]
988        unsafe fn encode(
989            self,
990            encoder: &mut fidl::encoding::Encoder<'_, D>,
991            offset: usize,
992            depth: fidl::encoding::Depth,
993        ) -> fidl::Result<()> {
994            encoder.debug_check_bounds::<SignalReportIndication>(offset);
995            // Zero out padding regions. There's no need to apply masks
996            // because the unmasked parts will be overwritten by fields.
997            // Write the fields.
998            self.0.encode(encoder, offset + 0, depth)?;
999            self.1.encode(encoder, offset + 1, depth)?;
1000            Ok(())
1001        }
1002    }
1003
1004    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1005        for SignalReportIndication
1006    {
1007        #[inline(always)]
1008        fn new_empty() -> Self {
1009            Self { rssi_dbm: fidl::new_empty!(i8, D), snr_db: fidl::new_empty!(i8, D) }
1010        }
1011
1012        #[inline]
1013        unsafe fn decode(
1014            &mut self,
1015            decoder: &mut fidl::encoding::Decoder<'_, D>,
1016            offset: usize,
1017            _depth: fidl::encoding::Depth,
1018        ) -> fidl::Result<()> {
1019            decoder.debug_check_bounds::<Self>(offset);
1020            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
1021            // Verify that padding bytes are zero.
1022            // Copy from the buffer into the object.
1023            unsafe {
1024                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 2);
1025            }
1026            Ok(())
1027        }
1028    }
1029
1030    impl fidl::encoding::ValueTypeMarker for WepCredentials {
1031        type Borrowed<'a> = &'a Self;
1032        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1033            value
1034        }
1035    }
1036
1037    unsafe impl fidl::encoding::TypeMarker for WepCredentials {
1038        type Owned = Self;
1039
1040        #[inline(always)]
1041        fn inline_align(_context: fidl::encoding::Context) -> usize {
1042            8
1043        }
1044
1045        #[inline(always)]
1046        fn inline_size(_context: fidl::encoding::Context) -> usize {
1047            16
1048        }
1049    }
1050
1051    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<WepCredentials, D>
1052        for &WepCredentials
1053    {
1054        #[inline]
1055        unsafe fn encode(
1056            self,
1057            encoder: &mut fidl::encoding::Encoder<'_, D>,
1058            offset: usize,
1059            _depth: fidl::encoding::Depth,
1060        ) -> fidl::Result<()> {
1061            encoder.debug_check_bounds::<WepCredentials>(offset);
1062            // Delegate to tuple encoding.
1063            fidl::encoding::Encode::<WepCredentials, D>::encode(
1064                (<fidl::encoding::UnboundedVector<u8> as fidl::encoding::ValueTypeMarker>::borrow(
1065                    &self.key,
1066                ),),
1067                encoder,
1068                offset,
1069                _depth,
1070            )
1071        }
1072    }
1073    unsafe impl<
1074        D: fidl::encoding::ResourceDialect,
1075        T0: fidl::encoding::Encode<fidl::encoding::UnboundedVector<u8>, D>,
1076    > fidl::encoding::Encode<WepCredentials, D> for (T0,)
1077    {
1078        #[inline]
1079        unsafe fn encode(
1080            self,
1081            encoder: &mut fidl::encoding::Encoder<'_, D>,
1082            offset: usize,
1083            depth: fidl::encoding::Depth,
1084        ) -> fidl::Result<()> {
1085            encoder.debug_check_bounds::<WepCredentials>(offset);
1086            // Zero out padding regions. There's no need to apply masks
1087            // because the unmasked parts will be overwritten by fields.
1088            // Write the fields.
1089            self.0.encode(encoder, offset + 0, depth)?;
1090            Ok(())
1091        }
1092    }
1093
1094    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for WepCredentials {
1095        #[inline(always)]
1096        fn new_empty() -> Self {
1097            Self { key: fidl::new_empty!(fidl::encoding::UnboundedVector<u8>, D) }
1098        }
1099
1100        #[inline]
1101        unsafe fn decode(
1102            &mut self,
1103            decoder: &mut fidl::encoding::Decoder<'_, D>,
1104            offset: usize,
1105            _depth: fidl::encoding::Depth,
1106        ) -> fidl::Result<()> {
1107            decoder.debug_check_bounds::<Self>(offset);
1108            // Verify that padding bytes are zero.
1109            fidl::decode!(
1110                fidl::encoding::UnboundedVector<u8>,
1111                D,
1112                &mut self.key,
1113                decoder,
1114                offset + 0,
1115                _depth
1116            )?;
1117            Ok(())
1118        }
1119    }
1120
1121    impl fidl::encoding::ValueTypeMarker for WmmAcParams {
1122        type Borrowed<'a> = &'a Self;
1123        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1124            value
1125        }
1126    }
1127
1128    unsafe impl fidl::encoding::TypeMarker for WmmAcParams {
1129        type Owned = Self;
1130
1131        #[inline(always)]
1132        fn inline_align(_context: fidl::encoding::Context) -> usize {
1133            2
1134        }
1135
1136        #[inline(always)]
1137        fn inline_size(_context: fidl::encoding::Context) -> usize {
1138            8
1139        }
1140    }
1141
1142    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<WmmAcParams, D>
1143        for &WmmAcParams
1144    {
1145        #[inline]
1146        unsafe fn encode(
1147            self,
1148            encoder: &mut fidl::encoding::Encoder<'_, D>,
1149            offset: usize,
1150            _depth: fidl::encoding::Depth,
1151        ) -> fidl::Result<()> {
1152            encoder.debug_check_bounds::<WmmAcParams>(offset);
1153            // Delegate to tuple encoding.
1154            fidl::encoding::Encode::<WmmAcParams, D>::encode(
1155                (
1156                    <u8 as fidl::encoding::ValueTypeMarker>::borrow(&self.ecw_min),
1157                    <u8 as fidl::encoding::ValueTypeMarker>::borrow(&self.ecw_max),
1158                    <u8 as fidl::encoding::ValueTypeMarker>::borrow(&self.aifsn),
1159                    <u16 as fidl::encoding::ValueTypeMarker>::borrow(&self.txop_limit),
1160                    <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.acm),
1161                ),
1162                encoder,
1163                offset,
1164                _depth,
1165            )
1166        }
1167    }
1168    unsafe impl<
1169        D: fidl::encoding::ResourceDialect,
1170        T0: fidl::encoding::Encode<u8, D>,
1171        T1: fidl::encoding::Encode<u8, D>,
1172        T2: fidl::encoding::Encode<u8, D>,
1173        T3: fidl::encoding::Encode<u16, D>,
1174        T4: fidl::encoding::Encode<bool, D>,
1175    > fidl::encoding::Encode<WmmAcParams, D> for (T0, T1, T2, T3, T4)
1176    {
1177        #[inline]
1178        unsafe fn encode(
1179            self,
1180            encoder: &mut fidl::encoding::Encoder<'_, D>,
1181            offset: usize,
1182            depth: fidl::encoding::Depth,
1183        ) -> fidl::Result<()> {
1184            encoder.debug_check_bounds::<WmmAcParams>(offset);
1185            // Zero out padding regions. There's no need to apply masks
1186            // because the unmasked parts will be overwritten by fields.
1187            unsafe {
1188                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(2);
1189                (ptr as *mut u16).write_unaligned(0);
1190            }
1191            unsafe {
1192                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(6);
1193                (ptr as *mut u16).write_unaligned(0);
1194            }
1195            // Write the fields.
1196            self.0.encode(encoder, offset + 0, depth)?;
1197            self.1.encode(encoder, offset + 1, depth)?;
1198            self.2.encode(encoder, offset + 2, depth)?;
1199            self.3.encode(encoder, offset + 4, depth)?;
1200            self.4.encode(encoder, offset + 6, depth)?;
1201            Ok(())
1202        }
1203    }
1204
1205    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for WmmAcParams {
1206        #[inline(always)]
1207        fn new_empty() -> Self {
1208            Self {
1209                ecw_min: fidl::new_empty!(u8, D),
1210                ecw_max: fidl::new_empty!(u8, D),
1211                aifsn: fidl::new_empty!(u8, D),
1212                txop_limit: fidl::new_empty!(u16, D),
1213                acm: fidl::new_empty!(bool, D),
1214            }
1215        }
1216
1217        #[inline]
1218        unsafe fn decode(
1219            &mut self,
1220            decoder: &mut fidl::encoding::Decoder<'_, D>,
1221            offset: usize,
1222            _depth: fidl::encoding::Depth,
1223        ) -> fidl::Result<()> {
1224            decoder.debug_check_bounds::<Self>(offset);
1225            // Verify that padding bytes are zero.
1226            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(2) };
1227            let padval = unsafe { (ptr as *const u16).read_unaligned() };
1228            let mask = 0xff00u16;
1229            let maskedval = padval & mask;
1230            if maskedval != 0 {
1231                return Err(fidl::Error::NonZeroPadding {
1232                    padding_start: offset + 2 + ((mask as u64).trailing_zeros() / 8) as usize,
1233                });
1234            }
1235            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(6) };
1236            let padval = unsafe { (ptr as *const u16).read_unaligned() };
1237            let mask = 0xff00u16;
1238            let maskedval = padval & mask;
1239            if maskedval != 0 {
1240                return Err(fidl::Error::NonZeroPadding {
1241                    padding_start: offset + 6 + ((mask as u64).trailing_zeros() / 8) as usize,
1242                });
1243            }
1244            fidl::decode!(u8, D, &mut self.ecw_min, decoder, offset + 0, _depth)?;
1245            fidl::decode!(u8, D, &mut self.ecw_max, decoder, offset + 1, _depth)?;
1246            fidl::decode!(u8, D, &mut self.aifsn, decoder, offset + 2, _depth)?;
1247            fidl::decode!(u16, D, &mut self.txop_limit, decoder, offset + 4, _depth)?;
1248            fidl::decode!(bool, D, &mut self.acm, decoder, offset + 6, _depth)?;
1249            Ok(())
1250        }
1251    }
1252
1253    impl fidl::encoding::ValueTypeMarker for WmmStatusResponse {
1254        type Borrowed<'a> = &'a Self;
1255        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1256            value
1257        }
1258    }
1259
1260    unsafe impl fidl::encoding::TypeMarker for WmmStatusResponse {
1261        type Owned = Self;
1262
1263        #[inline(always)]
1264        fn inline_align(_context: fidl::encoding::Context) -> usize {
1265            2
1266        }
1267
1268        #[inline(always)]
1269        fn inline_size(_context: fidl::encoding::Context) -> usize {
1270            34
1271        }
1272    }
1273
1274    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<WmmStatusResponse, D>
1275        for &WmmStatusResponse
1276    {
1277        #[inline]
1278        unsafe fn encode(
1279            self,
1280            encoder: &mut fidl::encoding::Encoder<'_, D>,
1281            offset: usize,
1282            _depth: fidl::encoding::Depth,
1283        ) -> fidl::Result<()> {
1284            encoder.debug_check_bounds::<WmmStatusResponse>(offset);
1285            // Delegate to tuple encoding.
1286            fidl::encoding::Encode::<WmmStatusResponse, D>::encode(
1287                (
1288                    <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.apsd),
1289                    <WmmAcParams as fidl::encoding::ValueTypeMarker>::borrow(&self.ac_be_params),
1290                    <WmmAcParams as fidl::encoding::ValueTypeMarker>::borrow(&self.ac_bk_params),
1291                    <WmmAcParams as fidl::encoding::ValueTypeMarker>::borrow(&self.ac_vi_params),
1292                    <WmmAcParams as fidl::encoding::ValueTypeMarker>::borrow(&self.ac_vo_params),
1293                ),
1294                encoder,
1295                offset,
1296                _depth,
1297            )
1298        }
1299    }
1300    unsafe impl<
1301        D: fidl::encoding::ResourceDialect,
1302        T0: fidl::encoding::Encode<bool, D>,
1303        T1: fidl::encoding::Encode<WmmAcParams, D>,
1304        T2: fidl::encoding::Encode<WmmAcParams, D>,
1305        T3: fidl::encoding::Encode<WmmAcParams, D>,
1306        T4: fidl::encoding::Encode<WmmAcParams, D>,
1307    > fidl::encoding::Encode<WmmStatusResponse, D> for (T0, T1, T2, T3, T4)
1308    {
1309        #[inline]
1310        unsafe fn encode(
1311            self,
1312            encoder: &mut fidl::encoding::Encoder<'_, D>,
1313            offset: usize,
1314            depth: fidl::encoding::Depth,
1315        ) -> fidl::Result<()> {
1316            encoder.debug_check_bounds::<WmmStatusResponse>(offset);
1317            // Zero out padding regions. There's no need to apply masks
1318            // because the unmasked parts will be overwritten by fields.
1319            unsafe {
1320                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
1321                (ptr as *mut u16).write_unaligned(0);
1322            }
1323            // Write the fields.
1324            self.0.encode(encoder, offset + 0, depth)?;
1325            self.1.encode(encoder, offset + 2, depth)?;
1326            self.2.encode(encoder, offset + 10, depth)?;
1327            self.3.encode(encoder, offset + 18, depth)?;
1328            self.4.encode(encoder, offset + 26, depth)?;
1329            Ok(())
1330        }
1331    }
1332
1333    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for WmmStatusResponse {
1334        #[inline(always)]
1335        fn new_empty() -> Self {
1336            Self {
1337                apsd: fidl::new_empty!(bool, D),
1338                ac_be_params: fidl::new_empty!(WmmAcParams, D),
1339                ac_bk_params: fidl::new_empty!(WmmAcParams, D),
1340                ac_vi_params: fidl::new_empty!(WmmAcParams, D),
1341                ac_vo_params: fidl::new_empty!(WmmAcParams, D),
1342            }
1343        }
1344
1345        #[inline]
1346        unsafe fn decode(
1347            &mut self,
1348            decoder: &mut fidl::encoding::Decoder<'_, D>,
1349            offset: usize,
1350            _depth: fidl::encoding::Depth,
1351        ) -> fidl::Result<()> {
1352            decoder.debug_check_bounds::<Self>(offset);
1353            // Verify that padding bytes are zero.
1354            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
1355            let padval = unsafe { (ptr as *const u16).read_unaligned() };
1356            let mask = 0xff00u16;
1357            let maskedval = padval & mask;
1358            if maskedval != 0 {
1359                return Err(fidl::Error::NonZeroPadding {
1360                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
1361                });
1362            }
1363            fidl::decode!(bool, D, &mut self.apsd, decoder, offset + 0, _depth)?;
1364            fidl::decode!(WmmAcParams, D, &mut self.ac_be_params, decoder, offset + 2, _depth)?;
1365            fidl::decode!(WmmAcParams, D, &mut self.ac_bk_params, decoder, offset + 10, _depth)?;
1366            fidl::decode!(WmmAcParams, D, &mut self.ac_vi_params, decoder, offset + 18, _depth)?;
1367            fidl::decode!(WmmAcParams, D, &mut self.ac_vo_params, decoder, offset + 26, _depth)?;
1368            Ok(())
1369        }
1370    }
1371
1372    impl fidl::encoding::ValueTypeMarker for Credentials {
1373        type Borrowed<'a> = &'a Self;
1374        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1375            value
1376        }
1377    }
1378
1379    unsafe impl fidl::encoding::TypeMarker for Credentials {
1380        type Owned = Self;
1381
1382        #[inline(always)]
1383        fn inline_align(_context: fidl::encoding::Context) -> usize {
1384            8
1385        }
1386
1387        #[inline(always)]
1388        fn inline_size(_context: fidl::encoding::Context) -> usize {
1389            16
1390        }
1391    }
1392
1393    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Credentials, D>
1394        for &Credentials
1395    {
1396        #[inline]
1397        unsafe fn encode(
1398            self,
1399            encoder: &mut fidl::encoding::Encoder<'_, D>,
1400            offset: usize,
1401            _depth: fidl::encoding::Depth,
1402        ) -> fidl::Result<()> {
1403            encoder.debug_check_bounds::<Credentials>(offset);
1404            encoder.write_num::<u64>(self.ordinal(), offset);
1405            match self {
1406                Credentials::Wep(ref val) => {
1407                    fidl::encoding::encode_in_envelope::<WepCredentials, D>(
1408                        <WepCredentials as fidl::encoding::ValueTypeMarker>::borrow(val),
1409                        encoder,
1410                        offset + 8,
1411                        _depth,
1412                    )
1413                }
1414                Credentials::Wpa(ref val) => {
1415                    fidl::encoding::encode_in_envelope::<WpaCredentials, D>(
1416                        <WpaCredentials as fidl::encoding::ValueTypeMarker>::borrow(val),
1417                        encoder,
1418                        offset + 8,
1419                        _depth,
1420                    )
1421                }
1422                Credentials::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
1423            }
1424        }
1425    }
1426
1427    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Credentials {
1428        #[inline(always)]
1429        fn new_empty() -> Self {
1430            Self::__SourceBreaking { unknown_ordinal: 0 }
1431        }
1432
1433        #[inline]
1434        unsafe fn decode(
1435            &mut self,
1436            decoder: &mut fidl::encoding::Decoder<'_, D>,
1437            offset: usize,
1438            mut depth: fidl::encoding::Depth,
1439        ) -> fidl::Result<()> {
1440            decoder.debug_check_bounds::<Self>(offset);
1441            #[allow(unused_variables)]
1442            let next_out_of_line = decoder.next_out_of_line();
1443            let handles_before = decoder.remaining_handles();
1444            let (ordinal, inlined, num_bytes, num_handles) =
1445                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
1446
1447            let member_inline_size = match ordinal {
1448                1 => <WepCredentials as fidl::encoding::TypeMarker>::inline_size(decoder.context),
1449                2 => <WpaCredentials as fidl::encoding::TypeMarker>::inline_size(decoder.context),
1450                0 => return Err(fidl::Error::UnknownUnionTag),
1451                _ => num_bytes as usize,
1452            };
1453
1454            if inlined != (member_inline_size <= 4) {
1455                return Err(fidl::Error::InvalidInlineBitInEnvelope);
1456            }
1457            let _inner_offset;
1458            if inlined {
1459                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
1460                _inner_offset = offset + 8;
1461            } else {
1462                depth.increment()?;
1463                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1464            }
1465            match ordinal {
1466                1 => {
1467                    #[allow(irrefutable_let_patterns)]
1468                    if let Credentials::Wep(_) = self {
1469                        // Do nothing, read the value into the object
1470                    } else {
1471                        // Initialize `self` to the right variant
1472                        *self = Credentials::Wep(fidl::new_empty!(WepCredentials, D));
1473                    }
1474                    #[allow(irrefutable_let_patterns)]
1475                    if let Credentials::Wep(ref mut val) = self {
1476                        fidl::decode!(WepCredentials, D, val, decoder, _inner_offset, depth)?;
1477                    } else {
1478                        unreachable!()
1479                    }
1480                }
1481                2 => {
1482                    #[allow(irrefutable_let_patterns)]
1483                    if let Credentials::Wpa(_) = self {
1484                        // Do nothing, read the value into the object
1485                    } else {
1486                        // Initialize `self` to the right variant
1487                        *self = Credentials::Wpa(fidl::new_empty!(WpaCredentials, D));
1488                    }
1489                    #[allow(irrefutable_let_patterns)]
1490                    if let Credentials::Wpa(ref mut val) = self {
1491                        fidl::decode!(WpaCredentials, D, val, decoder, _inner_offset, depth)?;
1492                    } else {
1493                        unreachable!()
1494                    }
1495                }
1496                #[allow(deprecated)]
1497                ordinal => {
1498                    for _ in 0..num_handles {
1499                        decoder.drop_next_handle()?;
1500                    }
1501                    *self = Credentials::__SourceBreaking { unknown_ordinal: ordinal };
1502                }
1503            }
1504            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
1505                return Err(fidl::Error::InvalidNumBytesInEnvelope);
1506            }
1507            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1508                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1509            }
1510            Ok(())
1511        }
1512    }
1513
1514    impl fidl::encoding::ValueTypeMarker for WpaCredentials {
1515        type Borrowed<'a> = &'a Self;
1516        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1517            value
1518        }
1519    }
1520
1521    unsafe impl fidl::encoding::TypeMarker for WpaCredentials {
1522        type Owned = Self;
1523
1524        #[inline(always)]
1525        fn inline_align(_context: fidl::encoding::Context) -> usize {
1526            8
1527        }
1528
1529        #[inline(always)]
1530        fn inline_size(_context: fidl::encoding::Context) -> usize {
1531            16
1532        }
1533    }
1534
1535    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<WpaCredentials, D>
1536        for &WpaCredentials
1537    {
1538        #[inline]
1539        unsafe fn encode(
1540            self,
1541            encoder: &mut fidl::encoding::Encoder<'_, D>,
1542            offset: usize,
1543            _depth: fidl::encoding::Depth,
1544        ) -> fidl::Result<()> {
1545            encoder.debug_check_bounds::<WpaCredentials>(offset);
1546            encoder.write_num::<u64>(self.ordinal(), offset);
1547            match self {
1548                WpaCredentials::Psk(ref val) => fidl::encoding::encode_in_envelope::<
1549                    fidl::encoding::Array<u8, 32>,
1550                    D,
1551                >(
1552                    <fidl::encoding::Array<u8, 32> as fidl::encoding::ValueTypeMarker>::borrow(val),
1553                    encoder,
1554                    offset + 8,
1555                    _depth,
1556                ),
1557                WpaCredentials::Passphrase(ref val) => {
1558                    fidl::encoding::encode_in_envelope::<fidl::encoding::Vector<u8, 63>, D>(
1559                        <fidl::encoding::Vector<u8, 63> as fidl::encoding::ValueTypeMarker>::borrow(
1560                            val,
1561                        ),
1562                        encoder,
1563                        offset + 8,
1564                        _depth,
1565                    )
1566                }
1567                WpaCredentials::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
1568            }
1569        }
1570    }
1571
1572    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for WpaCredentials {
1573        #[inline(always)]
1574        fn new_empty() -> Self {
1575            Self::__SourceBreaking { unknown_ordinal: 0 }
1576        }
1577
1578        #[inline]
1579        unsafe fn decode(
1580            &mut self,
1581            decoder: &mut fidl::encoding::Decoder<'_, D>,
1582            offset: usize,
1583            mut depth: fidl::encoding::Depth,
1584        ) -> fidl::Result<()> {
1585            decoder.debug_check_bounds::<Self>(offset);
1586            #[allow(unused_variables)]
1587            let next_out_of_line = decoder.next_out_of_line();
1588            let handles_before = decoder.remaining_handles();
1589            let (ordinal, inlined, num_bytes, num_handles) =
1590                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
1591
1592            let member_inline_size = match ordinal {
1593                1 => <fidl::encoding::Array<u8, 32> as fidl::encoding::TypeMarker>::inline_size(
1594                    decoder.context,
1595                ),
1596                2 => <fidl::encoding::Vector<u8, 63> as fidl::encoding::TypeMarker>::inline_size(
1597                    decoder.context,
1598                ),
1599                0 => return Err(fidl::Error::UnknownUnionTag),
1600                _ => num_bytes as usize,
1601            };
1602
1603            if inlined != (member_inline_size <= 4) {
1604                return Err(fidl::Error::InvalidInlineBitInEnvelope);
1605            }
1606            let _inner_offset;
1607            if inlined {
1608                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
1609                _inner_offset = offset + 8;
1610            } else {
1611                depth.increment()?;
1612                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1613            }
1614            match ordinal {
1615                1 => {
1616                    #[allow(irrefutable_let_patterns)]
1617                    if let WpaCredentials::Psk(_) = self {
1618                        // Do nothing, read the value into the object
1619                    } else {
1620                        // Initialize `self` to the right variant
1621                        *self =
1622                            WpaCredentials::Psk(fidl::new_empty!(fidl::encoding::Array<u8, 32>, D));
1623                    }
1624                    #[allow(irrefutable_let_patterns)]
1625                    if let WpaCredentials::Psk(ref mut val) = self {
1626                        fidl::decode!(fidl::encoding::Array<u8, 32>, D, val, decoder, _inner_offset, depth)?;
1627                    } else {
1628                        unreachable!()
1629                    }
1630                }
1631                2 => {
1632                    #[allow(irrefutable_let_patterns)]
1633                    if let WpaCredentials::Passphrase(_) = self {
1634                        // Do nothing, read the value into the object
1635                    } else {
1636                        // Initialize `self` to the right variant
1637                        *self = WpaCredentials::Passphrase(
1638                            fidl::new_empty!(fidl::encoding::Vector<u8, 63>, D),
1639                        );
1640                    }
1641                    #[allow(irrefutable_let_patterns)]
1642                    if let WpaCredentials::Passphrase(ref mut val) = self {
1643                        fidl::decode!(fidl::encoding::Vector<u8, 63>, D, val, decoder, _inner_offset, depth)?;
1644                    } else {
1645                        unreachable!()
1646                    }
1647                }
1648                #[allow(deprecated)]
1649                ordinal => {
1650                    for _ in 0..num_handles {
1651                        decoder.drop_next_handle()?;
1652                    }
1653                    *self = WpaCredentials::__SourceBreaking { unknown_ordinal: ordinal };
1654                }
1655            }
1656            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
1657                return Err(fidl::Error::InvalidNumBytesInEnvelope);
1658            }
1659            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1660                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1661            }
1662            Ok(())
1663        }
1664    }
1665}