fidl_fuchsia_hardware_network_common/
fidl_fuchsia_hardware_network_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
11/// The base identifier of a port within a device. Always less than
12/// [`MAX_PORTS`].
13pub type BasePortId = u8;
14
15/// Blanket definition for raw frames.
16///
17/// Devices that do not perform any sort of parsing of outbound traffic should
18/// define `FRAME_FEATURES_RAW` in the [`FrameTypeSupport`] entry.
19pub const FRAME_FEATURES_RAW: u32 = 1;
20
21/// Maximum number of acceleration flags.
22///
23/// Each descriptor has 16 bits of space for acceleration flags ([`RxFlags`] and
24/// [`TxFlags`]) thus the maximum number of reported accelerations is 16. Each
25/// descriptor reports which accelerations were applied (`RxFlags`) or are
26/// requested (`TxFlags`) by mapping indexes in the vector of supported
27/// accelerations ([`Info.rx_accel`] and ([`Info.tx_accel`]) to bits in the
28/// respective acceleration flags bitfield.
29pub const MAX_ACCEL_FLAGS: u32 = 16;
30
31/// Maximum number of chained descriptors that describe a single frame.
32pub const MAX_DESCRIPTOR_CHAIN: u8 = 4;
33
34/// Maximum numbers of supported frame types for rx or tx.
35pub const MAX_FRAME_TYPES: u32 = 4;
36
37/// The maximum number of ports attached to a device at a given time.
38pub const MAX_PORTS: u8 = 32;
39
40/// Maximum length of session label.
41pub const MAX_SESSION_NAME: u32 = 64;
42
43/// The maximum number of status samples that can be buffered by a
44/// [`StatusWatcher`].
45pub const MAX_STATUS_BUFFER: u32 = 50;
46
47bitflags! {
48    /// Ethernet frame sub-types and features.
49    #[derive(Clone, Copy, Debug, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
50    pub struct EthernetFeatures: u32 {
51        /// Device supports any type of ethernet frame.
52        ///
53        /// Same as specifying all other flags. Used by devices that do not inspect
54        /// or parse outbound traffic.
55        const RAW = 1;
56        /// Device supports EthernetII frames.
57        const ETHERNET_II = 2;
58        /// Device supports 802.1q VLAN additions.
59        const E_802_1_Q = 4;
60        /// Device supports 802.1 q-in-q Multiple VLAN tagging additions.
61        ///
62        /// Only meaningful if `E_802_1_Q` is also present.
63        const E_802_1_Q_IN_Q = 8;
64        /// Device supports 802.3 LLC + SNAP Ethernet frame format.
65        const E_802_3_LLC_SNAP = 16;
66    }
67}
68
69impl EthernetFeatures {}
70
71bitflags! {
72    /// Flags set by a Device when handing a buffer to a client on the rx path.
73    ///
74    /// Set by devices on the `inbound_flags` field of an rx descriptor.
75    #[derive(Clone, Copy, Debug, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
76    pub struct RxFlags: u32 {
77        /// Acceleration flag 0.
78        ///
79        /// Acceleration flags are mapped to the acceleration features reported by
80        /// the [`Device`] in [`Info.rx_accel`]. The n-th feature in `rx_accel` maps
81        /// to the `RX_ACCEL_n` `RxFlag`.
82        const RX_ACCEL_0 = 1;
83        const RX_ACCEL_1 = 2;
84        const RX_ACCEL_2 = 4;
85        const RX_ACCEL_3 = 8;
86        const RX_ACCEL_4 = 16;
87        const RX_ACCEL_5 = 32;
88        const RX_ACCEL_6 = 64;
89        const RX_ACCEL_7 = 128;
90        const RX_ACCEL_8 = 256;
91        const RX_ACCEL_9 = 512;
92        const RX_ACCEL_10 = 1024;
93        const RX_ACCEL_11 = 2048;
94        const RX_ACCEL_12 = 4096;
95        const RX_ACCEL_13 = 8192;
96        const RX_ACCEL_14 = 16384;
97        const RX_ACCEL_15 = 32768;
98        /// Device experienced a hardware rx overrun.
99        ///
100        /// Rx overruns are typically set by hardware controllers when a frame event
101        /// was detected but the frame data couldn't be captured. Devices should
102        /// clear the controller flag once this is set on an inbound frame, so
103        /// future overruns can be detected and reported.
104        const RX_OVERRUN = 536870912;
105        /// This bit is set if frame validation is performed (such as by hardware
106        /// acceleration features) and fails.
107        ///
108        /// It's important to note that some devices may simply discard frames for
109        /// which validation fails and never notify the client. Rx frames that
110        /// failed validation are only transmitted to the client if the
111        /// `SessionFlags::REPORT_INVALID_RX` option is selected when creating a
112        /// session.
113        const RX_VALIDATION_ERROR = 1073741824;
114        /// This is an echoed tx frame, created by a tx request.
115        ///
116        /// Can only be set in sessions that have the `LISTEN_TX` flag.
117        const RX_ECHOED_TX = 2147483648;
118    }
119}
120
121impl RxFlags {}
122
123bitflags! {
124    /// Additional session options.
125    #[derive(Clone, Copy, Debug, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
126    pub struct SessionFlags: u16 {
127        /// Attach as primary session.
128        ///
129        /// Sessions marked with the `PRIMARY` bit get the following different
130        /// treatment:
131        /// - If no PRIMARY sessions are attached, the device will *not* serve rx
132        ///   frames to non-PRIMARY sessions.
133        /// - If there's only one PRIMARY session active, it may get a zero-copy
134        ///   data path from the the backing hardware, if the underlying
135        ///   implementation supports it.
136        const PRIMARY = 1;
137        /// Listen for outgoing frames.
138        ///
139        /// `LISTEN_TX` sessions receive any outgoing frames (from all sessions) on
140        /// its rx path. Can be used for snooping traffic. Sessions marked with
141        /// `LISTEN_TX` may also send frames, but they should keep in mind that
142        /// they'll ALWAYS receive those frames back on their rx path (no origin
143        /// session filtering is performed).
144        const LISTEN_TX = 2;
145        /// Receive invalid rx frames.
146        ///
147        /// Sessions marked with `REPORT_INVALID_RX` are interested in receiving
148        /// frames that were rejected by internal device checks or payload
149        /// validation performed by hardware. Due to the nature of some hardware
150        /// platforms, sessions marked with `REPORT_INVALID_RX` may still not
151        /// receive frames that fail validation if the hardware implementation
152        /// simply drops the frame and doesn't expose it to the software stack.
153        /// Sessions NOT marked with `REPORT_INVALID_RX`, in contrast, will NEVER
154        /// receive an rx frame with the `RX_VALIDATION_ERROR` flag set.
155        const REPORT_INVALID_RX = 4;
156        /// Receive rx power leases.
157        ///
158        /// Sessions marked with `RECEIVE_RX_POWER_LEASES` receive
159        /// [`DelegatedRxLease`]s through [`Session.WatchDelegatedRxLease`] calls.
160        const RECEIVE_RX_POWER_LEASES = 8;
161    }
162}
163
164impl SessionFlags {}
165
166bitflags! {
167    /// Port status bits, reported in [`PortStatus.flags`].
168    #[derive(Clone, Copy, Debug, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
169    pub struct StatusFlags: u32 {
170        /// Port is online, i.e., data path is open and any ongoing sessions may
171        /// send and receive frames.
172        const ONLINE = 1;
173    }
174}
175
176impl StatusFlags {}
177
178bitflags! {
179    /// Flags set by a Client when handing a buffer to a client on the tx path.
180    ///
181    /// Set by Clients on the `inbound_flags` field of a tx descriptor.
182    #[derive(Clone, Copy, Debug, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
183    pub struct TxFlags: u32 {
184        /// Acceleration flag 0.
185        ///
186        /// Acceleration flags are mapped to the acceleration features reported by
187        /// the [`Device`] in [`Info.tx_accel`]. The n-th feature in `tx_accel` maps
188        /// to the `TX_ACCEL_n` `TxFlag`.
189        const TX_ACCEL_0 = 1;
190        const TX_ACCEL_1 = 2;
191        const TX_ACCEL_2 = 4;
192        const TX_ACCEL_3 = 8;
193        const TX_ACCEL_4 = 16;
194        const TX_ACCEL_5 = 32;
195        const TX_ACCEL_6 = 64;
196        const TX_ACCEL_7 = 128;
197        const TX_ACCEL_8 = 256;
198        const TX_ACCEL_9 = 512;
199        const TX_ACCEL_10 = 1024;
200        const TX_ACCEL_11 = 2048;
201        const TX_ACCEL_12 = 4096;
202        const TX_ACCEL_13 = 8192;
203        const TX_ACCEL_14 = 16384;
204        const TX_ACCEL_15 = 32768;
205    }
206}
207
208impl TxFlags {
209    #[inline(always)]
210    pub fn from_bits_allow_unknown(bits: u32) -> Self {
211        Self::from_bits_retain(bits)
212    }
213
214    #[inline(always)]
215    pub fn has_unknown_bits(&self) -> bool {
216        self.get_unknown_bits() != 0
217    }
218
219    #[inline(always)]
220    pub fn get_unknown_bits(&self) -> u32 {
221        self.bits() & !Self::all().bits()
222    }
223}
224
225bitflags! {
226    /// Flags set by a Device when returning a tx buffer back to a client.
227    ///
228    /// Set by Devices on the `return_flags` field of a tx descriptor.
229    #[derive(Clone, Copy, Debug, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
230    pub struct TxReturnFlags: u32 {
231        /// Requested operation in `inbound_flags` is not supported; the frame was
232        /// not sent.
233        ///
234        /// Always set in conjunction with `TX_RET_ERROR`.
235        const TX_RET_NOT_SUPPORTED = 1;
236        /// Could not allocate resources to send frame.
237        ///
238        /// Always set in conjunction with `TX_RET_ERROR`.
239        const TX_RET_OUT_OF_RESOURCES = 2;
240        /// Device is not available (offline or disconnected); the frame was not
241        /// sent.
242        ///
243        /// Always set in conjunction with `TX_RET_ERROR`.
244        const TX_RET_NOT_AVAILABLE = 4;
245        const TX_RET_ERROR = 2147483648;
246    }
247}
248
249impl TxReturnFlags {
250    #[inline(always)]
251    pub fn from_bits_allow_unknown(bits: u32) -> Self {
252        Self::from_bits_retain(bits)
253    }
254
255    #[inline(always)]
256    pub fn has_unknown_bits(&self) -> bool {
257        self.get_unknown_bits() != 0
258    }
259
260    #[inline(always)]
261    pub fn get_unknown_bits(&self) -> u32 {
262        self.bits() & !Self::all().bits()
263    }
264}
265
266/// Network device class.
267///
268/// # Deprecation
269///
270/// Replaced by `PortClass`. Scheduled for removal in 2025.
271#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
272#[repr(u16)]
273pub enum DeviceClass {
274    Virtual = 0,
275    Ethernet = 1,
276    Wlan = 2,
277    Ppp = 3,
278    Bridge = 4,
279    WlanAp = 5,
280}
281
282impl DeviceClass {
283    #[inline]
284    pub fn from_primitive(prim: u16) -> Option<Self> {
285        match prim {
286            0 => Some(Self::Virtual),
287            1 => Some(Self::Ethernet),
288            2 => Some(Self::Wlan),
289            3 => Some(Self::Ppp),
290            4 => Some(Self::Bridge),
291            5 => Some(Self::WlanAp),
292            _ => None,
293        }
294    }
295
296    #[inline]
297    pub const fn into_primitive(self) -> u16 {
298        self as u16
299    }
300}
301
302/// Types of frames.
303#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
304pub enum FrameType {
305    Ethernet,
306    Ipv4,
307    Ipv6,
308    #[doc(hidden)]
309    __SourceBreaking {
310        unknown_ordinal: u8,
311    },
312}
313
314/// Pattern that matches an unknown `FrameType` member.
315#[macro_export]
316macro_rules! FrameTypeUnknown {
317    () => {
318        _
319    };
320}
321
322impl FrameType {
323    #[inline]
324    pub fn from_primitive(prim: u8) -> Option<Self> {
325        match prim {
326            1 => Some(Self::Ethernet),
327            2 => Some(Self::Ipv4),
328            3 => Some(Self::Ipv6),
329            _ => None,
330        }
331    }
332
333    #[inline]
334    pub fn from_primitive_allow_unknown(prim: u8) -> Self {
335        match prim {
336            1 => Self::Ethernet,
337            2 => Self::Ipv4,
338            3 => Self::Ipv6,
339            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
340        }
341    }
342
343    #[inline]
344    pub fn unknown() -> Self {
345        Self::__SourceBreaking { unknown_ordinal: 0xff }
346    }
347
348    #[inline]
349    pub const fn into_primitive(self) -> u8 {
350        match self {
351            Self::Ethernet => 1,
352            Self::Ipv4 => 2,
353            Self::Ipv6 => 3,
354            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
355        }
356    }
357
358    #[inline]
359    pub fn is_unknown(&self) -> bool {
360        match self {
361            Self::__SourceBreaking { unknown_ordinal: _ } => true,
362            _ => false,
363        }
364    }
365}
366
367/// The type of metadata information appended to a frame.
368#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
369#[repr(u32)]
370pub enum InfoType {
371    /// No extra information is available.
372    NoInfo = 0,
373}
374
375impl InfoType {
376    #[inline]
377    pub fn from_primitive(prim: u32) -> Option<Self> {
378        match prim {
379            0 => Some(Self::NoInfo),
380            _ => None,
381        }
382    }
383
384    #[inline]
385    pub const fn into_primitive(self) -> u32 {
386        self as u32
387    }
388}
389
390/// The address filtering mode supported by MAC devices.
391#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
392pub enum MacFilterMode {
393    /// Device accepts only unicast frames addressed to its own unicast address,
394    /// or multicast frames that are part of the multicast address filter list.
395    MulticastFilter,
396    /// Device accepts unicast frames addressed to its own unicast address, or
397    /// any multicast frames.
398    MulticastPromiscuous,
399    /// Device accepts all frames.
400    Promiscuous,
401    #[doc(hidden)]
402    __SourceBreaking { unknown_ordinal: u32 },
403}
404
405/// Pattern that matches an unknown `MacFilterMode` member.
406#[macro_export]
407macro_rules! MacFilterModeUnknown {
408    () => {
409        _
410    };
411}
412
413impl MacFilterMode {
414    #[inline]
415    pub fn from_primitive(prim: u32) -> Option<Self> {
416        match prim {
417            0 => Some(Self::MulticastFilter),
418            1 => Some(Self::MulticastPromiscuous),
419            2 => Some(Self::Promiscuous),
420            _ => None,
421        }
422    }
423
424    #[inline]
425    pub fn from_primitive_allow_unknown(prim: u32) -> Self {
426        match prim {
427            0 => Self::MulticastFilter,
428            1 => Self::MulticastPromiscuous,
429            2 => Self::Promiscuous,
430            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
431        }
432    }
433
434    #[inline]
435    pub fn unknown() -> Self {
436        Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
437    }
438
439    #[inline]
440    pub const fn into_primitive(self) -> u32 {
441        match self {
442            Self::MulticastFilter => 0,
443            Self::MulticastPromiscuous => 1,
444            Self::Promiscuous => 2,
445            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
446        }
447    }
448
449    #[inline]
450    pub fn is_unknown(&self) -> bool {
451        match self {
452            Self::__SourceBreaking { unknown_ordinal: _ } => true,
453            _ => false,
454        }
455    }
456}
457
458/// Network port class.
459///
460/// *Note*: Device implementers are encouraged to propose additions to this
461/// enumeration to avoid using ill-fitting variants if there's not a good match
462/// available.
463#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
464pub enum PortClass {
465    Ethernet,
466    WlanClient,
467    Ppp,
468    Bridge,
469    WlanAp,
470    Virtual,
471    Lowpan,
472    #[doc(hidden)]
473    __SourceBreaking {
474        unknown_ordinal: u16,
475    },
476}
477
478/// Pattern that matches an unknown `PortClass` member.
479#[macro_export]
480macro_rules! PortClassUnknown {
481    () => {
482        _
483    };
484}
485
486impl PortClass {
487    #[inline]
488    pub fn from_primitive(prim: u16) -> Option<Self> {
489        match prim {
490            1 => Some(Self::Ethernet),
491            2 => Some(Self::WlanClient),
492            3 => Some(Self::Ppp),
493            4 => Some(Self::Bridge),
494            5 => Some(Self::WlanAp),
495            6 => Some(Self::Virtual),
496            7 => Some(Self::Lowpan),
497            _ => None,
498        }
499    }
500
501    #[inline]
502    pub fn from_primitive_allow_unknown(prim: u16) -> Self {
503        match prim {
504            1 => Self::Ethernet,
505            2 => Self::WlanClient,
506            3 => Self::Ppp,
507            4 => Self::Bridge,
508            5 => Self::WlanAp,
509            6 => Self::Virtual,
510            7 => Self::Lowpan,
511            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
512        }
513    }
514
515    #[inline]
516    pub fn unknown() -> Self {
517        Self::__SourceBreaking { unknown_ordinal: 0xffff }
518    }
519
520    #[inline]
521    pub const fn into_primitive(self) -> u16 {
522        match self {
523            Self::Ethernet => 1,
524            Self::WlanClient => 2,
525            Self::Ppp => 3,
526            Self::Bridge => 4,
527            Self::WlanAp => 5,
528            Self::Virtual => 6,
529            Self::Lowpan => 7,
530            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
531        }
532    }
533
534    #[inline]
535    pub fn is_unknown(&self) -> bool {
536        match self {
537            Self::__SourceBreaking { unknown_ordinal: _ } => true,
538            _ => false,
539        }
540    }
541}
542
543/// Available rx acceleration features.
544///
545/// Features are mapped to the `RX_ACCEL_*` bits in descriptors by the available
546/// values reported in [`Info.rx_accel`].
547#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
548pub enum RxAcceleration {
549    /// Inbound rx frame validated the Ethernet Frame Check Sequence.
550    ValidatedEthernetFcs,
551    /// Inbound rx frame validated the IPv4 checksum.
552    ValidatedIpv4Checksum,
553    /// Inbound rx frame validated the TCP checksum.
554    ValidatedTcpChecksum,
555    /// Inbound rx frame validated the UDP checksum.
556    ValidatedUdpChecksum,
557    #[doc(hidden)]
558    __SourceBreaking { unknown_ordinal: u8 },
559}
560
561/// Pattern that matches an unknown `RxAcceleration` member.
562#[macro_export]
563macro_rules! RxAccelerationUnknown {
564    () => {
565        _
566    };
567}
568
569impl RxAcceleration {
570    #[inline]
571    pub fn from_primitive(prim: u8) -> Option<Self> {
572        match prim {
573            0 => Some(Self::ValidatedEthernetFcs),
574            1 => Some(Self::ValidatedIpv4Checksum),
575            2 => Some(Self::ValidatedTcpChecksum),
576            3 => Some(Self::ValidatedUdpChecksum),
577            _ => None,
578        }
579    }
580
581    #[inline]
582    pub fn from_primitive_allow_unknown(prim: u8) -> Self {
583        match prim {
584            0 => Self::ValidatedEthernetFcs,
585            1 => Self::ValidatedIpv4Checksum,
586            2 => Self::ValidatedTcpChecksum,
587            3 => Self::ValidatedUdpChecksum,
588            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
589        }
590    }
591
592    #[inline]
593    pub fn unknown() -> Self {
594        Self::__SourceBreaking { unknown_ordinal: 0xff }
595    }
596
597    #[inline]
598    pub const fn into_primitive(self) -> u8 {
599        match self {
600            Self::ValidatedEthernetFcs => 0,
601            Self::ValidatedIpv4Checksum => 1,
602            Self::ValidatedTcpChecksum => 2,
603            Self::ValidatedUdpChecksum => 3,
604            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
605        }
606    }
607
608    #[inline]
609    pub fn is_unknown(&self) -> bool {
610        match self {
611            Self::__SourceBreaking { unknown_ordinal: _ } => true,
612            _ => false,
613        }
614    }
615}
616
617/// Available tx acceleration features.
618///
619/// Features are mapped to the `TX_ACCEL_*` bits in descriptors by the available
620/// values reported in [`Info.tx_accel`].
621#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
622pub enum TxAcceleration {
623    /// Request that device calculate the Ethernet Frame Check Sequence and
624    /// write it in place.
625    ComputeEthernetFcs,
626    /// Request that the device calculate the IPv4 checksum and write it in
627    /// place.
628    ComputeIpv4Checksum,
629    /// Request that the device calculate the TCP checksum and write it in
630    /// place.
631    ComputeTcpChecksum,
632    /// Request that the device calculate the UDP checksum and write it in
633    /// place.
634    ComputeUdpChecksum,
635    #[doc(hidden)]
636    __SourceBreaking { unknown_ordinal: u8 },
637}
638
639/// Pattern that matches an unknown `TxAcceleration` member.
640#[macro_export]
641macro_rules! TxAccelerationUnknown {
642    () => {
643        _
644    };
645}
646
647impl TxAcceleration {
648    #[inline]
649    pub fn from_primitive(prim: u8) -> Option<Self> {
650        match prim {
651            0 => Some(Self::ComputeEthernetFcs),
652            1 => Some(Self::ComputeIpv4Checksum),
653            2 => Some(Self::ComputeTcpChecksum),
654            3 => Some(Self::ComputeUdpChecksum),
655            _ => None,
656        }
657    }
658
659    #[inline]
660    pub fn from_primitive_allow_unknown(prim: u8) -> Self {
661        match prim {
662            0 => Self::ComputeEthernetFcs,
663            1 => Self::ComputeIpv4Checksum,
664            2 => Self::ComputeTcpChecksum,
665            3 => Self::ComputeUdpChecksum,
666            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
667        }
668    }
669
670    #[inline]
671    pub fn unknown() -> Self {
672        Self::__SourceBreaking { unknown_ordinal: 0xff }
673    }
674
675    #[inline]
676    pub const fn into_primitive(self) -> u8 {
677        match self {
678            Self::ComputeEthernetFcs => 0,
679            Self::ComputeIpv4Checksum => 1,
680            Self::ComputeTcpChecksum => 2,
681            Self::ComputeUdpChecksum => 3,
682            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
683        }
684    }
685
686    #[inline]
687    pub fn is_unknown(&self) -> bool {
688        match self {
689            Self::__SourceBreaking { unknown_ordinal: _ } => true,
690            _ => false,
691        }
692    }
693}
694
695#[derive(Clone, Debug, PartialEq)]
696pub struct DeviceGetInfoResponse {
697    pub info: DeviceInfo,
698}
699
700impl fidl::Persistable for DeviceGetInfoResponse {}
701
702#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
703pub struct Empty;
704
705impl fidl::Persistable for Empty {}
706
707/// Specifies a frame type and features and supported flags associated with that
708/// type.
709///
710/// This is used by clients to read the supported frames on the tx path for a
711/// given Network Device.
712///
713/// Some Network Devices may parse outgoing frames to perform frame
714/// transformation or specific hardware support. Each frame type has an
715/// associated [`FrameTypeSupport.features`] bits enumeration that lists
716/// FrameType-specific features that may or may not be supported. Devices that
717/// do not perform parsing are encouraged to just use the [`FRAME_FEATURES_RAW`]
718/// bit in `features`, which informs the client that all frame features are
719/// allowed.
720#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
721pub struct FrameTypeSupport {
722    /// The frame type this support entry refers to.
723    pub type_: FrameType,
724    /// The frame type-specific features supported.
725    pub features: u32,
726    /// The flags supported for the given frame type.
727    pub supported_flags: TxFlags,
728}
729
730impl fidl::Persistable for FrameTypeSupport {}
731
732#[derive(Clone, Debug, PartialEq)]
733pub struct MacAddressingAddMulticastAddressRequest {
734    pub address: fidl_fuchsia_net::MacAddress,
735}
736
737impl fidl::Persistable for MacAddressingAddMulticastAddressRequest {}
738
739#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
740#[repr(C)]
741pub struct MacAddressingAddMulticastAddressResponse {
742    pub status: i32,
743}
744
745impl fidl::Persistable for MacAddressingAddMulticastAddressResponse {}
746
747#[derive(Clone, Debug, PartialEq)]
748pub struct MacAddressingGetUnicastAddressResponse {
749    pub address: fidl_fuchsia_net::MacAddress,
750}
751
752impl fidl::Persistable for MacAddressingGetUnicastAddressResponse {}
753
754#[derive(Clone, Debug, PartialEq)]
755pub struct MacAddressingRemoveMulticastAddressRequest {
756    pub address: fidl_fuchsia_net::MacAddress,
757}
758
759impl fidl::Persistable for MacAddressingRemoveMulticastAddressRequest {}
760
761#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
762#[repr(C)]
763pub struct MacAddressingRemoveMulticastAddressResponse {
764    pub status: i32,
765}
766
767impl fidl::Persistable for MacAddressingRemoveMulticastAddressResponse {}
768
769#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
770pub struct MacAddressingSetModeRequest {
771    pub mode: MacFilterMode,
772}
773
774impl fidl::Persistable for MacAddressingSetModeRequest {}
775
776#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
777#[repr(C)]
778pub struct MacAddressingSetModeResponse {
779    pub status: i32,
780}
781
782impl fidl::Persistable for MacAddressingSetModeResponse {}
783
784#[derive(Clone, Debug, PartialEq)]
785pub struct PortGetInfoResponse {
786    pub info: PortInfo,
787}
788
789impl fidl::Persistable for PortGetInfoResponse {}
790
791#[derive(Clone, Debug, PartialEq)]
792pub struct PortGetStatusResponse {
793    pub status: PortStatus,
794}
795
796impl fidl::Persistable for PortGetStatusResponse {}
797
798/// A device port identifier.
799#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
800#[repr(C)]
801pub struct PortId {
802    /// The base identifier for the port.
803    ///
804    /// Generally identifies a port instance in hardware.
805    pub base: u8,
806    /// An implementation-defined identifier that is guaranteed to change on
807    /// every instantiation of the identified port.
808    pub salt: u8,
809}
810
811impl fidl::Persistable for PortId {}
812
813#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
814pub struct PortWatcherWatchResponse {
815    pub event: DevicePortEvent,
816}
817
818impl fidl::Persistable for PortWatcherWatchResponse {}
819
820#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
821pub struct SessionAttachRequest {
822    pub port: PortId,
823    pub rx_frames: Vec<FrameType>,
824}
825
826impl fidl::Persistable for SessionAttachRequest {}
827
828#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
829#[repr(C)]
830pub struct SessionDetachRequest {
831    pub port: PortId,
832}
833
834impl fidl::Persistable for SessionDetachRequest {}
835
836#[derive(Clone, Debug, PartialEq)]
837pub struct StatusWatcherWatchStatusResponse {
838    pub port_status: PortStatus,
839}
840
841impl fidl::Persistable for StatusWatcherWatchStatusResponse {}
842
843/// Network device base info.
844#[derive(Clone, Debug, Default, PartialEq)]
845pub struct DeviceBaseInfo {
846    /// Maximum number of items in rx FIFO (per session). Required.
847    ///
848    /// `rx_depth` is calculated based on the size of the actual backing
849    /// hardware rx queue.
850    pub rx_depth: Option<u16>,
851    /// Maximum number of items in tx FIFO (per session). Required.
852    ///
853    /// `tx_depth` is calculated based on the size of the actual backing
854    /// hardware tx queue.
855    pub tx_depth: Option<u16>,
856    /// Alignment requirement for buffers in the data VMO.
857    ///
858    /// All buffers in the data VMO *must* be aligned to `buffer_alignment`
859    /// relative to the start of the VMO. `buffer_alignment == 0` is never
860    /// reported. Required.
861    pub buffer_alignment: Option<u32>,
862    /// Maximum supported length of buffers in the data VMO, in bytes.
863    ///
864    /// Absent if no maximum buffer length is defined. Must be nonzero.
865    pub max_buffer_length: Option<u32>,
866    /// The minimum rx buffer length required for device. Required.
867    pub min_rx_buffer_length: Option<u32>,
868    /// The minimum tx buffer length required for the device. Required.
869    ///
870    /// This value accounts only for tx payload length, `min_tx_buffer_head` and
871    /// `min_tx_buffer_tail` are not part of this value.
872    ///
873    /// Clients must zero pad outgoing frames to meet the required minimum
874    /// length.
875    pub min_tx_buffer_length: Option<u32>,
876    /// The number of bytes the device requests be free as `head` space in a tx
877    /// buffer. Required.
878    pub min_tx_buffer_head: Option<u16>,
879    /// The amount of bytes the device requests be free as `tail` space in a tx
880    /// buffer. Required.
881    pub min_tx_buffer_tail: Option<u16>,
882    /// Maximum descriptor chain length accepted by the device. Required.
883    pub max_buffer_parts: Option<u8>,
884    /// Available rx acceleration flags for this device.
885    ///
886    /// `rx_accel` maps the `RX_ACCEL_*` flags in the frame descriptors with
887    /// semantic acceleration features described by [`RxAcceleration`]. Position
888    /// `n` of `rx_accel` conveys the meaning of the `RX_ACCEL_n` flag.
889    ///
890    /// Interpreted as empty if not provided.
891    pub rx_accel: Option<Vec<RxAcceleration>>,
892    /// Available tx acceleration flags for this device.
893    ///
894    /// `tx_accel` maps the `TX_ACCEL_*` flags in the frame descriptors with
895    /// semantic acceleration features described by [`TxAcceleration`]. Position
896    /// `n` of `tx_accel` conveys the meaning of the `TX_ACCEL_n` flag.
897    ///
898    /// Interpreted as empty if not provided.
899    pub tx_accel: Option<Vec<TxAcceleration>>,
900    #[doc(hidden)]
901    pub __source_breaking: fidl::marker::SourceBreaking,
902}
903
904impl fidl::Persistable for DeviceBaseInfo {}
905
906/// Network device information.
907#[derive(Clone, Debug, Default, PartialEq)]
908pub struct DeviceInfo {
909    /// Minimum descriptor length, in 64-bit words. Required.
910    ///
911    /// The minimum length that each buffer descriptor must have for correct
912    /// operation with this device. Devices that support extra frame metadata
913    /// inform larger minimum descriptor lengths that reflect the minimum space
914    /// needed to be able to store frame metadata.
915    pub min_descriptor_length: Option<u8>,
916    /// Accepted descriptor version. Required.
917    pub descriptor_version: Option<u8>,
918    /// Device base info. Required.
919    pub base_info: Option<DeviceBaseInfo>,
920    #[doc(hidden)]
921    pub __source_breaking: fidl::marker::SourceBreaking,
922}
923
924impl fidl::Persistable for DeviceInfo {}
925
926/// Port base info.
927#[derive(Clone, Debug, Default, PartialEq)]
928pub struct PortBaseInfo {
929    /// Port's class. Required.
930    pub port_class: Option<PortClass>,
931    /// Supported rx frame types on this port. Required.
932    ///
933    /// Clients may open sessions subscribing to a subset of `rx_types` frame
934    /// types on this port.
935    pub rx_types: Option<Vec<FrameType>>,
936    /// Supported tx frame types on this port. Required.
937    ///
938    /// Frames destined to this port whose frame type is not in `tx_types` are
939    /// returned with an error.
940    ///
941    /// Some network devices may need to perform partial frame parsing and
942    /// serialization and, for that reason, `tx_types` is a vector of
943    /// [`FrameTypeSupport`] which includes specific features per frame type.
944    /// For example, a device that supports Ethernet frames but needs to convert
945    /// the Ethernet header may only support standard Ethernet II frames, and
946    /// not any "raw" Ethernet frame.
947    pub tx_types: Option<Vec<FrameTypeSupport>>,
948    #[doc(hidden)]
949    pub __source_breaking: fidl::marker::SourceBreaking,
950}
951
952impl fidl::Persistable for PortBaseInfo {}
953
954#[derive(Clone, Debug, Default, PartialEq)]
955pub struct PortGetCountersResponse {
956    /// The total number of ingress frames on this port.
957    pub rx_frames: Option<u64>,
958    /// The total number of ingress bytes on this port.
959    pub rx_bytes: Option<u64>,
960    /// The total number of egress frames on this port.
961    pub tx_frames: Option<u64>,
962    /// The total number of egress bytes on this port.
963    pub tx_bytes: Option<u64>,
964    #[doc(hidden)]
965    pub __source_breaking: fidl::marker::SourceBreaking,
966}
967
968impl fidl::Persistable for PortGetCountersResponse {}
969
970/// Logical port information.
971#[derive(Clone, Debug, Default, PartialEq)]
972pub struct PortInfo {
973    /// Port's identifier. Required.
974    pub id: Option<PortId>,
975    pub base_info: Option<PortBaseInfo>,
976    #[doc(hidden)]
977    pub __source_breaking: fidl::marker::SourceBreaking,
978}
979
980impl fidl::Persistable for PortInfo {}
981
982/// Dynamic port information.
983#[derive(Clone, Debug, Default, PartialEq)]
984pub struct PortStatus {
985    /// Port status flags.
986    pub flags: Option<StatusFlags>,
987    /// Maximum transmit unit for this port, in bytes.
988    ///
989    /// The reported MTU is the size of an entire frame, including any header
990    /// and trailer bytes for whatever protocols this port supports.
991    pub mtu: Option<u32>,
992    #[doc(hidden)]
993    pub __source_breaking: fidl::marker::SourceBreaking,
994}
995
996impl fidl::Persistable for PortStatus {}
997
998/// Port creation and destruction events.
999#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
1000pub enum DevicePortEvent {
1001    /// Port existed when watcher was created.
1002    Existing(PortId),
1003    /// New port was added to device.
1004    Added(PortId),
1005    /// Port was removed from the device.
1006    Removed(PortId),
1007    /// Exhausted list of existing ports.
1008    Idle(Empty),
1009}
1010
1011impl DevicePortEvent {
1012    #[inline]
1013    pub fn ordinal(&self) -> u64 {
1014        match *self {
1015            Self::Existing(_) => 1,
1016            Self::Added(_) => 2,
1017            Self::Removed(_) => 3,
1018            Self::Idle(_) => 4,
1019        }
1020    }
1021}
1022
1023impl fidl::Persistable for DevicePortEvent {}
1024
1025mod internal {
1026    use super::*;
1027    unsafe impl fidl::encoding::TypeMarker for EthernetFeatures {
1028        type Owned = Self;
1029
1030        #[inline(always)]
1031        fn inline_align(_context: fidl::encoding::Context) -> usize {
1032            4
1033        }
1034
1035        #[inline(always)]
1036        fn inline_size(_context: fidl::encoding::Context) -> usize {
1037            4
1038        }
1039    }
1040
1041    impl fidl::encoding::ValueTypeMarker for EthernetFeatures {
1042        type Borrowed<'a> = Self;
1043        #[inline(always)]
1044        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1045            *value
1046        }
1047    }
1048
1049    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
1050        for EthernetFeatures
1051    {
1052        #[inline]
1053        unsafe fn encode(
1054            self,
1055            encoder: &mut fidl::encoding::Encoder<'_, D>,
1056            offset: usize,
1057            _depth: fidl::encoding::Depth,
1058        ) -> fidl::Result<()> {
1059            encoder.debug_check_bounds::<Self>(offset);
1060            if self.bits() & Self::all().bits() != self.bits() {
1061                return Err(fidl::Error::InvalidBitsValue);
1062            }
1063            encoder.write_num(self.bits(), offset);
1064            Ok(())
1065        }
1066    }
1067
1068    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for EthernetFeatures {
1069        #[inline(always)]
1070        fn new_empty() -> Self {
1071            Self::empty()
1072        }
1073
1074        #[inline]
1075        unsafe fn decode(
1076            &mut self,
1077            decoder: &mut fidl::encoding::Decoder<'_, D>,
1078            offset: usize,
1079            _depth: fidl::encoding::Depth,
1080        ) -> fidl::Result<()> {
1081            decoder.debug_check_bounds::<Self>(offset);
1082            let prim = decoder.read_num::<u32>(offset);
1083            *self = Self::from_bits(prim).ok_or(fidl::Error::InvalidBitsValue)?;
1084            Ok(())
1085        }
1086    }
1087    unsafe impl fidl::encoding::TypeMarker for RxFlags {
1088        type Owned = Self;
1089
1090        #[inline(always)]
1091        fn inline_align(_context: fidl::encoding::Context) -> usize {
1092            4
1093        }
1094
1095        #[inline(always)]
1096        fn inline_size(_context: fidl::encoding::Context) -> usize {
1097            4
1098        }
1099    }
1100
1101    impl fidl::encoding::ValueTypeMarker for RxFlags {
1102        type Borrowed<'a> = Self;
1103        #[inline(always)]
1104        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1105            *value
1106        }
1107    }
1108
1109    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for RxFlags {
1110        #[inline]
1111        unsafe fn encode(
1112            self,
1113            encoder: &mut fidl::encoding::Encoder<'_, D>,
1114            offset: usize,
1115            _depth: fidl::encoding::Depth,
1116        ) -> fidl::Result<()> {
1117            encoder.debug_check_bounds::<Self>(offset);
1118            if self.bits() & Self::all().bits() != self.bits() {
1119                return Err(fidl::Error::InvalidBitsValue);
1120            }
1121            encoder.write_num(self.bits(), offset);
1122            Ok(())
1123        }
1124    }
1125
1126    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for RxFlags {
1127        #[inline(always)]
1128        fn new_empty() -> Self {
1129            Self::empty()
1130        }
1131
1132        #[inline]
1133        unsafe fn decode(
1134            &mut self,
1135            decoder: &mut fidl::encoding::Decoder<'_, D>,
1136            offset: usize,
1137            _depth: fidl::encoding::Depth,
1138        ) -> fidl::Result<()> {
1139            decoder.debug_check_bounds::<Self>(offset);
1140            let prim = decoder.read_num::<u32>(offset);
1141            *self = Self::from_bits(prim).ok_or(fidl::Error::InvalidBitsValue)?;
1142            Ok(())
1143        }
1144    }
1145    unsafe impl fidl::encoding::TypeMarker for SessionFlags {
1146        type Owned = Self;
1147
1148        #[inline(always)]
1149        fn inline_align(_context: fidl::encoding::Context) -> usize {
1150            2
1151        }
1152
1153        #[inline(always)]
1154        fn inline_size(_context: fidl::encoding::Context) -> usize {
1155            2
1156        }
1157    }
1158
1159    impl fidl::encoding::ValueTypeMarker for SessionFlags {
1160        type Borrowed<'a> = Self;
1161        #[inline(always)]
1162        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1163            *value
1164        }
1165    }
1166
1167    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for SessionFlags {
1168        #[inline]
1169        unsafe fn encode(
1170            self,
1171            encoder: &mut fidl::encoding::Encoder<'_, D>,
1172            offset: usize,
1173            _depth: fidl::encoding::Depth,
1174        ) -> fidl::Result<()> {
1175            encoder.debug_check_bounds::<Self>(offset);
1176            if self.bits() & Self::all().bits() != self.bits() {
1177                return Err(fidl::Error::InvalidBitsValue);
1178            }
1179            encoder.write_num(self.bits(), offset);
1180            Ok(())
1181        }
1182    }
1183
1184    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SessionFlags {
1185        #[inline(always)]
1186        fn new_empty() -> Self {
1187            Self::empty()
1188        }
1189
1190        #[inline]
1191        unsafe fn decode(
1192            &mut self,
1193            decoder: &mut fidl::encoding::Decoder<'_, D>,
1194            offset: usize,
1195            _depth: fidl::encoding::Depth,
1196        ) -> fidl::Result<()> {
1197            decoder.debug_check_bounds::<Self>(offset);
1198            let prim = decoder.read_num::<u16>(offset);
1199            *self = Self::from_bits(prim).ok_or(fidl::Error::InvalidBitsValue)?;
1200            Ok(())
1201        }
1202    }
1203    unsafe impl fidl::encoding::TypeMarker for StatusFlags {
1204        type Owned = Self;
1205
1206        #[inline(always)]
1207        fn inline_align(_context: fidl::encoding::Context) -> usize {
1208            4
1209        }
1210
1211        #[inline(always)]
1212        fn inline_size(_context: fidl::encoding::Context) -> usize {
1213            4
1214        }
1215    }
1216
1217    impl fidl::encoding::ValueTypeMarker for StatusFlags {
1218        type Borrowed<'a> = Self;
1219        #[inline(always)]
1220        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1221            *value
1222        }
1223    }
1224
1225    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for StatusFlags {
1226        #[inline]
1227        unsafe fn encode(
1228            self,
1229            encoder: &mut fidl::encoding::Encoder<'_, D>,
1230            offset: usize,
1231            _depth: fidl::encoding::Depth,
1232        ) -> fidl::Result<()> {
1233            encoder.debug_check_bounds::<Self>(offset);
1234            if self.bits() & Self::all().bits() != self.bits() {
1235                return Err(fidl::Error::InvalidBitsValue);
1236            }
1237            encoder.write_num(self.bits(), offset);
1238            Ok(())
1239        }
1240    }
1241
1242    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for StatusFlags {
1243        #[inline(always)]
1244        fn new_empty() -> Self {
1245            Self::empty()
1246        }
1247
1248        #[inline]
1249        unsafe fn decode(
1250            &mut self,
1251            decoder: &mut fidl::encoding::Decoder<'_, D>,
1252            offset: usize,
1253            _depth: fidl::encoding::Depth,
1254        ) -> fidl::Result<()> {
1255            decoder.debug_check_bounds::<Self>(offset);
1256            let prim = decoder.read_num::<u32>(offset);
1257            *self = Self::from_bits(prim).ok_or(fidl::Error::InvalidBitsValue)?;
1258            Ok(())
1259        }
1260    }
1261    unsafe impl fidl::encoding::TypeMarker for TxFlags {
1262        type Owned = Self;
1263
1264        #[inline(always)]
1265        fn inline_align(_context: fidl::encoding::Context) -> usize {
1266            4
1267        }
1268
1269        #[inline(always)]
1270        fn inline_size(_context: fidl::encoding::Context) -> usize {
1271            4
1272        }
1273    }
1274
1275    impl fidl::encoding::ValueTypeMarker for TxFlags {
1276        type Borrowed<'a> = Self;
1277        #[inline(always)]
1278        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1279            *value
1280        }
1281    }
1282
1283    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for TxFlags {
1284        #[inline]
1285        unsafe fn encode(
1286            self,
1287            encoder: &mut fidl::encoding::Encoder<'_, D>,
1288            offset: usize,
1289            _depth: fidl::encoding::Depth,
1290        ) -> fidl::Result<()> {
1291            encoder.debug_check_bounds::<Self>(offset);
1292            encoder.write_num(self.bits(), offset);
1293            Ok(())
1294        }
1295    }
1296
1297    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for TxFlags {
1298        #[inline(always)]
1299        fn new_empty() -> Self {
1300            Self::empty()
1301        }
1302
1303        #[inline]
1304        unsafe fn decode(
1305            &mut self,
1306            decoder: &mut fidl::encoding::Decoder<'_, D>,
1307            offset: usize,
1308            _depth: fidl::encoding::Depth,
1309        ) -> fidl::Result<()> {
1310            decoder.debug_check_bounds::<Self>(offset);
1311            let prim = decoder.read_num::<u32>(offset);
1312            *self = Self::from_bits_allow_unknown(prim);
1313            Ok(())
1314        }
1315    }
1316    unsafe impl fidl::encoding::TypeMarker for TxReturnFlags {
1317        type Owned = Self;
1318
1319        #[inline(always)]
1320        fn inline_align(_context: fidl::encoding::Context) -> usize {
1321            4
1322        }
1323
1324        #[inline(always)]
1325        fn inline_size(_context: fidl::encoding::Context) -> usize {
1326            4
1327        }
1328    }
1329
1330    impl fidl::encoding::ValueTypeMarker for TxReturnFlags {
1331        type Borrowed<'a> = Self;
1332        #[inline(always)]
1333        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1334            *value
1335        }
1336    }
1337
1338    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for TxReturnFlags {
1339        #[inline]
1340        unsafe fn encode(
1341            self,
1342            encoder: &mut fidl::encoding::Encoder<'_, D>,
1343            offset: usize,
1344            _depth: fidl::encoding::Depth,
1345        ) -> fidl::Result<()> {
1346            encoder.debug_check_bounds::<Self>(offset);
1347            encoder.write_num(self.bits(), offset);
1348            Ok(())
1349        }
1350    }
1351
1352    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for TxReturnFlags {
1353        #[inline(always)]
1354        fn new_empty() -> Self {
1355            Self::empty()
1356        }
1357
1358        #[inline]
1359        unsafe fn decode(
1360            &mut self,
1361            decoder: &mut fidl::encoding::Decoder<'_, D>,
1362            offset: usize,
1363            _depth: fidl::encoding::Depth,
1364        ) -> fidl::Result<()> {
1365            decoder.debug_check_bounds::<Self>(offset);
1366            let prim = decoder.read_num::<u32>(offset);
1367            *self = Self::from_bits_allow_unknown(prim);
1368            Ok(())
1369        }
1370    }
1371    unsafe impl fidl::encoding::TypeMarker for DeviceClass {
1372        type Owned = Self;
1373
1374        #[inline(always)]
1375        fn inline_align(_context: fidl::encoding::Context) -> usize {
1376            std::mem::align_of::<u16>()
1377        }
1378
1379        #[inline(always)]
1380        fn inline_size(_context: fidl::encoding::Context) -> usize {
1381            std::mem::size_of::<u16>()
1382        }
1383
1384        #[inline(always)]
1385        fn encode_is_copy() -> bool {
1386            true
1387        }
1388
1389        #[inline(always)]
1390        fn decode_is_copy() -> bool {
1391            false
1392        }
1393    }
1394
1395    impl fidl::encoding::ValueTypeMarker for DeviceClass {
1396        type Borrowed<'a> = Self;
1397        #[inline(always)]
1398        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1399            *value
1400        }
1401    }
1402
1403    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for DeviceClass {
1404        #[inline]
1405        unsafe fn encode(
1406            self,
1407            encoder: &mut fidl::encoding::Encoder<'_, D>,
1408            offset: usize,
1409            _depth: fidl::encoding::Depth,
1410        ) -> fidl::Result<()> {
1411            encoder.debug_check_bounds::<Self>(offset);
1412            encoder.write_num(self.into_primitive(), offset);
1413            Ok(())
1414        }
1415    }
1416
1417    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for DeviceClass {
1418        #[inline(always)]
1419        fn new_empty() -> Self {
1420            Self::Virtual
1421        }
1422
1423        #[inline]
1424        unsafe fn decode(
1425            &mut self,
1426            decoder: &mut fidl::encoding::Decoder<'_, D>,
1427            offset: usize,
1428            _depth: fidl::encoding::Depth,
1429        ) -> fidl::Result<()> {
1430            decoder.debug_check_bounds::<Self>(offset);
1431            let prim = decoder.read_num::<u16>(offset);
1432
1433            *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
1434            Ok(())
1435        }
1436    }
1437    unsafe impl fidl::encoding::TypeMarker for FrameType {
1438        type Owned = Self;
1439
1440        #[inline(always)]
1441        fn inline_align(_context: fidl::encoding::Context) -> usize {
1442            std::mem::align_of::<u8>()
1443        }
1444
1445        #[inline(always)]
1446        fn inline_size(_context: fidl::encoding::Context) -> usize {
1447            std::mem::size_of::<u8>()
1448        }
1449
1450        #[inline(always)]
1451        fn encode_is_copy() -> bool {
1452            false
1453        }
1454
1455        #[inline(always)]
1456        fn decode_is_copy() -> bool {
1457            false
1458        }
1459    }
1460
1461    impl fidl::encoding::ValueTypeMarker for FrameType {
1462        type Borrowed<'a> = Self;
1463        #[inline(always)]
1464        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1465            *value
1466        }
1467    }
1468
1469    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for FrameType {
1470        #[inline]
1471        unsafe fn encode(
1472            self,
1473            encoder: &mut fidl::encoding::Encoder<'_, D>,
1474            offset: usize,
1475            _depth: fidl::encoding::Depth,
1476        ) -> fidl::Result<()> {
1477            encoder.debug_check_bounds::<Self>(offset);
1478            encoder.write_num(self.into_primitive(), offset);
1479            Ok(())
1480        }
1481    }
1482
1483    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for FrameType {
1484        #[inline(always)]
1485        fn new_empty() -> Self {
1486            Self::unknown()
1487        }
1488
1489        #[inline]
1490        unsafe fn decode(
1491            &mut self,
1492            decoder: &mut fidl::encoding::Decoder<'_, D>,
1493            offset: usize,
1494            _depth: fidl::encoding::Depth,
1495        ) -> fidl::Result<()> {
1496            decoder.debug_check_bounds::<Self>(offset);
1497            let prim = decoder.read_num::<u8>(offset);
1498
1499            *self = Self::from_primitive_allow_unknown(prim);
1500            Ok(())
1501        }
1502    }
1503    unsafe impl fidl::encoding::TypeMarker for InfoType {
1504        type Owned = Self;
1505
1506        #[inline(always)]
1507        fn inline_align(_context: fidl::encoding::Context) -> usize {
1508            std::mem::align_of::<u32>()
1509        }
1510
1511        #[inline(always)]
1512        fn inline_size(_context: fidl::encoding::Context) -> usize {
1513            std::mem::size_of::<u32>()
1514        }
1515
1516        #[inline(always)]
1517        fn encode_is_copy() -> bool {
1518            true
1519        }
1520
1521        #[inline(always)]
1522        fn decode_is_copy() -> bool {
1523            false
1524        }
1525    }
1526
1527    impl fidl::encoding::ValueTypeMarker for InfoType {
1528        type Borrowed<'a> = Self;
1529        #[inline(always)]
1530        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1531            *value
1532        }
1533    }
1534
1535    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for InfoType {
1536        #[inline]
1537        unsafe fn encode(
1538            self,
1539            encoder: &mut fidl::encoding::Encoder<'_, D>,
1540            offset: usize,
1541            _depth: fidl::encoding::Depth,
1542        ) -> fidl::Result<()> {
1543            encoder.debug_check_bounds::<Self>(offset);
1544            encoder.write_num(self.into_primitive(), offset);
1545            Ok(())
1546        }
1547    }
1548
1549    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for InfoType {
1550        #[inline(always)]
1551        fn new_empty() -> Self {
1552            Self::NoInfo
1553        }
1554
1555        #[inline]
1556        unsafe fn decode(
1557            &mut self,
1558            decoder: &mut fidl::encoding::Decoder<'_, D>,
1559            offset: usize,
1560            _depth: fidl::encoding::Depth,
1561        ) -> fidl::Result<()> {
1562            decoder.debug_check_bounds::<Self>(offset);
1563            let prim = decoder.read_num::<u32>(offset);
1564
1565            *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
1566            Ok(())
1567        }
1568    }
1569    unsafe impl fidl::encoding::TypeMarker for MacFilterMode {
1570        type Owned = Self;
1571
1572        #[inline(always)]
1573        fn inline_align(_context: fidl::encoding::Context) -> usize {
1574            std::mem::align_of::<u32>()
1575        }
1576
1577        #[inline(always)]
1578        fn inline_size(_context: fidl::encoding::Context) -> usize {
1579            std::mem::size_of::<u32>()
1580        }
1581
1582        #[inline(always)]
1583        fn encode_is_copy() -> bool {
1584            false
1585        }
1586
1587        #[inline(always)]
1588        fn decode_is_copy() -> bool {
1589            false
1590        }
1591    }
1592
1593    impl fidl::encoding::ValueTypeMarker for MacFilterMode {
1594        type Borrowed<'a> = Self;
1595        #[inline(always)]
1596        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1597            *value
1598        }
1599    }
1600
1601    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for MacFilterMode {
1602        #[inline]
1603        unsafe fn encode(
1604            self,
1605            encoder: &mut fidl::encoding::Encoder<'_, D>,
1606            offset: usize,
1607            _depth: fidl::encoding::Depth,
1608        ) -> fidl::Result<()> {
1609            encoder.debug_check_bounds::<Self>(offset);
1610            encoder.write_num(self.into_primitive(), offset);
1611            Ok(())
1612        }
1613    }
1614
1615    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for MacFilterMode {
1616        #[inline(always)]
1617        fn new_empty() -> Self {
1618            Self::unknown()
1619        }
1620
1621        #[inline]
1622        unsafe fn decode(
1623            &mut self,
1624            decoder: &mut fidl::encoding::Decoder<'_, D>,
1625            offset: usize,
1626            _depth: fidl::encoding::Depth,
1627        ) -> fidl::Result<()> {
1628            decoder.debug_check_bounds::<Self>(offset);
1629            let prim = decoder.read_num::<u32>(offset);
1630
1631            *self = Self::from_primitive_allow_unknown(prim);
1632            Ok(())
1633        }
1634    }
1635    unsafe impl fidl::encoding::TypeMarker for PortClass {
1636        type Owned = Self;
1637
1638        #[inline(always)]
1639        fn inline_align(_context: fidl::encoding::Context) -> usize {
1640            std::mem::align_of::<u16>()
1641        }
1642
1643        #[inline(always)]
1644        fn inline_size(_context: fidl::encoding::Context) -> usize {
1645            std::mem::size_of::<u16>()
1646        }
1647
1648        #[inline(always)]
1649        fn encode_is_copy() -> bool {
1650            false
1651        }
1652
1653        #[inline(always)]
1654        fn decode_is_copy() -> bool {
1655            false
1656        }
1657    }
1658
1659    impl fidl::encoding::ValueTypeMarker for PortClass {
1660        type Borrowed<'a> = Self;
1661        #[inline(always)]
1662        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1663            *value
1664        }
1665    }
1666
1667    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for PortClass {
1668        #[inline]
1669        unsafe fn encode(
1670            self,
1671            encoder: &mut fidl::encoding::Encoder<'_, D>,
1672            offset: usize,
1673            _depth: fidl::encoding::Depth,
1674        ) -> fidl::Result<()> {
1675            encoder.debug_check_bounds::<Self>(offset);
1676            encoder.write_num(self.into_primitive(), offset);
1677            Ok(())
1678        }
1679    }
1680
1681    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for PortClass {
1682        #[inline(always)]
1683        fn new_empty() -> Self {
1684            Self::unknown()
1685        }
1686
1687        #[inline]
1688        unsafe fn decode(
1689            &mut self,
1690            decoder: &mut fidl::encoding::Decoder<'_, D>,
1691            offset: usize,
1692            _depth: fidl::encoding::Depth,
1693        ) -> fidl::Result<()> {
1694            decoder.debug_check_bounds::<Self>(offset);
1695            let prim = decoder.read_num::<u16>(offset);
1696
1697            *self = Self::from_primitive_allow_unknown(prim);
1698            Ok(())
1699        }
1700    }
1701    unsafe impl fidl::encoding::TypeMarker for RxAcceleration {
1702        type Owned = Self;
1703
1704        #[inline(always)]
1705        fn inline_align(_context: fidl::encoding::Context) -> usize {
1706            std::mem::align_of::<u8>()
1707        }
1708
1709        #[inline(always)]
1710        fn inline_size(_context: fidl::encoding::Context) -> usize {
1711            std::mem::size_of::<u8>()
1712        }
1713
1714        #[inline(always)]
1715        fn encode_is_copy() -> bool {
1716            false
1717        }
1718
1719        #[inline(always)]
1720        fn decode_is_copy() -> bool {
1721            false
1722        }
1723    }
1724
1725    impl fidl::encoding::ValueTypeMarker for RxAcceleration {
1726        type Borrowed<'a> = Self;
1727        #[inline(always)]
1728        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1729            *value
1730        }
1731    }
1732
1733    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for RxAcceleration {
1734        #[inline]
1735        unsafe fn encode(
1736            self,
1737            encoder: &mut fidl::encoding::Encoder<'_, D>,
1738            offset: usize,
1739            _depth: fidl::encoding::Depth,
1740        ) -> fidl::Result<()> {
1741            encoder.debug_check_bounds::<Self>(offset);
1742            encoder.write_num(self.into_primitive(), offset);
1743            Ok(())
1744        }
1745    }
1746
1747    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for RxAcceleration {
1748        #[inline(always)]
1749        fn new_empty() -> Self {
1750            Self::unknown()
1751        }
1752
1753        #[inline]
1754        unsafe fn decode(
1755            &mut self,
1756            decoder: &mut fidl::encoding::Decoder<'_, D>,
1757            offset: usize,
1758            _depth: fidl::encoding::Depth,
1759        ) -> fidl::Result<()> {
1760            decoder.debug_check_bounds::<Self>(offset);
1761            let prim = decoder.read_num::<u8>(offset);
1762
1763            *self = Self::from_primitive_allow_unknown(prim);
1764            Ok(())
1765        }
1766    }
1767    unsafe impl fidl::encoding::TypeMarker for TxAcceleration {
1768        type Owned = Self;
1769
1770        #[inline(always)]
1771        fn inline_align(_context: fidl::encoding::Context) -> usize {
1772            std::mem::align_of::<u8>()
1773        }
1774
1775        #[inline(always)]
1776        fn inline_size(_context: fidl::encoding::Context) -> usize {
1777            std::mem::size_of::<u8>()
1778        }
1779
1780        #[inline(always)]
1781        fn encode_is_copy() -> bool {
1782            false
1783        }
1784
1785        #[inline(always)]
1786        fn decode_is_copy() -> bool {
1787            false
1788        }
1789    }
1790
1791    impl fidl::encoding::ValueTypeMarker for TxAcceleration {
1792        type Borrowed<'a> = Self;
1793        #[inline(always)]
1794        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1795            *value
1796        }
1797    }
1798
1799    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for TxAcceleration {
1800        #[inline]
1801        unsafe fn encode(
1802            self,
1803            encoder: &mut fidl::encoding::Encoder<'_, D>,
1804            offset: usize,
1805            _depth: fidl::encoding::Depth,
1806        ) -> fidl::Result<()> {
1807            encoder.debug_check_bounds::<Self>(offset);
1808            encoder.write_num(self.into_primitive(), offset);
1809            Ok(())
1810        }
1811    }
1812
1813    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for TxAcceleration {
1814        #[inline(always)]
1815        fn new_empty() -> Self {
1816            Self::unknown()
1817        }
1818
1819        #[inline]
1820        unsafe fn decode(
1821            &mut self,
1822            decoder: &mut fidl::encoding::Decoder<'_, D>,
1823            offset: usize,
1824            _depth: fidl::encoding::Depth,
1825        ) -> fidl::Result<()> {
1826            decoder.debug_check_bounds::<Self>(offset);
1827            let prim = decoder.read_num::<u8>(offset);
1828
1829            *self = Self::from_primitive_allow_unknown(prim);
1830            Ok(())
1831        }
1832    }
1833
1834    impl fidl::encoding::ValueTypeMarker for DeviceGetInfoResponse {
1835        type Borrowed<'a> = &'a Self;
1836        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1837            value
1838        }
1839    }
1840
1841    unsafe impl fidl::encoding::TypeMarker for DeviceGetInfoResponse {
1842        type Owned = Self;
1843
1844        #[inline(always)]
1845        fn inline_align(_context: fidl::encoding::Context) -> usize {
1846            8
1847        }
1848
1849        #[inline(always)]
1850        fn inline_size(_context: fidl::encoding::Context) -> usize {
1851            16
1852        }
1853    }
1854
1855    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<DeviceGetInfoResponse, D>
1856        for &DeviceGetInfoResponse
1857    {
1858        #[inline]
1859        unsafe fn encode(
1860            self,
1861            encoder: &mut fidl::encoding::Encoder<'_, D>,
1862            offset: usize,
1863            _depth: fidl::encoding::Depth,
1864        ) -> fidl::Result<()> {
1865            encoder.debug_check_bounds::<DeviceGetInfoResponse>(offset);
1866            // Delegate to tuple encoding.
1867            fidl::encoding::Encode::<DeviceGetInfoResponse, D>::encode(
1868                (<DeviceInfo as fidl::encoding::ValueTypeMarker>::borrow(&self.info),),
1869                encoder,
1870                offset,
1871                _depth,
1872            )
1873        }
1874    }
1875    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<DeviceInfo, D>>
1876        fidl::encoding::Encode<DeviceGetInfoResponse, D> for (T0,)
1877    {
1878        #[inline]
1879        unsafe fn encode(
1880            self,
1881            encoder: &mut fidl::encoding::Encoder<'_, D>,
1882            offset: usize,
1883            depth: fidl::encoding::Depth,
1884        ) -> fidl::Result<()> {
1885            encoder.debug_check_bounds::<DeviceGetInfoResponse>(offset);
1886            // Zero out padding regions. There's no need to apply masks
1887            // because the unmasked parts will be overwritten by fields.
1888            // Write the fields.
1889            self.0.encode(encoder, offset + 0, depth)?;
1890            Ok(())
1891        }
1892    }
1893
1894    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for DeviceGetInfoResponse {
1895        #[inline(always)]
1896        fn new_empty() -> Self {
1897            Self { info: fidl::new_empty!(DeviceInfo, D) }
1898        }
1899
1900        #[inline]
1901        unsafe fn decode(
1902            &mut self,
1903            decoder: &mut fidl::encoding::Decoder<'_, D>,
1904            offset: usize,
1905            _depth: fidl::encoding::Depth,
1906        ) -> fidl::Result<()> {
1907            decoder.debug_check_bounds::<Self>(offset);
1908            // Verify that padding bytes are zero.
1909            fidl::decode!(DeviceInfo, D, &mut self.info, decoder, offset + 0, _depth)?;
1910            Ok(())
1911        }
1912    }
1913
1914    impl fidl::encoding::ValueTypeMarker for Empty {
1915        type Borrowed<'a> = &'a Self;
1916        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1917            value
1918        }
1919    }
1920
1921    unsafe impl fidl::encoding::TypeMarker for Empty {
1922        type Owned = Self;
1923
1924        #[inline(always)]
1925        fn inline_align(_context: fidl::encoding::Context) -> usize {
1926            1
1927        }
1928
1929        #[inline(always)]
1930        fn inline_size(_context: fidl::encoding::Context) -> usize {
1931            1
1932        }
1933    }
1934
1935    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Empty, D> for &Empty {
1936        #[inline]
1937        unsafe fn encode(
1938            self,
1939            encoder: &mut fidl::encoding::Encoder<'_, D>,
1940            offset: usize,
1941            _depth: fidl::encoding::Depth,
1942        ) -> fidl::Result<()> {
1943            encoder.debug_check_bounds::<Empty>(offset);
1944            encoder.write_num(0u8, offset);
1945            Ok(())
1946        }
1947    }
1948
1949    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Empty {
1950        #[inline(always)]
1951        fn new_empty() -> Self {
1952            Self
1953        }
1954
1955        #[inline]
1956        unsafe fn decode(
1957            &mut self,
1958            decoder: &mut fidl::encoding::Decoder<'_, D>,
1959            offset: usize,
1960            _depth: fidl::encoding::Depth,
1961        ) -> fidl::Result<()> {
1962            decoder.debug_check_bounds::<Self>(offset);
1963            match decoder.read_num::<u8>(offset) {
1964                0 => Ok(()),
1965                _ => Err(fidl::Error::Invalid),
1966            }
1967        }
1968    }
1969
1970    impl fidl::encoding::ValueTypeMarker for FrameTypeSupport {
1971        type Borrowed<'a> = &'a Self;
1972        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1973            value
1974        }
1975    }
1976
1977    unsafe impl fidl::encoding::TypeMarker for FrameTypeSupport {
1978        type Owned = Self;
1979
1980        #[inline(always)]
1981        fn inline_align(_context: fidl::encoding::Context) -> usize {
1982            4
1983        }
1984
1985        #[inline(always)]
1986        fn inline_size(_context: fidl::encoding::Context) -> usize {
1987            12
1988        }
1989    }
1990
1991    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<FrameTypeSupport, D>
1992        for &FrameTypeSupport
1993    {
1994        #[inline]
1995        unsafe fn encode(
1996            self,
1997            encoder: &mut fidl::encoding::Encoder<'_, D>,
1998            offset: usize,
1999            _depth: fidl::encoding::Depth,
2000        ) -> fidl::Result<()> {
2001            encoder.debug_check_bounds::<FrameTypeSupport>(offset);
2002            // Delegate to tuple encoding.
2003            fidl::encoding::Encode::<FrameTypeSupport, D>::encode(
2004                (
2005                    <FrameType as fidl::encoding::ValueTypeMarker>::borrow(&self.type_),
2006                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.features),
2007                    <TxFlags as fidl::encoding::ValueTypeMarker>::borrow(&self.supported_flags),
2008                ),
2009                encoder,
2010                offset,
2011                _depth,
2012            )
2013        }
2014    }
2015    unsafe impl<
2016            D: fidl::encoding::ResourceDialect,
2017            T0: fidl::encoding::Encode<FrameType, D>,
2018            T1: fidl::encoding::Encode<u32, D>,
2019            T2: fidl::encoding::Encode<TxFlags, D>,
2020        > fidl::encoding::Encode<FrameTypeSupport, D> for (T0, T1, T2)
2021    {
2022        #[inline]
2023        unsafe fn encode(
2024            self,
2025            encoder: &mut fidl::encoding::Encoder<'_, D>,
2026            offset: usize,
2027            depth: fidl::encoding::Depth,
2028        ) -> fidl::Result<()> {
2029            encoder.debug_check_bounds::<FrameTypeSupport>(offset);
2030            // Zero out padding regions. There's no need to apply masks
2031            // because the unmasked parts will be overwritten by fields.
2032            unsafe {
2033                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
2034                (ptr as *mut u32).write_unaligned(0);
2035            }
2036            // Write the fields.
2037            self.0.encode(encoder, offset + 0, depth)?;
2038            self.1.encode(encoder, offset + 4, depth)?;
2039            self.2.encode(encoder, offset + 8, depth)?;
2040            Ok(())
2041        }
2042    }
2043
2044    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for FrameTypeSupport {
2045        #[inline(always)]
2046        fn new_empty() -> Self {
2047            Self {
2048                type_: fidl::new_empty!(FrameType, D),
2049                features: fidl::new_empty!(u32, D),
2050                supported_flags: fidl::new_empty!(TxFlags, D),
2051            }
2052        }
2053
2054        #[inline]
2055        unsafe fn decode(
2056            &mut self,
2057            decoder: &mut fidl::encoding::Decoder<'_, D>,
2058            offset: usize,
2059            _depth: fidl::encoding::Depth,
2060        ) -> fidl::Result<()> {
2061            decoder.debug_check_bounds::<Self>(offset);
2062            // Verify that padding bytes are zero.
2063            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
2064            let padval = unsafe { (ptr as *const u32).read_unaligned() };
2065            let mask = 0xffffff00u32;
2066            let maskedval = padval & mask;
2067            if maskedval != 0 {
2068                return Err(fidl::Error::NonZeroPadding {
2069                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
2070                });
2071            }
2072            fidl::decode!(FrameType, D, &mut self.type_, decoder, offset + 0, _depth)?;
2073            fidl::decode!(u32, D, &mut self.features, decoder, offset + 4, _depth)?;
2074            fidl::decode!(TxFlags, D, &mut self.supported_flags, decoder, offset + 8, _depth)?;
2075            Ok(())
2076        }
2077    }
2078
2079    impl fidl::encoding::ValueTypeMarker for MacAddressingAddMulticastAddressRequest {
2080        type Borrowed<'a> = &'a Self;
2081        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2082            value
2083        }
2084    }
2085
2086    unsafe impl fidl::encoding::TypeMarker for MacAddressingAddMulticastAddressRequest {
2087        type Owned = Self;
2088
2089        #[inline(always)]
2090        fn inline_align(_context: fidl::encoding::Context) -> usize {
2091            1
2092        }
2093
2094        #[inline(always)]
2095        fn inline_size(_context: fidl::encoding::Context) -> usize {
2096            6
2097        }
2098    }
2099
2100    unsafe impl<D: fidl::encoding::ResourceDialect>
2101        fidl::encoding::Encode<MacAddressingAddMulticastAddressRequest, D>
2102        for &MacAddressingAddMulticastAddressRequest
2103    {
2104        #[inline]
2105        unsafe fn encode(
2106            self,
2107            encoder: &mut fidl::encoding::Encoder<'_, D>,
2108            offset: usize,
2109            _depth: fidl::encoding::Depth,
2110        ) -> fidl::Result<()> {
2111            encoder.debug_check_bounds::<MacAddressingAddMulticastAddressRequest>(offset);
2112            // Delegate to tuple encoding.
2113            fidl::encoding::Encode::<MacAddressingAddMulticastAddressRequest, D>::encode(
2114                (<fidl_fuchsia_net::MacAddress as fidl::encoding::ValueTypeMarker>::borrow(
2115                    &self.address,
2116                ),),
2117                encoder,
2118                offset,
2119                _depth,
2120            )
2121        }
2122    }
2123    unsafe impl<
2124            D: fidl::encoding::ResourceDialect,
2125            T0: fidl::encoding::Encode<fidl_fuchsia_net::MacAddress, D>,
2126        > fidl::encoding::Encode<MacAddressingAddMulticastAddressRequest, D> for (T0,)
2127    {
2128        #[inline]
2129        unsafe fn encode(
2130            self,
2131            encoder: &mut fidl::encoding::Encoder<'_, D>,
2132            offset: usize,
2133            depth: fidl::encoding::Depth,
2134        ) -> fidl::Result<()> {
2135            encoder.debug_check_bounds::<MacAddressingAddMulticastAddressRequest>(offset);
2136            // Zero out padding regions. There's no need to apply masks
2137            // because the unmasked parts will be overwritten by fields.
2138            // Write the fields.
2139            self.0.encode(encoder, offset + 0, depth)?;
2140            Ok(())
2141        }
2142    }
2143
2144    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2145        for MacAddressingAddMulticastAddressRequest
2146    {
2147        #[inline(always)]
2148        fn new_empty() -> Self {
2149            Self { address: fidl::new_empty!(fidl_fuchsia_net::MacAddress, D) }
2150        }
2151
2152        #[inline]
2153        unsafe fn decode(
2154            &mut self,
2155            decoder: &mut fidl::encoding::Decoder<'_, D>,
2156            offset: usize,
2157            _depth: fidl::encoding::Depth,
2158        ) -> fidl::Result<()> {
2159            decoder.debug_check_bounds::<Self>(offset);
2160            // Verify that padding bytes are zero.
2161            fidl::decode!(
2162                fidl_fuchsia_net::MacAddress,
2163                D,
2164                &mut self.address,
2165                decoder,
2166                offset + 0,
2167                _depth
2168            )?;
2169            Ok(())
2170        }
2171    }
2172
2173    impl fidl::encoding::ValueTypeMarker for MacAddressingAddMulticastAddressResponse {
2174        type Borrowed<'a> = &'a Self;
2175        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2176            value
2177        }
2178    }
2179
2180    unsafe impl fidl::encoding::TypeMarker for MacAddressingAddMulticastAddressResponse {
2181        type Owned = Self;
2182
2183        #[inline(always)]
2184        fn inline_align(_context: fidl::encoding::Context) -> usize {
2185            4
2186        }
2187
2188        #[inline(always)]
2189        fn inline_size(_context: fidl::encoding::Context) -> usize {
2190            4
2191        }
2192        #[inline(always)]
2193        fn encode_is_copy() -> bool {
2194            true
2195        }
2196
2197        #[inline(always)]
2198        fn decode_is_copy() -> bool {
2199            true
2200        }
2201    }
2202
2203    unsafe impl<D: fidl::encoding::ResourceDialect>
2204        fidl::encoding::Encode<MacAddressingAddMulticastAddressResponse, D>
2205        for &MacAddressingAddMulticastAddressResponse
2206    {
2207        #[inline]
2208        unsafe fn encode(
2209            self,
2210            encoder: &mut fidl::encoding::Encoder<'_, D>,
2211            offset: usize,
2212            _depth: fidl::encoding::Depth,
2213        ) -> fidl::Result<()> {
2214            encoder.debug_check_bounds::<MacAddressingAddMulticastAddressResponse>(offset);
2215            unsafe {
2216                // Copy the object into the buffer.
2217                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
2218                (buf_ptr as *mut MacAddressingAddMulticastAddressResponse).write_unaligned(
2219                    (self as *const MacAddressingAddMulticastAddressResponse).read(),
2220                );
2221                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
2222                // done second because the memcpy will write garbage to these bytes.
2223            }
2224            Ok(())
2225        }
2226    }
2227    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<i32, D>>
2228        fidl::encoding::Encode<MacAddressingAddMulticastAddressResponse, D> for (T0,)
2229    {
2230        #[inline]
2231        unsafe fn encode(
2232            self,
2233            encoder: &mut fidl::encoding::Encoder<'_, D>,
2234            offset: usize,
2235            depth: fidl::encoding::Depth,
2236        ) -> fidl::Result<()> {
2237            encoder.debug_check_bounds::<MacAddressingAddMulticastAddressResponse>(offset);
2238            // Zero out padding regions. There's no need to apply masks
2239            // because the unmasked parts will be overwritten by fields.
2240            // Write the fields.
2241            self.0.encode(encoder, offset + 0, depth)?;
2242            Ok(())
2243        }
2244    }
2245
2246    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2247        for MacAddressingAddMulticastAddressResponse
2248    {
2249        #[inline(always)]
2250        fn new_empty() -> Self {
2251            Self { status: fidl::new_empty!(i32, D) }
2252        }
2253
2254        #[inline]
2255        unsafe fn decode(
2256            &mut self,
2257            decoder: &mut fidl::encoding::Decoder<'_, D>,
2258            offset: usize,
2259            _depth: fidl::encoding::Depth,
2260        ) -> fidl::Result<()> {
2261            decoder.debug_check_bounds::<Self>(offset);
2262            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
2263            // Verify that padding bytes are zero.
2264            // Copy from the buffer into the object.
2265            unsafe {
2266                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
2267            }
2268            Ok(())
2269        }
2270    }
2271
2272    impl fidl::encoding::ValueTypeMarker for MacAddressingGetUnicastAddressResponse {
2273        type Borrowed<'a> = &'a Self;
2274        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2275            value
2276        }
2277    }
2278
2279    unsafe impl fidl::encoding::TypeMarker for MacAddressingGetUnicastAddressResponse {
2280        type Owned = Self;
2281
2282        #[inline(always)]
2283        fn inline_align(_context: fidl::encoding::Context) -> usize {
2284            1
2285        }
2286
2287        #[inline(always)]
2288        fn inline_size(_context: fidl::encoding::Context) -> usize {
2289            6
2290        }
2291    }
2292
2293    unsafe impl<D: fidl::encoding::ResourceDialect>
2294        fidl::encoding::Encode<MacAddressingGetUnicastAddressResponse, D>
2295        for &MacAddressingGetUnicastAddressResponse
2296    {
2297        #[inline]
2298        unsafe fn encode(
2299            self,
2300            encoder: &mut fidl::encoding::Encoder<'_, D>,
2301            offset: usize,
2302            _depth: fidl::encoding::Depth,
2303        ) -> fidl::Result<()> {
2304            encoder.debug_check_bounds::<MacAddressingGetUnicastAddressResponse>(offset);
2305            // Delegate to tuple encoding.
2306            fidl::encoding::Encode::<MacAddressingGetUnicastAddressResponse, D>::encode(
2307                (<fidl_fuchsia_net::MacAddress as fidl::encoding::ValueTypeMarker>::borrow(
2308                    &self.address,
2309                ),),
2310                encoder,
2311                offset,
2312                _depth,
2313            )
2314        }
2315    }
2316    unsafe impl<
2317            D: fidl::encoding::ResourceDialect,
2318            T0: fidl::encoding::Encode<fidl_fuchsia_net::MacAddress, D>,
2319        > fidl::encoding::Encode<MacAddressingGetUnicastAddressResponse, D> for (T0,)
2320    {
2321        #[inline]
2322        unsafe fn encode(
2323            self,
2324            encoder: &mut fidl::encoding::Encoder<'_, D>,
2325            offset: usize,
2326            depth: fidl::encoding::Depth,
2327        ) -> fidl::Result<()> {
2328            encoder.debug_check_bounds::<MacAddressingGetUnicastAddressResponse>(offset);
2329            // Zero out padding regions. There's no need to apply masks
2330            // because the unmasked parts will be overwritten by fields.
2331            // Write the fields.
2332            self.0.encode(encoder, offset + 0, depth)?;
2333            Ok(())
2334        }
2335    }
2336
2337    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2338        for MacAddressingGetUnicastAddressResponse
2339    {
2340        #[inline(always)]
2341        fn new_empty() -> Self {
2342            Self { address: fidl::new_empty!(fidl_fuchsia_net::MacAddress, D) }
2343        }
2344
2345        #[inline]
2346        unsafe fn decode(
2347            &mut self,
2348            decoder: &mut fidl::encoding::Decoder<'_, D>,
2349            offset: usize,
2350            _depth: fidl::encoding::Depth,
2351        ) -> fidl::Result<()> {
2352            decoder.debug_check_bounds::<Self>(offset);
2353            // Verify that padding bytes are zero.
2354            fidl::decode!(
2355                fidl_fuchsia_net::MacAddress,
2356                D,
2357                &mut self.address,
2358                decoder,
2359                offset + 0,
2360                _depth
2361            )?;
2362            Ok(())
2363        }
2364    }
2365
2366    impl fidl::encoding::ValueTypeMarker for MacAddressingRemoveMulticastAddressRequest {
2367        type Borrowed<'a> = &'a Self;
2368        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2369            value
2370        }
2371    }
2372
2373    unsafe impl fidl::encoding::TypeMarker for MacAddressingRemoveMulticastAddressRequest {
2374        type Owned = Self;
2375
2376        #[inline(always)]
2377        fn inline_align(_context: fidl::encoding::Context) -> usize {
2378            1
2379        }
2380
2381        #[inline(always)]
2382        fn inline_size(_context: fidl::encoding::Context) -> usize {
2383            6
2384        }
2385    }
2386
2387    unsafe impl<D: fidl::encoding::ResourceDialect>
2388        fidl::encoding::Encode<MacAddressingRemoveMulticastAddressRequest, D>
2389        for &MacAddressingRemoveMulticastAddressRequest
2390    {
2391        #[inline]
2392        unsafe fn encode(
2393            self,
2394            encoder: &mut fidl::encoding::Encoder<'_, D>,
2395            offset: usize,
2396            _depth: fidl::encoding::Depth,
2397        ) -> fidl::Result<()> {
2398            encoder.debug_check_bounds::<MacAddressingRemoveMulticastAddressRequest>(offset);
2399            // Delegate to tuple encoding.
2400            fidl::encoding::Encode::<MacAddressingRemoveMulticastAddressRequest, D>::encode(
2401                (<fidl_fuchsia_net::MacAddress as fidl::encoding::ValueTypeMarker>::borrow(
2402                    &self.address,
2403                ),),
2404                encoder,
2405                offset,
2406                _depth,
2407            )
2408        }
2409    }
2410    unsafe impl<
2411            D: fidl::encoding::ResourceDialect,
2412            T0: fidl::encoding::Encode<fidl_fuchsia_net::MacAddress, D>,
2413        > fidl::encoding::Encode<MacAddressingRemoveMulticastAddressRequest, D> for (T0,)
2414    {
2415        #[inline]
2416        unsafe fn encode(
2417            self,
2418            encoder: &mut fidl::encoding::Encoder<'_, D>,
2419            offset: usize,
2420            depth: fidl::encoding::Depth,
2421        ) -> fidl::Result<()> {
2422            encoder.debug_check_bounds::<MacAddressingRemoveMulticastAddressRequest>(offset);
2423            // Zero out padding regions. There's no need to apply masks
2424            // because the unmasked parts will be overwritten by fields.
2425            // Write the fields.
2426            self.0.encode(encoder, offset + 0, depth)?;
2427            Ok(())
2428        }
2429    }
2430
2431    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2432        for MacAddressingRemoveMulticastAddressRequest
2433    {
2434        #[inline(always)]
2435        fn new_empty() -> Self {
2436            Self { address: fidl::new_empty!(fidl_fuchsia_net::MacAddress, D) }
2437        }
2438
2439        #[inline]
2440        unsafe fn decode(
2441            &mut self,
2442            decoder: &mut fidl::encoding::Decoder<'_, D>,
2443            offset: usize,
2444            _depth: fidl::encoding::Depth,
2445        ) -> fidl::Result<()> {
2446            decoder.debug_check_bounds::<Self>(offset);
2447            // Verify that padding bytes are zero.
2448            fidl::decode!(
2449                fidl_fuchsia_net::MacAddress,
2450                D,
2451                &mut self.address,
2452                decoder,
2453                offset + 0,
2454                _depth
2455            )?;
2456            Ok(())
2457        }
2458    }
2459
2460    impl fidl::encoding::ValueTypeMarker for MacAddressingRemoveMulticastAddressResponse {
2461        type Borrowed<'a> = &'a Self;
2462        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2463            value
2464        }
2465    }
2466
2467    unsafe impl fidl::encoding::TypeMarker for MacAddressingRemoveMulticastAddressResponse {
2468        type Owned = Self;
2469
2470        #[inline(always)]
2471        fn inline_align(_context: fidl::encoding::Context) -> usize {
2472            4
2473        }
2474
2475        #[inline(always)]
2476        fn inline_size(_context: fidl::encoding::Context) -> usize {
2477            4
2478        }
2479        #[inline(always)]
2480        fn encode_is_copy() -> bool {
2481            true
2482        }
2483
2484        #[inline(always)]
2485        fn decode_is_copy() -> bool {
2486            true
2487        }
2488    }
2489
2490    unsafe impl<D: fidl::encoding::ResourceDialect>
2491        fidl::encoding::Encode<MacAddressingRemoveMulticastAddressResponse, D>
2492        for &MacAddressingRemoveMulticastAddressResponse
2493    {
2494        #[inline]
2495        unsafe fn encode(
2496            self,
2497            encoder: &mut fidl::encoding::Encoder<'_, D>,
2498            offset: usize,
2499            _depth: fidl::encoding::Depth,
2500        ) -> fidl::Result<()> {
2501            encoder.debug_check_bounds::<MacAddressingRemoveMulticastAddressResponse>(offset);
2502            unsafe {
2503                // Copy the object into the buffer.
2504                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
2505                (buf_ptr as *mut MacAddressingRemoveMulticastAddressResponse).write_unaligned(
2506                    (self as *const MacAddressingRemoveMulticastAddressResponse).read(),
2507                );
2508                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
2509                // done second because the memcpy will write garbage to these bytes.
2510            }
2511            Ok(())
2512        }
2513    }
2514    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<i32, D>>
2515        fidl::encoding::Encode<MacAddressingRemoveMulticastAddressResponse, D> for (T0,)
2516    {
2517        #[inline]
2518        unsafe fn encode(
2519            self,
2520            encoder: &mut fidl::encoding::Encoder<'_, D>,
2521            offset: usize,
2522            depth: fidl::encoding::Depth,
2523        ) -> fidl::Result<()> {
2524            encoder.debug_check_bounds::<MacAddressingRemoveMulticastAddressResponse>(offset);
2525            // Zero out padding regions. There's no need to apply masks
2526            // because the unmasked parts will be overwritten by fields.
2527            // Write the fields.
2528            self.0.encode(encoder, offset + 0, depth)?;
2529            Ok(())
2530        }
2531    }
2532
2533    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2534        for MacAddressingRemoveMulticastAddressResponse
2535    {
2536        #[inline(always)]
2537        fn new_empty() -> Self {
2538            Self { status: fidl::new_empty!(i32, D) }
2539        }
2540
2541        #[inline]
2542        unsafe fn decode(
2543            &mut self,
2544            decoder: &mut fidl::encoding::Decoder<'_, D>,
2545            offset: usize,
2546            _depth: fidl::encoding::Depth,
2547        ) -> fidl::Result<()> {
2548            decoder.debug_check_bounds::<Self>(offset);
2549            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
2550            // Verify that padding bytes are zero.
2551            // Copy from the buffer into the object.
2552            unsafe {
2553                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
2554            }
2555            Ok(())
2556        }
2557    }
2558
2559    impl fidl::encoding::ValueTypeMarker for MacAddressingSetModeRequest {
2560        type Borrowed<'a> = &'a Self;
2561        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2562            value
2563        }
2564    }
2565
2566    unsafe impl fidl::encoding::TypeMarker for MacAddressingSetModeRequest {
2567        type Owned = Self;
2568
2569        #[inline(always)]
2570        fn inline_align(_context: fidl::encoding::Context) -> usize {
2571            4
2572        }
2573
2574        #[inline(always)]
2575        fn inline_size(_context: fidl::encoding::Context) -> usize {
2576            4
2577        }
2578    }
2579
2580    unsafe impl<D: fidl::encoding::ResourceDialect>
2581        fidl::encoding::Encode<MacAddressingSetModeRequest, D> for &MacAddressingSetModeRequest
2582    {
2583        #[inline]
2584        unsafe fn encode(
2585            self,
2586            encoder: &mut fidl::encoding::Encoder<'_, D>,
2587            offset: usize,
2588            _depth: fidl::encoding::Depth,
2589        ) -> fidl::Result<()> {
2590            encoder.debug_check_bounds::<MacAddressingSetModeRequest>(offset);
2591            // Delegate to tuple encoding.
2592            fidl::encoding::Encode::<MacAddressingSetModeRequest, D>::encode(
2593                (<MacFilterMode as fidl::encoding::ValueTypeMarker>::borrow(&self.mode),),
2594                encoder,
2595                offset,
2596                _depth,
2597            )
2598        }
2599    }
2600    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<MacFilterMode, D>>
2601        fidl::encoding::Encode<MacAddressingSetModeRequest, D> for (T0,)
2602    {
2603        #[inline]
2604        unsafe fn encode(
2605            self,
2606            encoder: &mut fidl::encoding::Encoder<'_, D>,
2607            offset: usize,
2608            depth: fidl::encoding::Depth,
2609        ) -> fidl::Result<()> {
2610            encoder.debug_check_bounds::<MacAddressingSetModeRequest>(offset);
2611            // Zero out padding regions. There's no need to apply masks
2612            // because the unmasked parts will be overwritten by fields.
2613            // Write the fields.
2614            self.0.encode(encoder, offset + 0, depth)?;
2615            Ok(())
2616        }
2617    }
2618
2619    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2620        for MacAddressingSetModeRequest
2621    {
2622        #[inline(always)]
2623        fn new_empty() -> Self {
2624            Self { mode: fidl::new_empty!(MacFilterMode, D) }
2625        }
2626
2627        #[inline]
2628        unsafe fn decode(
2629            &mut self,
2630            decoder: &mut fidl::encoding::Decoder<'_, D>,
2631            offset: usize,
2632            _depth: fidl::encoding::Depth,
2633        ) -> fidl::Result<()> {
2634            decoder.debug_check_bounds::<Self>(offset);
2635            // Verify that padding bytes are zero.
2636            fidl::decode!(MacFilterMode, D, &mut self.mode, decoder, offset + 0, _depth)?;
2637            Ok(())
2638        }
2639    }
2640
2641    impl fidl::encoding::ValueTypeMarker for MacAddressingSetModeResponse {
2642        type Borrowed<'a> = &'a Self;
2643        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2644            value
2645        }
2646    }
2647
2648    unsafe impl fidl::encoding::TypeMarker for MacAddressingSetModeResponse {
2649        type Owned = Self;
2650
2651        #[inline(always)]
2652        fn inline_align(_context: fidl::encoding::Context) -> usize {
2653            4
2654        }
2655
2656        #[inline(always)]
2657        fn inline_size(_context: fidl::encoding::Context) -> usize {
2658            4
2659        }
2660        #[inline(always)]
2661        fn encode_is_copy() -> bool {
2662            true
2663        }
2664
2665        #[inline(always)]
2666        fn decode_is_copy() -> bool {
2667            true
2668        }
2669    }
2670
2671    unsafe impl<D: fidl::encoding::ResourceDialect>
2672        fidl::encoding::Encode<MacAddressingSetModeResponse, D> for &MacAddressingSetModeResponse
2673    {
2674        #[inline]
2675        unsafe fn encode(
2676            self,
2677            encoder: &mut fidl::encoding::Encoder<'_, D>,
2678            offset: usize,
2679            _depth: fidl::encoding::Depth,
2680        ) -> fidl::Result<()> {
2681            encoder.debug_check_bounds::<MacAddressingSetModeResponse>(offset);
2682            unsafe {
2683                // Copy the object into the buffer.
2684                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
2685                (buf_ptr as *mut MacAddressingSetModeResponse)
2686                    .write_unaligned((self as *const MacAddressingSetModeResponse).read());
2687                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
2688                // done second because the memcpy will write garbage to these bytes.
2689            }
2690            Ok(())
2691        }
2692    }
2693    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<i32, D>>
2694        fidl::encoding::Encode<MacAddressingSetModeResponse, D> for (T0,)
2695    {
2696        #[inline]
2697        unsafe fn encode(
2698            self,
2699            encoder: &mut fidl::encoding::Encoder<'_, D>,
2700            offset: usize,
2701            depth: fidl::encoding::Depth,
2702        ) -> fidl::Result<()> {
2703            encoder.debug_check_bounds::<MacAddressingSetModeResponse>(offset);
2704            // Zero out padding regions. There's no need to apply masks
2705            // because the unmasked parts will be overwritten by fields.
2706            // Write the fields.
2707            self.0.encode(encoder, offset + 0, depth)?;
2708            Ok(())
2709        }
2710    }
2711
2712    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2713        for MacAddressingSetModeResponse
2714    {
2715        #[inline(always)]
2716        fn new_empty() -> Self {
2717            Self { status: fidl::new_empty!(i32, D) }
2718        }
2719
2720        #[inline]
2721        unsafe fn decode(
2722            &mut self,
2723            decoder: &mut fidl::encoding::Decoder<'_, D>,
2724            offset: usize,
2725            _depth: fidl::encoding::Depth,
2726        ) -> fidl::Result<()> {
2727            decoder.debug_check_bounds::<Self>(offset);
2728            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
2729            // Verify that padding bytes are zero.
2730            // Copy from the buffer into the object.
2731            unsafe {
2732                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
2733            }
2734            Ok(())
2735        }
2736    }
2737
2738    impl fidl::encoding::ValueTypeMarker for PortGetInfoResponse {
2739        type Borrowed<'a> = &'a Self;
2740        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2741            value
2742        }
2743    }
2744
2745    unsafe impl fidl::encoding::TypeMarker for PortGetInfoResponse {
2746        type Owned = Self;
2747
2748        #[inline(always)]
2749        fn inline_align(_context: fidl::encoding::Context) -> usize {
2750            8
2751        }
2752
2753        #[inline(always)]
2754        fn inline_size(_context: fidl::encoding::Context) -> usize {
2755            16
2756        }
2757    }
2758
2759    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<PortGetInfoResponse, D>
2760        for &PortGetInfoResponse
2761    {
2762        #[inline]
2763        unsafe fn encode(
2764            self,
2765            encoder: &mut fidl::encoding::Encoder<'_, D>,
2766            offset: usize,
2767            _depth: fidl::encoding::Depth,
2768        ) -> fidl::Result<()> {
2769            encoder.debug_check_bounds::<PortGetInfoResponse>(offset);
2770            // Delegate to tuple encoding.
2771            fidl::encoding::Encode::<PortGetInfoResponse, D>::encode(
2772                (<PortInfo as fidl::encoding::ValueTypeMarker>::borrow(&self.info),),
2773                encoder,
2774                offset,
2775                _depth,
2776            )
2777        }
2778    }
2779    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<PortInfo, D>>
2780        fidl::encoding::Encode<PortGetInfoResponse, D> for (T0,)
2781    {
2782        #[inline]
2783        unsafe fn encode(
2784            self,
2785            encoder: &mut fidl::encoding::Encoder<'_, D>,
2786            offset: usize,
2787            depth: fidl::encoding::Depth,
2788        ) -> fidl::Result<()> {
2789            encoder.debug_check_bounds::<PortGetInfoResponse>(offset);
2790            // Zero out padding regions. There's no need to apply masks
2791            // because the unmasked parts will be overwritten by fields.
2792            // Write the fields.
2793            self.0.encode(encoder, offset + 0, depth)?;
2794            Ok(())
2795        }
2796    }
2797
2798    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for PortGetInfoResponse {
2799        #[inline(always)]
2800        fn new_empty() -> Self {
2801            Self { info: fidl::new_empty!(PortInfo, D) }
2802        }
2803
2804        #[inline]
2805        unsafe fn decode(
2806            &mut self,
2807            decoder: &mut fidl::encoding::Decoder<'_, D>,
2808            offset: usize,
2809            _depth: fidl::encoding::Depth,
2810        ) -> fidl::Result<()> {
2811            decoder.debug_check_bounds::<Self>(offset);
2812            // Verify that padding bytes are zero.
2813            fidl::decode!(PortInfo, D, &mut self.info, decoder, offset + 0, _depth)?;
2814            Ok(())
2815        }
2816    }
2817
2818    impl fidl::encoding::ValueTypeMarker for PortGetStatusResponse {
2819        type Borrowed<'a> = &'a Self;
2820        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2821            value
2822        }
2823    }
2824
2825    unsafe impl fidl::encoding::TypeMarker for PortGetStatusResponse {
2826        type Owned = Self;
2827
2828        #[inline(always)]
2829        fn inline_align(_context: fidl::encoding::Context) -> usize {
2830            8
2831        }
2832
2833        #[inline(always)]
2834        fn inline_size(_context: fidl::encoding::Context) -> usize {
2835            16
2836        }
2837    }
2838
2839    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<PortGetStatusResponse, D>
2840        for &PortGetStatusResponse
2841    {
2842        #[inline]
2843        unsafe fn encode(
2844            self,
2845            encoder: &mut fidl::encoding::Encoder<'_, D>,
2846            offset: usize,
2847            _depth: fidl::encoding::Depth,
2848        ) -> fidl::Result<()> {
2849            encoder.debug_check_bounds::<PortGetStatusResponse>(offset);
2850            // Delegate to tuple encoding.
2851            fidl::encoding::Encode::<PortGetStatusResponse, D>::encode(
2852                (<PortStatus as fidl::encoding::ValueTypeMarker>::borrow(&self.status),),
2853                encoder,
2854                offset,
2855                _depth,
2856            )
2857        }
2858    }
2859    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<PortStatus, D>>
2860        fidl::encoding::Encode<PortGetStatusResponse, D> for (T0,)
2861    {
2862        #[inline]
2863        unsafe fn encode(
2864            self,
2865            encoder: &mut fidl::encoding::Encoder<'_, D>,
2866            offset: usize,
2867            depth: fidl::encoding::Depth,
2868        ) -> fidl::Result<()> {
2869            encoder.debug_check_bounds::<PortGetStatusResponse>(offset);
2870            // Zero out padding regions. There's no need to apply masks
2871            // because the unmasked parts will be overwritten by fields.
2872            // Write the fields.
2873            self.0.encode(encoder, offset + 0, depth)?;
2874            Ok(())
2875        }
2876    }
2877
2878    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for PortGetStatusResponse {
2879        #[inline(always)]
2880        fn new_empty() -> Self {
2881            Self { status: fidl::new_empty!(PortStatus, D) }
2882        }
2883
2884        #[inline]
2885        unsafe fn decode(
2886            &mut self,
2887            decoder: &mut fidl::encoding::Decoder<'_, D>,
2888            offset: usize,
2889            _depth: fidl::encoding::Depth,
2890        ) -> fidl::Result<()> {
2891            decoder.debug_check_bounds::<Self>(offset);
2892            // Verify that padding bytes are zero.
2893            fidl::decode!(PortStatus, D, &mut self.status, decoder, offset + 0, _depth)?;
2894            Ok(())
2895        }
2896    }
2897
2898    impl fidl::encoding::ValueTypeMarker for PortId {
2899        type Borrowed<'a> = &'a Self;
2900        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2901            value
2902        }
2903    }
2904
2905    unsafe impl fidl::encoding::TypeMarker for PortId {
2906        type Owned = Self;
2907
2908        #[inline(always)]
2909        fn inline_align(_context: fidl::encoding::Context) -> usize {
2910            1
2911        }
2912
2913        #[inline(always)]
2914        fn inline_size(_context: fidl::encoding::Context) -> usize {
2915            2
2916        }
2917        #[inline(always)]
2918        fn encode_is_copy() -> bool {
2919            true
2920        }
2921
2922        #[inline(always)]
2923        fn decode_is_copy() -> bool {
2924            true
2925        }
2926    }
2927
2928    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<PortId, D> for &PortId {
2929        #[inline]
2930        unsafe fn encode(
2931            self,
2932            encoder: &mut fidl::encoding::Encoder<'_, D>,
2933            offset: usize,
2934            _depth: fidl::encoding::Depth,
2935        ) -> fidl::Result<()> {
2936            encoder.debug_check_bounds::<PortId>(offset);
2937            unsafe {
2938                // Copy the object into the buffer.
2939                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
2940                (buf_ptr as *mut PortId).write_unaligned((self as *const PortId).read());
2941                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
2942                // done second because the memcpy will write garbage to these bytes.
2943            }
2944            Ok(())
2945        }
2946    }
2947    unsafe impl<
2948            D: fidl::encoding::ResourceDialect,
2949            T0: fidl::encoding::Encode<u8, D>,
2950            T1: fidl::encoding::Encode<u8, D>,
2951        > fidl::encoding::Encode<PortId, D> for (T0, T1)
2952    {
2953        #[inline]
2954        unsafe fn encode(
2955            self,
2956            encoder: &mut fidl::encoding::Encoder<'_, D>,
2957            offset: usize,
2958            depth: fidl::encoding::Depth,
2959        ) -> fidl::Result<()> {
2960            encoder.debug_check_bounds::<PortId>(offset);
2961            // Zero out padding regions. There's no need to apply masks
2962            // because the unmasked parts will be overwritten by fields.
2963            // Write the fields.
2964            self.0.encode(encoder, offset + 0, depth)?;
2965            self.1.encode(encoder, offset + 1, depth)?;
2966            Ok(())
2967        }
2968    }
2969
2970    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for PortId {
2971        #[inline(always)]
2972        fn new_empty() -> Self {
2973            Self { base: fidl::new_empty!(u8, D), salt: fidl::new_empty!(u8, D) }
2974        }
2975
2976        #[inline]
2977        unsafe fn decode(
2978            &mut self,
2979            decoder: &mut fidl::encoding::Decoder<'_, D>,
2980            offset: usize,
2981            _depth: fidl::encoding::Depth,
2982        ) -> fidl::Result<()> {
2983            decoder.debug_check_bounds::<Self>(offset);
2984            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
2985            // Verify that padding bytes are zero.
2986            // Copy from the buffer into the object.
2987            unsafe {
2988                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 2);
2989            }
2990            Ok(())
2991        }
2992    }
2993
2994    impl fidl::encoding::ValueTypeMarker for PortWatcherWatchResponse {
2995        type Borrowed<'a> = &'a Self;
2996        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2997            value
2998        }
2999    }
3000
3001    unsafe impl fidl::encoding::TypeMarker for PortWatcherWatchResponse {
3002        type Owned = Self;
3003
3004        #[inline(always)]
3005        fn inline_align(_context: fidl::encoding::Context) -> usize {
3006            8
3007        }
3008
3009        #[inline(always)]
3010        fn inline_size(_context: fidl::encoding::Context) -> usize {
3011            16
3012        }
3013    }
3014
3015    unsafe impl<D: fidl::encoding::ResourceDialect>
3016        fidl::encoding::Encode<PortWatcherWatchResponse, D> for &PortWatcherWatchResponse
3017    {
3018        #[inline]
3019        unsafe fn encode(
3020            self,
3021            encoder: &mut fidl::encoding::Encoder<'_, D>,
3022            offset: usize,
3023            _depth: fidl::encoding::Depth,
3024        ) -> fidl::Result<()> {
3025            encoder.debug_check_bounds::<PortWatcherWatchResponse>(offset);
3026            // Delegate to tuple encoding.
3027            fidl::encoding::Encode::<PortWatcherWatchResponse, D>::encode(
3028                (<DevicePortEvent as fidl::encoding::ValueTypeMarker>::borrow(&self.event),),
3029                encoder,
3030                offset,
3031                _depth,
3032            )
3033        }
3034    }
3035    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<DevicePortEvent, D>>
3036        fidl::encoding::Encode<PortWatcherWatchResponse, D> for (T0,)
3037    {
3038        #[inline]
3039        unsafe fn encode(
3040            self,
3041            encoder: &mut fidl::encoding::Encoder<'_, D>,
3042            offset: usize,
3043            depth: fidl::encoding::Depth,
3044        ) -> fidl::Result<()> {
3045            encoder.debug_check_bounds::<PortWatcherWatchResponse>(offset);
3046            // Zero out padding regions. There's no need to apply masks
3047            // because the unmasked parts will be overwritten by fields.
3048            // Write the fields.
3049            self.0.encode(encoder, offset + 0, depth)?;
3050            Ok(())
3051        }
3052    }
3053
3054    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3055        for PortWatcherWatchResponse
3056    {
3057        #[inline(always)]
3058        fn new_empty() -> Self {
3059            Self { event: fidl::new_empty!(DevicePortEvent, D) }
3060        }
3061
3062        #[inline]
3063        unsafe fn decode(
3064            &mut self,
3065            decoder: &mut fidl::encoding::Decoder<'_, D>,
3066            offset: usize,
3067            _depth: fidl::encoding::Depth,
3068        ) -> fidl::Result<()> {
3069            decoder.debug_check_bounds::<Self>(offset);
3070            // Verify that padding bytes are zero.
3071            fidl::decode!(DevicePortEvent, D, &mut self.event, decoder, offset + 0, _depth)?;
3072            Ok(())
3073        }
3074    }
3075
3076    impl fidl::encoding::ValueTypeMarker for SessionAttachRequest {
3077        type Borrowed<'a> = &'a Self;
3078        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3079            value
3080        }
3081    }
3082
3083    unsafe impl fidl::encoding::TypeMarker for SessionAttachRequest {
3084        type Owned = Self;
3085
3086        #[inline(always)]
3087        fn inline_align(_context: fidl::encoding::Context) -> usize {
3088            8
3089        }
3090
3091        #[inline(always)]
3092        fn inline_size(_context: fidl::encoding::Context) -> usize {
3093            24
3094        }
3095    }
3096
3097    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<SessionAttachRequest, D>
3098        for &SessionAttachRequest
3099    {
3100        #[inline]
3101        unsafe fn encode(
3102            self,
3103            encoder: &mut fidl::encoding::Encoder<'_, D>,
3104            offset: usize,
3105            _depth: fidl::encoding::Depth,
3106        ) -> fidl::Result<()> {
3107            encoder.debug_check_bounds::<SessionAttachRequest>(offset);
3108            // Delegate to tuple encoding.
3109            fidl::encoding::Encode::<SessionAttachRequest, D>::encode(
3110                (
3111                    <PortId as fidl::encoding::ValueTypeMarker>::borrow(&self.port),
3112                    <fidl::encoding::Vector<FrameType, 4> as fidl::encoding::ValueTypeMarker>::borrow(&self.rx_frames),
3113                ),
3114                encoder, offset, _depth
3115            )
3116        }
3117    }
3118    unsafe impl<
3119            D: fidl::encoding::ResourceDialect,
3120            T0: fidl::encoding::Encode<PortId, D>,
3121            T1: fidl::encoding::Encode<fidl::encoding::Vector<FrameType, 4>, D>,
3122        > fidl::encoding::Encode<SessionAttachRequest, D> for (T0, T1)
3123    {
3124        #[inline]
3125        unsafe fn encode(
3126            self,
3127            encoder: &mut fidl::encoding::Encoder<'_, D>,
3128            offset: usize,
3129            depth: fidl::encoding::Depth,
3130        ) -> fidl::Result<()> {
3131            encoder.debug_check_bounds::<SessionAttachRequest>(offset);
3132            // Zero out padding regions. There's no need to apply masks
3133            // because the unmasked parts will be overwritten by fields.
3134            unsafe {
3135                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
3136                (ptr as *mut u64).write_unaligned(0);
3137            }
3138            // Write the fields.
3139            self.0.encode(encoder, offset + 0, depth)?;
3140            self.1.encode(encoder, offset + 8, depth)?;
3141            Ok(())
3142        }
3143    }
3144
3145    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SessionAttachRequest {
3146        #[inline(always)]
3147        fn new_empty() -> Self {
3148            Self {
3149                port: fidl::new_empty!(PortId, D),
3150                rx_frames: fidl::new_empty!(fidl::encoding::Vector<FrameType, 4>, D),
3151            }
3152        }
3153
3154        #[inline]
3155        unsafe fn decode(
3156            &mut self,
3157            decoder: &mut fidl::encoding::Decoder<'_, D>,
3158            offset: usize,
3159            _depth: fidl::encoding::Depth,
3160        ) -> fidl::Result<()> {
3161            decoder.debug_check_bounds::<Self>(offset);
3162            // Verify that padding bytes are zero.
3163            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
3164            let padval = unsafe { (ptr as *const u64).read_unaligned() };
3165            let mask = 0xffffffffffff0000u64;
3166            let maskedval = padval & mask;
3167            if maskedval != 0 {
3168                return Err(fidl::Error::NonZeroPadding {
3169                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
3170                });
3171            }
3172            fidl::decode!(PortId, D, &mut self.port, decoder, offset + 0, _depth)?;
3173            fidl::decode!(fidl::encoding::Vector<FrameType, 4>, D, &mut self.rx_frames, decoder, offset + 8, _depth)?;
3174            Ok(())
3175        }
3176    }
3177
3178    impl fidl::encoding::ValueTypeMarker for SessionDetachRequest {
3179        type Borrowed<'a> = &'a Self;
3180        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3181            value
3182        }
3183    }
3184
3185    unsafe impl fidl::encoding::TypeMarker for SessionDetachRequest {
3186        type Owned = Self;
3187
3188        #[inline(always)]
3189        fn inline_align(_context: fidl::encoding::Context) -> usize {
3190            1
3191        }
3192
3193        #[inline(always)]
3194        fn inline_size(_context: fidl::encoding::Context) -> usize {
3195            2
3196        }
3197        #[inline(always)]
3198        fn encode_is_copy() -> bool {
3199            true
3200        }
3201
3202        #[inline(always)]
3203        fn decode_is_copy() -> bool {
3204            true
3205        }
3206    }
3207
3208    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<SessionDetachRequest, D>
3209        for &SessionDetachRequest
3210    {
3211        #[inline]
3212        unsafe fn encode(
3213            self,
3214            encoder: &mut fidl::encoding::Encoder<'_, D>,
3215            offset: usize,
3216            _depth: fidl::encoding::Depth,
3217        ) -> fidl::Result<()> {
3218            encoder.debug_check_bounds::<SessionDetachRequest>(offset);
3219            unsafe {
3220                // Copy the object into the buffer.
3221                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
3222                (buf_ptr as *mut SessionDetachRequest)
3223                    .write_unaligned((self as *const SessionDetachRequest).read());
3224                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
3225                // done second because the memcpy will write garbage to these bytes.
3226            }
3227            Ok(())
3228        }
3229    }
3230    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<PortId, D>>
3231        fidl::encoding::Encode<SessionDetachRequest, D> for (T0,)
3232    {
3233        #[inline]
3234        unsafe fn encode(
3235            self,
3236            encoder: &mut fidl::encoding::Encoder<'_, D>,
3237            offset: usize,
3238            depth: fidl::encoding::Depth,
3239        ) -> fidl::Result<()> {
3240            encoder.debug_check_bounds::<SessionDetachRequest>(offset);
3241            // Zero out padding regions. There's no need to apply masks
3242            // because the unmasked parts will be overwritten by fields.
3243            // Write the fields.
3244            self.0.encode(encoder, offset + 0, depth)?;
3245            Ok(())
3246        }
3247    }
3248
3249    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SessionDetachRequest {
3250        #[inline(always)]
3251        fn new_empty() -> Self {
3252            Self { port: fidl::new_empty!(PortId, D) }
3253        }
3254
3255        #[inline]
3256        unsafe fn decode(
3257            &mut self,
3258            decoder: &mut fidl::encoding::Decoder<'_, D>,
3259            offset: usize,
3260            _depth: fidl::encoding::Depth,
3261        ) -> fidl::Result<()> {
3262            decoder.debug_check_bounds::<Self>(offset);
3263            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
3264            // Verify that padding bytes are zero.
3265            // Copy from the buffer into the object.
3266            unsafe {
3267                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 2);
3268            }
3269            Ok(())
3270        }
3271    }
3272
3273    impl fidl::encoding::ValueTypeMarker for StatusWatcherWatchStatusResponse {
3274        type Borrowed<'a> = &'a Self;
3275        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3276            value
3277        }
3278    }
3279
3280    unsafe impl fidl::encoding::TypeMarker for StatusWatcherWatchStatusResponse {
3281        type Owned = Self;
3282
3283        #[inline(always)]
3284        fn inline_align(_context: fidl::encoding::Context) -> usize {
3285            8
3286        }
3287
3288        #[inline(always)]
3289        fn inline_size(_context: fidl::encoding::Context) -> usize {
3290            16
3291        }
3292    }
3293
3294    unsafe impl<D: fidl::encoding::ResourceDialect>
3295        fidl::encoding::Encode<StatusWatcherWatchStatusResponse, D>
3296        for &StatusWatcherWatchStatusResponse
3297    {
3298        #[inline]
3299        unsafe fn encode(
3300            self,
3301            encoder: &mut fidl::encoding::Encoder<'_, D>,
3302            offset: usize,
3303            _depth: fidl::encoding::Depth,
3304        ) -> fidl::Result<()> {
3305            encoder.debug_check_bounds::<StatusWatcherWatchStatusResponse>(offset);
3306            // Delegate to tuple encoding.
3307            fidl::encoding::Encode::<StatusWatcherWatchStatusResponse, D>::encode(
3308                (<PortStatus as fidl::encoding::ValueTypeMarker>::borrow(&self.port_status),),
3309                encoder,
3310                offset,
3311                _depth,
3312            )
3313        }
3314    }
3315    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<PortStatus, D>>
3316        fidl::encoding::Encode<StatusWatcherWatchStatusResponse, D> for (T0,)
3317    {
3318        #[inline]
3319        unsafe fn encode(
3320            self,
3321            encoder: &mut fidl::encoding::Encoder<'_, D>,
3322            offset: usize,
3323            depth: fidl::encoding::Depth,
3324        ) -> fidl::Result<()> {
3325            encoder.debug_check_bounds::<StatusWatcherWatchStatusResponse>(offset);
3326            // Zero out padding regions. There's no need to apply masks
3327            // because the unmasked parts will be overwritten by fields.
3328            // Write the fields.
3329            self.0.encode(encoder, offset + 0, depth)?;
3330            Ok(())
3331        }
3332    }
3333
3334    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3335        for StatusWatcherWatchStatusResponse
3336    {
3337        #[inline(always)]
3338        fn new_empty() -> Self {
3339            Self { port_status: fidl::new_empty!(PortStatus, D) }
3340        }
3341
3342        #[inline]
3343        unsafe fn decode(
3344            &mut self,
3345            decoder: &mut fidl::encoding::Decoder<'_, D>,
3346            offset: usize,
3347            _depth: fidl::encoding::Depth,
3348        ) -> fidl::Result<()> {
3349            decoder.debug_check_bounds::<Self>(offset);
3350            // Verify that padding bytes are zero.
3351            fidl::decode!(PortStatus, D, &mut self.port_status, decoder, offset + 0, _depth)?;
3352            Ok(())
3353        }
3354    }
3355
3356    impl DeviceBaseInfo {
3357        #[inline(always)]
3358        fn max_ordinal_present(&self) -> u64 {
3359            if let Some(_) = self.tx_accel {
3360                return 11;
3361            }
3362            if let Some(_) = self.rx_accel {
3363                return 10;
3364            }
3365            if let Some(_) = self.max_buffer_parts {
3366                return 9;
3367            }
3368            if let Some(_) = self.min_tx_buffer_tail {
3369                return 8;
3370            }
3371            if let Some(_) = self.min_tx_buffer_head {
3372                return 7;
3373            }
3374            if let Some(_) = self.min_tx_buffer_length {
3375                return 6;
3376            }
3377            if let Some(_) = self.min_rx_buffer_length {
3378                return 5;
3379            }
3380            if let Some(_) = self.max_buffer_length {
3381                return 4;
3382            }
3383            if let Some(_) = self.buffer_alignment {
3384                return 3;
3385            }
3386            if let Some(_) = self.tx_depth {
3387                return 2;
3388            }
3389            if let Some(_) = self.rx_depth {
3390                return 1;
3391            }
3392            0
3393        }
3394    }
3395
3396    impl fidl::encoding::ValueTypeMarker for DeviceBaseInfo {
3397        type Borrowed<'a> = &'a Self;
3398        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3399            value
3400        }
3401    }
3402
3403    unsafe impl fidl::encoding::TypeMarker for DeviceBaseInfo {
3404        type Owned = Self;
3405
3406        #[inline(always)]
3407        fn inline_align(_context: fidl::encoding::Context) -> usize {
3408            8
3409        }
3410
3411        #[inline(always)]
3412        fn inline_size(_context: fidl::encoding::Context) -> usize {
3413            16
3414        }
3415    }
3416
3417    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<DeviceBaseInfo, D>
3418        for &DeviceBaseInfo
3419    {
3420        unsafe fn encode(
3421            self,
3422            encoder: &mut fidl::encoding::Encoder<'_, D>,
3423            offset: usize,
3424            mut depth: fidl::encoding::Depth,
3425        ) -> fidl::Result<()> {
3426            encoder.debug_check_bounds::<DeviceBaseInfo>(offset);
3427            // Vector header
3428            let max_ordinal: u64 = self.max_ordinal_present();
3429            encoder.write_num(max_ordinal, offset);
3430            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
3431            // Calling encoder.out_of_line_offset(0) is not allowed.
3432            if max_ordinal == 0 {
3433                return Ok(());
3434            }
3435            depth.increment()?;
3436            let envelope_size = 8;
3437            let bytes_len = max_ordinal as usize * envelope_size;
3438            #[allow(unused_variables)]
3439            let offset = encoder.out_of_line_offset(bytes_len);
3440            let mut _prev_end_offset: usize = 0;
3441            if 1 > max_ordinal {
3442                return Ok(());
3443            }
3444
3445            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3446            // are envelope_size bytes.
3447            let cur_offset: usize = (1 - 1) * envelope_size;
3448
3449            // Zero reserved fields.
3450            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3451
3452            // Safety:
3453            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3454            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3455            //   envelope_size bytes, there is always sufficient room.
3456            fidl::encoding::encode_in_envelope_optional::<u16, D>(
3457                self.rx_depth.as_ref().map(<u16 as fidl::encoding::ValueTypeMarker>::borrow),
3458                encoder,
3459                offset + cur_offset,
3460                depth,
3461            )?;
3462
3463            _prev_end_offset = cur_offset + envelope_size;
3464            if 2 > max_ordinal {
3465                return Ok(());
3466            }
3467
3468            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3469            // are envelope_size bytes.
3470            let cur_offset: usize = (2 - 1) * envelope_size;
3471
3472            // Zero reserved fields.
3473            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3474
3475            // Safety:
3476            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3477            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3478            //   envelope_size bytes, there is always sufficient room.
3479            fidl::encoding::encode_in_envelope_optional::<u16, D>(
3480                self.tx_depth.as_ref().map(<u16 as fidl::encoding::ValueTypeMarker>::borrow),
3481                encoder,
3482                offset + cur_offset,
3483                depth,
3484            )?;
3485
3486            _prev_end_offset = cur_offset + envelope_size;
3487            if 3 > max_ordinal {
3488                return Ok(());
3489            }
3490
3491            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3492            // are envelope_size bytes.
3493            let cur_offset: usize = (3 - 1) * envelope_size;
3494
3495            // Zero reserved fields.
3496            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3497
3498            // Safety:
3499            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3500            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3501            //   envelope_size bytes, there is always sufficient room.
3502            fidl::encoding::encode_in_envelope_optional::<u32, D>(
3503                self.buffer_alignment
3504                    .as_ref()
3505                    .map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
3506                encoder,
3507                offset + cur_offset,
3508                depth,
3509            )?;
3510
3511            _prev_end_offset = cur_offset + envelope_size;
3512            if 4 > max_ordinal {
3513                return Ok(());
3514            }
3515
3516            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3517            // are envelope_size bytes.
3518            let cur_offset: usize = (4 - 1) * envelope_size;
3519
3520            // Zero reserved fields.
3521            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3522
3523            // Safety:
3524            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3525            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3526            //   envelope_size bytes, there is always sufficient room.
3527            fidl::encoding::encode_in_envelope_optional::<u32, D>(
3528                self.max_buffer_length
3529                    .as_ref()
3530                    .map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
3531                encoder,
3532                offset + cur_offset,
3533                depth,
3534            )?;
3535
3536            _prev_end_offset = cur_offset + envelope_size;
3537            if 5 > max_ordinal {
3538                return Ok(());
3539            }
3540
3541            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3542            // are envelope_size bytes.
3543            let cur_offset: usize = (5 - 1) * envelope_size;
3544
3545            // Zero reserved fields.
3546            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3547
3548            // Safety:
3549            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3550            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3551            //   envelope_size bytes, there is always sufficient room.
3552            fidl::encoding::encode_in_envelope_optional::<u32, D>(
3553                self.min_rx_buffer_length
3554                    .as_ref()
3555                    .map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
3556                encoder,
3557                offset + cur_offset,
3558                depth,
3559            )?;
3560
3561            _prev_end_offset = cur_offset + envelope_size;
3562            if 6 > max_ordinal {
3563                return Ok(());
3564            }
3565
3566            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3567            // are envelope_size bytes.
3568            let cur_offset: usize = (6 - 1) * envelope_size;
3569
3570            // Zero reserved fields.
3571            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3572
3573            // Safety:
3574            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3575            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3576            //   envelope_size bytes, there is always sufficient room.
3577            fidl::encoding::encode_in_envelope_optional::<u32, D>(
3578                self.min_tx_buffer_length
3579                    .as_ref()
3580                    .map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
3581                encoder,
3582                offset + cur_offset,
3583                depth,
3584            )?;
3585
3586            _prev_end_offset = cur_offset + envelope_size;
3587            if 7 > max_ordinal {
3588                return Ok(());
3589            }
3590
3591            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3592            // are envelope_size bytes.
3593            let cur_offset: usize = (7 - 1) * envelope_size;
3594
3595            // Zero reserved fields.
3596            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3597
3598            // Safety:
3599            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3600            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3601            //   envelope_size bytes, there is always sufficient room.
3602            fidl::encoding::encode_in_envelope_optional::<u16, D>(
3603                self.min_tx_buffer_head
3604                    .as_ref()
3605                    .map(<u16 as fidl::encoding::ValueTypeMarker>::borrow),
3606                encoder,
3607                offset + cur_offset,
3608                depth,
3609            )?;
3610
3611            _prev_end_offset = cur_offset + envelope_size;
3612            if 8 > max_ordinal {
3613                return Ok(());
3614            }
3615
3616            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3617            // are envelope_size bytes.
3618            let cur_offset: usize = (8 - 1) * envelope_size;
3619
3620            // Zero reserved fields.
3621            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3622
3623            // Safety:
3624            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3625            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3626            //   envelope_size bytes, there is always sufficient room.
3627            fidl::encoding::encode_in_envelope_optional::<u16, D>(
3628                self.min_tx_buffer_tail
3629                    .as_ref()
3630                    .map(<u16 as fidl::encoding::ValueTypeMarker>::borrow),
3631                encoder,
3632                offset + cur_offset,
3633                depth,
3634            )?;
3635
3636            _prev_end_offset = cur_offset + envelope_size;
3637            if 9 > max_ordinal {
3638                return Ok(());
3639            }
3640
3641            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3642            // are envelope_size bytes.
3643            let cur_offset: usize = (9 - 1) * envelope_size;
3644
3645            // Zero reserved fields.
3646            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3647
3648            // Safety:
3649            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3650            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3651            //   envelope_size bytes, there is always sufficient room.
3652            fidl::encoding::encode_in_envelope_optional::<u8, D>(
3653                self.max_buffer_parts.as_ref().map(<u8 as fidl::encoding::ValueTypeMarker>::borrow),
3654                encoder,
3655                offset + cur_offset,
3656                depth,
3657            )?;
3658
3659            _prev_end_offset = cur_offset + envelope_size;
3660            if 10 > max_ordinal {
3661                return Ok(());
3662            }
3663
3664            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3665            // are envelope_size bytes.
3666            let cur_offset: usize = (10 - 1) * envelope_size;
3667
3668            // Zero reserved fields.
3669            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3670
3671            // Safety:
3672            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3673            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3674            //   envelope_size bytes, there is always sufficient room.
3675            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<RxAcceleration, 16>, D>(
3676            self.rx_accel.as_ref().map(<fidl::encoding::Vector<RxAcceleration, 16> as fidl::encoding::ValueTypeMarker>::borrow),
3677            encoder, offset + cur_offset, depth
3678        )?;
3679
3680            _prev_end_offset = cur_offset + envelope_size;
3681            if 11 > max_ordinal {
3682                return Ok(());
3683            }
3684
3685            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3686            // are envelope_size bytes.
3687            let cur_offset: usize = (11 - 1) * envelope_size;
3688
3689            // Zero reserved fields.
3690            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3691
3692            // Safety:
3693            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3694            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3695            //   envelope_size bytes, there is always sufficient room.
3696            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<TxAcceleration, 16>, D>(
3697            self.tx_accel.as_ref().map(<fidl::encoding::Vector<TxAcceleration, 16> as fidl::encoding::ValueTypeMarker>::borrow),
3698            encoder, offset + cur_offset, depth
3699        )?;
3700
3701            _prev_end_offset = cur_offset + envelope_size;
3702
3703            Ok(())
3704        }
3705    }
3706
3707    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for DeviceBaseInfo {
3708        #[inline(always)]
3709        fn new_empty() -> Self {
3710            Self::default()
3711        }
3712
3713        unsafe fn decode(
3714            &mut self,
3715            decoder: &mut fidl::encoding::Decoder<'_, D>,
3716            offset: usize,
3717            mut depth: fidl::encoding::Depth,
3718        ) -> fidl::Result<()> {
3719            decoder.debug_check_bounds::<Self>(offset);
3720            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
3721                None => return Err(fidl::Error::NotNullable),
3722                Some(len) => len,
3723            };
3724            // Calling decoder.out_of_line_offset(0) is not allowed.
3725            if len == 0 {
3726                return Ok(());
3727            };
3728            depth.increment()?;
3729            let envelope_size = 8;
3730            let bytes_len = len * envelope_size;
3731            let offset = decoder.out_of_line_offset(bytes_len)?;
3732            // Decode the envelope for each type.
3733            let mut _next_ordinal_to_read = 0;
3734            let mut next_offset = offset;
3735            let end_offset = offset + bytes_len;
3736            _next_ordinal_to_read += 1;
3737            if next_offset >= end_offset {
3738                return Ok(());
3739            }
3740
3741            // Decode unknown envelopes for gaps in ordinals.
3742            while _next_ordinal_to_read < 1 {
3743                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3744                _next_ordinal_to_read += 1;
3745                next_offset += envelope_size;
3746            }
3747
3748            let next_out_of_line = decoder.next_out_of_line();
3749            let handles_before = decoder.remaining_handles();
3750            if let Some((inlined, num_bytes, num_handles)) =
3751                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3752            {
3753                let member_inline_size =
3754                    <u16 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3755                if inlined != (member_inline_size <= 4) {
3756                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3757                }
3758                let inner_offset;
3759                let mut inner_depth = depth.clone();
3760                if inlined {
3761                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3762                    inner_offset = next_offset;
3763                } else {
3764                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3765                    inner_depth.increment()?;
3766                }
3767                let val_ref = self.rx_depth.get_or_insert_with(|| fidl::new_empty!(u16, D));
3768                fidl::decode!(u16, D, val_ref, decoder, inner_offset, inner_depth)?;
3769                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3770                {
3771                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3772                }
3773                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3774                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3775                }
3776            }
3777
3778            next_offset += envelope_size;
3779            _next_ordinal_to_read += 1;
3780            if next_offset >= end_offset {
3781                return Ok(());
3782            }
3783
3784            // Decode unknown envelopes for gaps in ordinals.
3785            while _next_ordinal_to_read < 2 {
3786                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3787                _next_ordinal_to_read += 1;
3788                next_offset += envelope_size;
3789            }
3790
3791            let next_out_of_line = decoder.next_out_of_line();
3792            let handles_before = decoder.remaining_handles();
3793            if let Some((inlined, num_bytes, num_handles)) =
3794                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3795            {
3796                let member_inline_size =
3797                    <u16 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3798                if inlined != (member_inline_size <= 4) {
3799                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3800                }
3801                let inner_offset;
3802                let mut inner_depth = depth.clone();
3803                if inlined {
3804                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3805                    inner_offset = next_offset;
3806                } else {
3807                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3808                    inner_depth.increment()?;
3809                }
3810                let val_ref = self.tx_depth.get_or_insert_with(|| fidl::new_empty!(u16, D));
3811                fidl::decode!(u16, D, val_ref, decoder, inner_offset, inner_depth)?;
3812                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3813                {
3814                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3815                }
3816                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3817                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3818                }
3819            }
3820
3821            next_offset += envelope_size;
3822            _next_ordinal_to_read += 1;
3823            if next_offset >= end_offset {
3824                return Ok(());
3825            }
3826
3827            // Decode unknown envelopes for gaps in ordinals.
3828            while _next_ordinal_to_read < 3 {
3829                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3830                _next_ordinal_to_read += 1;
3831                next_offset += envelope_size;
3832            }
3833
3834            let next_out_of_line = decoder.next_out_of_line();
3835            let handles_before = decoder.remaining_handles();
3836            if let Some((inlined, num_bytes, num_handles)) =
3837                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3838            {
3839                let member_inline_size =
3840                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3841                if inlined != (member_inline_size <= 4) {
3842                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3843                }
3844                let inner_offset;
3845                let mut inner_depth = depth.clone();
3846                if inlined {
3847                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3848                    inner_offset = next_offset;
3849                } else {
3850                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3851                    inner_depth.increment()?;
3852                }
3853                let val_ref = self.buffer_alignment.get_or_insert_with(|| fidl::new_empty!(u32, D));
3854                fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
3855                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3856                {
3857                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3858                }
3859                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3860                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3861                }
3862            }
3863
3864            next_offset += envelope_size;
3865            _next_ordinal_to_read += 1;
3866            if next_offset >= end_offset {
3867                return Ok(());
3868            }
3869
3870            // Decode unknown envelopes for gaps in ordinals.
3871            while _next_ordinal_to_read < 4 {
3872                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3873                _next_ordinal_to_read += 1;
3874                next_offset += envelope_size;
3875            }
3876
3877            let next_out_of_line = decoder.next_out_of_line();
3878            let handles_before = decoder.remaining_handles();
3879            if let Some((inlined, num_bytes, num_handles)) =
3880                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3881            {
3882                let member_inline_size =
3883                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3884                if inlined != (member_inline_size <= 4) {
3885                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3886                }
3887                let inner_offset;
3888                let mut inner_depth = depth.clone();
3889                if inlined {
3890                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3891                    inner_offset = next_offset;
3892                } else {
3893                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3894                    inner_depth.increment()?;
3895                }
3896                let val_ref =
3897                    self.max_buffer_length.get_or_insert_with(|| fidl::new_empty!(u32, D));
3898                fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
3899                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3900                {
3901                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3902                }
3903                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3904                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3905                }
3906            }
3907
3908            next_offset += envelope_size;
3909            _next_ordinal_to_read += 1;
3910            if next_offset >= end_offset {
3911                return Ok(());
3912            }
3913
3914            // Decode unknown envelopes for gaps in ordinals.
3915            while _next_ordinal_to_read < 5 {
3916                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3917                _next_ordinal_to_read += 1;
3918                next_offset += envelope_size;
3919            }
3920
3921            let next_out_of_line = decoder.next_out_of_line();
3922            let handles_before = decoder.remaining_handles();
3923            if let Some((inlined, num_bytes, num_handles)) =
3924                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3925            {
3926                let member_inline_size =
3927                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3928                if inlined != (member_inline_size <= 4) {
3929                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3930                }
3931                let inner_offset;
3932                let mut inner_depth = depth.clone();
3933                if inlined {
3934                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3935                    inner_offset = next_offset;
3936                } else {
3937                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3938                    inner_depth.increment()?;
3939                }
3940                let val_ref =
3941                    self.min_rx_buffer_length.get_or_insert_with(|| fidl::new_empty!(u32, D));
3942                fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
3943                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3944                {
3945                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3946                }
3947                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3948                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3949                }
3950            }
3951
3952            next_offset += envelope_size;
3953            _next_ordinal_to_read += 1;
3954            if next_offset >= end_offset {
3955                return Ok(());
3956            }
3957
3958            // Decode unknown envelopes for gaps in ordinals.
3959            while _next_ordinal_to_read < 6 {
3960                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3961                _next_ordinal_to_read += 1;
3962                next_offset += envelope_size;
3963            }
3964
3965            let next_out_of_line = decoder.next_out_of_line();
3966            let handles_before = decoder.remaining_handles();
3967            if let Some((inlined, num_bytes, num_handles)) =
3968                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3969            {
3970                let member_inline_size =
3971                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3972                if inlined != (member_inline_size <= 4) {
3973                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3974                }
3975                let inner_offset;
3976                let mut inner_depth = depth.clone();
3977                if inlined {
3978                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3979                    inner_offset = next_offset;
3980                } else {
3981                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3982                    inner_depth.increment()?;
3983                }
3984                let val_ref =
3985                    self.min_tx_buffer_length.get_or_insert_with(|| fidl::new_empty!(u32, D));
3986                fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
3987                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3988                {
3989                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3990                }
3991                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3992                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3993                }
3994            }
3995
3996            next_offset += envelope_size;
3997            _next_ordinal_to_read += 1;
3998            if next_offset >= end_offset {
3999                return Ok(());
4000            }
4001
4002            // Decode unknown envelopes for gaps in ordinals.
4003            while _next_ordinal_to_read < 7 {
4004                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4005                _next_ordinal_to_read += 1;
4006                next_offset += envelope_size;
4007            }
4008
4009            let next_out_of_line = decoder.next_out_of_line();
4010            let handles_before = decoder.remaining_handles();
4011            if let Some((inlined, num_bytes, num_handles)) =
4012                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4013            {
4014                let member_inline_size =
4015                    <u16 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4016                if inlined != (member_inline_size <= 4) {
4017                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4018                }
4019                let inner_offset;
4020                let mut inner_depth = depth.clone();
4021                if inlined {
4022                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4023                    inner_offset = next_offset;
4024                } else {
4025                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4026                    inner_depth.increment()?;
4027                }
4028                let val_ref =
4029                    self.min_tx_buffer_head.get_or_insert_with(|| fidl::new_empty!(u16, D));
4030                fidl::decode!(u16, D, val_ref, decoder, inner_offset, inner_depth)?;
4031                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4032                {
4033                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4034                }
4035                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4036                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4037                }
4038            }
4039
4040            next_offset += envelope_size;
4041            _next_ordinal_to_read += 1;
4042            if next_offset >= end_offset {
4043                return Ok(());
4044            }
4045
4046            // Decode unknown envelopes for gaps in ordinals.
4047            while _next_ordinal_to_read < 8 {
4048                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4049                _next_ordinal_to_read += 1;
4050                next_offset += envelope_size;
4051            }
4052
4053            let next_out_of_line = decoder.next_out_of_line();
4054            let handles_before = decoder.remaining_handles();
4055            if let Some((inlined, num_bytes, num_handles)) =
4056                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4057            {
4058                let member_inline_size =
4059                    <u16 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4060                if inlined != (member_inline_size <= 4) {
4061                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4062                }
4063                let inner_offset;
4064                let mut inner_depth = depth.clone();
4065                if inlined {
4066                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4067                    inner_offset = next_offset;
4068                } else {
4069                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4070                    inner_depth.increment()?;
4071                }
4072                let val_ref =
4073                    self.min_tx_buffer_tail.get_or_insert_with(|| fidl::new_empty!(u16, D));
4074                fidl::decode!(u16, D, val_ref, decoder, inner_offset, inner_depth)?;
4075                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4076                {
4077                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4078                }
4079                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4080                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4081                }
4082            }
4083
4084            next_offset += envelope_size;
4085            _next_ordinal_to_read += 1;
4086            if next_offset >= end_offset {
4087                return Ok(());
4088            }
4089
4090            // Decode unknown envelopes for gaps in ordinals.
4091            while _next_ordinal_to_read < 9 {
4092                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4093                _next_ordinal_to_read += 1;
4094                next_offset += envelope_size;
4095            }
4096
4097            let next_out_of_line = decoder.next_out_of_line();
4098            let handles_before = decoder.remaining_handles();
4099            if let Some((inlined, num_bytes, num_handles)) =
4100                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4101            {
4102                let member_inline_size =
4103                    <u8 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4104                if inlined != (member_inline_size <= 4) {
4105                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4106                }
4107                let inner_offset;
4108                let mut inner_depth = depth.clone();
4109                if inlined {
4110                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4111                    inner_offset = next_offset;
4112                } else {
4113                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4114                    inner_depth.increment()?;
4115                }
4116                let val_ref = self.max_buffer_parts.get_or_insert_with(|| fidl::new_empty!(u8, D));
4117                fidl::decode!(u8, D, val_ref, decoder, inner_offset, inner_depth)?;
4118                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4119                {
4120                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4121                }
4122                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4123                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4124                }
4125            }
4126
4127            next_offset += envelope_size;
4128            _next_ordinal_to_read += 1;
4129            if next_offset >= end_offset {
4130                return Ok(());
4131            }
4132
4133            // Decode unknown envelopes for gaps in ordinals.
4134            while _next_ordinal_to_read < 10 {
4135                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4136                _next_ordinal_to_read += 1;
4137                next_offset += envelope_size;
4138            }
4139
4140            let next_out_of_line = decoder.next_out_of_line();
4141            let handles_before = decoder.remaining_handles();
4142            if let Some((inlined, num_bytes, num_handles)) =
4143                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4144            {
4145                let member_inline_size = <fidl::encoding::Vector<RxAcceleration, 16> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4146                if inlined != (member_inline_size <= 4) {
4147                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4148                }
4149                let inner_offset;
4150                let mut inner_depth = depth.clone();
4151                if inlined {
4152                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4153                    inner_offset = next_offset;
4154                } else {
4155                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4156                    inner_depth.increment()?;
4157                }
4158                let val_ref = self.rx_accel.get_or_insert_with(
4159                    || fidl::new_empty!(fidl::encoding::Vector<RxAcceleration, 16>, D),
4160                );
4161                fidl::decode!(fidl::encoding::Vector<RxAcceleration, 16>, D, val_ref, decoder, inner_offset, inner_depth)?;
4162                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4163                {
4164                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4165                }
4166                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4167                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4168                }
4169            }
4170
4171            next_offset += envelope_size;
4172            _next_ordinal_to_read += 1;
4173            if next_offset >= end_offset {
4174                return Ok(());
4175            }
4176
4177            // Decode unknown envelopes for gaps in ordinals.
4178            while _next_ordinal_to_read < 11 {
4179                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4180                _next_ordinal_to_read += 1;
4181                next_offset += envelope_size;
4182            }
4183
4184            let next_out_of_line = decoder.next_out_of_line();
4185            let handles_before = decoder.remaining_handles();
4186            if let Some((inlined, num_bytes, num_handles)) =
4187                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4188            {
4189                let member_inline_size = <fidl::encoding::Vector<TxAcceleration, 16> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4190                if inlined != (member_inline_size <= 4) {
4191                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4192                }
4193                let inner_offset;
4194                let mut inner_depth = depth.clone();
4195                if inlined {
4196                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4197                    inner_offset = next_offset;
4198                } else {
4199                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4200                    inner_depth.increment()?;
4201                }
4202                let val_ref = self.tx_accel.get_or_insert_with(
4203                    || fidl::new_empty!(fidl::encoding::Vector<TxAcceleration, 16>, D),
4204                );
4205                fidl::decode!(fidl::encoding::Vector<TxAcceleration, 16>, D, val_ref, decoder, inner_offset, inner_depth)?;
4206                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4207                {
4208                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4209                }
4210                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4211                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4212                }
4213            }
4214
4215            next_offset += envelope_size;
4216
4217            // Decode the remaining unknown envelopes.
4218            while next_offset < end_offset {
4219                _next_ordinal_to_read += 1;
4220                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4221                next_offset += envelope_size;
4222            }
4223
4224            Ok(())
4225        }
4226    }
4227
4228    impl DeviceInfo {
4229        #[inline(always)]
4230        fn max_ordinal_present(&self) -> u64 {
4231            if let Some(_) = self.base_info {
4232                return 3;
4233            }
4234            if let Some(_) = self.descriptor_version {
4235                return 2;
4236            }
4237            if let Some(_) = self.min_descriptor_length {
4238                return 1;
4239            }
4240            0
4241        }
4242    }
4243
4244    impl fidl::encoding::ValueTypeMarker for DeviceInfo {
4245        type Borrowed<'a> = &'a Self;
4246        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4247            value
4248        }
4249    }
4250
4251    unsafe impl fidl::encoding::TypeMarker for DeviceInfo {
4252        type Owned = Self;
4253
4254        #[inline(always)]
4255        fn inline_align(_context: fidl::encoding::Context) -> usize {
4256            8
4257        }
4258
4259        #[inline(always)]
4260        fn inline_size(_context: fidl::encoding::Context) -> usize {
4261            16
4262        }
4263    }
4264
4265    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<DeviceInfo, D>
4266        for &DeviceInfo
4267    {
4268        unsafe fn encode(
4269            self,
4270            encoder: &mut fidl::encoding::Encoder<'_, D>,
4271            offset: usize,
4272            mut depth: fidl::encoding::Depth,
4273        ) -> fidl::Result<()> {
4274            encoder.debug_check_bounds::<DeviceInfo>(offset);
4275            // Vector header
4276            let max_ordinal: u64 = self.max_ordinal_present();
4277            encoder.write_num(max_ordinal, offset);
4278            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
4279            // Calling encoder.out_of_line_offset(0) is not allowed.
4280            if max_ordinal == 0 {
4281                return Ok(());
4282            }
4283            depth.increment()?;
4284            let envelope_size = 8;
4285            let bytes_len = max_ordinal as usize * envelope_size;
4286            #[allow(unused_variables)]
4287            let offset = encoder.out_of_line_offset(bytes_len);
4288            let mut _prev_end_offset: usize = 0;
4289            if 1 > max_ordinal {
4290                return Ok(());
4291            }
4292
4293            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4294            // are envelope_size bytes.
4295            let cur_offset: usize = (1 - 1) * envelope_size;
4296
4297            // Zero reserved fields.
4298            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4299
4300            // Safety:
4301            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4302            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4303            //   envelope_size bytes, there is always sufficient room.
4304            fidl::encoding::encode_in_envelope_optional::<u8, D>(
4305                self.min_descriptor_length
4306                    .as_ref()
4307                    .map(<u8 as fidl::encoding::ValueTypeMarker>::borrow),
4308                encoder,
4309                offset + cur_offset,
4310                depth,
4311            )?;
4312
4313            _prev_end_offset = cur_offset + envelope_size;
4314            if 2 > max_ordinal {
4315                return Ok(());
4316            }
4317
4318            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4319            // are envelope_size bytes.
4320            let cur_offset: usize = (2 - 1) * envelope_size;
4321
4322            // Zero reserved fields.
4323            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4324
4325            // Safety:
4326            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4327            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4328            //   envelope_size bytes, there is always sufficient room.
4329            fidl::encoding::encode_in_envelope_optional::<u8, D>(
4330                self.descriptor_version
4331                    .as_ref()
4332                    .map(<u8 as fidl::encoding::ValueTypeMarker>::borrow),
4333                encoder,
4334                offset + cur_offset,
4335                depth,
4336            )?;
4337
4338            _prev_end_offset = cur_offset + envelope_size;
4339            if 3 > max_ordinal {
4340                return Ok(());
4341            }
4342
4343            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4344            // are envelope_size bytes.
4345            let cur_offset: usize = (3 - 1) * envelope_size;
4346
4347            // Zero reserved fields.
4348            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4349
4350            // Safety:
4351            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4352            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4353            //   envelope_size bytes, there is always sufficient room.
4354            fidl::encoding::encode_in_envelope_optional::<DeviceBaseInfo, D>(
4355                self.base_info
4356                    .as_ref()
4357                    .map(<DeviceBaseInfo as fidl::encoding::ValueTypeMarker>::borrow),
4358                encoder,
4359                offset + cur_offset,
4360                depth,
4361            )?;
4362
4363            _prev_end_offset = cur_offset + envelope_size;
4364
4365            Ok(())
4366        }
4367    }
4368
4369    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for DeviceInfo {
4370        #[inline(always)]
4371        fn new_empty() -> Self {
4372            Self::default()
4373        }
4374
4375        unsafe fn decode(
4376            &mut self,
4377            decoder: &mut fidl::encoding::Decoder<'_, D>,
4378            offset: usize,
4379            mut depth: fidl::encoding::Depth,
4380        ) -> fidl::Result<()> {
4381            decoder.debug_check_bounds::<Self>(offset);
4382            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
4383                None => return Err(fidl::Error::NotNullable),
4384                Some(len) => len,
4385            };
4386            // Calling decoder.out_of_line_offset(0) is not allowed.
4387            if len == 0 {
4388                return Ok(());
4389            };
4390            depth.increment()?;
4391            let envelope_size = 8;
4392            let bytes_len = len * envelope_size;
4393            let offset = decoder.out_of_line_offset(bytes_len)?;
4394            // Decode the envelope for each type.
4395            let mut _next_ordinal_to_read = 0;
4396            let mut next_offset = offset;
4397            let end_offset = offset + bytes_len;
4398            _next_ordinal_to_read += 1;
4399            if next_offset >= end_offset {
4400                return Ok(());
4401            }
4402
4403            // Decode unknown envelopes for gaps in ordinals.
4404            while _next_ordinal_to_read < 1 {
4405                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4406                _next_ordinal_to_read += 1;
4407                next_offset += envelope_size;
4408            }
4409
4410            let next_out_of_line = decoder.next_out_of_line();
4411            let handles_before = decoder.remaining_handles();
4412            if let Some((inlined, num_bytes, num_handles)) =
4413                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4414            {
4415                let member_inline_size =
4416                    <u8 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4417                if inlined != (member_inline_size <= 4) {
4418                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4419                }
4420                let inner_offset;
4421                let mut inner_depth = depth.clone();
4422                if inlined {
4423                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4424                    inner_offset = next_offset;
4425                } else {
4426                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4427                    inner_depth.increment()?;
4428                }
4429                let val_ref =
4430                    self.min_descriptor_length.get_or_insert_with(|| fidl::new_empty!(u8, D));
4431                fidl::decode!(u8, D, val_ref, decoder, inner_offset, inner_depth)?;
4432                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4433                {
4434                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4435                }
4436                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4437                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4438                }
4439            }
4440
4441            next_offset += envelope_size;
4442            _next_ordinal_to_read += 1;
4443            if next_offset >= end_offset {
4444                return Ok(());
4445            }
4446
4447            // Decode unknown envelopes for gaps in ordinals.
4448            while _next_ordinal_to_read < 2 {
4449                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4450                _next_ordinal_to_read += 1;
4451                next_offset += envelope_size;
4452            }
4453
4454            let next_out_of_line = decoder.next_out_of_line();
4455            let handles_before = decoder.remaining_handles();
4456            if let Some((inlined, num_bytes, num_handles)) =
4457                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4458            {
4459                let member_inline_size =
4460                    <u8 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4461                if inlined != (member_inline_size <= 4) {
4462                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4463                }
4464                let inner_offset;
4465                let mut inner_depth = depth.clone();
4466                if inlined {
4467                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4468                    inner_offset = next_offset;
4469                } else {
4470                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4471                    inner_depth.increment()?;
4472                }
4473                let val_ref =
4474                    self.descriptor_version.get_or_insert_with(|| fidl::new_empty!(u8, D));
4475                fidl::decode!(u8, D, val_ref, decoder, inner_offset, inner_depth)?;
4476                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4477                {
4478                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4479                }
4480                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4481                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4482                }
4483            }
4484
4485            next_offset += envelope_size;
4486            _next_ordinal_to_read += 1;
4487            if next_offset >= end_offset {
4488                return Ok(());
4489            }
4490
4491            // Decode unknown envelopes for gaps in ordinals.
4492            while _next_ordinal_to_read < 3 {
4493                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4494                _next_ordinal_to_read += 1;
4495                next_offset += envelope_size;
4496            }
4497
4498            let next_out_of_line = decoder.next_out_of_line();
4499            let handles_before = decoder.remaining_handles();
4500            if let Some((inlined, num_bytes, num_handles)) =
4501                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4502            {
4503                let member_inline_size =
4504                    <DeviceBaseInfo as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4505                if inlined != (member_inline_size <= 4) {
4506                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4507                }
4508                let inner_offset;
4509                let mut inner_depth = depth.clone();
4510                if inlined {
4511                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4512                    inner_offset = next_offset;
4513                } else {
4514                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4515                    inner_depth.increment()?;
4516                }
4517                let val_ref =
4518                    self.base_info.get_or_insert_with(|| fidl::new_empty!(DeviceBaseInfo, D));
4519                fidl::decode!(DeviceBaseInfo, D, val_ref, decoder, inner_offset, inner_depth)?;
4520                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4521                {
4522                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4523                }
4524                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4525                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4526                }
4527            }
4528
4529            next_offset += envelope_size;
4530
4531            // Decode the remaining unknown envelopes.
4532            while next_offset < end_offset {
4533                _next_ordinal_to_read += 1;
4534                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4535                next_offset += envelope_size;
4536            }
4537
4538            Ok(())
4539        }
4540    }
4541
4542    impl PortBaseInfo {
4543        #[inline(always)]
4544        fn max_ordinal_present(&self) -> u64 {
4545            if let Some(_) = self.tx_types {
4546                return 3;
4547            }
4548            if let Some(_) = self.rx_types {
4549                return 2;
4550            }
4551            if let Some(_) = self.port_class {
4552                return 1;
4553            }
4554            0
4555        }
4556    }
4557
4558    impl fidl::encoding::ValueTypeMarker for PortBaseInfo {
4559        type Borrowed<'a> = &'a Self;
4560        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4561            value
4562        }
4563    }
4564
4565    unsafe impl fidl::encoding::TypeMarker for PortBaseInfo {
4566        type Owned = Self;
4567
4568        #[inline(always)]
4569        fn inline_align(_context: fidl::encoding::Context) -> usize {
4570            8
4571        }
4572
4573        #[inline(always)]
4574        fn inline_size(_context: fidl::encoding::Context) -> usize {
4575            16
4576        }
4577    }
4578
4579    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<PortBaseInfo, D>
4580        for &PortBaseInfo
4581    {
4582        unsafe fn encode(
4583            self,
4584            encoder: &mut fidl::encoding::Encoder<'_, D>,
4585            offset: usize,
4586            mut depth: fidl::encoding::Depth,
4587        ) -> fidl::Result<()> {
4588            encoder.debug_check_bounds::<PortBaseInfo>(offset);
4589            // Vector header
4590            let max_ordinal: u64 = self.max_ordinal_present();
4591            encoder.write_num(max_ordinal, offset);
4592            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
4593            // Calling encoder.out_of_line_offset(0) is not allowed.
4594            if max_ordinal == 0 {
4595                return Ok(());
4596            }
4597            depth.increment()?;
4598            let envelope_size = 8;
4599            let bytes_len = max_ordinal as usize * envelope_size;
4600            #[allow(unused_variables)]
4601            let offset = encoder.out_of_line_offset(bytes_len);
4602            let mut _prev_end_offset: usize = 0;
4603            if 1 > max_ordinal {
4604                return Ok(());
4605            }
4606
4607            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4608            // are envelope_size bytes.
4609            let cur_offset: usize = (1 - 1) * envelope_size;
4610
4611            // Zero reserved fields.
4612            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4613
4614            // Safety:
4615            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4616            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4617            //   envelope_size bytes, there is always sufficient room.
4618            fidl::encoding::encode_in_envelope_optional::<PortClass, D>(
4619                self.port_class
4620                    .as_ref()
4621                    .map(<PortClass as fidl::encoding::ValueTypeMarker>::borrow),
4622                encoder,
4623                offset + cur_offset,
4624                depth,
4625            )?;
4626
4627            _prev_end_offset = cur_offset + envelope_size;
4628            if 2 > max_ordinal {
4629                return Ok(());
4630            }
4631
4632            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4633            // are envelope_size bytes.
4634            let cur_offset: usize = (2 - 1) * envelope_size;
4635
4636            // Zero reserved fields.
4637            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4638
4639            // Safety:
4640            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4641            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4642            //   envelope_size bytes, there is always sufficient room.
4643            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<FrameType, 4>, D>(
4644            self.rx_types.as_ref().map(<fidl::encoding::Vector<FrameType, 4> as fidl::encoding::ValueTypeMarker>::borrow),
4645            encoder, offset + cur_offset, depth
4646        )?;
4647
4648            _prev_end_offset = cur_offset + envelope_size;
4649            if 3 > max_ordinal {
4650                return Ok(());
4651            }
4652
4653            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4654            // are envelope_size bytes.
4655            let cur_offset: usize = (3 - 1) * envelope_size;
4656
4657            // Zero reserved fields.
4658            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4659
4660            // Safety:
4661            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4662            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4663            //   envelope_size bytes, there is always sufficient room.
4664            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<FrameTypeSupport, 4>, D>(
4665            self.tx_types.as_ref().map(<fidl::encoding::Vector<FrameTypeSupport, 4> as fidl::encoding::ValueTypeMarker>::borrow),
4666            encoder, offset + cur_offset, depth
4667        )?;
4668
4669            _prev_end_offset = cur_offset + envelope_size;
4670
4671            Ok(())
4672        }
4673    }
4674
4675    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for PortBaseInfo {
4676        #[inline(always)]
4677        fn new_empty() -> Self {
4678            Self::default()
4679        }
4680
4681        unsafe fn decode(
4682            &mut self,
4683            decoder: &mut fidl::encoding::Decoder<'_, D>,
4684            offset: usize,
4685            mut depth: fidl::encoding::Depth,
4686        ) -> fidl::Result<()> {
4687            decoder.debug_check_bounds::<Self>(offset);
4688            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
4689                None => return Err(fidl::Error::NotNullable),
4690                Some(len) => len,
4691            };
4692            // Calling decoder.out_of_line_offset(0) is not allowed.
4693            if len == 0 {
4694                return Ok(());
4695            };
4696            depth.increment()?;
4697            let envelope_size = 8;
4698            let bytes_len = len * envelope_size;
4699            let offset = decoder.out_of_line_offset(bytes_len)?;
4700            // Decode the envelope for each type.
4701            let mut _next_ordinal_to_read = 0;
4702            let mut next_offset = offset;
4703            let end_offset = offset + bytes_len;
4704            _next_ordinal_to_read += 1;
4705            if next_offset >= end_offset {
4706                return Ok(());
4707            }
4708
4709            // Decode unknown envelopes for gaps in ordinals.
4710            while _next_ordinal_to_read < 1 {
4711                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4712                _next_ordinal_to_read += 1;
4713                next_offset += envelope_size;
4714            }
4715
4716            let next_out_of_line = decoder.next_out_of_line();
4717            let handles_before = decoder.remaining_handles();
4718            if let Some((inlined, num_bytes, num_handles)) =
4719                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4720            {
4721                let member_inline_size =
4722                    <PortClass as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4723                if inlined != (member_inline_size <= 4) {
4724                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4725                }
4726                let inner_offset;
4727                let mut inner_depth = depth.clone();
4728                if inlined {
4729                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4730                    inner_offset = next_offset;
4731                } else {
4732                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4733                    inner_depth.increment()?;
4734                }
4735                let val_ref = self.port_class.get_or_insert_with(|| fidl::new_empty!(PortClass, D));
4736                fidl::decode!(PortClass, D, val_ref, decoder, inner_offset, inner_depth)?;
4737                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4738                {
4739                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4740                }
4741                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4742                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4743                }
4744            }
4745
4746            next_offset += envelope_size;
4747            _next_ordinal_to_read += 1;
4748            if next_offset >= end_offset {
4749                return Ok(());
4750            }
4751
4752            // Decode unknown envelopes for gaps in ordinals.
4753            while _next_ordinal_to_read < 2 {
4754                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4755                _next_ordinal_to_read += 1;
4756                next_offset += envelope_size;
4757            }
4758
4759            let next_out_of_line = decoder.next_out_of_line();
4760            let handles_before = decoder.remaining_handles();
4761            if let Some((inlined, num_bytes, num_handles)) =
4762                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4763            {
4764                let member_inline_size = <fidl::encoding::Vector<FrameType, 4> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4765                if inlined != (member_inline_size <= 4) {
4766                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4767                }
4768                let inner_offset;
4769                let mut inner_depth = depth.clone();
4770                if inlined {
4771                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4772                    inner_offset = next_offset;
4773                } else {
4774                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4775                    inner_depth.increment()?;
4776                }
4777                let val_ref = self.rx_types.get_or_insert_with(
4778                    || fidl::new_empty!(fidl::encoding::Vector<FrameType, 4>, D),
4779                );
4780                fidl::decode!(fidl::encoding::Vector<FrameType, 4>, D, val_ref, decoder, inner_offset, inner_depth)?;
4781                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4782                {
4783                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4784                }
4785                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4786                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4787                }
4788            }
4789
4790            next_offset += envelope_size;
4791            _next_ordinal_to_read += 1;
4792            if next_offset >= end_offset {
4793                return Ok(());
4794            }
4795
4796            // Decode unknown envelopes for gaps in ordinals.
4797            while _next_ordinal_to_read < 3 {
4798                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4799                _next_ordinal_to_read += 1;
4800                next_offset += envelope_size;
4801            }
4802
4803            let next_out_of_line = decoder.next_out_of_line();
4804            let handles_before = decoder.remaining_handles();
4805            if let Some((inlined, num_bytes, num_handles)) =
4806                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4807            {
4808                let member_inline_size = <fidl::encoding::Vector<FrameTypeSupport, 4> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4809                if inlined != (member_inline_size <= 4) {
4810                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4811                }
4812                let inner_offset;
4813                let mut inner_depth = depth.clone();
4814                if inlined {
4815                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4816                    inner_offset = next_offset;
4817                } else {
4818                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4819                    inner_depth.increment()?;
4820                }
4821                let val_ref = self.tx_types.get_or_insert_with(
4822                    || fidl::new_empty!(fidl::encoding::Vector<FrameTypeSupport, 4>, D),
4823                );
4824                fidl::decode!(fidl::encoding::Vector<FrameTypeSupport, 4>, D, val_ref, decoder, inner_offset, inner_depth)?;
4825                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4826                {
4827                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4828                }
4829                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4830                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4831                }
4832            }
4833
4834            next_offset += envelope_size;
4835
4836            // Decode the remaining unknown envelopes.
4837            while next_offset < end_offset {
4838                _next_ordinal_to_read += 1;
4839                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4840                next_offset += envelope_size;
4841            }
4842
4843            Ok(())
4844        }
4845    }
4846
4847    impl PortGetCountersResponse {
4848        #[inline(always)]
4849        fn max_ordinal_present(&self) -> u64 {
4850            if let Some(_) = self.tx_bytes {
4851                return 4;
4852            }
4853            if let Some(_) = self.tx_frames {
4854                return 3;
4855            }
4856            if let Some(_) = self.rx_bytes {
4857                return 2;
4858            }
4859            if let Some(_) = self.rx_frames {
4860                return 1;
4861            }
4862            0
4863        }
4864    }
4865
4866    impl fidl::encoding::ValueTypeMarker for PortGetCountersResponse {
4867        type Borrowed<'a> = &'a Self;
4868        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4869            value
4870        }
4871    }
4872
4873    unsafe impl fidl::encoding::TypeMarker for PortGetCountersResponse {
4874        type Owned = Self;
4875
4876        #[inline(always)]
4877        fn inline_align(_context: fidl::encoding::Context) -> usize {
4878            8
4879        }
4880
4881        #[inline(always)]
4882        fn inline_size(_context: fidl::encoding::Context) -> usize {
4883            16
4884        }
4885    }
4886
4887    unsafe impl<D: fidl::encoding::ResourceDialect>
4888        fidl::encoding::Encode<PortGetCountersResponse, D> for &PortGetCountersResponse
4889    {
4890        unsafe fn encode(
4891            self,
4892            encoder: &mut fidl::encoding::Encoder<'_, D>,
4893            offset: usize,
4894            mut depth: fidl::encoding::Depth,
4895        ) -> fidl::Result<()> {
4896            encoder.debug_check_bounds::<PortGetCountersResponse>(offset);
4897            // Vector header
4898            let max_ordinal: u64 = self.max_ordinal_present();
4899            encoder.write_num(max_ordinal, offset);
4900            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
4901            // Calling encoder.out_of_line_offset(0) is not allowed.
4902            if max_ordinal == 0 {
4903                return Ok(());
4904            }
4905            depth.increment()?;
4906            let envelope_size = 8;
4907            let bytes_len = max_ordinal as usize * envelope_size;
4908            #[allow(unused_variables)]
4909            let offset = encoder.out_of_line_offset(bytes_len);
4910            let mut _prev_end_offset: usize = 0;
4911            if 1 > max_ordinal {
4912                return Ok(());
4913            }
4914
4915            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4916            // are envelope_size bytes.
4917            let cur_offset: usize = (1 - 1) * envelope_size;
4918
4919            // Zero reserved fields.
4920            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4921
4922            // Safety:
4923            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4924            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4925            //   envelope_size bytes, there is always sufficient room.
4926            fidl::encoding::encode_in_envelope_optional::<u64, D>(
4927                self.rx_frames.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
4928                encoder,
4929                offset + cur_offset,
4930                depth,
4931            )?;
4932
4933            _prev_end_offset = cur_offset + envelope_size;
4934            if 2 > max_ordinal {
4935                return Ok(());
4936            }
4937
4938            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4939            // are envelope_size bytes.
4940            let cur_offset: usize = (2 - 1) * envelope_size;
4941
4942            // Zero reserved fields.
4943            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4944
4945            // Safety:
4946            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4947            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4948            //   envelope_size bytes, there is always sufficient room.
4949            fidl::encoding::encode_in_envelope_optional::<u64, D>(
4950                self.rx_bytes.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
4951                encoder,
4952                offset + cur_offset,
4953                depth,
4954            )?;
4955
4956            _prev_end_offset = cur_offset + envelope_size;
4957            if 3 > max_ordinal {
4958                return Ok(());
4959            }
4960
4961            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4962            // are envelope_size bytes.
4963            let cur_offset: usize = (3 - 1) * envelope_size;
4964
4965            // Zero reserved fields.
4966            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4967
4968            // Safety:
4969            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4970            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4971            //   envelope_size bytes, there is always sufficient room.
4972            fidl::encoding::encode_in_envelope_optional::<u64, D>(
4973                self.tx_frames.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
4974                encoder,
4975                offset + cur_offset,
4976                depth,
4977            )?;
4978
4979            _prev_end_offset = cur_offset + envelope_size;
4980            if 4 > max_ordinal {
4981                return Ok(());
4982            }
4983
4984            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4985            // are envelope_size bytes.
4986            let cur_offset: usize = (4 - 1) * envelope_size;
4987
4988            // Zero reserved fields.
4989            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4990
4991            // Safety:
4992            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4993            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4994            //   envelope_size bytes, there is always sufficient room.
4995            fidl::encoding::encode_in_envelope_optional::<u64, D>(
4996                self.tx_bytes.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
4997                encoder,
4998                offset + cur_offset,
4999                depth,
5000            )?;
5001
5002            _prev_end_offset = cur_offset + envelope_size;
5003
5004            Ok(())
5005        }
5006    }
5007
5008    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
5009        for PortGetCountersResponse
5010    {
5011        #[inline(always)]
5012        fn new_empty() -> Self {
5013            Self::default()
5014        }
5015
5016        unsafe fn decode(
5017            &mut self,
5018            decoder: &mut fidl::encoding::Decoder<'_, D>,
5019            offset: usize,
5020            mut depth: fidl::encoding::Depth,
5021        ) -> fidl::Result<()> {
5022            decoder.debug_check_bounds::<Self>(offset);
5023            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
5024                None => return Err(fidl::Error::NotNullable),
5025                Some(len) => len,
5026            };
5027            // Calling decoder.out_of_line_offset(0) is not allowed.
5028            if len == 0 {
5029                return Ok(());
5030            };
5031            depth.increment()?;
5032            let envelope_size = 8;
5033            let bytes_len = len * envelope_size;
5034            let offset = decoder.out_of_line_offset(bytes_len)?;
5035            // Decode the envelope for each type.
5036            let mut _next_ordinal_to_read = 0;
5037            let mut next_offset = offset;
5038            let end_offset = offset + bytes_len;
5039            _next_ordinal_to_read += 1;
5040            if next_offset >= end_offset {
5041                return Ok(());
5042            }
5043
5044            // Decode unknown envelopes for gaps in ordinals.
5045            while _next_ordinal_to_read < 1 {
5046                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5047                _next_ordinal_to_read += 1;
5048                next_offset += envelope_size;
5049            }
5050
5051            let next_out_of_line = decoder.next_out_of_line();
5052            let handles_before = decoder.remaining_handles();
5053            if let Some((inlined, num_bytes, num_handles)) =
5054                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5055            {
5056                let member_inline_size =
5057                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5058                if inlined != (member_inline_size <= 4) {
5059                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5060                }
5061                let inner_offset;
5062                let mut inner_depth = depth.clone();
5063                if inlined {
5064                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5065                    inner_offset = next_offset;
5066                } else {
5067                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5068                    inner_depth.increment()?;
5069                }
5070                let val_ref = self.rx_frames.get_or_insert_with(|| fidl::new_empty!(u64, D));
5071                fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
5072                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5073                {
5074                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5075                }
5076                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5077                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5078                }
5079            }
5080
5081            next_offset += envelope_size;
5082            _next_ordinal_to_read += 1;
5083            if next_offset >= end_offset {
5084                return Ok(());
5085            }
5086
5087            // Decode unknown envelopes for gaps in ordinals.
5088            while _next_ordinal_to_read < 2 {
5089                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5090                _next_ordinal_to_read += 1;
5091                next_offset += envelope_size;
5092            }
5093
5094            let next_out_of_line = decoder.next_out_of_line();
5095            let handles_before = decoder.remaining_handles();
5096            if let Some((inlined, num_bytes, num_handles)) =
5097                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5098            {
5099                let member_inline_size =
5100                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5101                if inlined != (member_inline_size <= 4) {
5102                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5103                }
5104                let inner_offset;
5105                let mut inner_depth = depth.clone();
5106                if inlined {
5107                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5108                    inner_offset = next_offset;
5109                } else {
5110                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5111                    inner_depth.increment()?;
5112                }
5113                let val_ref = self.rx_bytes.get_or_insert_with(|| fidl::new_empty!(u64, D));
5114                fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
5115                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5116                {
5117                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5118                }
5119                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5120                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5121                }
5122            }
5123
5124            next_offset += envelope_size;
5125            _next_ordinal_to_read += 1;
5126            if next_offset >= end_offset {
5127                return Ok(());
5128            }
5129
5130            // Decode unknown envelopes for gaps in ordinals.
5131            while _next_ordinal_to_read < 3 {
5132                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5133                _next_ordinal_to_read += 1;
5134                next_offset += envelope_size;
5135            }
5136
5137            let next_out_of_line = decoder.next_out_of_line();
5138            let handles_before = decoder.remaining_handles();
5139            if let Some((inlined, num_bytes, num_handles)) =
5140                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5141            {
5142                let member_inline_size =
5143                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5144                if inlined != (member_inline_size <= 4) {
5145                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5146                }
5147                let inner_offset;
5148                let mut inner_depth = depth.clone();
5149                if inlined {
5150                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5151                    inner_offset = next_offset;
5152                } else {
5153                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5154                    inner_depth.increment()?;
5155                }
5156                let val_ref = self.tx_frames.get_or_insert_with(|| fidl::new_empty!(u64, D));
5157                fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
5158                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5159                {
5160                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5161                }
5162                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5163                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5164                }
5165            }
5166
5167            next_offset += envelope_size;
5168            _next_ordinal_to_read += 1;
5169            if next_offset >= end_offset {
5170                return Ok(());
5171            }
5172
5173            // Decode unknown envelopes for gaps in ordinals.
5174            while _next_ordinal_to_read < 4 {
5175                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5176                _next_ordinal_to_read += 1;
5177                next_offset += envelope_size;
5178            }
5179
5180            let next_out_of_line = decoder.next_out_of_line();
5181            let handles_before = decoder.remaining_handles();
5182            if let Some((inlined, num_bytes, num_handles)) =
5183                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5184            {
5185                let member_inline_size =
5186                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5187                if inlined != (member_inline_size <= 4) {
5188                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5189                }
5190                let inner_offset;
5191                let mut inner_depth = depth.clone();
5192                if inlined {
5193                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5194                    inner_offset = next_offset;
5195                } else {
5196                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5197                    inner_depth.increment()?;
5198                }
5199                let val_ref = self.tx_bytes.get_or_insert_with(|| fidl::new_empty!(u64, D));
5200                fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
5201                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5202                {
5203                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5204                }
5205                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5206                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5207                }
5208            }
5209
5210            next_offset += envelope_size;
5211
5212            // Decode the remaining unknown envelopes.
5213            while next_offset < end_offset {
5214                _next_ordinal_to_read += 1;
5215                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5216                next_offset += envelope_size;
5217            }
5218
5219            Ok(())
5220        }
5221    }
5222
5223    impl PortInfo {
5224        #[inline(always)]
5225        fn max_ordinal_present(&self) -> u64 {
5226            if let Some(_) = self.base_info {
5227                return 2;
5228            }
5229            if let Some(_) = self.id {
5230                return 1;
5231            }
5232            0
5233        }
5234    }
5235
5236    impl fidl::encoding::ValueTypeMarker for PortInfo {
5237        type Borrowed<'a> = &'a Self;
5238        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
5239            value
5240        }
5241    }
5242
5243    unsafe impl fidl::encoding::TypeMarker for PortInfo {
5244        type Owned = Self;
5245
5246        #[inline(always)]
5247        fn inline_align(_context: fidl::encoding::Context) -> usize {
5248            8
5249        }
5250
5251        #[inline(always)]
5252        fn inline_size(_context: fidl::encoding::Context) -> usize {
5253            16
5254        }
5255    }
5256
5257    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<PortInfo, D> for &PortInfo {
5258        unsafe fn encode(
5259            self,
5260            encoder: &mut fidl::encoding::Encoder<'_, D>,
5261            offset: usize,
5262            mut depth: fidl::encoding::Depth,
5263        ) -> fidl::Result<()> {
5264            encoder.debug_check_bounds::<PortInfo>(offset);
5265            // Vector header
5266            let max_ordinal: u64 = self.max_ordinal_present();
5267            encoder.write_num(max_ordinal, offset);
5268            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
5269            // Calling encoder.out_of_line_offset(0) is not allowed.
5270            if max_ordinal == 0 {
5271                return Ok(());
5272            }
5273            depth.increment()?;
5274            let envelope_size = 8;
5275            let bytes_len = max_ordinal as usize * envelope_size;
5276            #[allow(unused_variables)]
5277            let offset = encoder.out_of_line_offset(bytes_len);
5278            let mut _prev_end_offset: usize = 0;
5279            if 1 > max_ordinal {
5280                return Ok(());
5281            }
5282
5283            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5284            // are envelope_size bytes.
5285            let cur_offset: usize = (1 - 1) * envelope_size;
5286
5287            // Zero reserved fields.
5288            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5289
5290            // Safety:
5291            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5292            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5293            //   envelope_size bytes, there is always sufficient room.
5294            fidl::encoding::encode_in_envelope_optional::<PortId, D>(
5295                self.id.as_ref().map(<PortId as fidl::encoding::ValueTypeMarker>::borrow),
5296                encoder,
5297                offset + cur_offset,
5298                depth,
5299            )?;
5300
5301            _prev_end_offset = cur_offset + envelope_size;
5302            if 2 > max_ordinal {
5303                return Ok(());
5304            }
5305
5306            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5307            // are envelope_size bytes.
5308            let cur_offset: usize = (2 - 1) * envelope_size;
5309
5310            // Zero reserved fields.
5311            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5312
5313            // Safety:
5314            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5315            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5316            //   envelope_size bytes, there is always sufficient room.
5317            fidl::encoding::encode_in_envelope_optional::<PortBaseInfo, D>(
5318                self.base_info
5319                    .as_ref()
5320                    .map(<PortBaseInfo as fidl::encoding::ValueTypeMarker>::borrow),
5321                encoder,
5322                offset + cur_offset,
5323                depth,
5324            )?;
5325
5326            _prev_end_offset = cur_offset + envelope_size;
5327
5328            Ok(())
5329        }
5330    }
5331
5332    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for PortInfo {
5333        #[inline(always)]
5334        fn new_empty() -> Self {
5335            Self::default()
5336        }
5337
5338        unsafe fn decode(
5339            &mut self,
5340            decoder: &mut fidl::encoding::Decoder<'_, D>,
5341            offset: usize,
5342            mut depth: fidl::encoding::Depth,
5343        ) -> fidl::Result<()> {
5344            decoder.debug_check_bounds::<Self>(offset);
5345            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
5346                None => return Err(fidl::Error::NotNullable),
5347                Some(len) => len,
5348            };
5349            // Calling decoder.out_of_line_offset(0) is not allowed.
5350            if len == 0 {
5351                return Ok(());
5352            };
5353            depth.increment()?;
5354            let envelope_size = 8;
5355            let bytes_len = len * envelope_size;
5356            let offset = decoder.out_of_line_offset(bytes_len)?;
5357            // Decode the envelope for each type.
5358            let mut _next_ordinal_to_read = 0;
5359            let mut next_offset = offset;
5360            let end_offset = offset + bytes_len;
5361            _next_ordinal_to_read += 1;
5362            if next_offset >= end_offset {
5363                return Ok(());
5364            }
5365
5366            // Decode unknown envelopes for gaps in ordinals.
5367            while _next_ordinal_to_read < 1 {
5368                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5369                _next_ordinal_to_read += 1;
5370                next_offset += envelope_size;
5371            }
5372
5373            let next_out_of_line = decoder.next_out_of_line();
5374            let handles_before = decoder.remaining_handles();
5375            if let Some((inlined, num_bytes, num_handles)) =
5376                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5377            {
5378                let member_inline_size =
5379                    <PortId as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5380                if inlined != (member_inline_size <= 4) {
5381                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5382                }
5383                let inner_offset;
5384                let mut inner_depth = depth.clone();
5385                if inlined {
5386                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5387                    inner_offset = next_offset;
5388                } else {
5389                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5390                    inner_depth.increment()?;
5391                }
5392                let val_ref = self.id.get_or_insert_with(|| fidl::new_empty!(PortId, D));
5393                fidl::decode!(PortId, D, val_ref, decoder, inner_offset, inner_depth)?;
5394                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5395                {
5396                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5397                }
5398                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5399                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5400                }
5401            }
5402
5403            next_offset += envelope_size;
5404            _next_ordinal_to_read += 1;
5405            if next_offset >= end_offset {
5406                return Ok(());
5407            }
5408
5409            // Decode unknown envelopes for gaps in ordinals.
5410            while _next_ordinal_to_read < 2 {
5411                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5412                _next_ordinal_to_read += 1;
5413                next_offset += envelope_size;
5414            }
5415
5416            let next_out_of_line = decoder.next_out_of_line();
5417            let handles_before = decoder.remaining_handles();
5418            if let Some((inlined, num_bytes, num_handles)) =
5419                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5420            {
5421                let member_inline_size =
5422                    <PortBaseInfo as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5423                if inlined != (member_inline_size <= 4) {
5424                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5425                }
5426                let inner_offset;
5427                let mut inner_depth = depth.clone();
5428                if inlined {
5429                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5430                    inner_offset = next_offset;
5431                } else {
5432                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5433                    inner_depth.increment()?;
5434                }
5435                let val_ref =
5436                    self.base_info.get_or_insert_with(|| fidl::new_empty!(PortBaseInfo, D));
5437                fidl::decode!(PortBaseInfo, D, val_ref, decoder, inner_offset, inner_depth)?;
5438                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5439                {
5440                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5441                }
5442                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5443                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5444                }
5445            }
5446
5447            next_offset += envelope_size;
5448
5449            // Decode the remaining unknown envelopes.
5450            while next_offset < end_offset {
5451                _next_ordinal_to_read += 1;
5452                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5453                next_offset += envelope_size;
5454            }
5455
5456            Ok(())
5457        }
5458    }
5459
5460    impl PortStatus {
5461        #[inline(always)]
5462        fn max_ordinal_present(&self) -> u64 {
5463            if let Some(_) = self.mtu {
5464                return 2;
5465            }
5466            if let Some(_) = self.flags {
5467                return 1;
5468            }
5469            0
5470        }
5471    }
5472
5473    impl fidl::encoding::ValueTypeMarker for PortStatus {
5474        type Borrowed<'a> = &'a Self;
5475        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
5476            value
5477        }
5478    }
5479
5480    unsafe impl fidl::encoding::TypeMarker for PortStatus {
5481        type Owned = Self;
5482
5483        #[inline(always)]
5484        fn inline_align(_context: fidl::encoding::Context) -> usize {
5485            8
5486        }
5487
5488        #[inline(always)]
5489        fn inline_size(_context: fidl::encoding::Context) -> usize {
5490            16
5491        }
5492    }
5493
5494    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<PortStatus, D>
5495        for &PortStatus
5496    {
5497        unsafe fn encode(
5498            self,
5499            encoder: &mut fidl::encoding::Encoder<'_, D>,
5500            offset: usize,
5501            mut depth: fidl::encoding::Depth,
5502        ) -> fidl::Result<()> {
5503            encoder.debug_check_bounds::<PortStatus>(offset);
5504            // Vector header
5505            let max_ordinal: u64 = self.max_ordinal_present();
5506            encoder.write_num(max_ordinal, offset);
5507            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
5508            // Calling encoder.out_of_line_offset(0) is not allowed.
5509            if max_ordinal == 0 {
5510                return Ok(());
5511            }
5512            depth.increment()?;
5513            let envelope_size = 8;
5514            let bytes_len = max_ordinal as usize * envelope_size;
5515            #[allow(unused_variables)]
5516            let offset = encoder.out_of_line_offset(bytes_len);
5517            let mut _prev_end_offset: usize = 0;
5518            if 1 > max_ordinal {
5519                return Ok(());
5520            }
5521
5522            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5523            // are envelope_size bytes.
5524            let cur_offset: usize = (1 - 1) * envelope_size;
5525
5526            // Zero reserved fields.
5527            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5528
5529            // Safety:
5530            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5531            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5532            //   envelope_size bytes, there is always sufficient room.
5533            fidl::encoding::encode_in_envelope_optional::<StatusFlags, D>(
5534                self.flags.as_ref().map(<StatusFlags as fidl::encoding::ValueTypeMarker>::borrow),
5535                encoder,
5536                offset + cur_offset,
5537                depth,
5538            )?;
5539
5540            _prev_end_offset = cur_offset + envelope_size;
5541            if 2 > max_ordinal {
5542                return Ok(());
5543            }
5544
5545            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5546            // are envelope_size bytes.
5547            let cur_offset: usize = (2 - 1) * envelope_size;
5548
5549            // Zero reserved fields.
5550            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5551
5552            // Safety:
5553            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5554            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5555            //   envelope_size bytes, there is always sufficient room.
5556            fidl::encoding::encode_in_envelope_optional::<u32, D>(
5557                self.mtu.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
5558                encoder,
5559                offset + cur_offset,
5560                depth,
5561            )?;
5562
5563            _prev_end_offset = cur_offset + envelope_size;
5564
5565            Ok(())
5566        }
5567    }
5568
5569    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for PortStatus {
5570        #[inline(always)]
5571        fn new_empty() -> Self {
5572            Self::default()
5573        }
5574
5575        unsafe fn decode(
5576            &mut self,
5577            decoder: &mut fidl::encoding::Decoder<'_, D>,
5578            offset: usize,
5579            mut depth: fidl::encoding::Depth,
5580        ) -> fidl::Result<()> {
5581            decoder.debug_check_bounds::<Self>(offset);
5582            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
5583                None => return Err(fidl::Error::NotNullable),
5584                Some(len) => len,
5585            };
5586            // Calling decoder.out_of_line_offset(0) is not allowed.
5587            if len == 0 {
5588                return Ok(());
5589            };
5590            depth.increment()?;
5591            let envelope_size = 8;
5592            let bytes_len = len * envelope_size;
5593            let offset = decoder.out_of_line_offset(bytes_len)?;
5594            // Decode the envelope for each type.
5595            let mut _next_ordinal_to_read = 0;
5596            let mut next_offset = offset;
5597            let end_offset = offset + bytes_len;
5598            _next_ordinal_to_read += 1;
5599            if next_offset >= end_offset {
5600                return Ok(());
5601            }
5602
5603            // Decode unknown envelopes for gaps in ordinals.
5604            while _next_ordinal_to_read < 1 {
5605                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5606                _next_ordinal_to_read += 1;
5607                next_offset += envelope_size;
5608            }
5609
5610            let next_out_of_line = decoder.next_out_of_line();
5611            let handles_before = decoder.remaining_handles();
5612            if let Some((inlined, num_bytes, num_handles)) =
5613                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5614            {
5615                let member_inline_size =
5616                    <StatusFlags as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5617                if inlined != (member_inline_size <= 4) {
5618                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5619                }
5620                let inner_offset;
5621                let mut inner_depth = depth.clone();
5622                if inlined {
5623                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5624                    inner_offset = next_offset;
5625                } else {
5626                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5627                    inner_depth.increment()?;
5628                }
5629                let val_ref = self.flags.get_or_insert_with(|| fidl::new_empty!(StatusFlags, D));
5630                fidl::decode!(StatusFlags, D, val_ref, decoder, inner_offset, inner_depth)?;
5631                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5632                {
5633                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5634                }
5635                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5636                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5637                }
5638            }
5639
5640            next_offset += envelope_size;
5641            _next_ordinal_to_read += 1;
5642            if next_offset >= end_offset {
5643                return Ok(());
5644            }
5645
5646            // Decode unknown envelopes for gaps in ordinals.
5647            while _next_ordinal_to_read < 2 {
5648                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5649                _next_ordinal_to_read += 1;
5650                next_offset += envelope_size;
5651            }
5652
5653            let next_out_of_line = decoder.next_out_of_line();
5654            let handles_before = decoder.remaining_handles();
5655            if let Some((inlined, num_bytes, num_handles)) =
5656                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5657            {
5658                let member_inline_size =
5659                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5660                if inlined != (member_inline_size <= 4) {
5661                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5662                }
5663                let inner_offset;
5664                let mut inner_depth = depth.clone();
5665                if inlined {
5666                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5667                    inner_offset = next_offset;
5668                } else {
5669                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5670                    inner_depth.increment()?;
5671                }
5672                let val_ref = self.mtu.get_or_insert_with(|| fidl::new_empty!(u32, D));
5673                fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
5674                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5675                {
5676                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5677                }
5678                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5679                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5680                }
5681            }
5682
5683            next_offset += envelope_size;
5684
5685            // Decode the remaining unknown envelopes.
5686            while next_offset < end_offset {
5687                _next_ordinal_to_read += 1;
5688                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5689                next_offset += envelope_size;
5690            }
5691
5692            Ok(())
5693        }
5694    }
5695
5696    impl fidl::encoding::ValueTypeMarker for DevicePortEvent {
5697        type Borrowed<'a> = &'a Self;
5698        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
5699            value
5700        }
5701    }
5702
5703    unsafe impl fidl::encoding::TypeMarker for DevicePortEvent {
5704        type Owned = Self;
5705
5706        #[inline(always)]
5707        fn inline_align(_context: fidl::encoding::Context) -> usize {
5708            8
5709        }
5710
5711        #[inline(always)]
5712        fn inline_size(_context: fidl::encoding::Context) -> usize {
5713            16
5714        }
5715    }
5716
5717    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<DevicePortEvent, D>
5718        for &DevicePortEvent
5719    {
5720        #[inline]
5721        unsafe fn encode(
5722            self,
5723            encoder: &mut fidl::encoding::Encoder<'_, D>,
5724            offset: usize,
5725            _depth: fidl::encoding::Depth,
5726        ) -> fidl::Result<()> {
5727            encoder.debug_check_bounds::<DevicePortEvent>(offset);
5728            encoder.write_num::<u64>(self.ordinal(), offset);
5729            match self {
5730                DevicePortEvent::Existing(ref val) => {
5731                    fidl::encoding::encode_in_envelope::<PortId, D>(
5732                        <PortId as fidl::encoding::ValueTypeMarker>::borrow(val),
5733                        encoder,
5734                        offset + 8,
5735                        _depth,
5736                    )
5737                }
5738                DevicePortEvent::Added(ref val) => fidl::encoding::encode_in_envelope::<PortId, D>(
5739                    <PortId as fidl::encoding::ValueTypeMarker>::borrow(val),
5740                    encoder,
5741                    offset + 8,
5742                    _depth,
5743                ),
5744                DevicePortEvent::Removed(ref val) => {
5745                    fidl::encoding::encode_in_envelope::<PortId, D>(
5746                        <PortId as fidl::encoding::ValueTypeMarker>::borrow(val),
5747                        encoder,
5748                        offset + 8,
5749                        _depth,
5750                    )
5751                }
5752                DevicePortEvent::Idle(ref val) => fidl::encoding::encode_in_envelope::<Empty, D>(
5753                    <Empty as fidl::encoding::ValueTypeMarker>::borrow(val),
5754                    encoder,
5755                    offset + 8,
5756                    _depth,
5757                ),
5758            }
5759        }
5760    }
5761
5762    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for DevicePortEvent {
5763        #[inline(always)]
5764        fn new_empty() -> Self {
5765            Self::Existing(fidl::new_empty!(PortId, D))
5766        }
5767
5768        #[inline]
5769        unsafe fn decode(
5770            &mut self,
5771            decoder: &mut fidl::encoding::Decoder<'_, D>,
5772            offset: usize,
5773            mut depth: fidl::encoding::Depth,
5774        ) -> fidl::Result<()> {
5775            decoder.debug_check_bounds::<Self>(offset);
5776            #[allow(unused_variables)]
5777            let next_out_of_line = decoder.next_out_of_line();
5778            let handles_before = decoder.remaining_handles();
5779            let (ordinal, inlined, num_bytes, num_handles) =
5780                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
5781
5782            let member_inline_size = match ordinal {
5783                1 => <PortId as fidl::encoding::TypeMarker>::inline_size(decoder.context),
5784                2 => <PortId as fidl::encoding::TypeMarker>::inline_size(decoder.context),
5785                3 => <PortId as fidl::encoding::TypeMarker>::inline_size(decoder.context),
5786                4 => <Empty as fidl::encoding::TypeMarker>::inline_size(decoder.context),
5787                _ => return Err(fidl::Error::UnknownUnionTag),
5788            };
5789
5790            if inlined != (member_inline_size <= 4) {
5791                return Err(fidl::Error::InvalidInlineBitInEnvelope);
5792            }
5793            let _inner_offset;
5794            if inlined {
5795                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
5796                _inner_offset = offset + 8;
5797            } else {
5798                depth.increment()?;
5799                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5800            }
5801            match ordinal {
5802                1 => {
5803                    #[allow(irrefutable_let_patterns)]
5804                    if let DevicePortEvent::Existing(_) = self {
5805                        // Do nothing, read the value into the object
5806                    } else {
5807                        // Initialize `self` to the right variant
5808                        *self = DevicePortEvent::Existing(fidl::new_empty!(PortId, D));
5809                    }
5810                    #[allow(irrefutable_let_patterns)]
5811                    if let DevicePortEvent::Existing(ref mut val) = self {
5812                        fidl::decode!(PortId, D, val, decoder, _inner_offset, depth)?;
5813                    } else {
5814                        unreachable!()
5815                    }
5816                }
5817                2 => {
5818                    #[allow(irrefutable_let_patterns)]
5819                    if let DevicePortEvent::Added(_) = self {
5820                        // Do nothing, read the value into the object
5821                    } else {
5822                        // Initialize `self` to the right variant
5823                        *self = DevicePortEvent::Added(fidl::new_empty!(PortId, D));
5824                    }
5825                    #[allow(irrefutable_let_patterns)]
5826                    if let DevicePortEvent::Added(ref mut val) = self {
5827                        fidl::decode!(PortId, D, val, decoder, _inner_offset, depth)?;
5828                    } else {
5829                        unreachable!()
5830                    }
5831                }
5832                3 => {
5833                    #[allow(irrefutable_let_patterns)]
5834                    if let DevicePortEvent::Removed(_) = self {
5835                        // Do nothing, read the value into the object
5836                    } else {
5837                        // Initialize `self` to the right variant
5838                        *self = DevicePortEvent::Removed(fidl::new_empty!(PortId, D));
5839                    }
5840                    #[allow(irrefutable_let_patterns)]
5841                    if let DevicePortEvent::Removed(ref mut val) = self {
5842                        fidl::decode!(PortId, D, val, decoder, _inner_offset, depth)?;
5843                    } else {
5844                        unreachable!()
5845                    }
5846                }
5847                4 => {
5848                    #[allow(irrefutable_let_patterns)]
5849                    if let DevicePortEvent::Idle(_) = self {
5850                        // Do nothing, read the value into the object
5851                    } else {
5852                        // Initialize `self` to the right variant
5853                        *self = DevicePortEvent::Idle(fidl::new_empty!(Empty, D));
5854                    }
5855                    #[allow(irrefutable_let_patterns)]
5856                    if let DevicePortEvent::Idle(ref mut val) = self {
5857                        fidl::decode!(Empty, D, val, decoder, _inner_offset, depth)?;
5858                    } else {
5859                        unreachable!()
5860                    }
5861                }
5862                ordinal => panic!("unexpected ordinal {:?}", ordinal),
5863            }
5864            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
5865                return Err(fidl::Error::InvalidNumBytesInEnvelope);
5866            }
5867            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5868                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5869            }
5870            Ok(())
5871        }
5872    }
5873}