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