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