Skip to main content

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