fidl_fuchsia_hardware_network__common/
fidl_fuchsia_hardware_network__common.rs

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