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