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