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__common::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__common::MacAddress,
750}
751
752impl fidl::Persistable for MacAddressingGetUnicastAddressResponse {}
753
754#[derive(Clone, Debug, PartialEq)]
755pub struct MacAddressingRemoveMulticastAddressRequest {
756    pub address: fidl_fuchsia_net__common::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                (
2115                    <fidl_fuchsia_net__common::MacAddress as fidl::encoding::ValueTypeMarker>::borrow(&self.address),
2116                ),
2117                encoder, offset, _depth
2118            )
2119        }
2120    }
2121    unsafe impl<
2122            D: fidl::encoding::ResourceDialect,
2123            T0: fidl::encoding::Encode<fidl_fuchsia_net__common::MacAddress, D>,
2124        > fidl::encoding::Encode<MacAddressingAddMulticastAddressRequest, D> for (T0,)
2125    {
2126        #[inline]
2127        unsafe fn encode(
2128            self,
2129            encoder: &mut fidl::encoding::Encoder<'_, D>,
2130            offset: usize,
2131            depth: fidl::encoding::Depth,
2132        ) -> fidl::Result<()> {
2133            encoder.debug_check_bounds::<MacAddressingAddMulticastAddressRequest>(offset);
2134            // Zero out padding regions. There's no need to apply masks
2135            // because the unmasked parts will be overwritten by fields.
2136            // Write the fields.
2137            self.0.encode(encoder, offset + 0, depth)?;
2138            Ok(())
2139        }
2140    }
2141
2142    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2143        for MacAddressingAddMulticastAddressRequest
2144    {
2145        #[inline(always)]
2146        fn new_empty() -> Self {
2147            Self { address: fidl::new_empty!(fidl_fuchsia_net__common::MacAddress, D) }
2148        }
2149
2150        #[inline]
2151        unsafe fn decode(
2152            &mut self,
2153            decoder: &mut fidl::encoding::Decoder<'_, D>,
2154            offset: usize,
2155            _depth: fidl::encoding::Depth,
2156        ) -> fidl::Result<()> {
2157            decoder.debug_check_bounds::<Self>(offset);
2158            // Verify that padding bytes are zero.
2159            fidl::decode!(
2160                fidl_fuchsia_net__common::MacAddress,
2161                D,
2162                &mut self.address,
2163                decoder,
2164                offset + 0,
2165                _depth
2166            )?;
2167            Ok(())
2168        }
2169    }
2170
2171    impl fidl::encoding::ValueTypeMarker for MacAddressingAddMulticastAddressResponse {
2172        type Borrowed<'a> = &'a Self;
2173        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2174            value
2175        }
2176    }
2177
2178    unsafe impl fidl::encoding::TypeMarker for MacAddressingAddMulticastAddressResponse {
2179        type Owned = Self;
2180
2181        #[inline(always)]
2182        fn inline_align(_context: fidl::encoding::Context) -> usize {
2183            4
2184        }
2185
2186        #[inline(always)]
2187        fn inline_size(_context: fidl::encoding::Context) -> usize {
2188            4
2189        }
2190        #[inline(always)]
2191        fn encode_is_copy() -> bool {
2192            true
2193        }
2194
2195        #[inline(always)]
2196        fn decode_is_copy() -> bool {
2197            true
2198        }
2199    }
2200
2201    unsafe impl<D: fidl::encoding::ResourceDialect>
2202        fidl::encoding::Encode<MacAddressingAddMulticastAddressResponse, D>
2203        for &MacAddressingAddMulticastAddressResponse
2204    {
2205        #[inline]
2206        unsafe fn encode(
2207            self,
2208            encoder: &mut fidl::encoding::Encoder<'_, D>,
2209            offset: usize,
2210            _depth: fidl::encoding::Depth,
2211        ) -> fidl::Result<()> {
2212            encoder.debug_check_bounds::<MacAddressingAddMulticastAddressResponse>(offset);
2213            unsafe {
2214                // Copy the object into the buffer.
2215                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
2216                (buf_ptr as *mut MacAddressingAddMulticastAddressResponse).write_unaligned(
2217                    (self as *const MacAddressingAddMulticastAddressResponse).read(),
2218                );
2219                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
2220                // done second because the memcpy will write garbage to these bytes.
2221            }
2222            Ok(())
2223        }
2224    }
2225    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<i32, D>>
2226        fidl::encoding::Encode<MacAddressingAddMulticastAddressResponse, D> for (T0,)
2227    {
2228        #[inline]
2229        unsafe fn encode(
2230            self,
2231            encoder: &mut fidl::encoding::Encoder<'_, D>,
2232            offset: usize,
2233            depth: fidl::encoding::Depth,
2234        ) -> fidl::Result<()> {
2235            encoder.debug_check_bounds::<MacAddressingAddMulticastAddressResponse>(offset);
2236            // Zero out padding regions. There's no need to apply masks
2237            // because the unmasked parts will be overwritten by fields.
2238            // Write the fields.
2239            self.0.encode(encoder, offset + 0, depth)?;
2240            Ok(())
2241        }
2242    }
2243
2244    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2245        for MacAddressingAddMulticastAddressResponse
2246    {
2247        #[inline(always)]
2248        fn new_empty() -> Self {
2249            Self { status: fidl::new_empty!(i32, D) }
2250        }
2251
2252        #[inline]
2253        unsafe fn decode(
2254            &mut self,
2255            decoder: &mut fidl::encoding::Decoder<'_, D>,
2256            offset: usize,
2257            _depth: fidl::encoding::Depth,
2258        ) -> fidl::Result<()> {
2259            decoder.debug_check_bounds::<Self>(offset);
2260            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
2261            // Verify that padding bytes are zero.
2262            // Copy from the buffer into the object.
2263            unsafe {
2264                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
2265            }
2266            Ok(())
2267        }
2268    }
2269
2270    impl fidl::encoding::ValueTypeMarker for MacAddressingGetUnicastAddressResponse {
2271        type Borrowed<'a> = &'a Self;
2272        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2273            value
2274        }
2275    }
2276
2277    unsafe impl fidl::encoding::TypeMarker for MacAddressingGetUnicastAddressResponse {
2278        type Owned = Self;
2279
2280        #[inline(always)]
2281        fn inline_align(_context: fidl::encoding::Context) -> usize {
2282            1
2283        }
2284
2285        #[inline(always)]
2286        fn inline_size(_context: fidl::encoding::Context) -> usize {
2287            6
2288        }
2289    }
2290
2291    unsafe impl<D: fidl::encoding::ResourceDialect>
2292        fidl::encoding::Encode<MacAddressingGetUnicastAddressResponse, D>
2293        for &MacAddressingGetUnicastAddressResponse
2294    {
2295        #[inline]
2296        unsafe fn encode(
2297            self,
2298            encoder: &mut fidl::encoding::Encoder<'_, D>,
2299            offset: usize,
2300            _depth: fidl::encoding::Depth,
2301        ) -> fidl::Result<()> {
2302            encoder.debug_check_bounds::<MacAddressingGetUnicastAddressResponse>(offset);
2303            // Delegate to tuple encoding.
2304            fidl::encoding::Encode::<MacAddressingGetUnicastAddressResponse, D>::encode(
2305                (
2306                    <fidl_fuchsia_net__common::MacAddress as fidl::encoding::ValueTypeMarker>::borrow(&self.address),
2307                ),
2308                encoder, offset, _depth
2309            )
2310        }
2311    }
2312    unsafe impl<
2313            D: fidl::encoding::ResourceDialect,
2314            T0: fidl::encoding::Encode<fidl_fuchsia_net__common::MacAddress, D>,
2315        > fidl::encoding::Encode<MacAddressingGetUnicastAddressResponse, D> for (T0,)
2316    {
2317        #[inline]
2318        unsafe fn encode(
2319            self,
2320            encoder: &mut fidl::encoding::Encoder<'_, D>,
2321            offset: usize,
2322            depth: fidl::encoding::Depth,
2323        ) -> fidl::Result<()> {
2324            encoder.debug_check_bounds::<MacAddressingGetUnicastAddressResponse>(offset);
2325            // Zero out padding regions. There's no need to apply masks
2326            // because the unmasked parts will be overwritten by fields.
2327            // Write the fields.
2328            self.0.encode(encoder, offset + 0, depth)?;
2329            Ok(())
2330        }
2331    }
2332
2333    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2334        for MacAddressingGetUnicastAddressResponse
2335    {
2336        #[inline(always)]
2337        fn new_empty() -> Self {
2338            Self { address: fidl::new_empty!(fidl_fuchsia_net__common::MacAddress, D) }
2339        }
2340
2341        #[inline]
2342        unsafe fn decode(
2343            &mut self,
2344            decoder: &mut fidl::encoding::Decoder<'_, D>,
2345            offset: usize,
2346            _depth: fidl::encoding::Depth,
2347        ) -> fidl::Result<()> {
2348            decoder.debug_check_bounds::<Self>(offset);
2349            // Verify that padding bytes are zero.
2350            fidl::decode!(
2351                fidl_fuchsia_net__common::MacAddress,
2352                D,
2353                &mut self.address,
2354                decoder,
2355                offset + 0,
2356                _depth
2357            )?;
2358            Ok(())
2359        }
2360    }
2361
2362    impl fidl::encoding::ValueTypeMarker for MacAddressingRemoveMulticastAddressRequest {
2363        type Borrowed<'a> = &'a Self;
2364        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2365            value
2366        }
2367    }
2368
2369    unsafe impl fidl::encoding::TypeMarker for MacAddressingRemoveMulticastAddressRequest {
2370        type Owned = Self;
2371
2372        #[inline(always)]
2373        fn inline_align(_context: fidl::encoding::Context) -> usize {
2374            1
2375        }
2376
2377        #[inline(always)]
2378        fn inline_size(_context: fidl::encoding::Context) -> usize {
2379            6
2380        }
2381    }
2382
2383    unsafe impl<D: fidl::encoding::ResourceDialect>
2384        fidl::encoding::Encode<MacAddressingRemoveMulticastAddressRequest, D>
2385        for &MacAddressingRemoveMulticastAddressRequest
2386    {
2387        #[inline]
2388        unsafe fn encode(
2389            self,
2390            encoder: &mut fidl::encoding::Encoder<'_, D>,
2391            offset: usize,
2392            _depth: fidl::encoding::Depth,
2393        ) -> fidl::Result<()> {
2394            encoder.debug_check_bounds::<MacAddressingRemoveMulticastAddressRequest>(offset);
2395            // Delegate to tuple encoding.
2396            fidl::encoding::Encode::<MacAddressingRemoveMulticastAddressRequest, D>::encode(
2397                (
2398                    <fidl_fuchsia_net__common::MacAddress as fidl::encoding::ValueTypeMarker>::borrow(&self.address),
2399                ),
2400                encoder, offset, _depth
2401            )
2402        }
2403    }
2404    unsafe impl<
2405            D: fidl::encoding::ResourceDialect,
2406            T0: fidl::encoding::Encode<fidl_fuchsia_net__common::MacAddress, D>,
2407        > fidl::encoding::Encode<MacAddressingRemoveMulticastAddressRequest, D> for (T0,)
2408    {
2409        #[inline]
2410        unsafe fn encode(
2411            self,
2412            encoder: &mut fidl::encoding::Encoder<'_, D>,
2413            offset: usize,
2414            depth: fidl::encoding::Depth,
2415        ) -> fidl::Result<()> {
2416            encoder.debug_check_bounds::<MacAddressingRemoveMulticastAddressRequest>(offset);
2417            // Zero out padding regions. There's no need to apply masks
2418            // because the unmasked parts will be overwritten by fields.
2419            // Write the fields.
2420            self.0.encode(encoder, offset + 0, depth)?;
2421            Ok(())
2422        }
2423    }
2424
2425    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2426        for MacAddressingRemoveMulticastAddressRequest
2427    {
2428        #[inline(always)]
2429        fn new_empty() -> Self {
2430            Self { address: fidl::new_empty!(fidl_fuchsia_net__common::MacAddress, D) }
2431        }
2432
2433        #[inline]
2434        unsafe fn decode(
2435            &mut self,
2436            decoder: &mut fidl::encoding::Decoder<'_, D>,
2437            offset: usize,
2438            _depth: fidl::encoding::Depth,
2439        ) -> fidl::Result<()> {
2440            decoder.debug_check_bounds::<Self>(offset);
2441            // Verify that padding bytes are zero.
2442            fidl::decode!(
2443                fidl_fuchsia_net__common::MacAddress,
2444                D,
2445                &mut self.address,
2446                decoder,
2447                offset + 0,
2448                _depth
2449            )?;
2450            Ok(())
2451        }
2452    }
2453
2454    impl fidl::encoding::ValueTypeMarker for MacAddressingRemoveMulticastAddressResponse {
2455        type Borrowed<'a> = &'a Self;
2456        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2457            value
2458        }
2459    }
2460
2461    unsafe impl fidl::encoding::TypeMarker for MacAddressingRemoveMulticastAddressResponse {
2462        type Owned = Self;
2463
2464        #[inline(always)]
2465        fn inline_align(_context: fidl::encoding::Context) -> usize {
2466            4
2467        }
2468
2469        #[inline(always)]
2470        fn inline_size(_context: fidl::encoding::Context) -> usize {
2471            4
2472        }
2473        #[inline(always)]
2474        fn encode_is_copy() -> bool {
2475            true
2476        }
2477
2478        #[inline(always)]
2479        fn decode_is_copy() -> bool {
2480            true
2481        }
2482    }
2483
2484    unsafe impl<D: fidl::encoding::ResourceDialect>
2485        fidl::encoding::Encode<MacAddressingRemoveMulticastAddressResponse, D>
2486        for &MacAddressingRemoveMulticastAddressResponse
2487    {
2488        #[inline]
2489        unsafe fn encode(
2490            self,
2491            encoder: &mut fidl::encoding::Encoder<'_, D>,
2492            offset: usize,
2493            _depth: fidl::encoding::Depth,
2494        ) -> fidl::Result<()> {
2495            encoder.debug_check_bounds::<MacAddressingRemoveMulticastAddressResponse>(offset);
2496            unsafe {
2497                // Copy the object into the buffer.
2498                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
2499                (buf_ptr as *mut MacAddressingRemoveMulticastAddressResponse).write_unaligned(
2500                    (self as *const MacAddressingRemoveMulticastAddressResponse).read(),
2501                );
2502                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
2503                // done second because the memcpy will write garbage to these bytes.
2504            }
2505            Ok(())
2506        }
2507    }
2508    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<i32, D>>
2509        fidl::encoding::Encode<MacAddressingRemoveMulticastAddressResponse, D> for (T0,)
2510    {
2511        #[inline]
2512        unsafe fn encode(
2513            self,
2514            encoder: &mut fidl::encoding::Encoder<'_, D>,
2515            offset: usize,
2516            depth: fidl::encoding::Depth,
2517        ) -> fidl::Result<()> {
2518            encoder.debug_check_bounds::<MacAddressingRemoveMulticastAddressResponse>(offset);
2519            // Zero out padding regions. There's no need to apply masks
2520            // because the unmasked parts will be overwritten by fields.
2521            // Write the fields.
2522            self.0.encode(encoder, offset + 0, depth)?;
2523            Ok(())
2524        }
2525    }
2526
2527    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2528        for MacAddressingRemoveMulticastAddressResponse
2529    {
2530        #[inline(always)]
2531        fn new_empty() -> Self {
2532            Self { status: fidl::new_empty!(i32, D) }
2533        }
2534
2535        #[inline]
2536        unsafe fn decode(
2537            &mut self,
2538            decoder: &mut fidl::encoding::Decoder<'_, D>,
2539            offset: usize,
2540            _depth: fidl::encoding::Depth,
2541        ) -> fidl::Result<()> {
2542            decoder.debug_check_bounds::<Self>(offset);
2543            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
2544            // Verify that padding bytes are zero.
2545            // Copy from the buffer into the object.
2546            unsafe {
2547                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
2548            }
2549            Ok(())
2550        }
2551    }
2552
2553    impl fidl::encoding::ValueTypeMarker for MacAddressingSetModeRequest {
2554        type Borrowed<'a> = &'a Self;
2555        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2556            value
2557        }
2558    }
2559
2560    unsafe impl fidl::encoding::TypeMarker for MacAddressingSetModeRequest {
2561        type Owned = Self;
2562
2563        #[inline(always)]
2564        fn inline_align(_context: fidl::encoding::Context) -> usize {
2565            4
2566        }
2567
2568        #[inline(always)]
2569        fn inline_size(_context: fidl::encoding::Context) -> usize {
2570            4
2571        }
2572    }
2573
2574    unsafe impl<D: fidl::encoding::ResourceDialect>
2575        fidl::encoding::Encode<MacAddressingSetModeRequest, D> for &MacAddressingSetModeRequest
2576    {
2577        #[inline]
2578        unsafe fn encode(
2579            self,
2580            encoder: &mut fidl::encoding::Encoder<'_, D>,
2581            offset: usize,
2582            _depth: fidl::encoding::Depth,
2583        ) -> fidl::Result<()> {
2584            encoder.debug_check_bounds::<MacAddressingSetModeRequest>(offset);
2585            // Delegate to tuple encoding.
2586            fidl::encoding::Encode::<MacAddressingSetModeRequest, D>::encode(
2587                (<MacFilterMode as fidl::encoding::ValueTypeMarker>::borrow(&self.mode),),
2588                encoder,
2589                offset,
2590                _depth,
2591            )
2592        }
2593    }
2594    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<MacFilterMode, D>>
2595        fidl::encoding::Encode<MacAddressingSetModeRequest, D> for (T0,)
2596    {
2597        #[inline]
2598        unsafe fn encode(
2599            self,
2600            encoder: &mut fidl::encoding::Encoder<'_, D>,
2601            offset: usize,
2602            depth: fidl::encoding::Depth,
2603        ) -> fidl::Result<()> {
2604            encoder.debug_check_bounds::<MacAddressingSetModeRequest>(offset);
2605            // Zero out padding regions. There's no need to apply masks
2606            // because the unmasked parts will be overwritten by fields.
2607            // Write the fields.
2608            self.0.encode(encoder, offset + 0, depth)?;
2609            Ok(())
2610        }
2611    }
2612
2613    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2614        for MacAddressingSetModeRequest
2615    {
2616        #[inline(always)]
2617        fn new_empty() -> Self {
2618            Self { mode: fidl::new_empty!(MacFilterMode, D) }
2619        }
2620
2621        #[inline]
2622        unsafe fn decode(
2623            &mut self,
2624            decoder: &mut fidl::encoding::Decoder<'_, D>,
2625            offset: usize,
2626            _depth: fidl::encoding::Depth,
2627        ) -> fidl::Result<()> {
2628            decoder.debug_check_bounds::<Self>(offset);
2629            // Verify that padding bytes are zero.
2630            fidl::decode!(MacFilterMode, D, &mut self.mode, decoder, offset + 0, _depth)?;
2631            Ok(())
2632        }
2633    }
2634
2635    impl fidl::encoding::ValueTypeMarker for MacAddressingSetModeResponse {
2636        type Borrowed<'a> = &'a Self;
2637        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2638            value
2639        }
2640    }
2641
2642    unsafe impl fidl::encoding::TypeMarker for MacAddressingSetModeResponse {
2643        type Owned = Self;
2644
2645        #[inline(always)]
2646        fn inline_align(_context: fidl::encoding::Context) -> usize {
2647            4
2648        }
2649
2650        #[inline(always)]
2651        fn inline_size(_context: fidl::encoding::Context) -> usize {
2652            4
2653        }
2654        #[inline(always)]
2655        fn encode_is_copy() -> bool {
2656            true
2657        }
2658
2659        #[inline(always)]
2660        fn decode_is_copy() -> bool {
2661            true
2662        }
2663    }
2664
2665    unsafe impl<D: fidl::encoding::ResourceDialect>
2666        fidl::encoding::Encode<MacAddressingSetModeResponse, D> for &MacAddressingSetModeResponse
2667    {
2668        #[inline]
2669        unsafe fn encode(
2670            self,
2671            encoder: &mut fidl::encoding::Encoder<'_, D>,
2672            offset: usize,
2673            _depth: fidl::encoding::Depth,
2674        ) -> fidl::Result<()> {
2675            encoder.debug_check_bounds::<MacAddressingSetModeResponse>(offset);
2676            unsafe {
2677                // Copy the object into the buffer.
2678                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
2679                (buf_ptr as *mut MacAddressingSetModeResponse)
2680                    .write_unaligned((self as *const MacAddressingSetModeResponse).read());
2681                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
2682                // done second because the memcpy will write garbage to these bytes.
2683            }
2684            Ok(())
2685        }
2686    }
2687    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<i32, D>>
2688        fidl::encoding::Encode<MacAddressingSetModeResponse, D> for (T0,)
2689    {
2690        #[inline]
2691        unsafe fn encode(
2692            self,
2693            encoder: &mut fidl::encoding::Encoder<'_, D>,
2694            offset: usize,
2695            depth: fidl::encoding::Depth,
2696        ) -> fidl::Result<()> {
2697            encoder.debug_check_bounds::<MacAddressingSetModeResponse>(offset);
2698            // Zero out padding regions. There's no need to apply masks
2699            // because the unmasked parts will be overwritten by fields.
2700            // Write the fields.
2701            self.0.encode(encoder, offset + 0, depth)?;
2702            Ok(())
2703        }
2704    }
2705
2706    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2707        for MacAddressingSetModeResponse
2708    {
2709        #[inline(always)]
2710        fn new_empty() -> Self {
2711            Self { status: fidl::new_empty!(i32, D) }
2712        }
2713
2714        #[inline]
2715        unsafe fn decode(
2716            &mut self,
2717            decoder: &mut fidl::encoding::Decoder<'_, D>,
2718            offset: usize,
2719            _depth: fidl::encoding::Depth,
2720        ) -> fidl::Result<()> {
2721            decoder.debug_check_bounds::<Self>(offset);
2722            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
2723            // Verify that padding bytes are zero.
2724            // Copy from the buffer into the object.
2725            unsafe {
2726                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
2727            }
2728            Ok(())
2729        }
2730    }
2731
2732    impl fidl::encoding::ValueTypeMarker for PortGetInfoResponse {
2733        type Borrowed<'a> = &'a Self;
2734        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2735            value
2736        }
2737    }
2738
2739    unsafe impl fidl::encoding::TypeMarker for PortGetInfoResponse {
2740        type Owned = Self;
2741
2742        #[inline(always)]
2743        fn inline_align(_context: fidl::encoding::Context) -> usize {
2744            8
2745        }
2746
2747        #[inline(always)]
2748        fn inline_size(_context: fidl::encoding::Context) -> usize {
2749            16
2750        }
2751    }
2752
2753    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<PortGetInfoResponse, D>
2754        for &PortGetInfoResponse
2755    {
2756        #[inline]
2757        unsafe fn encode(
2758            self,
2759            encoder: &mut fidl::encoding::Encoder<'_, D>,
2760            offset: usize,
2761            _depth: fidl::encoding::Depth,
2762        ) -> fidl::Result<()> {
2763            encoder.debug_check_bounds::<PortGetInfoResponse>(offset);
2764            // Delegate to tuple encoding.
2765            fidl::encoding::Encode::<PortGetInfoResponse, D>::encode(
2766                (<PortInfo as fidl::encoding::ValueTypeMarker>::borrow(&self.info),),
2767                encoder,
2768                offset,
2769                _depth,
2770            )
2771        }
2772    }
2773    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<PortInfo, D>>
2774        fidl::encoding::Encode<PortGetInfoResponse, D> for (T0,)
2775    {
2776        #[inline]
2777        unsafe fn encode(
2778            self,
2779            encoder: &mut fidl::encoding::Encoder<'_, D>,
2780            offset: usize,
2781            depth: fidl::encoding::Depth,
2782        ) -> fidl::Result<()> {
2783            encoder.debug_check_bounds::<PortGetInfoResponse>(offset);
2784            // Zero out padding regions. There's no need to apply masks
2785            // because the unmasked parts will be overwritten by fields.
2786            // Write the fields.
2787            self.0.encode(encoder, offset + 0, depth)?;
2788            Ok(())
2789        }
2790    }
2791
2792    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for PortGetInfoResponse {
2793        #[inline(always)]
2794        fn new_empty() -> Self {
2795            Self { info: fidl::new_empty!(PortInfo, D) }
2796        }
2797
2798        #[inline]
2799        unsafe fn decode(
2800            &mut self,
2801            decoder: &mut fidl::encoding::Decoder<'_, D>,
2802            offset: usize,
2803            _depth: fidl::encoding::Depth,
2804        ) -> fidl::Result<()> {
2805            decoder.debug_check_bounds::<Self>(offset);
2806            // Verify that padding bytes are zero.
2807            fidl::decode!(PortInfo, D, &mut self.info, decoder, offset + 0, _depth)?;
2808            Ok(())
2809        }
2810    }
2811
2812    impl fidl::encoding::ValueTypeMarker for PortGetStatusResponse {
2813        type Borrowed<'a> = &'a Self;
2814        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2815            value
2816        }
2817    }
2818
2819    unsafe impl fidl::encoding::TypeMarker for PortGetStatusResponse {
2820        type Owned = Self;
2821
2822        #[inline(always)]
2823        fn inline_align(_context: fidl::encoding::Context) -> usize {
2824            8
2825        }
2826
2827        #[inline(always)]
2828        fn inline_size(_context: fidl::encoding::Context) -> usize {
2829            16
2830        }
2831    }
2832
2833    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<PortGetStatusResponse, D>
2834        for &PortGetStatusResponse
2835    {
2836        #[inline]
2837        unsafe fn encode(
2838            self,
2839            encoder: &mut fidl::encoding::Encoder<'_, D>,
2840            offset: usize,
2841            _depth: fidl::encoding::Depth,
2842        ) -> fidl::Result<()> {
2843            encoder.debug_check_bounds::<PortGetStatusResponse>(offset);
2844            // Delegate to tuple encoding.
2845            fidl::encoding::Encode::<PortGetStatusResponse, D>::encode(
2846                (<PortStatus as fidl::encoding::ValueTypeMarker>::borrow(&self.status),),
2847                encoder,
2848                offset,
2849                _depth,
2850            )
2851        }
2852    }
2853    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<PortStatus, D>>
2854        fidl::encoding::Encode<PortGetStatusResponse, D> for (T0,)
2855    {
2856        #[inline]
2857        unsafe fn encode(
2858            self,
2859            encoder: &mut fidl::encoding::Encoder<'_, D>,
2860            offset: usize,
2861            depth: fidl::encoding::Depth,
2862        ) -> fidl::Result<()> {
2863            encoder.debug_check_bounds::<PortGetStatusResponse>(offset);
2864            // Zero out padding regions. There's no need to apply masks
2865            // because the unmasked parts will be overwritten by fields.
2866            // Write the fields.
2867            self.0.encode(encoder, offset + 0, depth)?;
2868            Ok(())
2869        }
2870    }
2871
2872    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for PortGetStatusResponse {
2873        #[inline(always)]
2874        fn new_empty() -> Self {
2875            Self { status: fidl::new_empty!(PortStatus, D) }
2876        }
2877
2878        #[inline]
2879        unsafe fn decode(
2880            &mut self,
2881            decoder: &mut fidl::encoding::Decoder<'_, D>,
2882            offset: usize,
2883            _depth: fidl::encoding::Depth,
2884        ) -> fidl::Result<()> {
2885            decoder.debug_check_bounds::<Self>(offset);
2886            // Verify that padding bytes are zero.
2887            fidl::decode!(PortStatus, D, &mut self.status, decoder, offset + 0, _depth)?;
2888            Ok(())
2889        }
2890    }
2891
2892    impl fidl::encoding::ValueTypeMarker for PortId {
2893        type Borrowed<'a> = &'a Self;
2894        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2895            value
2896        }
2897    }
2898
2899    unsafe impl fidl::encoding::TypeMarker for PortId {
2900        type Owned = Self;
2901
2902        #[inline(always)]
2903        fn inline_align(_context: fidl::encoding::Context) -> usize {
2904            1
2905        }
2906
2907        #[inline(always)]
2908        fn inline_size(_context: fidl::encoding::Context) -> usize {
2909            2
2910        }
2911        #[inline(always)]
2912        fn encode_is_copy() -> bool {
2913            true
2914        }
2915
2916        #[inline(always)]
2917        fn decode_is_copy() -> bool {
2918            true
2919        }
2920    }
2921
2922    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<PortId, D> for &PortId {
2923        #[inline]
2924        unsafe fn encode(
2925            self,
2926            encoder: &mut fidl::encoding::Encoder<'_, D>,
2927            offset: usize,
2928            _depth: fidl::encoding::Depth,
2929        ) -> fidl::Result<()> {
2930            encoder.debug_check_bounds::<PortId>(offset);
2931            unsafe {
2932                // Copy the object into the buffer.
2933                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
2934                (buf_ptr as *mut PortId).write_unaligned((self as *const PortId).read());
2935                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
2936                // done second because the memcpy will write garbage to these bytes.
2937            }
2938            Ok(())
2939        }
2940    }
2941    unsafe impl<
2942            D: fidl::encoding::ResourceDialect,
2943            T0: fidl::encoding::Encode<u8, D>,
2944            T1: fidl::encoding::Encode<u8, D>,
2945        > fidl::encoding::Encode<PortId, D> for (T0, T1)
2946    {
2947        #[inline]
2948        unsafe fn encode(
2949            self,
2950            encoder: &mut fidl::encoding::Encoder<'_, D>,
2951            offset: usize,
2952            depth: fidl::encoding::Depth,
2953        ) -> fidl::Result<()> {
2954            encoder.debug_check_bounds::<PortId>(offset);
2955            // Zero out padding regions. There's no need to apply masks
2956            // because the unmasked parts will be overwritten by fields.
2957            // Write the fields.
2958            self.0.encode(encoder, offset + 0, depth)?;
2959            self.1.encode(encoder, offset + 1, depth)?;
2960            Ok(())
2961        }
2962    }
2963
2964    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for PortId {
2965        #[inline(always)]
2966        fn new_empty() -> Self {
2967            Self { base: fidl::new_empty!(u8, D), salt: fidl::new_empty!(u8, D) }
2968        }
2969
2970        #[inline]
2971        unsafe fn decode(
2972            &mut self,
2973            decoder: &mut fidl::encoding::Decoder<'_, D>,
2974            offset: usize,
2975            _depth: fidl::encoding::Depth,
2976        ) -> fidl::Result<()> {
2977            decoder.debug_check_bounds::<Self>(offset);
2978            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
2979            // Verify that padding bytes are zero.
2980            // Copy from the buffer into the object.
2981            unsafe {
2982                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 2);
2983            }
2984            Ok(())
2985        }
2986    }
2987
2988    impl fidl::encoding::ValueTypeMarker for PortWatcherWatchResponse {
2989        type Borrowed<'a> = &'a Self;
2990        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2991            value
2992        }
2993    }
2994
2995    unsafe impl fidl::encoding::TypeMarker for PortWatcherWatchResponse {
2996        type Owned = Self;
2997
2998        #[inline(always)]
2999        fn inline_align(_context: fidl::encoding::Context) -> usize {
3000            8
3001        }
3002
3003        #[inline(always)]
3004        fn inline_size(_context: fidl::encoding::Context) -> usize {
3005            16
3006        }
3007    }
3008
3009    unsafe impl<D: fidl::encoding::ResourceDialect>
3010        fidl::encoding::Encode<PortWatcherWatchResponse, D> for &PortWatcherWatchResponse
3011    {
3012        #[inline]
3013        unsafe fn encode(
3014            self,
3015            encoder: &mut fidl::encoding::Encoder<'_, D>,
3016            offset: usize,
3017            _depth: fidl::encoding::Depth,
3018        ) -> fidl::Result<()> {
3019            encoder.debug_check_bounds::<PortWatcherWatchResponse>(offset);
3020            // Delegate to tuple encoding.
3021            fidl::encoding::Encode::<PortWatcherWatchResponse, D>::encode(
3022                (<DevicePortEvent as fidl::encoding::ValueTypeMarker>::borrow(&self.event),),
3023                encoder,
3024                offset,
3025                _depth,
3026            )
3027        }
3028    }
3029    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<DevicePortEvent, D>>
3030        fidl::encoding::Encode<PortWatcherWatchResponse, D> for (T0,)
3031    {
3032        #[inline]
3033        unsafe fn encode(
3034            self,
3035            encoder: &mut fidl::encoding::Encoder<'_, D>,
3036            offset: usize,
3037            depth: fidl::encoding::Depth,
3038        ) -> fidl::Result<()> {
3039            encoder.debug_check_bounds::<PortWatcherWatchResponse>(offset);
3040            // Zero out padding regions. There's no need to apply masks
3041            // because the unmasked parts will be overwritten by fields.
3042            // Write the fields.
3043            self.0.encode(encoder, offset + 0, depth)?;
3044            Ok(())
3045        }
3046    }
3047
3048    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3049        for PortWatcherWatchResponse
3050    {
3051        #[inline(always)]
3052        fn new_empty() -> Self {
3053            Self { event: fidl::new_empty!(DevicePortEvent, D) }
3054        }
3055
3056        #[inline]
3057        unsafe fn decode(
3058            &mut self,
3059            decoder: &mut fidl::encoding::Decoder<'_, D>,
3060            offset: usize,
3061            _depth: fidl::encoding::Depth,
3062        ) -> fidl::Result<()> {
3063            decoder.debug_check_bounds::<Self>(offset);
3064            // Verify that padding bytes are zero.
3065            fidl::decode!(DevicePortEvent, D, &mut self.event, decoder, offset + 0, _depth)?;
3066            Ok(())
3067        }
3068    }
3069
3070    impl fidl::encoding::ValueTypeMarker for SessionAttachRequest {
3071        type Borrowed<'a> = &'a Self;
3072        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3073            value
3074        }
3075    }
3076
3077    unsafe impl fidl::encoding::TypeMarker for SessionAttachRequest {
3078        type Owned = Self;
3079
3080        #[inline(always)]
3081        fn inline_align(_context: fidl::encoding::Context) -> usize {
3082            8
3083        }
3084
3085        #[inline(always)]
3086        fn inline_size(_context: fidl::encoding::Context) -> usize {
3087            24
3088        }
3089    }
3090
3091    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<SessionAttachRequest, D>
3092        for &SessionAttachRequest
3093    {
3094        #[inline]
3095        unsafe fn encode(
3096            self,
3097            encoder: &mut fidl::encoding::Encoder<'_, D>,
3098            offset: usize,
3099            _depth: fidl::encoding::Depth,
3100        ) -> fidl::Result<()> {
3101            encoder.debug_check_bounds::<SessionAttachRequest>(offset);
3102            // Delegate to tuple encoding.
3103            fidl::encoding::Encode::<SessionAttachRequest, D>::encode(
3104                (
3105                    <PortId as fidl::encoding::ValueTypeMarker>::borrow(&self.port),
3106                    <fidl::encoding::Vector<FrameType, 4> as fidl::encoding::ValueTypeMarker>::borrow(&self.rx_frames),
3107                ),
3108                encoder, offset, _depth
3109            )
3110        }
3111    }
3112    unsafe impl<
3113            D: fidl::encoding::ResourceDialect,
3114            T0: fidl::encoding::Encode<PortId, D>,
3115            T1: fidl::encoding::Encode<fidl::encoding::Vector<FrameType, 4>, D>,
3116        > fidl::encoding::Encode<SessionAttachRequest, D> for (T0, T1)
3117    {
3118        #[inline]
3119        unsafe fn encode(
3120            self,
3121            encoder: &mut fidl::encoding::Encoder<'_, D>,
3122            offset: usize,
3123            depth: fidl::encoding::Depth,
3124        ) -> fidl::Result<()> {
3125            encoder.debug_check_bounds::<SessionAttachRequest>(offset);
3126            // Zero out padding regions. There's no need to apply masks
3127            // because the unmasked parts will be overwritten by fields.
3128            unsafe {
3129                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
3130                (ptr as *mut u64).write_unaligned(0);
3131            }
3132            // Write the fields.
3133            self.0.encode(encoder, offset + 0, depth)?;
3134            self.1.encode(encoder, offset + 8, depth)?;
3135            Ok(())
3136        }
3137    }
3138
3139    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SessionAttachRequest {
3140        #[inline(always)]
3141        fn new_empty() -> Self {
3142            Self {
3143                port: fidl::new_empty!(PortId, D),
3144                rx_frames: fidl::new_empty!(fidl::encoding::Vector<FrameType, 4>, D),
3145            }
3146        }
3147
3148        #[inline]
3149        unsafe fn decode(
3150            &mut self,
3151            decoder: &mut fidl::encoding::Decoder<'_, D>,
3152            offset: usize,
3153            _depth: fidl::encoding::Depth,
3154        ) -> fidl::Result<()> {
3155            decoder.debug_check_bounds::<Self>(offset);
3156            // Verify that padding bytes are zero.
3157            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
3158            let padval = unsafe { (ptr as *const u64).read_unaligned() };
3159            let mask = 0xffffffffffff0000u64;
3160            let maskedval = padval & mask;
3161            if maskedval != 0 {
3162                return Err(fidl::Error::NonZeroPadding {
3163                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
3164                });
3165            }
3166            fidl::decode!(PortId, D, &mut self.port, decoder, offset + 0, _depth)?;
3167            fidl::decode!(fidl::encoding::Vector<FrameType, 4>, D, &mut self.rx_frames, decoder, offset + 8, _depth)?;
3168            Ok(())
3169        }
3170    }
3171
3172    impl fidl::encoding::ValueTypeMarker for SessionDetachRequest {
3173        type Borrowed<'a> = &'a Self;
3174        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3175            value
3176        }
3177    }
3178
3179    unsafe impl fidl::encoding::TypeMarker for SessionDetachRequest {
3180        type Owned = Self;
3181
3182        #[inline(always)]
3183        fn inline_align(_context: fidl::encoding::Context) -> usize {
3184            1
3185        }
3186
3187        #[inline(always)]
3188        fn inline_size(_context: fidl::encoding::Context) -> usize {
3189            2
3190        }
3191        #[inline(always)]
3192        fn encode_is_copy() -> bool {
3193            true
3194        }
3195
3196        #[inline(always)]
3197        fn decode_is_copy() -> bool {
3198            true
3199        }
3200    }
3201
3202    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<SessionDetachRequest, D>
3203        for &SessionDetachRequest
3204    {
3205        #[inline]
3206        unsafe fn encode(
3207            self,
3208            encoder: &mut fidl::encoding::Encoder<'_, D>,
3209            offset: usize,
3210            _depth: fidl::encoding::Depth,
3211        ) -> fidl::Result<()> {
3212            encoder.debug_check_bounds::<SessionDetachRequest>(offset);
3213            unsafe {
3214                // Copy the object into the buffer.
3215                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
3216                (buf_ptr as *mut SessionDetachRequest)
3217                    .write_unaligned((self as *const SessionDetachRequest).read());
3218                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
3219                // done second because the memcpy will write garbage to these bytes.
3220            }
3221            Ok(())
3222        }
3223    }
3224    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<PortId, D>>
3225        fidl::encoding::Encode<SessionDetachRequest, D> for (T0,)
3226    {
3227        #[inline]
3228        unsafe fn encode(
3229            self,
3230            encoder: &mut fidl::encoding::Encoder<'_, D>,
3231            offset: usize,
3232            depth: fidl::encoding::Depth,
3233        ) -> fidl::Result<()> {
3234            encoder.debug_check_bounds::<SessionDetachRequest>(offset);
3235            // Zero out padding regions. There's no need to apply masks
3236            // because the unmasked parts will be overwritten by fields.
3237            // Write the fields.
3238            self.0.encode(encoder, offset + 0, depth)?;
3239            Ok(())
3240        }
3241    }
3242
3243    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SessionDetachRequest {
3244        #[inline(always)]
3245        fn new_empty() -> Self {
3246            Self { port: fidl::new_empty!(PortId, D) }
3247        }
3248
3249        #[inline]
3250        unsafe fn decode(
3251            &mut self,
3252            decoder: &mut fidl::encoding::Decoder<'_, D>,
3253            offset: usize,
3254            _depth: fidl::encoding::Depth,
3255        ) -> fidl::Result<()> {
3256            decoder.debug_check_bounds::<Self>(offset);
3257            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
3258            // Verify that padding bytes are zero.
3259            // Copy from the buffer into the object.
3260            unsafe {
3261                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 2);
3262            }
3263            Ok(())
3264        }
3265    }
3266
3267    impl fidl::encoding::ValueTypeMarker for StatusWatcherWatchStatusResponse {
3268        type Borrowed<'a> = &'a Self;
3269        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3270            value
3271        }
3272    }
3273
3274    unsafe impl fidl::encoding::TypeMarker for StatusWatcherWatchStatusResponse {
3275        type Owned = Self;
3276
3277        #[inline(always)]
3278        fn inline_align(_context: fidl::encoding::Context) -> usize {
3279            8
3280        }
3281
3282        #[inline(always)]
3283        fn inline_size(_context: fidl::encoding::Context) -> usize {
3284            16
3285        }
3286    }
3287
3288    unsafe impl<D: fidl::encoding::ResourceDialect>
3289        fidl::encoding::Encode<StatusWatcherWatchStatusResponse, D>
3290        for &StatusWatcherWatchStatusResponse
3291    {
3292        #[inline]
3293        unsafe fn encode(
3294            self,
3295            encoder: &mut fidl::encoding::Encoder<'_, D>,
3296            offset: usize,
3297            _depth: fidl::encoding::Depth,
3298        ) -> fidl::Result<()> {
3299            encoder.debug_check_bounds::<StatusWatcherWatchStatusResponse>(offset);
3300            // Delegate to tuple encoding.
3301            fidl::encoding::Encode::<StatusWatcherWatchStatusResponse, D>::encode(
3302                (<PortStatus as fidl::encoding::ValueTypeMarker>::borrow(&self.port_status),),
3303                encoder,
3304                offset,
3305                _depth,
3306            )
3307        }
3308    }
3309    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<PortStatus, D>>
3310        fidl::encoding::Encode<StatusWatcherWatchStatusResponse, D> for (T0,)
3311    {
3312        #[inline]
3313        unsafe fn encode(
3314            self,
3315            encoder: &mut fidl::encoding::Encoder<'_, D>,
3316            offset: usize,
3317            depth: fidl::encoding::Depth,
3318        ) -> fidl::Result<()> {
3319            encoder.debug_check_bounds::<StatusWatcherWatchStatusResponse>(offset);
3320            // Zero out padding regions. There's no need to apply masks
3321            // because the unmasked parts will be overwritten by fields.
3322            // Write the fields.
3323            self.0.encode(encoder, offset + 0, depth)?;
3324            Ok(())
3325        }
3326    }
3327
3328    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3329        for StatusWatcherWatchStatusResponse
3330    {
3331        #[inline(always)]
3332        fn new_empty() -> Self {
3333            Self { port_status: fidl::new_empty!(PortStatus, D) }
3334        }
3335
3336        #[inline]
3337        unsafe fn decode(
3338            &mut self,
3339            decoder: &mut fidl::encoding::Decoder<'_, D>,
3340            offset: usize,
3341            _depth: fidl::encoding::Depth,
3342        ) -> fidl::Result<()> {
3343            decoder.debug_check_bounds::<Self>(offset);
3344            // Verify that padding bytes are zero.
3345            fidl::decode!(PortStatus, D, &mut self.port_status, decoder, offset + 0, _depth)?;
3346            Ok(())
3347        }
3348    }
3349
3350    impl DeviceBaseInfo {
3351        #[inline(always)]
3352        fn max_ordinal_present(&self) -> u64 {
3353            if let Some(_) = self.tx_accel {
3354                return 11;
3355            }
3356            if let Some(_) = self.rx_accel {
3357                return 10;
3358            }
3359            if let Some(_) = self.max_buffer_parts {
3360                return 9;
3361            }
3362            if let Some(_) = self.min_tx_buffer_tail {
3363                return 8;
3364            }
3365            if let Some(_) = self.min_tx_buffer_head {
3366                return 7;
3367            }
3368            if let Some(_) = self.min_tx_buffer_length {
3369                return 6;
3370            }
3371            if let Some(_) = self.min_rx_buffer_length {
3372                return 5;
3373            }
3374            if let Some(_) = self.max_buffer_length {
3375                return 4;
3376            }
3377            if let Some(_) = self.buffer_alignment {
3378                return 3;
3379            }
3380            if let Some(_) = self.tx_depth {
3381                return 2;
3382            }
3383            if let Some(_) = self.rx_depth {
3384                return 1;
3385            }
3386            0
3387        }
3388    }
3389
3390    impl fidl::encoding::ValueTypeMarker for DeviceBaseInfo {
3391        type Borrowed<'a> = &'a Self;
3392        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3393            value
3394        }
3395    }
3396
3397    unsafe impl fidl::encoding::TypeMarker for DeviceBaseInfo {
3398        type Owned = Self;
3399
3400        #[inline(always)]
3401        fn inline_align(_context: fidl::encoding::Context) -> usize {
3402            8
3403        }
3404
3405        #[inline(always)]
3406        fn inline_size(_context: fidl::encoding::Context) -> usize {
3407            16
3408        }
3409    }
3410
3411    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<DeviceBaseInfo, D>
3412        for &DeviceBaseInfo
3413    {
3414        unsafe fn encode(
3415            self,
3416            encoder: &mut fidl::encoding::Encoder<'_, D>,
3417            offset: usize,
3418            mut depth: fidl::encoding::Depth,
3419        ) -> fidl::Result<()> {
3420            encoder.debug_check_bounds::<DeviceBaseInfo>(offset);
3421            // Vector header
3422            let max_ordinal: u64 = self.max_ordinal_present();
3423            encoder.write_num(max_ordinal, offset);
3424            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
3425            // Calling encoder.out_of_line_offset(0) is not allowed.
3426            if max_ordinal == 0 {
3427                return Ok(());
3428            }
3429            depth.increment()?;
3430            let envelope_size = 8;
3431            let bytes_len = max_ordinal as usize * envelope_size;
3432            #[allow(unused_variables)]
3433            let offset = encoder.out_of_line_offset(bytes_len);
3434            let mut _prev_end_offset: usize = 0;
3435            if 1 > max_ordinal {
3436                return Ok(());
3437            }
3438
3439            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3440            // are envelope_size bytes.
3441            let cur_offset: usize = (1 - 1) * envelope_size;
3442
3443            // Zero reserved fields.
3444            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3445
3446            // Safety:
3447            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3448            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3449            //   envelope_size bytes, there is always sufficient room.
3450            fidl::encoding::encode_in_envelope_optional::<u16, D>(
3451                self.rx_depth.as_ref().map(<u16 as fidl::encoding::ValueTypeMarker>::borrow),
3452                encoder,
3453                offset + cur_offset,
3454                depth,
3455            )?;
3456
3457            _prev_end_offset = cur_offset + envelope_size;
3458            if 2 > max_ordinal {
3459                return Ok(());
3460            }
3461
3462            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3463            // are envelope_size bytes.
3464            let cur_offset: usize = (2 - 1) * envelope_size;
3465
3466            // Zero reserved fields.
3467            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3468
3469            // Safety:
3470            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3471            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3472            //   envelope_size bytes, there is always sufficient room.
3473            fidl::encoding::encode_in_envelope_optional::<u16, D>(
3474                self.tx_depth.as_ref().map(<u16 as fidl::encoding::ValueTypeMarker>::borrow),
3475                encoder,
3476                offset + cur_offset,
3477                depth,
3478            )?;
3479
3480            _prev_end_offset = cur_offset + envelope_size;
3481            if 3 > max_ordinal {
3482                return Ok(());
3483            }
3484
3485            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3486            // are envelope_size bytes.
3487            let cur_offset: usize = (3 - 1) * envelope_size;
3488
3489            // Zero reserved fields.
3490            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3491
3492            // Safety:
3493            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3494            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3495            //   envelope_size bytes, there is always sufficient room.
3496            fidl::encoding::encode_in_envelope_optional::<u32, D>(
3497                self.buffer_alignment
3498                    .as_ref()
3499                    .map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
3500                encoder,
3501                offset + cur_offset,
3502                depth,
3503            )?;
3504
3505            _prev_end_offset = cur_offset + envelope_size;
3506            if 4 > max_ordinal {
3507                return Ok(());
3508            }
3509
3510            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3511            // are envelope_size bytes.
3512            let cur_offset: usize = (4 - 1) * envelope_size;
3513
3514            // Zero reserved fields.
3515            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3516
3517            // Safety:
3518            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3519            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3520            //   envelope_size bytes, there is always sufficient room.
3521            fidl::encoding::encode_in_envelope_optional::<u32, D>(
3522                self.max_buffer_length
3523                    .as_ref()
3524                    .map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
3525                encoder,
3526                offset + cur_offset,
3527                depth,
3528            )?;
3529
3530            _prev_end_offset = cur_offset + envelope_size;
3531            if 5 > max_ordinal {
3532                return Ok(());
3533            }
3534
3535            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3536            // are envelope_size bytes.
3537            let cur_offset: usize = (5 - 1) * envelope_size;
3538
3539            // Zero reserved fields.
3540            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3541
3542            // Safety:
3543            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3544            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3545            //   envelope_size bytes, there is always sufficient room.
3546            fidl::encoding::encode_in_envelope_optional::<u32, D>(
3547                self.min_rx_buffer_length
3548                    .as_ref()
3549                    .map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
3550                encoder,
3551                offset + cur_offset,
3552                depth,
3553            )?;
3554
3555            _prev_end_offset = cur_offset + envelope_size;
3556            if 6 > max_ordinal {
3557                return Ok(());
3558            }
3559
3560            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3561            // are envelope_size bytes.
3562            let cur_offset: usize = (6 - 1) * envelope_size;
3563
3564            // Zero reserved fields.
3565            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3566
3567            // Safety:
3568            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3569            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3570            //   envelope_size bytes, there is always sufficient room.
3571            fidl::encoding::encode_in_envelope_optional::<u32, D>(
3572                self.min_tx_buffer_length
3573                    .as_ref()
3574                    .map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
3575                encoder,
3576                offset + cur_offset,
3577                depth,
3578            )?;
3579
3580            _prev_end_offset = cur_offset + envelope_size;
3581            if 7 > max_ordinal {
3582                return Ok(());
3583            }
3584
3585            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3586            // are envelope_size bytes.
3587            let cur_offset: usize = (7 - 1) * envelope_size;
3588
3589            // Zero reserved fields.
3590            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3591
3592            // Safety:
3593            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3594            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3595            //   envelope_size bytes, there is always sufficient room.
3596            fidl::encoding::encode_in_envelope_optional::<u16, D>(
3597                self.min_tx_buffer_head
3598                    .as_ref()
3599                    .map(<u16 as fidl::encoding::ValueTypeMarker>::borrow),
3600                encoder,
3601                offset + cur_offset,
3602                depth,
3603            )?;
3604
3605            _prev_end_offset = cur_offset + envelope_size;
3606            if 8 > max_ordinal {
3607                return Ok(());
3608            }
3609
3610            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3611            // are envelope_size bytes.
3612            let cur_offset: usize = (8 - 1) * envelope_size;
3613
3614            // Zero reserved fields.
3615            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3616
3617            // Safety:
3618            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3619            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3620            //   envelope_size bytes, there is always sufficient room.
3621            fidl::encoding::encode_in_envelope_optional::<u16, D>(
3622                self.min_tx_buffer_tail
3623                    .as_ref()
3624                    .map(<u16 as fidl::encoding::ValueTypeMarker>::borrow),
3625                encoder,
3626                offset + cur_offset,
3627                depth,
3628            )?;
3629
3630            _prev_end_offset = cur_offset + envelope_size;
3631            if 9 > max_ordinal {
3632                return Ok(());
3633            }
3634
3635            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3636            // are envelope_size bytes.
3637            let cur_offset: usize = (9 - 1) * envelope_size;
3638
3639            // Zero reserved fields.
3640            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3641
3642            // Safety:
3643            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3644            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3645            //   envelope_size bytes, there is always sufficient room.
3646            fidl::encoding::encode_in_envelope_optional::<u8, D>(
3647                self.max_buffer_parts.as_ref().map(<u8 as fidl::encoding::ValueTypeMarker>::borrow),
3648                encoder,
3649                offset + cur_offset,
3650                depth,
3651            )?;
3652
3653            _prev_end_offset = cur_offset + envelope_size;
3654            if 10 > max_ordinal {
3655                return Ok(());
3656            }
3657
3658            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3659            // are envelope_size bytes.
3660            let cur_offset: usize = (10 - 1) * envelope_size;
3661
3662            // Zero reserved fields.
3663            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3664
3665            // Safety:
3666            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3667            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3668            //   envelope_size bytes, there is always sufficient room.
3669            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<RxAcceleration, 16>, D>(
3670            self.rx_accel.as_ref().map(<fidl::encoding::Vector<RxAcceleration, 16> as fidl::encoding::ValueTypeMarker>::borrow),
3671            encoder, offset + cur_offset, depth
3672        )?;
3673
3674            _prev_end_offset = cur_offset + envelope_size;
3675            if 11 > max_ordinal {
3676                return Ok(());
3677            }
3678
3679            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3680            // are envelope_size bytes.
3681            let cur_offset: usize = (11 - 1) * envelope_size;
3682
3683            // Zero reserved fields.
3684            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3685
3686            // Safety:
3687            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3688            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3689            //   envelope_size bytes, there is always sufficient room.
3690            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<TxAcceleration, 16>, D>(
3691            self.tx_accel.as_ref().map(<fidl::encoding::Vector<TxAcceleration, 16> as fidl::encoding::ValueTypeMarker>::borrow),
3692            encoder, offset + cur_offset, depth
3693        )?;
3694
3695            _prev_end_offset = cur_offset + envelope_size;
3696
3697            Ok(())
3698        }
3699    }
3700
3701    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for DeviceBaseInfo {
3702        #[inline(always)]
3703        fn new_empty() -> Self {
3704            Self::default()
3705        }
3706
3707        unsafe fn decode(
3708            &mut self,
3709            decoder: &mut fidl::encoding::Decoder<'_, D>,
3710            offset: usize,
3711            mut depth: fidl::encoding::Depth,
3712        ) -> fidl::Result<()> {
3713            decoder.debug_check_bounds::<Self>(offset);
3714            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
3715                None => return Err(fidl::Error::NotNullable),
3716                Some(len) => len,
3717            };
3718            // Calling decoder.out_of_line_offset(0) is not allowed.
3719            if len == 0 {
3720                return Ok(());
3721            };
3722            depth.increment()?;
3723            let envelope_size = 8;
3724            let bytes_len = len * envelope_size;
3725            let offset = decoder.out_of_line_offset(bytes_len)?;
3726            // Decode the envelope for each type.
3727            let mut _next_ordinal_to_read = 0;
3728            let mut next_offset = offset;
3729            let end_offset = offset + bytes_len;
3730            _next_ordinal_to_read += 1;
3731            if next_offset >= end_offset {
3732                return Ok(());
3733            }
3734
3735            // Decode unknown envelopes for gaps in ordinals.
3736            while _next_ordinal_to_read < 1 {
3737                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3738                _next_ordinal_to_read += 1;
3739                next_offset += envelope_size;
3740            }
3741
3742            let next_out_of_line = decoder.next_out_of_line();
3743            let handles_before = decoder.remaining_handles();
3744            if let Some((inlined, num_bytes, num_handles)) =
3745                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3746            {
3747                let member_inline_size =
3748                    <u16 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3749                if inlined != (member_inline_size <= 4) {
3750                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3751                }
3752                let inner_offset;
3753                let mut inner_depth = depth.clone();
3754                if inlined {
3755                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3756                    inner_offset = next_offset;
3757                } else {
3758                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3759                    inner_depth.increment()?;
3760                }
3761                let val_ref = self.rx_depth.get_or_insert_with(|| fidl::new_empty!(u16, D));
3762                fidl::decode!(u16, D, val_ref, decoder, inner_offset, inner_depth)?;
3763                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3764                {
3765                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3766                }
3767                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3768                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3769                }
3770            }
3771
3772            next_offset += envelope_size;
3773            _next_ordinal_to_read += 1;
3774            if next_offset >= end_offset {
3775                return Ok(());
3776            }
3777
3778            // Decode unknown envelopes for gaps in ordinals.
3779            while _next_ordinal_to_read < 2 {
3780                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3781                _next_ordinal_to_read += 1;
3782                next_offset += envelope_size;
3783            }
3784
3785            let next_out_of_line = decoder.next_out_of_line();
3786            let handles_before = decoder.remaining_handles();
3787            if let Some((inlined, num_bytes, num_handles)) =
3788                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3789            {
3790                let member_inline_size =
3791                    <u16 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3792                if inlined != (member_inline_size <= 4) {
3793                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3794                }
3795                let inner_offset;
3796                let mut inner_depth = depth.clone();
3797                if inlined {
3798                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3799                    inner_offset = next_offset;
3800                } else {
3801                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3802                    inner_depth.increment()?;
3803                }
3804                let val_ref = self.tx_depth.get_or_insert_with(|| fidl::new_empty!(u16, D));
3805                fidl::decode!(u16, D, val_ref, decoder, inner_offset, inner_depth)?;
3806                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3807                {
3808                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3809                }
3810                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3811                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3812                }
3813            }
3814
3815            next_offset += envelope_size;
3816            _next_ordinal_to_read += 1;
3817            if next_offset >= end_offset {
3818                return Ok(());
3819            }
3820
3821            // Decode unknown envelopes for gaps in ordinals.
3822            while _next_ordinal_to_read < 3 {
3823                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3824                _next_ordinal_to_read += 1;
3825                next_offset += envelope_size;
3826            }
3827
3828            let next_out_of_line = decoder.next_out_of_line();
3829            let handles_before = decoder.remaining_handles();
3830            if let Some((inlined, num_bytes, num_handles)) =
3831                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3832            {
3833                let member_inline_size =
3834                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3835                if inlined != (member_inline_size <= 4) {
3836                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3837                }
3838                let inner_offset;
3839                let mut inner_depth = depth.clone();
3840                if inlined {
3841                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3842                    inner_offset = next_offset;
3843                } else {
3844                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3845                    inner_depth.increment()?;
3846                }
3847                let val_ref = self.buffer_alignment.get_or_insert_with(|| fidl::new_empty!(u32, D));
3848                fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
3849                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3850                {
3851                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3852                }
3853                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3854                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3855                }
3856            }
3857
3858            next_offset += envelope_size;
3859            _next_ordinal_to_read += 1;
3860            if next_offset >= end_offset {
3861                return Ok(());
3862            }
3863
3864            // Decode unknown envelopes for gaps in ordinals.
3865            while _next_ordinal_to_read < 4 {
3866                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3867                _next_ordinal_to_read += 1;
3868                next_offset += envelope_size;
3869            }
3870
3871            let next_out_of_line = decoder.next_out_of_line();
3872            let handles_before = decoder.remaining_handles();
3873            if let Some((inlined, num_bytes, num_handles)) =
3874                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3875            {
3876                let member_inline_size =
3877                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3878                if inlined != (member_inline_size <= 4) {
3879                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3880                }
3881                let inner_offset;
3882                let mut inner_depth = depth.clone();
3883                if inlined {
3884                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3885                    inner_offset = next_offset;
3886                } else {
3887                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3888                    inner_depth.increment()?;
3889                }
3890                let val_ref =
3891                    self.max_buffer_length.get_or_insert_with(|| fidl::new_empty!(u32, D));
3892                fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
3893                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3894                {
3895                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3896                }
3897                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3898                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3899                }
3900            }
3901
3902            next_offset += envelope_size;
3903            _next_ordinal_to_read += 1;
3904            if next_offset >= end_offset {
3905                return Ok(());
3906            }
3907
3908            // Decode unknown envelopes for gaps in ordinals.
3909            while _next_ordinal_to_read < 5 {
3910                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3911                _next_ordinal_to_read += 1;
3912                next_offset += envelope_size;
3913            }
3914
3915            let next_out_of_line = decoder.next_out_of_line();
3916            let handles_before = decoder.remaining_handles();
3917            if let Some((inlined, num_bytes, num_handles)) =
3918                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3919            {
3920                let member_inline_size =
3921                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3922                if inlined != (member_inline_size <= 4) {
3923                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3924                }
3925                let inner_offset;
3926                let mut inner_depth = depth.clone();
3927                if inlined {
3928                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3929                    inner_offset = next_offset;
3930                } else {
3931                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3932                    inner_depth.increment()?;
3933                }
3934                let val_ref =
3935                    self.min_rx_buffer_length.get_or_insert_with(|| fidl::new_empty!(u32, D));
3936                fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
3937                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3938                {
3939                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3940                }
3941                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3942                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3943                }
3944            }
3945
3946            next_offset += envelope_size;
3947            _next_ordinal_to_read += 1;
3948            if next_offset >= end_offset {
3949                return Ok(());
3950            }
3951
3952            // Decode unknown envelopes for gaps in ordinals.
3953            while _next_ordinal_to_read < 6 {
3954                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3955                _next_ordinal_to_read += 1;
3956                next_offset += envelope_size;
3957            }
3958
3959            let next_out_of_line = decoder.next_out_of_line();
3960            let handles_before = decoder.remaining_handles();
3961            if let Some((inlined, num_bytes, num_handles)) =
3962                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3963            {
3964                let member_inline_size =
3965                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3966                if inlined != (member_inline_size <= 4) {
3967                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3968                }
3969                let inner_offset;
3970                let mut inner_depth = depth.clone();
3971                if inlined {
3972                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3973                    inner_offset = next_offset;
3974                } else {
3975                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3976                    inner_depth.increment()?;
3977                }
3978                let val_ref =
3979                    self.min_tx_buffer_length.get_or_insert_with(|| fidl::new_empty!(u32, D));
3980                fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
3981                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3982                {
3983                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3984                }
3985                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3986                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3987                }
3988            }
3989
3990            next_offset += envelope_size;
3991            _next_ordinal_to_read += 1;
3992            if next_offset >= end_offset {
3993                return Ok(());
3994            }
3995
3996            // Decode unknown envelopes for gaps in ordinals.
3997            while _next_ordinal_to_read < 7 {
3998                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3999                _next_ordinal_to_read += 1;
4000                next_offset += envelope_size;
4001            }
4002
4003            let next_out_of_line = decoder.next_out_of_line();
4004            let handles_before = decoder.remaining_handles();
4005            if let Some((inlined, num_bytes, num_handles)) =
4006                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4007            {
4008                let member_inline_size =
4009                    <u16 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4010                if inlined != (member_inline_size <= 4) {
4011                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4012                }
4013                let inner_offset;
4014                let mut inner_depth = depth.clone();
4015                if inlined {
4016                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4017                    inner_offset = next_offset;
4018                } else {
4019                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4020                    inner_depth.increment()?;
4021                }
4022                let val_ref =
4023                    self.min_tx_buffer_head.get_or_insert_with(|| fidl::new_empty!(u16, D));
4024                fidl::decode!(u16, D, val_ref, decoder, inner_offset, inner_depth)?;
4025                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4026                {
4027                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4028                }
4029                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4030                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4031                }
4032            }
4033
4034            next_offset += envelope_size;
4035            _next_ordinal_to_read += 1;
4036            if next_offset >= end_offset {
4037                return Ok(());
4038            }
4039
4040            // Decode unknown envelopes for gaps in ordinals.
4041            while _next_ordinal_to_read < 8 {
4042                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4043                _next_ordinal_to_read += 1;
4044                next_offset += envelope_size;
4045            }
4046
4047            let next_out_of_line = decoder.next_out_of_line();
4048            let handles_before = decoder.remaining_handles();
4049            if let Some((inlined, num_bytes, num_handles)) =
4050                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4051            {
4052                let member_inline_size =
4053                    <u16 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4054                if inlined != (member_inline_size <= 4) {
4055                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4056                }
4057                let inner_offset;
4058                let mut inner_depth = depth.clone();
4059                if inlined {
4060                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4061                    inner_offset = next_offset;
4062                } else {
4063                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4064                    inner_depth.increment()?;
4065                }
4066                let val_ref =
4067                    self.min_tx_buffer_tail.get_or_insert_with(|| fidl::new_empty!(u16, D));
4068                fidl::decode!(u16, D, val_ref, decoder, inner_offset, inner_depth)?;
4069                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4070                {
4071                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4072                }
4073                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4074                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4075                }
4076            }
4077
4078            next_offset += envelope_size;
4079            _next_ordinal_to_read += 1;
4080            if next_offset >= end_offset {
4081                return Ok(());
4082            }
4083
4084            // Decode unknown envelopes for gaps in ordinals.
4085            while _next_ordinal_to_read < 9 {
4086                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4087                _next_ordinal_to_read += 1;
4088                next_offset += envelope_size;
4089            }
4090
4091            let next_out_of_line = decoder.next_out_of_line();
4092            let handles_before = decoder.remaining_handles();
4093            if let Some((inlined, num_bytes, num_handles)) =
4094                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4095            {
4096                let member_inline_size =
4097                    <u8 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4098                if inlined != (member_inline_size <= 4) {
4099                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4100                }
4101                let inner_offset;
4102                let mut inner_depth = depth.clone();
4103                if inlined {
4104                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4105                    inner_offset = next_offset;
4106                } else {
4107                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4108                    inner_depth.increment()?;
4109                }
4110                let val_ref = self.max_buffer_parts.get_or_insert_with(|| fidl::new_empty!(u8, D));
4111                fidl::decode!(u8, D, val_ref, decoder, inner_offset, inner_depth)?;
4112                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4113                {
4114                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4115                }
4116                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4117                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4118                }
4119            }
4120
4121            next_offset += envelope_size;
4122            _next_ordinal_to_read += 1;
4123            if next_offset >= end_offset {
4124                return Ok(());
4125            }
4126
4127            // Decode unknown envelopes for gaps in ordinals.
4128            while _next_ordinal_to_read < 10 {
4129                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4130                _next_ordinal_to_read += 1;
4131                next_offset += envelope_size;
4132            }
4133
4134            let next_out_of_line = decoder.next_out_of_line();
4135            let handles_before = decoder.remaining_handles();
4136            if let Some((inlined, num_bytes, num_handles)) =
4137                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4138            {
4139                let member_inline_size = <fidl::encoding::Vector<RxAcceleration, 16> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4140                if inlined != (member_inline_size <= 4) {
4141                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4142                }
4143                let inner_offset;
4144                let mut inner_depth = depth.clone();
4145                if inlined {
4146                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4147                    inner_offset = next_offset;
4148                } else {
4149                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4150                    inner_depth.increment()?;
4151                }
4152                let val_ref = self.rx_accel.get_or_insert_with(
4153                    || fidl::new_empty!(fidl::encoding::Vector<RxAcceleration, 16>, D),
4154                );
4155                fidl::decode!(fidl::encoding::Vector<RxAcceleration, 16>, D, val_ref, decoder, inner_offset, inner_depth)?;
4156                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4157                {
4158                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4159                }
4160                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4161                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4162                }
4163            }
4164
4165            next_offset += envelope_size;
4166            _next_ordinal_to_read += 1;
4167            if next_offset >= end_offset {
4168                return Ok(());
4169            }
4170
4171            // Decode unknown envelopes for gaps in ordinals.
4172            while _next_ordinal_to_read < 11 {
4173                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4174                _next_ordinal_to_read += 1;
4175                next_offset += envelope_size;
4176            }
4177
4178            let next_out_of_line = decoder.next_out_of_line();
4179            let handles_before = decoder.remaining_handles();
4180            if let Some((inlined, num_bytes, num_handles)) =
4181                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4182            {
4183                let member_inline_size = <fidl::encoding::Vector<TxAcceleration, 16> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4184                if inlined != (member_inline_size <= 4) {
4185                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4186                }
4187                let inner_offset;
4188                let mut inner_depth = depth.clone();
4189                if inlined {
4190                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4191                    inner_offset = next_offset;
4192                } else {
4193                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4194                    inner_depth.increment()?;
4195                }
4196                let val_ref = self.tx_accel.get_or_insert_with(
4197                    || fidl::new_empty!(fidl::encoding::Vector<TxAcceleration, 16>, D),
4198                );
4199                fidl::decode!(fidl::encoding::Vector<TxAcceleration, 16>, D, val_ref, decoder, inner_offset, inner_depth)?;
4200                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4201                {
4202                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4203                }
4204                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4205                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4206                }
4207            }
4208
4209            next_offset += envelope_size;
4210
4211            // Decode the remaining unknown envelopes.
4212            while next_offset < end_offset {
4213                _next_ordinal_to_read += 1;
4214                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4215                next_offset += envelope_size;
4216            }
4217
4218            Ok(())
4219        }
4220    }
4221
4222    impl DeviceInfo {
4223        #[inline(always)]
4224        fn max_ordinal_present(&self) -> u64 {
4225            if let Some(_) = self.base_info {
4226                return 3;
4227            }
4228            if let Some(_) = self.descriptor_version {
4229                return 2;
4230            }
4231            if let Some(_) = self.min_descriptor_length {
4232                return 1;
4233            }
4234            0
4235        }
4236    }
4237
4238    impl fidl::encoding::ValueTypeMarker for DeviceInfo {
4239        type Borrowed<'a> = &'a Self;
4240        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4241            value
4242        }
4243    }
4244
4245    unsafe impl fidl::encoding::TypeMarker for DeviceInfo {
4246        type Owned = Self;
4247
4248        #[inline(always)]
4249        fn inline_align(_context: fidl::encoding::Context) -> usize {
4250            8
4251        }
4252
4253        #[inline(always)]
4254        fn inline_size(_context: fidl::encoding::Context) -> usize {
4255            16
4256        }
4257    }
4258
4259    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<DeviceInfo, D>
4260        for &DeviceInfo
4261    {
4262        unsafe fn encode(
4263            self,
4264            encoder: &mut fidl::encoding::Encoder<'_, D>,
4265            offset: usize,
4266            mut depth: fidl::encoding::Depth,
4267        ) -> fidl::Result<()> {
4268            encoder.debug_check_bounds::<DeviceInfo>(offset);
4269            // Vector header
4270            let max_ordinal: u64 = self.max_ordinal_present();
4271            encoder.write_num(max_ordinal, offset);
4272            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
4273            // Calling encoder.out_of_line_offset(0) is not allowed.
4274            if max_ordinal == 0 {
4275                return Ok(());
4276            }
4277            depth.increment()?;
4278            let envelope_size = 8;
4279            let bytes_len = max_ordinal as usize * envelope_size;
4280            #[allow(unused_variables)]
4281            let offset = encoder.out_of_line_offset(bytes_len);
4282            let mut _prev_end_offset: usize = 0;
4283            if 1 > max_ordinal {
4284                return Ok(());
4285            }
4286
4287            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4288            // are envelope_size bytes.
4289            let cur_offset: usize = (1 - 1) * envelope_size;
4290
4291            // Zero reserved fields.
4292            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4293
4294            // Safety:
4295            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4296            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4297            //   envelope_size bytes, there is always sufficient room.
4298            fidl::encoding::encode_in_envelope_optional::<u8, D>(
4299                self.min_descriptor_length
4300                    .as_ref()
4301                    .map(<u8 as fidl::encoding::ValueTypeMarker>::borrow),
4302                encoder,
4303                offset + cur_offset,
4304                depth,
4305            )?;
4306
4307            _prev_end_offset = cur_offset + envelope_size;
4308            if 2 > max_ordinal {
4309                return Ok(());
4310            }
4311
4312            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4313            // are envelope_size bytes.
4314            let cur_offset: usize = (2 - 1) * envelope_size;
4315
4316            // Zero reserved fields.
4317            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4318
4319            // Safety:
4320            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4321            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4322            //   envelope_size bytes, there is always sufficient room.
4323            fidl::encoding::encode_in_envelope_optional::<u8, D>(
4324                self.descriptor_version
4325                    .as_ref()
4326                    .map(<u8 as fidl::encoding::ValueTypeMarker>::borrow),
4327                encoder,
4328                offset + cur_offset,
4329                depth,
4330            )?;
4331
4332            _prev_end_offset = cur_offset + envelope_size;
4333            if 3 > max_ordinal {
4334                return Ok(());
4335            }
4336
4337            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4338            // are envelope_size bytes.
4339            let cur_offset: usize = (3 - 1) * envelope_size;
4340
4341            // Zero reserved fields.
4342            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4343
4344            // Safety:
4345            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4346            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4347            //   envelope_size bytes, there is always sufficient room.
4348            fidl::encoding::encode_in_envelope_optional::<DeviceBaseInfo, D>(
4349                self.base_info
4350                    .as_ref()
4351                    .map(<DeviceBaseInfo as fidl::encoding::ValueTypeMarker>::borrow),
4352                encoder,
4353                offset + cur_offset,
4354                depth,
4355            )?;
4356
4357            _prev_end_offset = cur_offset + envelope_size;
4358
4359            Ok(())
4360        }
4361    }
4362
4363    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for DeviceInfo {
4364        #[inline(always)]
4365        fn new_empty() -> Self {
4366            Self::default()
4367        }
4368
4369        unsafe fn decode(
4370            &mut self,
4371            decoder: &mut fidl::encoding::Decoder<'_, D>,
4372            offset: usize,
4373            mut depth: fidl::encoding::Depth,
4374        ) -> fidl::Result<()> {
4375            decoder.debug_check_bounds::<Self>(offset);
4376            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
4377                None => return Err(fidl::Error::NotNullable),
4378                Some(len) => len,
4379            };
4380            // Calling decoder.out_of_line_offset(0) is not allowed.
4381            if len == 0 {
4382                return Ok(());
4383            };
4384            depth.increment()?;
4385            let envelope_size = 8;
4386            let bytes_len = len * envelope_size;
4387            let offset = decoder.out_of_line_offset(bytes_len)?;
4388            // Decode the envelope for each type.
4389            let mut _next_ordinal_to_read = 0;
4390            let mut next_offset = offset;
4391            let end_offset = offset + bytes_len;
4392            _next_ordinal_to_read += 1;
4393            if next_offset >= end_offset {
4394                return Ok(());
4395            }
4396
4397            // Decode unknown envelopes for gaps in ordinals.
4398            while _next_ordinal_to_read < 1 {
4399                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4400                _next_ordinal_to_read += 1;
4401                next_offset += envelope_size;
4402            }
4403
4404            let next_out_of_line = decoder.next_out_of_line();
4405            let handles_before = decoder.remaining_handles();
4406            if let Some((inlined, num_bytes, num_handles)) =
4407                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4408            {
4409                let member_inline_size =
4410                    <u8 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4411                if inlined != (member_inline_size <= 4) {
4412                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4413                }
4414                let inner_offset;
4415                let mut inner_depth = depth.clone();
4416                if inlined {
4417                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4418                    inner_offset = next_offset;
4419                } else {
4420                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4421                    inner_depth.increment()?;
4422                }
4423                let val_ref =
4424                    self.min_descriptor_length.get_or_insert_with(|| fidl::new_empty!(u8, D));
4425                fidl::decode!(u8, D, val_ref, decoder, inner_offset, inner_depth)?;
4426                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4427                {
4428                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4429                }
4430                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4431                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4432                }
4433            }
4434
4435            next_offset += envelope_size;
4436            _next_ordinal_to_read += 1;
4437            if next_offset >= end_offset {
4438                return Ok(());
4439            }
4440
4441            // Decode unknown envelopes for gaps in ordinals.
4442            while _next_ordinal_to_read < 2 {
4443                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4444                _next_ordinal_to_read += 1;
4445                next_offset += envelope_size;
4446            }
4447
4448            let next_out_of_line = decoder.next_out_of_line();
4449            let handles_before = decoder.remaining_handles();
4450            if let Some((inlined, num_bytes, num_handles)) =
4451                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4452            {
4453                let member_inline_size =
4454                    <u8 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4455                if inlined != (member_inline_size <= 4) {
4456                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4457                }
4458                let inner_offset;
4459                let mut inner_depth = depth.clone();
4460                if inlined {
4461                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4462                    inner_offset = next_offset;
4463                } else {
4464                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4465                    inner_depth.increment()?;
4466                }
4467                let val_ref =
4468                    self.descriptor_version.get_or_insert_with(|| fidl::new_empty!(u8, D));
4469                fidl::decode!(u8, D, val_ref, decoder, inner_offset, inner_depth)?;
4470                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4471                {
4472                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4473                }
4474                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4475                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4476                }
4477            }
4478
4479            next_offset += envelope_size;
4480            _next_ordinal_to_read += 1;
4481            if next_offset >= end_offset {
4482                return Ok(());
4483            }
4484
4485            // Decode unknown envelopes for gaps in ordinals.
4486            while _next_ordinal_to_read < 3 {
4487                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4488                _next_ordinal_to_read += 1;
4489                next_offset += envelope_size;
4490            }
4491
4492            let next_out_of_line = decoder.next_out_of_line();
4493            let handles_before = decoder.remaining_handles();
4494            if let Some((inlined, num_bytes, num_handles)) =
4495                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4496            {
4497                let member_inline_size =
4498                    <DeviceBaseInfo as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4499                if inlined != (member_inline_size <= 4) {
4500                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4501                }
4502                let inner_offset;
4503                let mut inner_depth = depth.clone();
4504                if inlined {
4505                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4506                    inner_offset = next_offset;
4507                } else {
4508                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4509                    inner_depth.increment()?;
4510                }
4511                let val_ref =
4512                    self.base_info.get_or_insert_with(|| fidl::new_empty!(DeviceBaseInfo, D));
4513                fidl::decode!(DeviceBaseInfo, D, val_ref, decoder, inner_offset, inner_depth)?;
4514                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4515                {
4516                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4517                }
4518                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4519                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4520                }
4521            }
4522
4523            next_offset += envelope_size;
4524
4525            // Decode the remaining unknown envelopes.
4526            while next_offset < end_offset {
4527                _next_ordinal_to_read += 1;
4528                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4529                next_offset += envelope_size;
4530            }
4531
4532            Ok(())
4533        }
4534    }
4535
4536    impl PortBaseInfo {
4537        #[inline(always)]
4538        fn max_ordinal_present(&self) -> u64 {
4539            if let Some(_) = self.tx_types {
4540                return 3;
4541            }
4542            if let Some(_) = self.rx_types {
4543                return 2;
4544            }
4545            if let Some(_) = self.port_class {
4546                return 1;
4547            }
4548            0
4549        }
4550    }
4551
4552    impl fidl::encoding::ValueTypeMarker for PortBaseInfo {
4553        type Borrowed<'a> = &'a Self;
4554        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4555            value
4556        }
4557    }
4558
4559    unsafe impl fidl::encoding::TypeMarker for PortBaseInfo {
4560        type Owned = Self;
4561
4562        #[inline(always)]
4563        fn inline_align(_context: fidl::encoding::Context) -> usize {
4564            8
4565        }
4566
4567        #[inline(always)]
4568        fn inline_size(_context: fidl::encoding::Context) -> usize {
4569            16
4570        }
4571    }
4572
4573    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<PortBaseInfo, D>
4574        for &PortBaseInfo
4575    {
4576        unsafe fn encode(
4577            self,
4578            encoder: &mut fidl::encoding::Encoder<'_, D>,
4579            offset: usize,
4580            mut depth: fidl::encoding::Depth,
4581        ) -> fidl::Result<()> {
4582            encoder.debug_check_bounds::<PortBaseInfo>(offset);
4583            // Vector header
4584            let max_ordinal: u64 = self.max_ordinal_present();
4585            encoder.write_num(max_ordinal, offset);
4586            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
4587            // Calling encoder.out_of_line_offset(0) is not allowed.
4588            if max_ordinal == 0 {
4589                return Ok(());
4590            }
4591            depth.increment()?;
4592            let envelope_size = 8;
4593            let bytes_len = max_ordinal as usize * envelope_size;
4594            #[allow(unused_variables)]
4595            let offset = encoder.out_of_line_offset(bytes_len);
4596            let mut _prev_end_offset: usize = 0;
4597            if 1 > max_ordinal {
4598                return Ok(());
4599            }
4600
4601            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4602            // are envelope_size bytes.
4603            let cur_offset: usize = (1 - 1) * envelope_size;
4604
4605            // Zero reserved fields.
4606            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4607
4608            // Safety:
4609            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4610            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4611            //   envelope_size bytes, there is always sufficient room.
4612            fidl::encoding::encode_in_envelope_optional::<PortClass, D>(
4613                self.port_class
4614                    .as_ref()
4615                    .map(<PortClass as fidl::encoding::ValueTypeMarker>::borrow),
4616                encoder,
4617                offset + cur_offset,
4618                depth,
4619            )?;
4620
4621            _prev_end_offset = cur_offset + envelope_size;
4622            if 2 > max_ordinal {
4623                return Ok(());
4624            }
4625
4626            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4627            // are envelope_size bytes.
4628            let cur_offset: usize = (2 - 1) * envelope_size;
4629
4630            // Zero reserved fields.
4631            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4632
4633            // Safety:
4634            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4635            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4636            //   envelope_size bytes, there is always sufficient room.
4637            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<FrameType, 4>, D>(
4638            self.rx_types.as_ref().map(<fidl::encoding::Vector<FrameType, 4> as fidl::encoding::ValueTypeMarker>::borrow),
4639            encoder, offset + cur_offset, depth
4640        )?;
4641
4642            _prev_end_offset = cur_offset + envelope_size;
4643            if 3 > max_ordinal {
4644                return Ok(());
4645            }
4646
4647            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4648            // are envelope_size bytes.
4649            let cur_offset: usize = (3 - 1) * envelope_size;
4650
4651            // Zero reserved fields.
4652            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4653
4654            // Safety:
4655            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4656            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4657            //   envelope_size bytes, there is always sufficient room.
4658            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<FrameTypeSupport, 4>, D>(
4659            self.tx_types.as_ref().map(<fidl::encoding::Vector<FrameTypeSupport, 4> as fidl::encoding::ValueTypeMarker>::borrow),
4660            encoder, offset + cur_offset, depth
4661        )?;
4662
4663            _prev_end_offset = cur_offset + envelope_size;
4664
4665            Ok(())
4666        }
4667    }
4668
4669    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for PortBaseInfo {
4670        #[inline(always)]
4671        fn new_empty() -> Self {
4672            Self::default()
4673        }
4674
4675        unsafe fn decode(
4676            &mut self,
4677            decoder: &mut fidl::encoding::Decoder<'_, D>,
4678            offset: usize,
4679            mut depth: fidl::encoding::Depth,
4680        ) -> fidl::Result<()> {
4681            decoder.debug_check_bounds::<Self>(offset);
4682            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
4683                None => return Err(fidl::Error::NotNullable),
4684                Some(len) => len,
4685            };
4686            // Calling decoder.out_of_line_offset(0) is not allowed.
4687            if len == 0 {
4688                return Ok(());
4689            };
4690            depth.increment()?;
4691            let envelope_size = 8;
4692            let bytes_len = len * envelope_size;
4693            let offset = decoder.out_of_line_offset(bytes_len)?;
4694            // Decode the envelope for each type.
4695            let mut _next_ordinal_to_read = 0;
4696            let mut next_offset = offset;
4697            let end_offset = offset + bytes_len;
4698            _next_ordinal_to_read += 1;
4699            if next_offset >= end_offset {
4700                return Ok(());
4701            }
4702
4703            // Decode unknown envelopes for gaps in ordinals.
4704            while _next_ordinal_to_read < 1 {
4705                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4706                _next_ordinal_to_read += 1;
4707                next_offset += envelope_size;
4708            }
4709
4710            let next_out_of_line = decoder.next_out_of_line();
4711            let handles_before = decoder.remaining_handles();
4712            if let Some((inlined, num_bytes, num_handles)) =
4713                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4714            {
4715                let member_inline_size =
4716                    <PortClass as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4717                if inlined != (member_inline_size <= 4) {
4718                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4719                }
4720                let inner_offset;
4721                let mut inner_depth = depth.clone();
4722                if inlined {
4723                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4724                    inner_offset = next_offset;
4725                } else {
4726                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4727                    inner_depth.increment()?;
4728                }
4729                let val_ref = self.port_class.get_or_insert_with(|| fidl::new_empty!(PortClass, D));
4730                fidl::decode!(PortClass, D, val_ref, decoder, inner_offset, inner_depth)?;
4731                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4732                {
4733                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4734                }
4735                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4736                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4737                }
4738            }
4739
4740            next_offset += envelope_size;
4741            _next_ordinal_to_read += 1;
4742            if next_offset >= end_offset {
4743                return Ok(());
4744            }
4745
4746            // Decode unknown envelopes for gaps in ordinals.
4747            while _next_ordinal_to_read < 2 {
4748                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4749                _next_ordinal_to_read += 1;
4750                next_offset += envelope_size;
4751            }
4752
4753            let next_out_of_line = decoder.next_out_of_line();
4754            let handles_before = decoder.remaining_handles();
4755            if let Some((inlined, num_bytes, num_handles)) =
4756                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4757            {
4758                let member_inline_size = <fidl::encoding::Vector<FrameType, 4> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4759                if inlined != (member_inline_size <= 4) {
4760                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4761                }
4762                let inner_offset;
4763                let mut inner_depth = depth.clone();
4764                if inlined {
4765                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4766                    inner_offset = next_offset;
4767                } else {
4768                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4769                    inner_depth.increment()?;
4770                }
4771                let val_ref = self.rx_types.get_or_insert_with(
4772                    || fidl::new_empty!(fidl::encoding::Vector<FrameType, 4>, D),
4773                );
4774                fidl::decode!(fidl::encoding::Vector<FrameType, 4>, D, val_ref, decoder, inner_offset, inner_depth)?;
4775                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4776                {
4777                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4778                }
4779                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4780                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4781                }
4782            }
4783
4784            next_offset += envelope_size;
4785            _next_ordinal_to_read += 1;
4786            if next_offset >= end_offset {
4787                return Ok(());
4788            }
4789
4790            // Decode unknown envelopes for gaps in ordinals.
4791            while _next_ordinal_to_read < 3 {
4792                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4793                _next_ordinal_to_read += 1;
4794                next_offset += envelope_size;
4795            }
4796
4797            let next_out_of_line = decoder.next_out_of_line();
4798            let handles_before = decoder.remaining_handles();
4799            if let Some((inlined, num_bytes, num_handles)) =
4800                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4801            {
4802                let member_inline_size = <fidl::encoding::Vector<FrameTypeSupport, 4> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4803                if inlined != (member_inline_size <= 4) {
4804                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4805                }
4806                let inner_offset;
4807                let mut inner_depth = depth.clone();
4808                if inlined {
4809                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4810                    inner_offset = next_offset;
4811                } else {
4812                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4813                    inner_depth.increment()?;
4814                }
4815                let val_ref = self.tx_types.get_or_insert_with(
4816                    || fidl::new_empty!(fidl::encoding::Vector<FrameTypeSupport, 4>, D),
4817                );
4818                fidl::decode!(fidl::encoding::Vector<FrameTypeSupport, 4>, D, val_ref, decoder, inner_offset, inner_depth)?;
4819                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4820                {
4821                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4822                }
4823                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4824                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4825                }
4826            }
4827
4828            next_offset += envelope_size;
4829
4830            // Decode the remaining unknown envelopes.
4831            while next_offset < end_offset {
4832                _next_ordinal_to_read += 1;
4833                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4834                next_offset += envelope_size;
4835            }
4836
4837            Ok(())
4838        }
4839    }
4840
4841    impl PortGetCountersResponse {
4842        #[inline(always)]
4843        fn max_ordinal_present(&self) -> u64 {
4844            if let Some(_) = self.tx_bytes {
4845                return 4;
4846            }
4847            if let Some(_) = self.tx_frames {
4848                return 3;
4849            }
4850            if let Some(_) = self.rx_bytes {
4851                return 2;
4852            }
4853            if let Some(_) = self.rx_frames {
4854                return 1;
4855            }
4856            0
4857        }
4858    }
4859
4860    impl fidl::encoding::ValueTypeMarker for PortGetCountersResponse {
4861        type Borrowed<'a> = &'a Self;
4862        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4863            value
4864        }
4865    }
4866
4867    unsafe impl fidl::encoding::TypeMarker for PortGetCountersResponse {
4868        type Owned = Self;
4869
4870        #[inline(always)]
4871        fn inline_align(_context: fidl::encoding::Context) -> usize {
4872            8
4873        }
4874
4875        #[inline(always)]
4876        fn inline_size(_context: fidl::encoding::Context) -> usize {
4877            16
4878        }
4879    }
4880
4881    unsafe impl<D: fidl::encoding::ResourceDialect>
4882        fidl::encoding::Encode<PortGetCountersResponse, D> for &PortGetCountersResponse
4883    {
4884        unsafe fn encode(
4885            self,
4886            encoder: &mut fidl::encoding::Encoder<'_, D>,
4887            offset: usize,
4888            mut depth: fidl::encoding::Depth,
4889        ) -> fidl::Result<()> {
4890            encoder.debug_check_bounds::<PortGetCountersResponse>(offset);
4891            // Vector header
4892            let max_ordinal: u64 = self.max_ordinal_present();
4893            encoder.write_num(max_ordinal, offset);
4894            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
4895            // Calling encoder.out_of_line_offset(0) is not allowed.
4896            if max_ordinal == 0 {
4897                return Ok(());
4898            }
4899            depth.increment()?;
4900            let envelope_size = 8;
4901            let bytes_len = max_ordinal as usize * envelope_size;
4902            #[allow(unused_variables)]
4903            let offset = encoder.out_of_line_offset(bytes_len);
4904            let mut _prev_end_offset: usize = 0;
4905            if 1 > max_ordinal {
4906                return Ok(());
4907            }
4908
4909            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4910            // are envelope_size bytes.
4911            let cur_offset: usize = (1 - 1) * envelope_size;
4912
4913            // Zero reserved fields.
4914            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4915
4916            // Safety:
4917            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4918            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4919            //   envelope_size bytes, there is always sufficient room.
4920            fidl::encoding::encode_in_envelope_optional::<u64, D>(
4921                self.rx_frames.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
4922                encoder,
4923                offset + cur_offset,
4924                depth,
4925            )?;
4926
4927            _prev_end_offset = cur_offset + envelope_size;
4928            if 2 > max_ordinal {
4929                return Ok(());
4930            }
4931
4932            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4933            // are envelope_size bytes.
4934            let cur_offset: usize = (2 - 1) * envelope_size;
4935
4936            // Zero reserved fields.
4937            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4938
4939            // Safety:
4940            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4941            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4942            //   envelope_size bytes, there is always sufficient room.
4943            fidl::encoding::encode_in_envelope_optional::<u64, D>(
4944                self.rx_bytes.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
4945                encoder,
4946                offset + cur_offset,
4947                depth,
4948            )?;
4949
4950            _prev_end_offset = cur_offset + envelope_size;
4951            if 3 > max_ordinal {
4952                return Ok(());
4953            }
4954
4955            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4956            // are envelope_size bytes.
4957            let cur_offset: usize = (3 - 1) * envelope_size;
4958
4959            // Zero reserved fields.
4960            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4961
4962            // Safety:
4963            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4964            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4965            //   envelope_size bytes, there is always sufficient room.
4966            fidl::encoding::encode_in_envelope_optional::<u64, D>(
4967                self.tx_frames.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
4968                encoder,
4969                offset + cur_offset,
4970                depth,
4971            )?;
4972
4973            _prev_end_offset = cur_offset + envelope_size;
4974            if 4 > max_ordinal {
4975                return Ok(());
4976            }
4977
4978            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4979            // are envelope_size bytes.
4980            let cur_offset: usize = (4 - 1) * envelope_size;
4981
4982            // Zero reserved fields.
4983            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4984
4985            // Safety:
4986            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4987            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4988            //   envelope_size bytes, there is always sufficient room.
4989            fidl::encoding::encode_in_envelope_optional::<u64, D>(
4990                self.tx_bytes.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
4991                encoder,
4992                offset + cur_offset,
4993                depth,
4994            )?;
4995
4996            _prev_end_offset = cur_offset + envelope_size;
4997
4998            Ok(())
4999        }
5000    }
5001
5002    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
5003        for PortGetCountersResponse
5004    {
5005        #[inline(always)]
5006        fn new_empty() -> Self {
5007            Self::default()
5008        }
5009
5010        unsafe fn decode(
5011            &mut self,
5012            decoder: &mut fidl::encoding::Decoder<'_, D>,
5013            offset: usize,
5014            mut depth: fidl::encoding::Depth,
5015        ) -> fidl::Result<()> {
5016            decoder.debug_check_bounds::<Self>(offset);
5017            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
5018                None => return Err(fidl::Error::NotNullable),
5019                Some(len) => len,
5020            };
5021            // Calling decoder.out_of_line_offset(0) is not allowed.
5022            if len == 0 {
5023                return Ok(());
5024            };
5025            depth.increment()?;
5026            let envelope_size = 8;
5027            let bytes_len = len * envelope_size;
5028            let offset = decoder.out_of_line_offset(bytes_len)?;
5029            // Decode the envelope for each type.
5030            let mut _next_ordinal_to_read = 0;
5031            let mut next_offset = offset;
5032            let end_offset = offset + bytes_len;
5033            _next_ordinal_to_read += 1;
5034            if next_offset >= end_offset {
5035                return Ok(());
5036            }
5037
5038            // Decode unknown envelopes for gaps in ordinals.
5039            while _next_ordinal_to_read < 1 {
5040                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5041                _next_ordinal_to_read += 1;
5042                next_offset += envelope_size;
5043            }
5044
5045            let next_out_of_line = decoder.next_out_of_line();
5046            let handles_before = decoder.remaining_handles();
5047            if let Some((inlined, num_bytes, num_handles)) =
5048                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5049            {
5050                let member_inline_size =
5051                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5052                if inlined != (member_inline_size <= 4) {
5053                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5054                }
5055                let inner_offset;
5056                let mut inner_depth = depth.clone();
5057                if inlined {
5058                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5059                    inner_offset = next_offset;
5060                } else {
5061                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5062                    inner_depth.increment()?;
5063                }
5064                let val_ref = self.rx_frames.get_or_insert_with(|| fidl::new_empty!(u64, D));
5065                fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
5066                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5067                {
5068                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5069                }
5070                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5071                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5072                }
5073            }
5074
5075            next_offset += envelope_size;
5076            _next_ordinal_to_read += 1;
5077            if next_offset >= end_offset {
5078                return Ok(());
5079            }
5080
5081            // Decode unknown envelopes for gaps in ordinals.
5082            while _next_ordinal_to_read < 2 {
5083                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5084                _next_ordinal_to_read += 1;
5085                next_offset += envelope_size;
5086            }
5087
5088            let next_out_of_line = decoder.next_out_of_line();
5089            let handles_before = decoder.remaining_handles();
5090            if let Some((inlined, num_bytes, num_handles)) =
5091                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5092            {
5093                let member_inline_size =
5094                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5095                if inlined != (member_inline_size <= 4) {
5096                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5097                }
5098                let inner_offset;
5099                let mut inner_depth = depth.clone();
5100                if inlined {
5101                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5102                    inner_offset = next_offset;
5103                } else {
5104                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5105                    inner_depth.increment()?;
5106                }
5107                let val_ref = self.rx_bytes.get_or_insert_with(|| fidl::new_empty!(u64, D));
5108                fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
5109                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5110                {
5111                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5112                }
5113                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5114                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5115                }
5116            }
5117
5118            next_offset += envelope_size;
5119            _next_ordinal_to_read += 1;
5120            if next_offset >= end_offset {
5121                return Ok(());
5122            }
5123
5124            // Decode unknown envelopes for gaps in ordinals.
5125            while _next_ordinal_to_read < 3 {
5126                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5127                _next_ordinal_to_read += 1;
5128                next_offset += envelope_size;
5129            }
5130
5131            let next_out_of_line = decoder.next_out_of_line();
5132            let handles_before = decoder.remaining_handles();
5133            if let Some((inlined, num_bytes, num_handles)) =
5134                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5135            {
5136                let member_inline_size =
5137                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5138                if inlined != (member_inline_size <= 4) {
5139                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5140                }
5141                let inner_offset;
5142                let mut inner_depth = depth.clone();
5143                if inlined {
5144                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5145                    inner_offset = next_offset;
5146                } else {
5147                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5148                    inner_depth.increment()?;
5149                }
5150                let val_ref = self.tx_frames.get_or_insert_with(|| fidl::new_empty!(u64, D));
5151                fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
5152                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5153                {
5154                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5155                }
5156                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5157                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5158                }
5159            }
5160
5161            next_offset += envelope_size;
5162            _next_ordinal_to_read += 1;
5163            if next_offset >= end_offset {
5164                return Ok(());
5165            }
5166
5167            // Decode unknown envelopes for gaps in ordinals.
5168            while _next_ordinal_to_read < 4 {
5169                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5170                _next_ordinal_to_read += 1;
5171                next_offset += envelope_size;
5172            }
5173
5174            let next_out_of_line = decoder.next_out_of_line();
5175            let handles_before = decoder.remaining_handles();
5176            if let Some((inlined, num_bytes, num_handles)) =
5177                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5178            {
5179                let member_inline_size =
5180                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5181                if inlined != (member_inline_size <= 4) {
5182                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5183                }
5184                let inner_offset;
5185                let mut inner_depth = depth.clone();
5186                if inlined {
5187                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5188                    inner_offset = next_offset;
5189                } else {
5190                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5191                    inner_depth.increment()?;
5192                }
5193                let val_ref = self.tx_bytes.get_or_insert_with(|| fidl::new_empty!(u64, D));
5194                fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
5195                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5196                {
5197                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5198                }
5199                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5200                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5201                }
5202            }
5203
5204            next_offset += envelope_size;
5205
5206            // Decode the remaining unknown envelopes.
5207            while next_offset < end_offset {
5208                _next_ordinal_to_read += 1;
5209                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5210                next_offset += envelope_size;
5211            }
5212
5213            Ok(())
5214        }
5215    }
5216
5217    impl PortInfo {
5218        #[inline(always)]
5219        fn max_ordinal_present(&self) -> u64 {
5220            if let Some(_) = self.base_info {
5221                return 2;
5222            }
5223            if let Some(_) = self.id {
5224                return 1;
5225            }
5226            0
5227        }
5228    }
5229
5230    impl fidl::encoding::ValueTypeMarker for PortInfo {
5231        type Borrowed<'a> = &'a Self;
5232        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
5233            value
5234        }
5235    }
5236
5237    unsafe impl fidl::encoding::TypeMarker for PortInfo {
5238        type Owned = Self;
5239
5240        #[inline(always)]
5241        fn inline_align(_context: fidl::encoding::Context) -> usize {
5242            8
5243        }
5244
5245        #[inline(always)]
5246        fn inline_size(_context: fidl::encoding::Context) -> usize {
5247            16
5248        }
5249    }
5250
5251    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<PortInfo, D> for &PortInfo {
5252        unsafe fn encode(
5253            self,
5254            encoder: &mut fidl::encoding::Encoder<'_, D>,
5255            offset: usize,
5256            mut depth: fidl::encoding::Depth,
5257        ) -> fidl::Result<()> {
5258            encoder.debug_check_bounds::<PortInfo>(offset);
5259            // Vector header
5260            let max_ordinal: u64 = self.max_ordinal_present();
5261            encoder.write_num(max_ordinal, offset);
5262            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
5263            // Calling encoder.out_of_line_offset(0) is not allowed.
5264            if max_ordinal == 0 {
5265                return Ok(());
5266            }
5267            depth.increment()?;
5268            let envelope_size = 8;
5269            let bytes_len = max_ordinal as usize * envelope_size;
5270            #[allow(unused_variables)]
5271            let offset = encoder.out_of_line_offset(bytes_len);
5272            let mut _prev_end_offset: usize = 0;
5273            if 1 > max_ordinal {
5274                return Ok(());
5275            }
5276
5277            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5278            // are envelope_size bytes.
5279            let cur_offset: usize = (1 - 1) * envelope_size;
5280
5281            // Zero reserved fields.
5282            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5283
5284            // Safety:
5285            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5286            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5287            //   envelope_size bytes, there is always sufficient room.
5288            fidl::encoding::encode_in_envelope_optional::<PortId, D>(
5289                self.id.as_ref().map(<PortId as fidl::encoding::ValueTypeMarker>::borrow),
5290                encoder,
5291                offset + cur_offset,
5292                depth,
5293            )?;
5294
5295            _prev_end_offset = cur_offset + envelope_size;
5296            if 2 > max_ordinal {
5297                return Ok(());
5298            }
5299
5300            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5301            // are envelope_size bytes.
5302            let cur_offset: usize = (2 - 1) * envelope_size;
5303
5304            // Zero reserved fields.
5305            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5306
5307            // Safety:
5308            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5309            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5310            //   envelope_size bytes, there is always sufficient room.
5311            fidl::encoding::encode_in_envelope_optional::<PortBaseInfo, D>(
5312                self.base_info
5313                    .as_ref()
5314                    .map(<PortBaseInfo as fidl::encoding::ValueTypeMarker>::borrow),
5315                encoder,
5316                offset + cur_offset,
5317                depth,
5318            )?;
5319
5320            _prev_end_offset = cur_offset + envelope_size;
5321
5322            Ok(())
5323        }
5324    }
5325
5326    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for PortInfo {
5327        #[inline(always)]
5328        fn new_empty() -> Self {
5329            Self::default()
5330        }
5331
5332        unsafe fn decode(
5333            &mut self,
5334            decoder: &mut fidl::encoding::Decoder<'_, D>,
5335            offset: usize,
5336            mut depth: fidl::encoding::Depth,
5337        ) -> fidl::Result<()> {
5338            decoder.debug_check_bounds::<Self>(offset);
5339            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
5340                None => return Err(fidl::Error::NotNullable),
5341                Some(len) => len,
5342            };
5343            // Calling decoder.out_of_line_offset(0) is not allowed.
5344            if len == 0 {
5345                return Ok(());
5346            };
5347            depth.increment()?;
5348            let envelope_size = 8;
5349            let bytes_len = len * envelope_size;
5350            let offset = decoder.out_of_line_offset(bytes_len)?;
5351            // Decode the envelope for each type.
5352            let mut _next_ordinal_to_read = 0;
5353            let mut next_offset = offset;
5354            let end_offset = offset + bytes_len;
5355            _next_ordinal_to_read += 1;
5356            if next_offset >= end_offset {
5357                return Ok(());
5358            }
5359
5360            // Decode unknown envelopes for gaps in ordinals.
5361            while _next_ordinal_to_read < 1 {
5362                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5363                _next_ordinal_to_read += 1;
5364                next_offset += envelope_size;
5365            }
5366
5367            let next_out_of_line = decoder.next_out_of_line();
5368            let handles_before = decoder.remaining_handles();
5369            if let Some((inlined, num_bytes, num_handles)) =
5370                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5371            {
5372                let member_inline_size =
5373                    <PortId as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5374                if inlined != (member_inline_size <= 4) {
5375                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5376                }
5377                let inner_offset;
5378                let mut inner_depth = depth.clone();
5379                if inlined {
5380                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5381                    inner_offset = next_offset;
5382                } else {
5383                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5384                    inner_depth.increment()?;
5385                }
5386                let val_ref = self.id.get_or_insert_with(|| fidl::new_empty!(PortId, D));
5387                fidl::decode!(PortId, D, val_ref, decoder, inner_offset, inner_depth)?;
5388                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5389                {
5390                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5391                }
5392                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5393                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5394                }
5395            }
5396
5397            next_offset += envelope_size;
5398            _next_ordinal_to_read += 1;
5399            if next_offset >= end_offset {
5400                return Ok(());
5401            }
5402
5403            // Decode unknown envelopes for gaps in ordinals.
5404            while _next_ordinal_to_read < 2 {
5405                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5406                _next_ordinal_to_read += 1;
5407                next_offset += envelope_size;
5408            }
5409
5410            let next_out_of_line = decoder.next_out_of_line();
5411            let handles_before = decoder.remaining_handles();
5412            if let Some((inlined, num_bytes, num_handles)) =
5413                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5414            {
5415                let member_inline_size =
5416                    <PortBaseInfo as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5417                if inlined != (member_inline_size <= 4) {
5418                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5419                }
5420                let inner_offset;
5421                let mut inner_depth = depth.clone();
5422                if inlined {
5423                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5424                    inner_offset = next_offset;
5425                } else {
5426                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5427                    inner_depth.increment()?;
5428                }
5429                let val_ref =
5430                    self.base_info.get_or_insert_with(|| fidl::new_empty!(PortBaseInfo, D));
5431                fidl::decode!(PortBaseInfo, D, val_ref, decoder, inner_offset, inner_depth)?;
5432                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5433                {
5434                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5435                }
5436                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5437                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5438                }
5439            }
5440
5441            next_offset += envelope_size;
5442
5443            // Decode the remaining unknown envelopes.
5444            while next_offset < end_offset {
5445                _next_ordinal_to_read += 1;
5446                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5447                next_offset += envelope_size;
5448            }
5449
5450            Ok(())
5451        }
5452    }
5453
5454    impl PortStatus {
5455        #[inline(always)]
5456        fn max_ordinal_present(&self) -> u64 {
5457            if let Some(_) = self.mtu {
5458                return 2;
5459            }
5460            if let Some(_) = self.flags {
5461                return 1;
5462            }
5463            0
5464        }
5465    }
5466
5467    impl fidl::encoding::ValueTypeMarker for PortStatus {
5468        type Borrowed<'a> = &'a Self;
5469        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
5470            value
5471        }
5472    }
5473
5474    unsafe impl fidl::encoding::TypeMarker for PortStatus {
5475        type Owned = Self;
5476
5477        #[inline(always)]
5478        fn inline_align(_context: fidl::encoding::Context) -> usize {
5479            8
5480        }
5481
5482        #[inline(always)]
5483        fn inline_size(_context: fidl::encoding::Context) -> usize {
5484            16
5485        }
5486    }
5487
5488    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<PortStatus, D>
5489        for &PortStatus
5490    {
5491        unsafe fn encode(
5492            self,
5493            encoder: &mut fidl::encoding::Encoder<'_, D>,
5494            offset: usize,
5495            mut depth: fidl::encoding::Depth,
5496        ) -> fidl::Result<()> {
5497            encoder.debug_check_bounds::<PortStatus>(offset);
5498            // Vector header
5499            let max_ordinal: u64 = self.max_ordinal_present();
5500            encoder.write_num(max_ordinal, offset);
5501            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
5502            // Calling encoder.out_of_line_offset(0) is not allowed.
5503            if max_ordinal == 0 {
5504                return Ok(());
5505            }
5506            depth.increment()?;
5507            let envelope_size = 8;
5508            let bytes_len = max_ordinal as usize * envelope_size;
5509            #[allow(unused_variables)]
5510            let offset = encoder.out_of_line_offset(bytes_len);
5511            let mut _prev_end_offset: usize = 0;
5512            if 1 > max_ordinal {
5513                return Ok(());
5514            }
5515
5516            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5517            // are envelope_size bytes.
5518            let cur_offset: usize = (1 - 1) * envelope_size;
5519
5520            // Zero reserved fields.
5521            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5522
5523            // Safety:
5524            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5525            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5526            //   envelope_size bytes, there is always sufficient room.
5527            fidl::encoding::encode_in_envelope_optional::<StatusFlags, D>(
5528                self.flags.as_ref().map(<StatusFlags as fidl::encoding::ValueTypeMarker>::borrow),
5529                encoder,
5530                offset + cur_offset,
5531                depth,
5532            )?;
5533
5534            _prev_end_offset = cur_offset + envelope_size;
5535            if 2 > max_ordinal {
5536                return Ok(());
5537            }
5538
5539            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5540            // are envelope_size bytes.
5541            let cur_offset: usize = (2 - 1) * envelope_size;
5542
5543            // Zero reserved fields.
5544            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5545
5546            // Safety:
5547            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5548            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5549            //   envelope_size bytes, there is always sufficient room.
5550            fidl::encoding::encode_in_envelope_optional::<u32, D>(
5551                self.mtu.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
5552                encoder,
5553                offset + cur_offset,
5554                depth,
5555            )?;
5556
5557            _prev_end_offset = cur_offset + envelope_size;
5558
5559            Ok(())
5560        }
5561    }
5562
5563    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for PortStatus {
5564        #[inline(always)]
5565        fn new_empty() -> Self {
5566            Self::default()
5567        }
5568
5569        unsafe fn decode(
5570            &mut self,
5571            decoder: &mut fidl::encoding::Decoder<'_, D>,
5572            offset: usize,
5573            mut depth: fidl::encoding::Depth,
5574        ) -> fidl::Result<()> {
5575            decoder.debug_check_bounds::<Self>(offset);
5576            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
5577                None => return Err(fidl::Error::NotNullable),
5578                Some(len) => len,
5579            };
5580            // Calling decoder.out_of_line_offset(0) is not allowed.
5581            if len == 0 {
5582                return Ok(());
5583            };
5584            depth.increment()?;
5585            let envelope_size = 8;
5586            let bytes_len = len * envelope_size;
5587            let offset = decoder.out_of_line_offset(bytes_len)?;
5588            // Decode the envelope for each type.
5589            let mut _next_ordinal_to_read = 0;
5590            let mut next_offset = offset;
5591            let end_offset = offset + bytes_len;
5592            _next_ordinal_to_read += 1;
5593            if next_offset >= end_offset {
5594                return Ok(());
5595            }
5596
5597            // Decode unknown envelopes for gaps in ordinals.
5598            while _next_ordinal_to_read < 1 {
5599                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5600                _next_ordinal_to_read += 1;
5601                next_offset += envelope_size;
5602            }
5603
5604            let next_out_of_line = decoder.next_out_of_line();
5605            let handles_before = decoder.remaining_handles();
5606            if let Some((inlined, num_bytes, num_handles)) =
5607                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5608            {
5609                let member_inline_size =
5610                    <StatusFlags as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5611                if inlined != (member_inline_size <= 4) {
5612                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5613                }
5614                let inner_offset;
5615                let mut inner_depth = depth.clone();
5616                if inlined {
5617                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5618                    inner_offset = next_offset;
5619                } else {
5620                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5621                    inner_depth.increment()?;
5622                }
5623                let val_ref = self.flags.get_or_insert_with(|| fidl::new_empty!(StatusFlags, D));
5624                fidl::decode!(StatusFlags, D, val_ref, decoder, inner_offset, inner_depth)?;
5625                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5626                {
5627                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5628                }
5629                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5630                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5631                }
5632            }
5633
5634            next_offset += envelope_size;
5635            _next_ordinal_to_read += 1;
5636            if next_offset >= end_offset {
5637                return Ok(());
5638            }
5639
5640            // Decode unknown envelopes for gaps in ordinals.
5641            while _next_ordinal_to_read < 2 {
5642                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5643                _next_ordinal_to_read += 1;
5644                next_offset += envelope_size;
5645            }
5646
5647            let next_out_of_line = decoder.next_out_of_line();
5648            let handles_before = decoder.remaining_handles();
5649            if let Some((inlined, num_bytes, num_handles)) =
5650                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5651            {
5652                let member_inline_size =
5653                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5654                if inlined != (member_inline_size <= 4) {
5655                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5656                }
5657                let inner_offset;
5658                let mut inner_depth = depth.clone();
5659                if inlined {
5660                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5661                    inner_offset = next_offset;
5662                } else {
5663                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5664                    inner_depth.increment()?;
5665                }
5666                let val_ref = self.mtu.get_or_insert_with(|| fidl::new_empty!(u32, D));
5667                fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
5668                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5669                {
5670                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5671                }
5672                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5673                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5674                }
5675            }
5676
5677            next_offset += envelope_size;
5678
5679            // Decode the remaining unknown envelopes.
5680            while next_offset < end_offset {
5681                _next_ordinal_to_read += 1;
5682                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5683                next_offset += envelope_size;
5684            }
5685
5686            Ok(())
5687        }
5688    }
5689
5690    impl fidl::encoding::ValueTypeMarker for DevicePortEvent {
5691        type Borrowed<'a> = &'a Self;
5692        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
5693            value
5694        }
5695    }
5696
5697    unsafe impl fidl::encoding::TypeMarker for DevicePortEvent {
5698        type Owned = Self;
5699
5700        #[inline(always)]
5701        fn inline_align(_context: fidl::encoding::Context) -> usize {
5702            8
5703        }
5704
5705        #[inline(always)]
5706        fn inline_size(_context: fidl::encoding::Context) -> usize {
5707            16
5708        }
5709    }
5710
5711    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<DevicePortEvent, D>
5712        for &DevicePortEvent
5713    {
5714        #[inline]
5715        unsafe fn encode(
5716            self,
5717            encoder: &mut fidl::encoding::Encoder<'_, D>,
5718            offset: usize,
5719            _depth: fidl::encoding::Depth,
5720        ) -> fidl::Result<()> {
5721            encoder.debug_check_bounds::<DevicePortEvent>(offset);
5722            encoder.write_num::<u64>(self.ordinal(), offset);
5723            match self {
5724                DevicePortEvent::Existing(ref val) => {
5725                    fidl::encoding::encode_in_envelope::<PortId, D>(
5726                        <PortId as fidl::encoding::ValueTypeMarker>::borrow(val),
5727                        encoder,
5728                        offset + 8,
5729                        _depth,
5730                    )
5731                }
5732                DevicePortEvent::Added(ref val) => fidl::encoding::encode_in_envelope::<PortId, D>(
5733                    <PortId as fidl::encoding::ValueTypeMarker>::borrow(val),
5734                    encoder,
5735                    offset + 8,
5736                    _depth,
5737                ),
5738                DevicePortEvent::Removed(ref val) => {
5739                    fidl::encoding::encode_in_envelope::<PortId, D>(
5740                        <PortId as fidl::encoding::ValueTypeMarker>::borrow(val),
5741                        encoder,
5742                        offset + 8,
5743                        _depth,
5744                    )
5745                }
5746                DevicePortEvent::Idle(ref val) => fidl::encoding::encode_in_envelope::<Empty, D>(
5747                    <Empty as fidl::encoding::ValueTypeMarker>::borrow(val),
5748                    encoder,
5749                    offset + 8,
5750                    _depth,
5751                ),
5752            }
5753        }
5754    }
5755
5756    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for DevicePortEvent {
5757        #[inline(always)]
5758        fn new_empty() -> Self {
5759            Self::Existing(fidl::new_empty!(PortId, D))
5760        }
5761
5762        #[inline]
5763        unsafe fn decode(
5764            &mut self,
5765            decoder: &mut fidl::encoding::Decoder<'_, D>,
5766            offset: usize,
5767            mut depth: fidl::encoding::Depth,
5768        ) -> fidl::Result<()> {
5769            decoder.debug_check_bounds::<Self>(offset);
5770            #[allow(unused_variables)]
5771            let next_out_of_line = decoder.next_out_of_line();
5772            let handles_before = decoder.remaining_handles();
5773            let (ordinal, inlined, num_bytes, num_handles) =
5774                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
5775
5776            let member_inline_size = match ordinal {
5777                1 => <PortId as fidl::encoding::TypeMarker>::inline_size(decoder.context),
5778                2 => <PortId as fidl::encoding::TypeMarker>::inline_size(decoder.context),
5779                3 => <PortId as fidl::encoding::TypeMarker>::inline_size(decoder.context),
5780                4 => <Empty as fidl::encoding::TypeMarker>::inline_size(decoder.context),
5781                _ => return Err(fidl::Error::UnknownUnionTag),
5782            };
5783
5784            if inlined != (member_inline_size <= 4) {
5785                return Err(fidl::Error::InvalidInlineBitInEnvelope);
5786            }
5787            let _inner_offset;
5788            if inlined {
5789                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
5790                _inner_offset = offset + 8;
5791            } else {
5792                depth.increment()?;
5793                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5794            }
5795            match ordinal {
5796                1 => {
5797                    #[allow(irrefutable_let_patterns)]
5798                    if let DevicePortEvent::Existing(_) = self {
5799                        // Do nothing, read the value into the object
5800                    } else {
5801                        // Initialize `self` to the right variant
5802                        *self = DevicePortEvent::Existing(fidl::new_empty!(PortId, D));
5803                    }
5804                    #[allow(irrefutable_let_patterns)]
5805                    if let DevicePortEvent::Existing(ref mut val) = self {
5806                        fidl::decode!(PortId, D, val, decoder, _inner_offset, depth)?;
5807                    } else {
5808                        unreachable!()
5809                    }
5810                }
5811                2 => {
5812                    #[allow(irrefutable_let_patterns)]
5813                    if let DevicePortEvent::Added(_) = self {
5814                        // Do nothing, read the value into the object
5815                    } else {
5816                        // Initialize `self` to the right variant
5817                        *self = DevicePortEvent::Added(fidl::new_empty!(PortId, D));
5818                    }
5819                    #[allow(irrefutable_let_patterns)]
5820                    if let DevicePortEvent::Added(ref mut val) = self {
5821                        fidl::decode!(PortId, D, val, decoder, _inner_offset, depth)?;
5822                    } else {
5823                        unreachable!()
5824                    }
5825                }
5826                3 => {
5827                    #[allow(irrefutable_let_patterns)]
5828                    if let DevicePortEvent::Removed(_) = self {
5829                        // Do nothing, read the value into the object
5830                    } else {
5831                        // Initialize `self` to the right variant
5832                        *self = DevicePortEvent::Removed(fidl::new_empty!(PortId, D));
5833                    }
5834                    #[allow(irrefutable_let_patterns)]
5835                    if let DevicePortEvent::Removed(ref mut val) = self {
5836                        fidl::decode!(PortId, D, val, decoder, _inner_offset, depth)?;
5837                    } else {
5838                        unreachable!()
5839                    }
5840                }
5841                4 => {
5842                    #[allow(irrefutable_let_patterns)]
5843                    if let DevicePortEvent::Idle(_) = self {
5844                        // Do nothing, read the value into the object
5845                    } else {
5846                        // Initialize `self` to the right variant
5847                        *self = DevicePortEvent::Idle(fidl::new_empty!(Empty, D));
5848                    }
5849                    #[allow(irrefutable_let_patterns)]
5850                    if let DevicePortEvent::Idle(ref mut val) = self {
5851                        fidl::decode!(Empty, D, val, decoder, _inner_offset, depth)?;
5852                    } else {
5853                        unreachable!()
5854                    }
5855                }
5856                ordinal => panic!("unexpected ordinal {:?}", ordinal),
5857            }
5858            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
5859                return Err(fidl::Error::InvalidNumBytesInEnvelope);
5860            }
5861            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5862                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5863            }
5864            Ok(())
5865        }
5866    }
5867}