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