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    pub const GET_ID_EVENT: u64 = 0x2a466ceb0e9c0b06;
1022}
1023
1024pub mod port_watcher_ordinals {
1025    pub const WATCH: u64 = 0x3e87244b74fff55e;
1026}
1027
1028pub mod session_ordinals {
1029    pub const ATTACH: u64 = 0x1e89c9013e201379;
1030    pub const DETACH: u64 = 0x68c40cf8fb549867;
1031    pub const CLOSE: u64 = 0x393d5070394a92f6;
1032    pub const WATCH_DELEGATED_RX_LEASE: u64 = 0x764d823ee64803b5;
1033}
1034
1035pub mod status_watcher_ordinals {
1036    pub const WATCH_STATUS: u64 = 0x1369a8125c0862b9;
1037}
1038
1039mod internal {
1040    use super::*;
1041    unsafe impl fidl::encoding::TypeMarker for EthernetFeatures {
1042        type Owned = Self;
1043
1044        #[inline(always)]
1045        fn inline_align(_context: fidl::encoding::Context) -> usize {
1046            4
1047        }
1048
1049        #[inline(always)]
1050        fn inline_size(_context: fidl::encoding::Context) -> usize {
1051            4
1052        }
1053    }
1054
1055    impl fidl::encoding::ValueTypeMarker for EthernetFeatures {
1056        type Borrowed<'a> = Self;
1057        #[inline(always)]
1058        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1059            *value
1060        }
1061    }
1062
1063    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
1064        for EthernetFeatures
1065    {
1066        #[inline]
1067        unsafe fn encode(
1068            self,
1069            encoder: &mut fidl::encoding::Encoder<'_, D>,
1070            offset: usize,
1071            _depth: fidl::encoding::Depth,
1072        ) -> fidl::Result<()> {
1073            encoder.debug_check_bounds::<Self>(offset);
1074            if self.bits() & Self::all().bits() != self.bits() {
1075                return Err(fidl::Error::InvalidBitsValue);
1076            }
1077            encoder.write_num(self.bits(), offset);
1078            Ok(())
1079        }
1080    }
1081
1082    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for EthernetFeatures {
1083        #[inline(always)]
1084        fn new_empty() -> Self {
1085            Self::empty()
1086        }
1087
1088        #[inline]
1089        unsafe fn decode(
1090            &mut self,
1091            decoder: &mut fidl::encoding::Decoder<'_, D>,
1092            offset: usize,
1093            _depth: fidl::encoding::Depth,
1094        ) -> fidl::Result<()> {
1095            decoder.debug_check_bounds::<Self>(offset);
1096            let prim = decoder.read_num::<u32>(offset);
1097            *self = Self::from_bits(prim).ok_or(fidl::Error::InvalidBitsValue)?;
1098            Ok(())
1099        }
1100    }
1101    unsafe impl fidl::encoding::TypeMarker for RxFlags {
1102        type Owned = Self;
1103
1104        #[inline(always)]
1105        fn inline_align(_context: fidl::encoding::Context) -> usize {
1106            4
1107        }
1108
1109        #[inline(always)]
1110        fn inline_size(_context: fidl::encoding::Context) -> usize {
1111            4
1112        }
1113    }
1114
1115    impl fidl::encoding::ValueTypeMarker for RxFlags {
1116        type Borrowed<'a> = Self;
1117        #[inline(always)]
1118        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1119            *value
1120        }
1121    }
1122
1123    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for RxFlags {
1124        #[inline]
1125        unsafe fn encode(
1126            self,
1127            encoder: &mut fidl::encoding::Encoder<'_, D>,
1128            offset: usize,
1129            _depth: fidl::encoding::Depth,
1130        ) -> fidl::Result<()> {
1131            encoder.debug_check_bounds::<Self>(offset);
1132            if self.bits() & Self::all().bits() != self.bits() {
1133                return Err(fidl::Error::InvalidBitsValue);
1134            }
1135            encoder.write_num(self.bits(), offset);
1136            Ok(())
1137        }
1138    }
1139
1140    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for RxFlags {
1141        #[inline(always)]
1142        fn new_empty() -> Self {
1143            Self::empty()
1144        }
1145
1146        #[inline]
1147        unsafe fn decode(
1148            &mut self,
1149            decoder: &mut fidl::encoding::Decoder<'_, D>,
1150            offset: usize,
1151            _depth: fidl::encoding::Depth,
1152        ) -> fidl::Result<()> {
1153            decoder.debug_check_bounds::<Self>(offset);
1154            let prim = decoder.read_num::<u32>(offset);
1155            *self = Self::from_bits(prim).ok_or(fidl::Error::InvalidBitsValue)?;
1156            Ok(())
1157        }
1158    }
1159    unsafe impl fidl::encoding::TypeMarker for SessionFlags {
1160        type Owned = Self;
1161
1162        #[inline(always)]
1163        fn inline_align(_context: fidl::encoding::Context) -> usize {
1164            2
1165        }
1166
1167        #[inline(always)]
1168        fn inline_size(_context: fidl::encoding::Context) -> usize {
1169            2
1170        }
1171    }
1172
1173    impl fidl::encoding::ValueTypeMarker for SessionFlags {
1174        type Borrowed<'a> = Self;
1175        #[inline(always)]
1176        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1177            *value
1178        }
1179    }
1180
1181    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for SessionFlags {
1182        #[inline]
1183        unsafe fn encode(
1184            self,
1185            encoder: &mut fidl::encoding::Encoder<'_, D>,
1186            offset: usize,
1187            _depth: fidl::encoding::Depth,
1188        ) -> fidl::Result<()> {
1189            encoder.debug_check_bounds::<Self>(offset);
1190            if self.bits() & Self::all().bits() != self.bits() {
1191                return Err(fidl::Error::InvalidBitsValue);
1192            }
1193            encoder.write_num(self.bits(), offset);
1194            Ok(())
1195        }
1196    }
1197
1198    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SessionFlags {
1199        #[inline(always)]
1200        fn new_empty() -> Self {
1201            Self::empty()
1202        }
1203
1204        #[inline]
1205        unsafe fn decode(
1206            &mut self,
1207            decoder: &mut fidl::encoding::Decoder<'_, D>,
1208            offset: usize,
1209            _depth: fidl::encoding::Depth,
1210        ) -> fidl::Result<()> {
1211            decoder.debug_check_bounds::<Self>(offset);
1212            let prim = decoder.read_num::<u16>(offset);
1213            *self = Self::from_bits(prim).ok_or(fidl::Error::InvalidBitsValue)?;
1214            Ok(())
1215        }
1216    }
1217    unsafe impl fidl::encoding::TypeMarker for StatusFlags {
1218        type Owned = Self;
1219
1220        #[inline(always)]
1221        fn inline_align(_context: fidl::encoding::Context) -> usize {
1222            4
1223        }
1224
1225        #[inline(always)]
1226        fn inline_size(_context: fidl::encoding::Context) -> usize {
1227            4
1228        }
1229    }
1230
1231    impl fidl::encoding::ValueTypeMarker for StatusFlags {
1232        type Borrowed<'a> = Self;
1233        #[inline(always)]
1234        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1235            *value
1236        }
1237    }
1238
1239    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for StatusFlags {
1240        #[inline]
1241        unsafe fn encode(
1242            self,
1243            encoder: &mut fidl::encoding::Encoder<'_, D>,
1244            offset: usize,
1245            _depth: fidl::encoding::Depth,
1246        ) -> fidl::Result<()> {
1247            encoder.debug_check_bounds::<Self>(offset);
1248            if self.bits() & Self::all().bits() != self.bits() {
1249                return Err(fidl::Error::InvalidBitsValue);
1250            }
1251            encoder.write_num(self.bits(), offset);
1252            Ok(())
1253        }
1254    }
1255
1256    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for StatusFlags {
1257        #[inline(always)]
1258        fn new_empty() -> Self {
1259            Self::empty()
1260        }
1261
1262        #[inline]
1263        unsafe fn decode(
1264            &mut self,
1265            decoder: &mut fidl::encoding::Decoder<'_, D>,
1266            offset: usize,
1267            _depth: fidl::encoding::Depth,
1268        ) -> fidl::Result<()> {
1269            decoder.debug_check_bounds::<Self>(offset);
1270            let prim = decoder.read_num::<u32>(offset);
1271            *self = Self::from_bits(prim).ok_or(fidl::Error::InvalidBitsValue)?;
1272            Ok(())
1273        }
1274    }
1275    unsafe impl fidl::encoding::TypeMarker for TxFlags {
1276        type Owned = Self;
1277
1278        #[inline(always)]
1279        fn inline_align(_context: fidl::encoding::Context) -> usize {
1280            4
1281        }
1282
1283        #[inline(always)]
1284        fn inline_size(_context: fidl::encoding::Context) -> usize {
1285            4
1286        }
1287    }
1288
1289    impl fidl::encoding::ValueTypeMarker for TxFlags {
1290        type Borrowed<'a> = Self;
1291        #[inline(always)]
1292        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1293            *value
1294        }
1295    }
1296
1297    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for TxFlags {
1298        #[inline]
1299        unsafe fn encode(
1300            self,
1301            encoder: &mut fidl::encoding::Encoder<'_, D>,
1302            offset: usize,
1303            _depth: fidl::encoding::Depth,
1304        ) -> fidl::Result<()> {
1305            encoder.debug_check_bounds::<Self>(offset);
1306            encoder.write_num(self.bits(), offset);
1307            Ok(())
1308        }
1309    }
1310
1311    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for TxFlags {
1312        #[inline(always)]
1313        fn new_empty() -> Self {
1314            Self::empty()
1315        }
1316
1317        #[inline]
1318        unsafe fn decode(
1319            &mut self,
1320            decoder: &mut fidl::encoding::Decoder<'_, D>,
1321            offset: usize,
1322            _depth: fidl::encoding::Depth,
1323        ) -> fidl::Result<()> {
1324            decoder.debug_check_bounds::<Self>(offset);
1325            let prim = decoder.read_num::<u32>(offset);
1326            *self = Self::from_bits_allow_unknown(prim);
1327            Ok(())
1328        }
1329    }
1330    unsafe impl fidl::encoding::TypeMarker for TxReturnFlags {
1331        type Owned = Self;
1332
1333        #[inline(always)]
1334        fn inline_align(_context: fidl::encoding::Context) -> usize {
1335            4
1336        }
1337
1338        #[inline(always)]
1339        fn inline_size(_context: fidl::encoding::Context) -> usize {
1340            4
1341        }
1342    }
1343
1344    impl fidl::encoding::ValueTypeMarker for TxReturnFlags {
1345        type Borrowed<'a> = Self;
1346        #[inline(always)]
1347        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1348            *value
1349        }
1350    }
1351
1352    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for TxReturnFlags {
1353        #[inline]
1354        unsafe fn encode(
1355            self,
1356            encoder: &mut fidl::encoding::Encoder<'_, D>,
1357            offset: usize,
1358            _depth: fidl::encoding::Depth,
1359        ) -> fidl::Result<()> {
1360            encoder.debug_check_bounds::<Self>(offset);
1361            encoder.write_num(self.bits(), offset);
1362            Ok(())
1363        }
1364    }
1365
1366    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for TxReturnFlags {
1367        #[inline(always)]
1368        fn new_empty() -> Self {
1369            Self::empty()
1370        }
1371
1372        #[inline]
1373        unsafe fn decode(
1374            &mut self,
1375            decoder: &mut fidl::encoding::Decoder<'_, D>,
1376            offset: usize,
1377            _depth: fidl::encoding::Depth,
1378        ) -> fidl::Result<()> {
1379            decoder.debug_check_bounds::<Self>(offset);
1380            let prim = decoder.read_num::<u32>(offset);
1381            *self = Self::from_bits_allow_unknown(prim);
1382            Ok(())
1383        }
1384    }
1385    unsafe impl fidl::encoding::TypeMarker for FrameType {
1386        type Owned = Self;
1387
1388        #[inline(always)]
1389        fn inline_align(_context: fidl::encoding::Context) -> usize {
1390            std::mem::align_of::<u8>()
1391        }
1392
1393        #[inline(always)]
1394        fn inline_size(_context: fidl::encoding::Context) -> usize {
1395            std::mem::size_of::<u8>()
1396        }
1397
1398        #[inline(always)]
1399        fn encode_is_copy() -> bool {
1400            false
1401        }
1402
1403        #[inline(always)]
1404        fn decode_is_copy() -> bool {
1405            false
1406        }
1407    }
1408
1409    impl fidl::encoding::ValueTypeMarker for FrameType {
1410        type Borrowed<'a> = Self;
1411        #[inline(always)]
1412        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1413            *value
1414        }
1415    }
1416
1417    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for FrameType {
1418        #[inline]
1419        unsafe fn encode(
1420            self,
1421            encoder: &mut fidl::encoding::Encoder<'_, D>,
1422            offset: usize,
1423            _depth: fidl::encoding::Depth,
1424        ) -> fidl::Result<()> {
1425            encoder.debug_check_bounds::<Self>(offset);
1426            encoder.write_num(self.into_primitive(), offset);
1427            Ok(())
1428        }
1429    }
1430
1431    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for FrameType {
1432        #[inline(always)]
1433        fn new_empty() -> Self {
1434            Self::unknown()
1435        }
1436
1437        #[inline]
1438        unsafe fn decode(
1439            &mut self,
1440            decoder: &mut fidl::encoding::Decoder<'_, D>,
1441            offset: usize,
1442            _depth: fidl::encoding::Depth,
1443        ) -> fidl::Result<()> {
1444            decoder.debug_check_bounds::<Self>(offset);
1445            let prim = decoder.read_num::<u8>(offset);
1446
1447            *self = Self::from_primitive_allow_unknown(prim);
1448            Ok(())
1449        }
1450    }
1451    unsafe impl fidl::encoding::TypeMarker for InfoType {
1452        type Owned = Self;
1453
1454        #[inline(always)]
1455        fn inline_align(_context: fidl::encoding::Context) -> usize {
1456            std::mem::align_of::<u32>()
1457        }
1458
1459        #[inline(always)]
1460        fn inline_size(_context: fidl::encoding::Context) -> usize {
1461            std::mem::size_of::<u32>()
1462        }
1463
1464        #[inline(always)]
1465        fn encode_is_copy() -> bool {
1466            true
1467        }
1468
1469        #[inline(always)]
1470        fn decode_is_copy() -> bool {
1471            false
1472        }
1473    }
1474
1475    impl fidl::encoding::ValueTypeMarker for InfoType {
1476        type Borrowed<'a> = Self;
1477        #[inline(always)]
1478        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1479            *value
1480        }
1481    }
1482
1483    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for InfoType {
1484        #[inline]
1485        unsafe fn encode(
1486            self,
1487            encoder: &mut fidl::encoding::Encoder<'_, D>,
1488            offset: usize,
1489            _depth: fidl::encoding::Depth,
1490        ) -> fidl::Result<()> {
1491            encoder.debug_check_bounds::<Self>(offset);
1492            encoder.write_num(self.into_primitive(), offset);
1493            Ok(())
1494        }
1495    }
1496
1497    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for InfoType {
1498        #[inline(always)]
1499        fn new_empty() -> Self {
1500            Self::NoInfo
1501        }
1502
1503        #[inline]
1504        unsafe fn decode(
1505            &mut self,
1506            decoder: &mut fidl::encoding::Decoder<'_, D>,
1507            offset: usize,
1508            _depth: fidl::encoding::Depth,
1509        ) -> fidl::Result<()> {
1510            decoder.debug_check_bounds::<Self>(offset);
1511            let prim = decoder.read_num::<u32>(offset);
1512
1513            *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
1514            Ok(())
1515        }
1516    }
1517    unsafe impl fidl::encoding::TypeMarker for MacFilterMode {
1518        type Owned = Self;
1519
1520        #[inline(always)]
1521        fn inline_align(_context: fidl::encoding::Context) -> usize {
1522            std::mem::align_of::<u32>()
1523        }
1524
1525        #[inline(always)]
1526        fn inline_size(_context: fidl::encoding::Context) -> usize {
1527            std::mem::size_of::<u32>()
1528        }
1529
1530        #[inline(always)]
1531        fn encode_is_copy() -> bool {
1532            false
1533        }
1534
1535        #[inline(always)]
1536        fn decode_is_copy() -> bool {
1537            false
1538        }
1539    }
1540
1541    impl fidl::encoding::ValueTypeMarker for MacFilterMode {
1542        type Borrowed<'a> = Self;
1543        #[inline(always)]
1544        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1545            *value
1546        }
1547    }
1548
1549    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for MacFilterMode {
1550        #[inline]
1551        unsafe fn encode(
1552            self,
1553            encoder: &mut fidl::encoding::Encoder<'_, D>,
1554            offset: usize,
1555            _depth: fidl::encoding::Depth,
1556        ) -> fidl::Result<()> {
1557            encoder.debug_check_bounds::<Self>(offset);
1558            encoder.write_num(self.into_primitive(), offset);
1559            Ok(())
1560        }
1561    }
1562
1563    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for MacFilterMode {
1564        #[inline(always)]
1565        fn new_empty() -> Self {
1566            Self::unknown()
1567        }
1568
1569        #[inline]
1570        unsafe fn decode(
1571            &mut self,
1572            decoder: &mut fidl::encoding::Decoder<'_, D>,
1573            offset: usize,
1574            _depth: fidl::encoding::Depth,
1575        ) -> fidl::Result<()> {
1576            decoder.debug_check_bounds::<Self>(offset);
1577            let prim = decoder.read_num::<u32>(offset);
1578
1579            *self = Self::from_primitive_allow_unknown(prim);
1580            Ok(())
1581        }
1582    }
1583    unsafe impl fidl::encoding::TypeMarker for PortClass {
1584        type Owned = Self;
1585
1586        #[inline(always)]
1587        fn inline_align(_context: fidl::encoding::Context) -> usize {
1588            std::mem::align_of::<u16>()
1589        }
1590
1591        #[inline(always)]
1592        fn inline_size(_context: fidl::encoding::Context) -> usize {
1593            std::mem::size_of::<u16>()
1594        }
1595
1596        #[inline(always)]
1597        fn encode_is_copy() -> bool {
1598            false
1599        }
1600
1601        #[inline(always)]
1602        fn decode_is_copy() -> bool {
1603            false
1604        }
1605    }
1606
1607    impl fidl::encoding::ValueTypeMarker for PortClass {
1608        type Borrowed<'a> = Self;
1609        #[inline(always)]
1610        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1611            *value
1612        }
1613    }
1614
1615    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for PortClass {
1616        #[inline]
1617        unsafe fn encode(
1618            self,
1619            encoder: &mut fidl::encoding::Encoder<'_, D>,
1620            offset: usize,
1621            _depth: fidl::encoding::Depth,
1622        ) -> fidl::Result<()> {
1623            encoder.debug_check_bounds::<Self>(offset);
1624            encoder.write_num(self.into_primitive(), offset);
1625            Ok(())
1626        }
1627    }
1628
1629    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for PortClass {
1630        #[inline(always)]
1631        fn new_empty() -> Self {
1632            Self::unknown()
1633        }
1634
1635        #[inline]
1636        unsafe fn decode(
1637            &mut self,
1638            decoder: &mut fidl::encoding::Decoder<'_, D>,
1639            offset: usize,
1640            _depth: fidl::encoding::Depth,
1641        ) -> fidl::Result<()> {
1642            decoder.debug_check_bounds::<Self>(offset);
1643            let prim = decoder.read_num::<u16>(offset);
1644
1645            *self = Self::from_primitive_allow_unknown(prim);
1646            Ok(())
1647        }
1648    }
1649    unsafe impl fidl::encoding::TypeMarker for RxAcceleration {
1650        type Owned = Self;
1651
1652        #[inline(always)]
1653        fn inline_align(_context: fidl::encoding::Context) -> usize {
1654            std::mem::align_of::<u8>()
1655        }
1656
1657        #[inline(always)]
1658        fn inline_size(_context: fidl::encoding::Context) -> usize {
1659            std::mem::size_of::<u8>()
1660        }
1661
1662        #[inline(always)]
1663        fn encode_is_copy() -> bool {
1664            false
1665        }
1666
1667        #[inline(always)]
1668        fn decode_is_copy() -> bool {
1669            false
1670        }
1671    }
1672
1673    impl fidl::encoding::ValueTypeMarker for RxAcceleration {
1674        type Borrowed<'a> = Self;
1675        #[inline(always)]
1676        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1677            *value
1678        }
1679    }
1680
1681    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for RxAcceleration {
1682        #[inline]
1683        unsafe fn encode(
1684            self,
1685            encoder: &mut fidl::encoding::Encoder<'_, D>,
1686            offset: usize,
1687            _depth: fidl::encoding::Depth,
1688        ) -> fidl::Result<()> {
1689            encoder.debug_check_bounds::<Self>(offset);
1690            encoder.write_num(self.into_primitive(), offset);
1691            Ok(())
1692        }
1693    }
1694
1695    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for RxAcceleration {
1696        #[inline(always)]
1697        fn new_empty() -> Self {
1698            Self::unknown()
1699        }
1700
1701        #[inline]
1702        unsafe fn decode(
1703            &mut self,
1704            decoder: &mut fidl::encoding::Decoder<'_, D>,
1705            offset: usize,
1706            _depth: fidl::encoding::Depth,
1707        ) -> fidl::Result<()> {
1708            decoder.debug_check_bounds::<Self>(offset);
1709            let prim = decoder.read_num::<u8>(offset);
1710
1711            *self = Self::from_primitive_allow_unknown(prim);
1712            Ok(())
1713        }
1714    }
1715    unsafe impl fidl::encoding::TypeMarker for TxAcceleration {
1716        type Owned = Self;
1717
1718        #[inline(always)]
1719        fn inline_align(_context: fidl::encoding::Context) -> usize {
1720            std::mem::align_of::<u8>()
1721        }
1722
1723        #[inline(always)]
1724        fn inline_size(_context: fidl::encoding::Context) -> usize {
1725            std::mem::size_of::<u8>()
1726        }
1727
1728        #[inline(always)]
1729        fn encode_is_copy() -> bool {
1730            false
1731        }
1732
1733        #[inline(always)]
1734        fn decode_is_copy() -> bool {
1735            false
1736        }
1737    }
1738
1739    impl fidl::encoding::ValueTypeMarker for TxAcceleration {
1740        type Borrowed<'a> = Self;
1741        #[inline(always)]
1742        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1743            *value
1744        }
1745    }
1746
1747    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for TxAcceleration {
1748        #[inline]
1749        unsafe fn encode(
1750            self,
1751            encoder: &mut fidl::encoding::Encoder<'_, D>,
1752            offset: usize,
1753            _depth: fidl::encoding::Depth,
1754        ) -> fidl::Result<()> {
1755            encoder.debug_check_bounds::<Self>(offset);
1756            encoder.write_num(self.into_primitive(), offset);
1757            Ok(())
1758        }
1759    }
1760
1761    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for TxAcceleration {
1762        #[inline(always)]
1763        fn new_empty() -> Self {
1764            Self::unknown()
1765        }
1766
1767        #[inline]
1768        unsafe fn decode(
1769            &mut self,
1770            decoder: &mut fidl::encoding::Decoder<'_, D>,
1771            offset: usize,
1772            _depth: fidl::encoding::Depth,
1773        ) -> fidl::Result<()> {
1774            decoder.debug_check_bounds::<Self>(offset);
1775            let prim = decoder.read_num::<u8>(offset);
1776
1777            *self = Self::from_primitive_allow_unknown(prim);
1778            Ok(())
1779        }
1780    }
1781
1782    impl fidl::encoding::ValueTypeMarker for DeviceGetInfoResponse {
1783        type Borrowed<'a> = &'a Self;
1784        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1785            value
1786        }
1787    }
1788
1789    unsafe impl fidl::encoding::TypeMarker for DeviceGetInfoResponse {
1790        type Owned = Self;
1791
1792        #[inline(always)]
1793        fn inline_align(_context: fidl::encoding::Context) -> usize {
1794            8
1795        }
1796
1797        #[inline(always)]
1798        fn inline_size(_context: fidl::encoding::Context) -> usize {
1799            16
1800        }
1801    }
1802
1803    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<DeviceGetInfoResponse, D>
1804        for &DeviceGetInfoResponse
1805    {
1806        #[inline]
1807        unsafe fn encode(
1808            self,
1809            encoder: &mut fidl::encoding::Encoder<'_, D>,
1810            offset: usize,
1811            _depth: fidl::encoding::Depth,
1812        ) -> fidl::Result<()> {
1813            encoder.debug_check_bounds::<DeviceGetInfoResponse>(offset);
1814            // Delegate to tuple encoding.
1815            fidl::encoding::Encode::<DeviceGetInfoResponse, D>::encode(
1816                (<DeviceInfo as fidl::encoding::ValueTypeMarker>::borrow(&self.info),),
1817                encoder,
1818                offset,
1819                _depth,
1820            )
1821        }
1822    }
1823    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<DeviceInfo, D>>
1824        fidl::encoding::Encode<DeviceGetInfoResponse, D> for (T0,)
1825    {
1826        #[inline]
1827        unsafe fn encode(
1828            self,
1829            encoder: &mut fidl::encoding::Encoder<'_, D>,
1830            offset: usize,
1831            depth: fidl::encoding::Depth,
1832        ) -> fidl::Result<()> {
1833            encoder.debug_check_bounds::<DeviceGetInfoResponse>(offset);
1834            // Zero out padding regions. There's no need to apply masks
1835            // because the unmasked parts will be overwritten by fields.
1836            // Write the fields.
1837            self.0.encode(encoder, offset + 0, depth)?;
1838            Ok(())
1839        }
1840    }
1841
1842    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for DeviceGetInfoResponse {
1843        #[inline(always)]
1844        fn new_empty() -> Self {
1845            Self { info: fidl::new_empty!(DeviceInfo, D) }
1846        }
1847
1848        #[inline]
1849        unsafe fn decode(
1850            &mut self,
1851            decoder: &mut fidl::encoding::Decoder<'_, D>,
1852            offset: usize,
1853            _depth: fidl::encoding::Depth,
1854        ) -> fidl::Result<()> {
1855            decoder.debug_check_bounds::<Self>(offset);
1856            // Verify that padding bytes are zero.
1857            fidl::decode!(DeviceInfo, D, &mut self.info, decoder, offset + 0, _depth)?;
1858            Ok(())
1859        }
1860    }
1861
1862    impl fidl::encoding::ValueTypeMarker for Empty {
1863        type Borrowed<'a> = &'a Self;
1864        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1865            value
1866        }
1867    }
1868
1869    unsafe impl fidl::encoding::TypeMarker for Empty {
1870        type Owned = Self;
1871
1872        #[inline(always)]
1873        fn inline_align(_context: fidl::encoding::Context) -> usize {
1874            1
1875        }
1876
1877        #[inline(always)]
1878        fn inline_size(_context: fidl::encoding::Context) -> usize {
1879            1
1880        }
1881    }
1882
1883    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Empty, D> for &Empty {
1884        #[inline]
1885        unsafe fn encode(
1886            self,
1887            encoder: &mut fidl::encoding::Encoder<'_, D>,
1888            offset: usize,
1889            _depth: fidl::encoding::Depth,
1890        ) -> fidl::Result<()> {
1891            encoder.debug_check_bounds::<Empty>(offset);
1892            encoder.write_num(0u8, offset);
1893            Ok(())
1894        }
1895    }
1896
1897    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Empty {
1898        #[inline(always)]
1899        fn new_empty() -> Self {
1900            Self
1901        }
1902
1903        #[inline]
1904        unsafe fn decode(
1905            &mut self,
1906            decoder: &mut fidl::encoding::Decoder<'_, D>,
1907            offset: usize,
1908            _depth: fidl::encoding::Depth,
1909        ) -> fidl::Result<()> {
1910            decoder.debug_check_bounds::<Self>(offset);
1911            match decoder.read_num::<u8>(offset) {
1912                0 => Ok(()),
1913                _ => Err(fidl::Error::Invalid),
1914            }
1915        }
1916    }
1917
1918    impl fidl::encoding::ValueTypeMarker for FrameTypeSupport {
1919        type Borrowed<'a> = &'a Self;
1920        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1921            value
1922        }
1923    }
1924
1925    unsafe impl fidl::encoding::TypeMarker for FrameTypeSupport {
1926        type Owned = Self;
1927
1928        #[inline(always)]
1929        fn inline_align(_context: fidl::encoding::Context) -> usize {
1930            4
1931        }
1932
1933        #[inline(always)]
1934        fn inline_size(_context: fidl::encoding::Context) -> usize {
1935            12
1936        }
1937    }
1938
1939    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<FrameTypeSupport, D>
1940        for &FrameTypeSupport
1941    {
1942        #[inline]
1943        unsafe fn encode(
1944            self,
1945            encoder: &mut fidl::encoding::Encoder<'_, D>,
1946            offset: usize,
1947            _depth: fidl::encoding::Depth,
1948        ) -> fidl::Result<()> {
1949            encoder.debug_check_bounds::<FrameTypeSupport>(offset);
1950            // Delegate to tuple encoding.
1951            fidl::encoding::Encode::<FrameTypeSupport, D>::encode(
1952                (
1953                    <FrameType as fidl::encoding::ValueTypeMarker>::borrow(&self.type_),
1954                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.features),
1955                    <TxFlags as fidl::encoding::ValueTypeMarker>::borrow(&self.supported_flags),
1956                ),
1957                encoder,
1958                offset,
1959                _depth,
1960            )
1961        }
1962    }
1963    unsafe impl<
1964        D: fidl::encoding::ResourceDialect,
1965        T0: fidl::encoding::Encode<FrameType, D>,
1966        T1: fidl::encoding::Encode<u32, D>,
1967        T2: fidl::encoding::Encode<TxFlags, D>,
1968    > fidl::encoding::Encode<FrameTypeSupport, D> for (T0, T1, T2)
1969    {
1970        #[inline]
1971        unsafe fn encode(
1972            self,
1973            encoder: &mut fidl::encoding::Encoder<'_, D>,
1974            offset: usize,
1975            depth: fidl::encoding::Depth,
1976        ) -> fidl::Result<()> {
1977            encoder.debug_check_bounds::<FrameTypeSupport>(offset);
1978            // Zero out padding regions. There's no need to apply masks
1979            // because the unmasked parts will be overwritten by fields.
1980            unsafe {
1981                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
1982                (ptr as *mut u32).write_unaligned(0);
1983            }
1984            // Write the fields.
1985            self.0.encode(encoder, offset + 0, depth)?;
1986            self.1.encode(encoder, offset + 4, depth)?;
1987            self.2.encode(encoder, offset + 8, depth)?;
1988            Ok(())
1989        }
1990    }
1991
1992    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for FrameTypeSupport {
1993        #[inline(always)]
1994        fn new_empty() -> Self {
1995            Self {
1996                type_: fidl::new_empty!(FrameType, D),
1997                features: fidl::new_empty!(u32, D),
1998                supported_flags: fidl::new_empty!(TxFlags, D),
1999            }
2000        }
2001
2002        #[inline]
2003        unsafe fn decode(
2004            &mut self,
2005            decoder: &mut fidl::encoding::Decoder<'_, D>,
2006            offset: usize,
2007            _depth: fidl::encoding::Depth,
2008        ) -> fidl::Result<()> {
2009            decoder.debug_check_bounds::<Self>(offset);
2010            // Verify that padding bytes are zero.
2011            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
2012            let padval = unsafe { (ptr as *const u32).read_unaligned() };
2013            let mask = 0xffffff00u32;
2014            let maskedval = padval & mask;
2015            if maskedval != 0 {
2016                return Err(fidl::Error::NonZeroPadding {
2017                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
2018                });
2019            }
2020            fidl::decode!(FrameType, D, &mut self.type_, decoder, offset + 0, _depth)?;
2021            fidl::decode!(u32, D, &mut self.features, decoder, offset + 4, _depth)?;
2022            fidl::decode!(TxFlags, D, &mut self.supported_flags, decoder, offset + 8, _depth)?;
2023            Ok(())
2024        }
2025    }
2026
2027    impl fidl::encoding::ValueTypeMarker for MacAddressingAddMulticastAddressRequest {
2028        type Borrowed<'a> = &'a Self;
2029        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2030            value
2031        }
2032    }
2033
2034    unsafe impl fidl::encoding::TypeMarker for MacAddressingAddMulticastAddressRequest {
2035        type Owned = Self;
2036
2037        #[inline(always)]
2038        fn inline_align(_context: fidl::encoding::Context) -> usize {
2039            1
2040        }
2041
2042        #[inline(always)]
2043        fn inline_size(_context: fidl::encoding::Context) -> usize {
2044            6
2045        }
2046    }
2047
2048    unsafe impl<D: fidl::encoding::ResourceDialect>
2049        fidl::encoding::Encode<MacAddressingAddMulticastAddressRequest, D>
2050        for &MacAddressingAddMulticastAddressRequest
2051    {
2052        #[inline]
2053        unsafe fn encode(
2054            self,
2055            encoder: &mut fidl::encoding::Encoder<'_, D>,
2056            offset: usize,
2057            _depth: fidl::encoding::Depth,
2058        ) -> fidl::Result<()> {
2059            encoder.debug_check_bounds::<MacAddressingAddMulticastAddressRequest>(offset);
2060            // Delegate to tuple encoding.
2061            fidl::encoding::Encode::<MacAddressingAddMulticastAddressRequest, D>::encode(
2062                (
2063                    <fidl_fuchsia_net__common::MacAddress as fidl::encoding::ValueTypeMarker>::borrow(&self.address),
2064                ),
2065                encoder, offset, _depth
2066            )
2067        }
2068    }
2069    unsafe impl<
2070        D: fidl::encoding::ResourceDialect,
2071        T0: fidl::encoding::Encode<fidl_fuchsia_net__common::MacAddress, D>,
2072    > fidl::encoding::Encode<MacAddressingAddMulticastAddressRequest, D> for (T0,)
2073    {
2074        #[inline]
2075        unsafe fn encode(
2076            self,
2077            encoder: &mut fidl::encoding::Encoder<'_, D>,
2078            offset: usize,
2079            depth: fidl::encoding::Depth,
2080        ) -> fidl::Result<()> {
2081            encoder.debug_check_bounds::<MacAddressingAddMulticastAddressRequest>(offset);
2082            // Zero out padding regions. There's no need to apply masks
2083            // because the unmasked parts will be overwritten by fields.
2084            // Write the fields.
2085            self.0.encode(encoder, offset + 0, depth)?;
2086            Ok(())
2087        }
2088    }
2089
2090    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2091        for MacAddressingAddMulticastAddressRequest
2092    {
2093        #[inline(always)]
2094        fn new_empty() -> Self {
2095            Self { address: fidl::new_empty!(fidl_fuchsia_net__common::MacAddress, D) }
2096        }
2097
2098        #[inline]
2099        unsafe fn decode(
2100            &mut self,
2101            decoder: &mut fidl::encoding::Decoder<'_, D>,
2102            offset: usize,
2103            _depth: fidl::encoding::Depth,
2104        ) -> fidl::Result<()> {
2105            decoder.debug_check_bounds::<Self>(offset);
2106            // Verify that padding bytes are zero.
2107            fidl::decode!(
2108                fidl_fuchsia_net__common::MacAddress,
2109                D,
2110                &mut self.address,
2111                decoder,
2112                offset + 0,
2113                _depth
2114            )?;
2115            Ok(())
2116        }
2117    }
2118
2119    impl fidl::encoding::ValueTypeMarker for MacAddressingAddMulticastAddressResponse {
2120        type Borrowed<'a> = &'a Self;
2121        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2122            value
2123        }
2124    }
2125
2126    unsafe impl fidl::encoding::TypeMarker for MacAddressingAddMulticastAddressResponse {
2127        type Owned = Self;
2128
2129        #[inline(always)]
2130        fn inline_align(_context: fidl::encoding::Context) -> usize {
2131            4
2132        }
2133
2134        #[inline(always)]
2135        fn inline_size(_context: fidl::encoding::Context) -> usize {
2136            4
2137        }
2138        #[inline(always)]
2139        fn encode_is_copy() -> bool {
2140            true
2141        }
2142
2143        #[inline(always)]
2144        fn decode_is_copy() -> bool {
2145            true
2146        }
2147    }
2148
2149    unsafe impl<D: fidl::encoding::ResourceDialect>
2150        fidl::encoding::Encode<MacAddressingAddMulticastAddressResponse, D>
2151        for &MacAddressingAddMulticastAddressResponse
2152    {
2153        #[inline]
2154        unsafe fn encode(
2155            self,
2156            encoder: &mut fidl::encoding::Encoder<'_, D>,
2157            offset: usize,
2158            _depth: fidl::encoding::Depth,
2159        ) -> fidl::Result<()> {
2160            encoder.debug_check_bounds::<MacAddressingAddMulticastAddressResponse>(offset);
2161            unsafe {
2162                // Copy the object into the buffer.
2163                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
2164                (buf_ptr as *mut MacAddressingAddMulticastAddressResponse).write_unaligned(
2165                    (self as *const MacAddressingAddMulticastAddressResponse).read(),
2166                );
2167                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
2168                // done second because the memcpy will write garbage to these bytes.
2169            }
2170            Ok(())
2171        }
2172    }
2173    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<i32, D>>
2174        fidl::encoding::Encode<MacAddressingAddMulticastAddressResponse, D> for (T0,)
2175    {
2176        #[inline]
2177        unsafe fn encode(
2178            self,
2179            encoder: &mut fidl::encoding::Encoder<'_, D>,
2180            offset: usize,
2181            depth: fidl::encoding::Depth,
2182        ) -> fidl::Result<()> {
2183            encoder.debug_check_bounds::<MacAddressingAddMulticastAddressResponse>(offset);
2184            // Zero out padding regions. There's no need to apply masks
2185            // because the unmasked parts will be overwritten by fields.
2186            // Write the fields.
2187            self.0.encode(encoder, offset + 0, depth)?;
2188            Ok(())
2189        }
2190    }
2191
2192    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2193        for MacAddressingAddMulticastAddressResponse
2194    {
2195        #[inline(always)]
2196        fn new_empty() -> Self {
2197            Self { status: fidl::new_empty!(i32, D) }
2198        }
2199
2200        #[inline]
2201        unsafe fn decode(
2202            &mut self,
2203            decoder: &mut fidl::encoding::Decoder<'_, D>,
2204            offset: usize,
2205            _depth: fidl::encoding::Depth,
2206        ) -> fidl::Result<()> {
2207            decoder.debug_check_bounds::<Self>(offset);
2208            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
2209            // Verify that padding bytes are zero.
2210            // Copy from the buffer into the object.
2211            unsafe {
2212                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
2213            }
2214            Ok(())
2215        }
2216    }
2217
2218    impl fidl::encoding::ValueTypeMarker for MacAddressingGetUnicastAddressResponse {
2219        type Borrowed<'a> = &'a Self;
2220        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2221            value
2222        }
2223    }
2224
2225    unsafe impl fidl::encoding::TypeMarker for MacAddressingGetUnicastAddressResponse {
2226        type Owned = Self;
2227
2228        #[inline(always)]
2229        fn inline_align(_context: fidl::encoding::Context) -> usize {
2230            1
2231        }
2232
2233        #[inline(always)]
2234        fn inline_size(_context: fidl::encoding::Context) -> usize {
2235            6
2236        }
2237    }
2238
2239    unsafe impl<D: fidl::encoding::ResourceDialect>
2240        fidl::encoding::Encode<MacAddressingGetUnicastAddressResponse, D>
2241        for &MacAddressingGetUnicastAddressResponse
2242    {
2243        #[inline]
2244        unsafe fn encode(
2245            self,
2246            encoder: &mut fidl::encoding::Encoder<'_, D>,
2247            offset: usize,
2248            _depth: fidl::encoding::Depth,
2249        ) -> fidl::Result<()> {
2250            encoder.debug_check_bounds::<MacAddressingGetUnicastAddressResponse>(offset);
2251            // Delegate to tuple encoding.
2252            fidl::encoding::Encode::<MacAddressingGetUnicastAddressResponse, D>::encode(
2253                (
2254                    <fidl_fuchsia_net__common::MacAddress as fidl::encoding::ValueTypeMarker>::borrow(&self.address),
2255                ),
2256                encoder, offset, _depth
2257            )
2258        }
2259    }
2260    unsafe impl<
2261        D: fidl::encoding::ResourceDialect,
2262        T0: fidl::encoding::Encode<fidl_fuchsia_net__common::MacAddress, D>,
2263    > fidl::encoding::Encode<MacAddressingGetUnicastAddressResponse, D> for (T0,)
2264    {
2265        #[inline]
2266        unsafe fn encode(
2267            self,
2268            encoder: &mut fidl::encoding::Encoder<'_, D>,
2269            offset: usize,
2270            depth: fidl::encoding::Depth,
2271        ) -> fidl::Result<()> {
2272            encoder.debug_check_bounds::<MacAddressingGetUnicastAddressResponse>(offset);
2273            // Zero out padding regions. There's no need to apply masks
2274            // because the unmasked parts will be overwritten by fields.
2275            // Write the fields.
2276            self.0.encode(encoder, offset + 0, depth)?;
2277            Ok(())
2278        }
2279    }
2280
2281    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2282        for MacAddressingGetUnicastAddressResponse
2283    {
2284        #[inline(always)]
2285        fn new_empty() -> Self {
2286            Self { address: fidl::new_empty!(fidl_fuchsia_net__common::MacAddress, D) }
2287        }
2288
2289        #[inline]
2290        unsafe fn decode(
2291            &mut self,
2292            decoder: &mut fidl::encoding::Decoder<'_, D>,
2293            offset: usize,
2294            _depth: fidl::encoding::Depth,
2295        ) -> fidl::Result<()> {
2296            decoder.debug_check_bounds::<Self>(offset);
2297            // Verify that padding bytes are zero.
2298            fidl::decode!(
2299                fidl_fuchsia_net__common::MacAddress,
2300                D,
2301                &mut self.address,
2302                decoder,
2303                offset + 0,
2304                _depth
2305            )?;
2306            Ok(())
2307        }
2308    }
2309
2310    impl fidl::encoding::ValueTypeMarker for MacAddressingRemoveMulticastAddressRequest {
2311        type Borrowed<'a> = &'a Self;
2312        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2313            value
2314        }
2315    }
2316
2317    unsafe impl fidl::encoding::TypeMarker for MacAddressingRemoveMulticastAddressRequest {
2318        type Owned = Self;
2319
2320        #[inline(always)]
2321        fn inline_align(_context: fidl::encoding::Context) -> usize {
2322            1
2323        }
2324
2325        #[inline(always)]
2326        fn inline_size(_context: fidl::encoding::Context) -> usize {
2327            6
2328        }
2329    }
2330
2331    unsafe impl<D: fidl::encoding::ResourceDialect>
2332        fidl::encoding::Encode<MacAddressingRemoveMulticastAddressRequest, D>
2333        for &MacAddressingRemoveMulticastAddressRequest
2334    {
2335        #[inline]
2336        unsafe fn encode(
2337            self,
2338            encoder: &mut fidl::encoding::Encoder<'_, D>,
2339            offset: usize,
2340            _depth: fidl::encoding::Depth,
2341        ) -> fidl::Result<()> {
2342            encoder.debug_check_bounds::<MacAddressingRemoveMulticastAddressRequest>(offset);
2343            // Delegate to tuple encoding.
2344            fidl::encoding::Encode::<MacAddressingRemoveMulticastAddressRequest, D>::encode(
2345                (
2346                    <fidl_fuchsia_net__common::MacAddress as fidl::encoding::ValueTypeMarker>::borrow(&self.address),
2347                ),
2348                encoder, offset, _depth
2349            )
2350        }
2351    }
2352    unsafe impl<
2353        D: fidl::encoding::ResourceDialect,
2354        T0: fidl::encoding::Encode<fidl_fuchsia_net__common::MacAddress, D>,
2355    > fidl::encoding::Encode<MacAddressingRemoveMulticastAddressRequest, D> for (T0,)
2356    {
2357        #[inline]
2358        unsafe fn encode(
2359            self,
2360            encoder: &mut fidl::encoding::Encoder<'_, D>,
2361            offset: usize,
2362            depth: fidl::encoding::Depth,
2363        ) -> fidl::Result<()> {
2364            encoder.debug_check_bounds::<MacAddressingRemoveMulticastAddressRequest>(offset);
2365            // Zero out padding regions. There's no need to apply masks
2366            // because the unmasked parts will be overwritten by fields.
2367            // Write the fields.
2368            self.0.encode(encoder, offset + 0, depth)?;
2369            Ok(())
2370        }
2371    }
2372
2373    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2374        for MacAddressingRemoveMulticastAddressRequest
2375    {
2376        #[inline(always)]
2377        fn new_empty() -> Self {
2378            Self { address: fidl::new_empty!(fidl_fuchsia_net__common::MacAddress, D) }
2379        }
2380
2381        #[inline]
2382        unsafe fn decode(
2383            &mut self,
2384            decoder: &mut fidl::encoding::Decoder<'_, D>,
2385            offset: usize,
2386            _depth: fidl::encoding::Depth,
2387        ) -> fidl::Result<()> {
2388            decoder.debug_check_bounds::<Self>(offset);
2389            // Verify that padding bytes are zero.
2390            fidl::decode!(
2391                fidl_fuchsia_net__common::MacAddress,
2392                D,
2393                &mut self.address,
2394                decoder,
2395                offset + 0,
2396                _depth
2397            )?;
2398            Ok(())
2399        }
2400    }
2401
2402    impl fidl::encoding::ValueTypeMarker for MacAddressingRemoveMulticastAddressResponse {
2403        type Borrowed<'a> = &'a Self;
2404        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2405            value
2406        }
2407    }
2408
2409    unsafe impl fidl::encoding::TypeMarker for MacAddressingRemoveMulticastAddressResponse {
2410        type Owned = Self;
2411
2412        #[inline(always)]
2413        fn inline_align(_context: fidl::encoding::Context) -> usize {
2414            4
2415        }
2416
2417        #[inline(always)]
2418        fn inline_size(_context: fidl::encoding::Context) -> usize {
2419            4
2420        }
2421        #[inline(always)]
2422        fn encode_is_copy() -> bool {
2423            true
2424        }
2425
2426        #[inline(always)]
2427        fn decode_is_copy() -> bool {
2428            true
2429        }
2430    }
2431
2432    unsafe impl<D: fidl::encoding::ResourceDialect>
2433        fidl::encoding::Encode<MacAddressingRemoveMulticastAddressResponse, D>
2434        for &MacAddressingRemoveMulticastAddressResponse
2435    {
2436        #[inline]
2437        unsafe fn encode(
2438            self,
2439            encoder: &mut fidl::encoding::Encoder<'_, D>,
2440            offset: usize,
2441            _depth: fidl::encoding::Depth,
2442        ) -> fidl::Result<()> {
2443            encoder.debug_check_bounds::<MacAddressingRemoveMulticastAddressResponse>(offset);
2444            unsafe {
2445                // Copy the object into the buffer.
2446                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
2447                (buf_ptr as *mut MacAddressingRemoveMulticastAddressResponse).write_unaligned(
2448                    (self as *const MacAddressingRemoveMulticastAddressResponse).read(),
2449                );
2450                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
2451                // done second because the memcpy will write garbage to these bytes.
2452            }
2453            Ok(())
2454        }
2455    }
2456    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<i32, D>>
2457        fidl::encoding::Encode<MacAddressingRemoveMulticastAddressResponse, D> for (T0,)
2458    {
2459        #[inline]
2460        unsafe fn encode(
2461            self,
2462            encoder: &mut fidl::encoding::Encoder<'_, D>,
2463            offset: usize,
2464            depth: fidl::encoding::Depth,
2465        ) -> fidl::Result<()> {
2466            encoder.debug_check_bounds::<MacAddressingRemoveMulticastAddressResponse>(offset);
2467            // Zero out padding regions. There's no need to apply masks
2468            // because the unmasked parts will be overwritten by fields.
2469            // Write the fields.
2470            self.0.encode(encoder, offset + 0, depth)?;
2471            Ok(())
2472        }
2473    }
2474
2475    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2476        for MacAddressingRemoveMulticastAddressResponse
2477    {
2478        #[inline(always)]
2479        fn new_empty() -> Self {
2480            Self { status: fidl::new_empty!(i32, D) }
2481        }
2482
2483        #[inline]
2484        unsafe fn decode(
2485            &mut self,
2486            decoder: &mut fidl::encoding::Decoder<'_, D>,
2487            offset: usize,
2488            _depth: fidl::encoding::Depth,
2489        ) -> fidl::Result<()> {
2490            decoder.debug_check_bounds::<Self>(offset);
2491            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
2492            // Verify that padding bytes are zero.
2493            // Copy from the buffer into the object.
2494            unsafe {
2495                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
2496            }
2497            Ok(())
2498        }
2499    }
2500
2501    impl fidl::encoding::ValueTypeMarker for MacAddressingSetModeRequest {
2502        type Borrowed<'a> = &'a Self;
2503        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2504            value
2505        }
2506    }
2507
2508    unsafe impl fidl::encoding::TypeMarker for MacAddressingSetModeRequest {
2509        type Owned = Self;
2510
2511        #[inline(always)]
2512        fn inline_align(_context: fidl::encoding::Context) -> usize {
2513            4
2514        }
2515
2516        #[inline(always)]
2517        fn inline_size(_context: fidl::encoding::Context) -> usize {
2518            4
2519        }
2520    }
2521
2522    unsafe impl<D: fidl::encoding::ResourceDialect>
2523        fidl::encoding::Encode<MacAddressingSetModeRequest, D> for &MacAddressingSetModeRequest
2524    {
2525        #[inline]
2526        unsafe fn encode(
2527            self,
2528            encoder: &mut fidl::encoding::Encoder<'_, D>,
2529            offset: usize,
2530            _depth: fidl::encoding::Depth,
2531        ) -> fidl::Result<()> {
2532            encoder.debug_check_bounds::<MacAddressingSetModeRequest>(offset);
2533            // Delegate to tuple encoding.
2534            fidl::encoding::Encode::<MacAddressingSetModeRequest, D>::encode(
2535                (<MacFilterMode as fidl::encoding::ValueTypeMarker>::borrow(&self.mode),),
2536                encoder,
2537                offset,
2538                _depth,
2539            )
2540        }
2541    }
2542    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<MacFilterMode, D>>
2543        fidl::encoding::Encode<MacAddressingSetModeRequest, D> for (T0,)
2544    {
2545        #[inline]
2546        unsafe fn encode(
2547            self,
2548            encoder: &mut fidl::encoding::Encoder<'_, D>,
2549            offset: usize,
2550            depth: fidl::encoding::Depth,
2551        ) -> fidl::Result<()> {
2552            encoder.debug_check_bounds::<MacAddressingSetModeRequest>(offset);
2553            // Zero out padding regions. There's no need to apply masks
2554            // because the unmasked parts will be overwritten by fields.
2555            // Write the fields.
2556            self.0.encode(encoder, offset + 0, depth)?;
2557            Ok(())
2558        }
2559    }
2560
2561    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2562        for MacAddressingSetModeRequest
2563    {
2564        #[inline(always)]
2565        fn new_empty() -> Self {
2566            Self { mode: fidl::new_empty!(MacFilterMode, D) }
2567        }
2568
2569        #[inline]
2570        unsafe fn decode(
2571            &mut self,
2572            decoder: &mut fidl::encoding::Decoder<'_, D>,
2573            offset: usize,
2574            _depth: fidl::encoding::Depth,
2575        ) -> fidl::Result<()> {
2576            decoder.debug_check_bounds::<Self>(offset);
2577            // Verify that padding bytes are zero.
2578            fidl::decode!(MacFilterMode, D, &mut self.mode, decoder, offset + 0, _depth)?;
2579            Ok(())
2580        }
2581    }
2582
2583    impl fidl::encoding::ValueTypeMarker for MacAddressingSetModeResponse {
2584        type Borrowed<'a> = &'a Self;
2585        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2586            value
2587        }
2588    }
2589
2590    unsafe impl fidl::encoding::TypeMarker for MacAddressingSetModeResponse {
2591        type Owned = Self;
2592
2593        #[inline(always)]
2594        fn inline_align(_context: fidl::encoding::Context) -> usize {
2595            4
2596        }
2597
2598        #[inline(always)]
2599        fn inline_size(_context: fidl::encoding::Context) -> usize {
2600            4
2601        }
2602        #[inline(always)]
2603        fn encode_is_copy() -> bool {
2604            true
2605        }
2606
2607        #[inline(always)]
2608        fn decode_is_copy() -> bool {
2609            true
2610        }
2611    }
2612
2613    unsafe impl<D: fidl::encoding::ResourceDialect>
2614        fidl::encoding::Encode<MacAddressingSetModeResponse, D> for &MacAddressingSetModeResponse
2615    {
2616        #[inline]
2617        unsafe fn encode(
2618            self,
2619            encoder: &mut fidl::encoding::Encoder<'_, D>,
2620            offset: usize,
2621            _depth: fidl::encoding::Depth,
2622        ) -> fidl::Result<()> {
2623            encoder.debug_check_bounds::<MacAddressingSetModeResponse>(offset);
2624            unsafe {
2625                // Copy the object into the buffer.
2626                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
2627                (buf_ptr as *mut MacAddressingSetModeResponse)
2628                    .write_unaligned((self as *const MacAddressingSetModeResponse).read());
2629                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
2630                // done second because the memcpy will write garbage to these bytes.
2631            }
2632            Ok(())
2633        }
2634    }
2635    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<i32, D>>
2636        fidl::encoding::Encode<MacAddressingSetModeResponse, D> for (T0,)
2637    {
2638        #[inline]
2639        unsafe fn encode(
2640            self,
2641            encoder: &mut fidl::encoding::Encoder<'_, D>,
2642            offset: usize,
2643            depth: fidl::encoding::Depth,
2644        ) -> fidl::Result<()> {
2645            encoder.debug_check_bounds::<MacAddressingSetModeResponse>(offset);
2646            // Zero out padding regions. There's no need to apply masks
2647            // because the unmasked parts will be overwritten by fields.
2648            // Write the fields.
2649            self.0.encode(encoder, offset + 0, depth)?;
2650            Ok(())
2651        }
2652    }
2653
2654    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2655        for MacAddressingSetModeResponse
2656    {
2657        #[inline(always)]
2658        fn new_empty() -> Self {
2659            Self { status: fidl::new_empty!(i32, D) }
2660        }
2661
2662        #[inline]
2663        unsafe fn decode(
2664            &mut self,
2665            decoder: &mut fidl::encoding::Decoder<'_, D>,
2666            offset: usize,
2667            _depth: fidl::encoding::Depth,
2668        ) -> fidl::Result<()> {
2669            decoder.debug_check_bounds::<Self>(offset);
2670            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
2671            // Verify that padding bytes are zero.
2672            // Copy from the buffer into the object.
2673            unsafe {
2674                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
2675            }
2676            Ok(())
2677        }
2678    }
2679
2680    impl fidl::encoding::ValueTypeMarker for PortGetInfoResponse {
2681        type Borrowed<'a> = &'a Self;
2682        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2683            value
2684        }
2685    }
2686
2687    unsafe impl fidl::encoding::TypeMarker for PortGetInfoResponse {
2688        type Owned = Self;
2689
2690        #[inline(always)]
2691        fn inline_align(_context: fidl::encoding::Context) -> usize {
2692            8
2693        }
2694
2695        #[inline(always)]
2696        fn inline_size(_context: fidl::encoding::Context) -> usize {
2697            16
2698        }
2699    }
2700
2701    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<PortGetInfoResponse, D>
2702        for &PortGetInfoResponse
2703    {
2704        #[inline]
2705        unsafe fn encode(
2706            self,
2707            encoder: &mut fidl::encoding::Encoder<'_, D>,
2708            offset: usize,
2709            _depth: fidl::encoding::Depth,
2710        ) -> fidl::Result<()> {
2711            encoder.debug_check_bounds::<PortGetInfoResponse>(offset);
2712            // Delegate to tuple encoding.
2713            fidl::encoding::Encode::<PortGetInfoResponse, D>::encode(
2714                (<PortInfo as fidl::encoding::ValueTypeMarker>::borrow(&self.info),),
2715                encoder,
2716                offset,
2717                _depth,
2718            )
2719        }
2720    }
2721    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<PortInfo, D>>
2722        fidl::encoding::Encode<PortGetInfoResponse, D> for (T0,)
2723    {
2724        #[inline]
2725        unsafe fn encode(
2726            self,
2727            encoder: &mut fidl::encoding::Encoder<'_, D>,
2728            offset: usize,
2729            depth: fidl::encoding::Depth,
2730        ) -> fidl::Result<()> {
2731            encoder.debug_check_bounds::<PortGetInfoResponse>(offset);
2732            // Zero out padding regions. There's no need to apply masks
2733            // because the unmasked parts will be overwritten by fields.
2734            // Write the fields.
2735            self.0.encode(encoder, offset + 0, depth)?;
2736            Ok(())
2737        }
2738    }
2739
2740    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for PortGetInfoResponse {
2741        #[inline(always)]
2742        fn new_empty() -> Self {
2743            Self { info: fidl::new_empty!(PortInfo, D) }
2744        }
2745
2746        #[inline]
2747        unsafe fn decode(
2748            &mut self,
2749            decoder: &mut fidl::encoding::Decoder<'_, D>,
2750            offset: usize,
2751            _depth: fidl::encoding::Depth,
2752        ) -> fidl::Result<()> {
2753            decoder.debug_check_bounds::<Self>(offset);
2754            // Verify that padding bytes are zero.
2755            fidl::decode!(PortInfo, D, &mut self.info, decoder, offset + 0, _depth)?;
2756            Ok(())
2757        }
2758    }
2759
2760    impl fidl::encoding::ValueTypeMarker for PortGetStatusResponse {
2761        type Borrowed<'a> = &'a Self;
2762        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2763            value
2764        }
2765    }
2766
2767    unsafe impl fidl::encoding::TypeMarker for PortGetStatusResponse {
2768        type Owned = Self;
2769
2770        #[inline(always)]
2771        fn inline_align(_context: fidl::encoding::Context) -> usize {
2772            8
2773        }
2774
2775        #[inline(always)]
2776        fn inline_size(_context: fidl::encoding::Context) -> usize {
2777            16
2778        }
2779    }
2780
2781    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<PortGetStatusResponse, D>
2782        for &PortGetStatusResponse
2783    {
2784        #[inline]
2785        unsafe fn encode(
2786            self,
2787            encoder: &mut fidl::encoding::Encoder<'_, D>,
2788            offset: usize,
2789            _depth: fidl::encoding::Depth,
2790        ) -> fidl::Result<()> {
2791            encoder.debug_check_bounds::<PortGetStatusResponse>(offset);
2792            // Delegate to tuple encoding.
2793            fidl::encoding::Encode::<PortGetStatusResponse, D>::encode(
2794                (<PortStatus as fidl::encoding::ValueTypeMarker>::borrow(&self.status),),
2795                encoder,
2796                offset,
2797                _depth,
2798            )
2799        }
2800    }
2801    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<PortStatus, D>>
2802        fidl::encoding::Encode<PortGetStatusResponse, D> for (T0,)
2803    {
2804        #[inline]
2805        unsafe fn encode(
2806            self,
2807            encoder: &mut fidl::encoding::Encoder<'_, D>,
2808            offset: usize,
2809            depth: fidl::encoding::Depth,
2810        ) -> fidl::Result<()> {
2811            encoder.debug_check_bounds::<PortGetStatusResponse>(offset);
2812            // Zero out padding regions. There's no need to apply masks
2813            // because the unmasked parts will be overwritten by fields.
2814            // Write the fields.
2815            self.0.encode(encoder, offset + 0, depth)?;
2816            Ok(())
2817        }
2818    }
2819
2820    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for PortGetStatusResponse {
2821        #[inline(always)]
2822        fn new_empty() -> Self {
2823            Self { status: fidl::new_empty!(PortStatus, D) }
2824        }
2825
2826        #[inline]
2827        unsafe fn decode(
2828            &mut self,
2829            decoder: &mut fidl::encoding::Decoder<'_, D>,
2830            offset: usize,
2831            _depth: fidl::encoding::Depth,
2832        ) -> fidl::Result<()> {
2833            decoder.debug_check_bounds::<Self>(offset);
2834            // Verify that padding bytes are zero.
2835            fidl::decode!(PortStatus, D, &mut self.status, decoder, offset + 0, _depth)?;
2836            Ok(())
2837        }
2838    }
2839
2840    impl fidl::encoding::ValueTypeMarker for PortId {
2841        type Borrowed<'a> = &'a Self;
2842        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2843            value
2844        }
2845    }
2846
2847    unsafe impl fidl::encoding::TypeMarker for PortId {
2848        type Owned = Self;
2849
2850        #[inline(always)]
2851        fn inline_align(_context: fidl::encoding::Context) -> usize {
2852            1
2853        }
2854
2855        #[inline(always)]
2856        fn inline_size(_context: fidl::encoding::Context) -> usize {
2857            2
2858        }
2859        #[inline(always)]
2860        fn encode_is_copy() -> bool {
2861            true
2862        }
2863
2864        #[inline(always)]
2865        fn decode_is_copy() -> bool {
2866            true
2867        }
2868    }
2869
2870    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<PortId, D> for &PortId {
2871        #[inline]
2872        unsafe fn encode(
2873            self,
2874            encoder: &mut fidl::encoding::Encoder<'_, D>,
2875            offset: usize,
2876            _depth: fidl::encoding::Depth,
2877        ) -> fidl::Result<()> {
2878            encoder.debug_check_bounds::<PortId>(offset);
2879            unsafe {
2880                // Copy the object into the buffer.
2881                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
2882                (buf_ptr as *mut PortId).write_unaligned((self as *const PortId).read());
2883                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
2884                // done second because the memcpy will write garbage to these bytes.
2885            }
2886            Ok(())
2887        }
2888    }
2889    unsafe impl<
2890        D: fidl::encoding::ResourceDialect,
2891        T0: fidl::encoding::Encode<u8, D>,
2892        T1: fidl::encoding::Encode<u8, D>,
2893    > fidl::encoding::Encode<PortId, D> for (T0, T1)
2894    {
2895        #[inline]
2896        unsafe fn encode(
2897            self,
2898            encoder: &mut fidl::encoding::Encoder<'_, D>,
2899            offset: usize,
2900            depth: fidl::encoding::Depth,
2901        ) -> fidl::Result<()> {
2902            encoder.debug_check_bounds::<PortId>(offset);
2903            // Zero out padding regions. There's no need to apply masks
2904            // because the unmasked parts will be overwritten by fields.
2905            // Write the fields.
2906            self.0.encode(encoder, offset + 0, depth)?;
2907            self.1.encode(encoder, offset + 1, depth)?;
2908            Ok(())
2909        }
2910    }
2911
2912    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for PortId {
2913        #[inline(always)]
2914        fn new_empty() -> Self {
2915            Self { base: fidl::new_empty!(u8, D), salt: fidl::new_empty!(u8, D) }
2916        }
2917
2918        #[inline]
2919        unsafe fn decode(
2920            &mut self,
2921            decoder: &mut fidl::encoding::Decoder<'_, D>,
2922            offset: usize,
2923            _depth: fidl::encoding::Depth,
2924        ) -> fidl::Result<()> {
2925            decoder.debug_check_bounds::<Self>(offset);
2926            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
2927            // Verify that padding bytes are zero.
2928            // Copy from the buffer into the object.
2929            unsafe {
2930                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 2);
2931            }
2932            Ok(())
2933        }
2934    }
2935
2936    impl fidl::encoding::ValueTypeMarker for PortWatcherWatchResponse {
2937        type Borrowed<'a> = &'a Self;
2938        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2939            value
2940        }
2941    }
2942
2943    unsafe impl fidl::encoding::TypeMarker for PortWatcherWatchResponse {
2944        type Owned = Self;
2945
2946        #[inline(always)]
2947        fn inline_align(_context: fidl::encoding::Context) -> usize {
2948            8
2949        }
2950
2951        #[inline(always)]
2952        fn inline_size(_context: fidl::encoding::Context) -> usize {
2953            16
2954        }
2955    }
2956
2957    unsafe impl<D: fidl::encoding::ResourceDialect>
2958        fidl::encoding::Encode<PortWatcherWatchResponse, D> for &PortWatcherWatchResponse
2959    {
2960        #[inline]
2961        unsafe fn encode(
2962            self,
2963            encoder: &mut fidl::encoding::Encoder<'_, D>,
2964            offset: usize,
2965            _depth: fidl::encoding::Depth,
2966        ) -> fidl::Result<()> {
2967            encoder.debug_check_bounds::<PortWatcherWatchResponse>(offset);
2968            // Delegate to tuple encoding.
2969            fidl::encoding::Encode::<PortWatcherWatchResponse, D>::encode(
2970                (<DevicePortEvent as fidl::encoding::ValueTypeMarker>::borrow(&self.event),),
2971                encoder,
2972                offset,
2973                _depth,
2974            )
2975        }
2976    }
2977    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<DevicePortEvent, D>>
2978        fidl::encoding::Encode<PortWatcherWatchResponse, D> for (T0,)
2979    {
2980        #[inline]
2981        unsafe fn encode(
2982            self,
2983            encoder: &mut fidl::encoding::Encoder<'_, D>,
2984            offset: usize,
2985            depth: fidl::encoding::Depth,
2986        ) -> fidl::Result<()> {
2987            encoder.debug_check_bounds::<PortWatcherWatchResponse>(offset);
2988            // Zero out padding regions. There's no need to apply masks
2989            // because the unmasked parts will be overwritten by fields.
2990            // Write the fields.
2991            self.0.encode(encoder, offset + 0, depth)?;
2992            Ok(())
2993        }
2994    }
2995
2996    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2997        for PortWatcherWatchResponse
2998    {
2999        #[inline(always)]
3000        fn new_empty() -> Self {
3001            Self { event: fidl::new_empty!(DevicePortEvent, D) }
3002        }
3003
3004        #[inline]
3005        unsafe fn decode(
3006            &mut self,
3007            decoder: &mut fidl::encoding::Decoder<'_, D>,
3008            offset: usize,
3009            _depth: fidl::encoding::Depth,
3010        ) -> fidl::Result<()> {
3011            decoder.debug_check_bounds::<Self>(offset);
3012            // Verify that padding bytes are zero.
3013            fidl::decode!(DevicePortEvent, D, &mut self.event, decoder, offset + 0, _depth)?;
3014            Ok(())
3015        }
3016    }
3017
3018    impl fidl::encoding::ValueTypeMarker for SessionAttachRequest {
3019        type Borrowed<'a> = &'a Self;
3020        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3021            value
3022        }
3023    }
3024
3025    unsafe impl fidl::encoding::TypeMarker for SessionAttachRequest {
3026        type Owned = Self;
3027
3028        #[inline(always)]
3029        fn inline_align(_context: fidl::encoding::Context) -> usize {
3030            8
3031        }
3032
3033        #[inline(always)]
3034        fn inline_size(_context: fidl::encoding::Context) -> usize {
3035            24
3036        }
3037    }
3038
3039    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<SessionAttachRequest, D>
3040        for &SessionAttachRequest
3041    {
3042        #[inline]
3043        unsafe fn encode(
3044            self,
3045            encoder: &mut fidl::encoding::Encoder<'_, D>,
3046            offset: usize,
3047            _depth: fidl::encoding::Depth,
3048        ) -> fidl::Result<()> {
3049            encoder.debug_check_bounds::<SessionAttachRequest>(offset);
3050            // Delegate to tuple encoding.
3051            fidl::encoding::Encode::<SessionAttachRequest, D>::encode(
3052                (
3053                    <PortId as fidl::encoding::ValueTypeMarker>::borrow(&self.port),
3054                    <fidl::encoding::Vector<FrameType, 4> as fidl::encoding::ValueTypeMarker>::borrow(&self.rx_frames),
3055                ),
3056                encoder, offset, _depth
3057            )
3058        }
3059    }
3060    unsafe impl<
3061        D: fidl::encoding::ResourceDialect,
3062        T0: fidl::encoding::Encode<PortId, D>,
3063        T1: fidl::encoding::Encode<fidl::encoding::Vector<FrameType, 4>, D>,
3064    > fidl::encoding::Encode<SessionAttachRequest, D> for (T0, T1)
3065    {
3066        #[inline]
3067        unsafe fn encode(
3068            self,
3069            encoder: &mut fidl::encoding::Encoder<'_, D>,
3070            offset: usize,
3071            depth: fidl::encoding::Depth,
3072        ) -> fidl::Result<()> {
3073            encoder.debug_check_bounds::<SessionAttachRequest>(offset);
3074            // Zero out padding regions. There's no need to apply masks
3075            // because the unmasked parts will be overwritten by fields.
3076            unsafe {
3077                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
3078                (ptr as *mut u64).write_unaligned(0);
3079            }
3080            // Write the fields.
3081            self.0.encode(encoder, offset + 0, depth)?;
3082            self.1.encode(encoder, offset + 8, depth)?;
3083            Ok(())
3084        }
3085    }
3086
3087    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SessionAttachRequest {
3088        #[inline(always)]
3089        fn new_empty() -> Self {
3090            Self {
3091                port: fidl::new_empty!(PortId, D),
3092                rx_frames: fidl::new_empty!(fidl::encoding::Vector<FrameType, 4>, D),
3093            }
3094        }
3095
3096        #[inline]
3097        unsafe fn decode(
3098            &mut self,
3099            decoder: &mut fidl::encoding::Decoder<'_, D>,
3100            offset: usize,
3101            _depth: fidl::encoding::Depth,
3102        ) -> fidl::Result<()> {
3103            decoder.debug_check_bounds::<Self>(offset);
3104            // Verify that padding bytes are zero.
3105            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
3106            let padval = unsafe { (ptr as *const u64).read_unaligned() };
3107            let mask = 0xffffffffffff0000u64;
3108            let maskedval = padval & mask;
3109            if maskedval != 0 {
3110                return Err(fidl::Error::NonZeroPadding {
3111                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
3112                });
3113            }
3114            fidl::decode!(PortId, D, &mut self.port, decoder, offset + 0, _depth)?;
3115            fidl::decode!(fidl::encoding::Vector<FrameType, 4>, D, &mut self.rx_frames, decoder, offset + 8, _depth)?;
3116            Ok(())
3117        }
3118    }
3119
3120    impl fidl::encoding::ValueTypeMarker for SessionDetachRequest {
3121        type Borrowed<'a> = &'a Self;
3122        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3123            value
3124        }
3125    }
3126
3127    unsafe impl fidl::encoding::TypeMarker for SessionDetachRequest {
3128        type Owned = Self;
3129
3130        #[inline(always)]
3131        fn inline_align(_context: fidl::encoding::Context) -> usize {
3132            1
3133        }
3134
3135        #[inline(always)]
3136        fn inline_size(_context: fidl::encoding::Context) -> usize {
3137            2
3138        }
3139        #[inline(always)]
3140        fn encode_is_copy() -> bool {
3141            true
3142        }
3143
3144        #[inline(always)]
3145        fn decode_is_copy() -> bool {
3146            true
3147        }
3148    }
3149
3150    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<SessionDetachRequest, D>
3151        for &SessionDetachRequest
3152    {
3153        #[inline]
3154        unsafe fn encode(
3155            self,
3156            encoder: &mut fidl::encoding::Encoder<'_, D>,
3157            offset: usize,
3158            _depth: fidl::encoding::Depth,
3159        ) -> fidl::Result<()> {
3160            encoder.debug_check_bounds::<SessionDetachRequest>(offset);
3161            unsafe {
3162                // Copy the object into the buffer.
3163                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
3164                (buf_ptr as *mut SessionDetachRequest)
3165                    .write_unaligned((self as *const SessionDetachRequest).read());
3166                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
3167                // done second because the memcpy will write garbage to these bytes.
3168            }
3169            Ok(())
3170        }
3171    }
3172    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<PortId, D>>
3173        fidl::encoding::Encode<SessionDetachRequest, D> for (T0,)
3174    {
3175        #[inline]
3176        unsafe fn encode(
3177            self,
3178            encoder: &mut fidl::encoding::Encoder<'_, D>,
3179            offset: usize,
3180            depth: fidl::encoding::Depth,
3181        ) -> fidl::Result<()> {
3182            encoder.debug_check_bounds::<SessionDetachRequest>(offset);
3183            // Zero out padding regions. There's no need to apply masks
3184            // because the unmasked parts will be overwritten by fields.
3185            // Write the fields.
3186            self.0.encode(encoder, offset + 0, depth)?;
3187            Ok(())
3188        }
3189    }
3190
3191    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SessionDetachRequest {
3192        #[inline(always)]
3193        fn new_empty() -> Self {
3194            Self { port: fidl::new_empty!(PortId, D) }
3195        }
3196
3197        #[inline]
3198        unsafe fn decode(
3199            &mut self,
3200            decoder: &mut fidl::encoding::Decoder<'_, D>,
3201            offset: usize,
3202            _depth: fidl::encoding::Depth,
3203        ) -> fidl::Result<()> {
3204            decoder.debug_check_bounds::<Self>(offset);
3205            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
3206            // Verify that padding bytes are zero.
3207            // Copy from the buffer into the object.
3208            unsafe {
3209                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 2);
3210            }
3211            Ok(())
3212        }
3213    }
3214
3215    impl fidl::encoding::ValueTypeMarker for StatusWatcherWatchStatusResponse {
3216        type Borrowed<'a> = &'a Self;
3217        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3218            value
3219        }
3220    }
3221
3222    unsafe impl fidl::encoding::TypeMarker for StatusWatcherWatchStatusResponse {
3223        type Owned = Self;
3224
3225        #[inline(always)]
3226        fn inline_align(_context: fidl::encoding::Context) -> usize {
3227            8
3228        }
3229
3230        #[inline(always)]
3231        fn inline_size(_context: fidl::encoding::Context) -> usize {
3232            16
3233        }
3234    }
3235
3236    unsafe impl<D: fidl::encoding::ResourceDialect>
3237        fidl::encoding::Encode<StatusWatcherWatchStatusResponse, D>
3238        for &StatusWatcherWatchStatusResponse
3239    {
3240        #[inline]
3241        unsafe fn encode(
3242            self,
3243            encoder: &mut fidl::encoding::Encoder<'_, D>,
3244            offset: usize,
3245            _depth: fidl::encoding::Depth,
3246        ) -> fidl::Result<()> {
3247            encoder.debug_check_bounds::<StatusWatcherWatchStatusResponse>(offset);
3248            // Delegate to tuple encoding.
3249            fidl::encoding::Encode::<StatusWatcherWatchStatusResponse, D>::encode(
3250                (<PortStatus as fidl::encoding::ValueTypeMarker>::borrow(&self.port_status),),
3251                encoder,
3252                offset,
3253                _depth,
3254            )
3255        }
3256    }
3257    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<PortStatus, D>>
3258        fidl::encoding::Encode<StatusWatcherWatchStatusResponse, D> for (T0,)
3259    {
3260        #[inline]
3261        unsafe fn encode(
3262            self,
3263            encoder: &mut fidl::encoding::Encoder<'_, D>,
3264            offset: usize,
3265            depth: fidl::encoding::Depth,
3266        ) -> fidl::Result<()> {
3267            encoder.debug_check_bounds::<StatusWatcherWatchStatusResponse>(offset);
3268            // Zero out padding regions. There's no need to apply masks
3269            // because the unmasked parts will be overwritten by fields.
3270            // Write the fields.
3271            self.0.encode(encoder, offset + 0, depth)?;
3272            Ok(())
3273        }
3274    }
3275
3276    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3277        for StatusWatcherWatchStatusResponse
3278    {
3279        #[inline(always)]
3280        fn new_empty() -> Self {
3281            Self { port_status: fidl::new_empty!(PortStatus, D) }
3282        }
3283
3284        #[inline]
3285        unsafe fn decode(
3286            &mut self,
3287            decoder: &mut fidl::encoding::Decoder<'_, D>,
3288            offset: usize,
3289            _depth: fidl::encoding::Depth,
3290        ) -> fidl::Result<()> {
3291            decoder.debug_check_bounds::<Self>(offset);
3292            // Verify that padding bytes are zero.
3293            fidl::decode!(PortStatus, D, &mut self.port_status, decoder, offset + 0, _depth)?;
3294            Ok(())
3295        }
3296    }
3297
3298    impl DeviceBaseInfo {
3299        #[inline(always)]
3300        fn max_ordinal_present(&self) -> u64 {
3301            if let Some(_) = self.tx_accel {
3302                return 11;
3303            }
3304            if let Some(_) = self.rx_accel {
3305                return 10;
3306            }
3307            if let Some(_) = self.max_buffer_parts {
3308                return 9;
3309            }
3310            if let Some(_) = self.min_tx_buffer_tail {
3311                return 8;
3312            }
3313            if let Some(_) = self.min_tx_buffer_head {
3314                return 7;
3315            }
3316            if let Some(_) = self.min_tx_buffer_length {
3317                return 6;
3318            }
3319            if let Some(_) = self.min_rx_buffer_length {
3320                return 5;
3321            }
3322            if let Some(_) = self.max_buffer_length {
3323                return 4;
3324            }
3325            if let Some(_) = self.buffer_alignment {
3326                return 3;
3327            }
3328            if let Some(_) = self.tx_depth {
3329                return 2;
3330            }
3331            if let Some(_) = self.rx_depth {
3332                return 1;
3333            }
3334            0
3335        }
3336    }
3337
3338    impl fidl::encoding::ValueTypeMarker for DeviceBaseInfo {
3339        type Borrowed<'a> = &'a Self;
3340        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3341            value
3342        }
3343    }
3344
3345    unsafe impl fidl::encoding::TypeMarker for DeviceBaseInfo {
3346        type Owned = Self;
3347
3348        #[inline(always)]
3349        fn inline_align(_context: fidl::encoding::Context) -> usize {
3350            8
3351        }
3352
3353        #[inline(always)]
3354        fn inline_size(_context: fidl::encoding::Context) -> usize {
3355            16
3356        }
3357    }
3358
3359    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<DeviceBaseInfo, D>
3360        for &DeviceBaseInfo
3361    {
3362        unsafe fn encode(
3363            self,
3364            encoder: &mut fidl::encoding::Encoder<'_, D>,
3365            offset: usize,
3366            mut depth: fidl::encoding::Depth,
3367        ) -> fidl::Result<()> {
3368            encoder.debug_check_bounds::<DeviceBaseInfo>(offset);
3369            // Vector header
3370            let max_ordinal: u64 = self.max_ordinal_present();
3371            encoder.write_num(max_ordinal, offset);
3372            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
3373            // Calling encoder.out_of_line_offset(0) is not allowed.
3374            if max_ordinal == 0 {
3375                return Ok(());
3376            }
3377            depth.increment()?;
3378            let envelope_size = 8;
3379            let bytes_len = max_ordinal as usize * envelope_size;
3380            #[allow(unused_variables)]
3381            let offset = encoder.out_of_line_offset(bytes_len);
3382            let mut _prev_end_offset: usize = 0;
3383            if 1 > max_ordinal {
3384                return Ok(());
3385            }
3386
3387            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3388            // are envelope_size bytes.
3389            let cur_offset: usize = (1 - 1) * envelope_size;
3390
3391            // Zero reserved fields.
3392            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3393
3394            // Safety:
3395            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3396            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3397            //   envelope_size bytes, there is always sufficient room.
3398            fidl::encoding::encode_in_envelope_optional::<u16, D>(
3399                self.rx_depth.as_ref().map(<u16 as fidl::encoding::ValueTypeMarker>::borrow),
3400                encoder,
3401                offset + cur_offset,
3402                depth,
3403            )?;
3404
3405            _prev_end_offset = cur_offset + envelope_size;
3406            if 2 > max_ordinal {
3407                return Ok(());
3408            }
3409
3410            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3411            // are envelope_size bytes.
3412            let cur_offset: usize = (2 - 1) * envelope_size;
3413
3414            // Zero reserved fields.
3415            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3416
3417            // Safety:
3418            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3419            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3420            //   envelope_size bytes, there is always sufficient room.
3421            fidl::encoding::encode_in_envelope_optional::<u16, D>(
3422                self.tx_depth.as_ref().map(<u16 as fidl::encoding::ValueTypeMarker>::borrow),
3423                encoder,
3424                offset + cur_offset,
3425                depth,
3426            )?;
3427
3428            _prev_end_offset = cur_offset + envelope_size;
3429            if 3 > max_ordinal {
3430                return Ok(());
3431            }
3432
3433            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3434            // are envelope_size bytes.
3435            let cur_offset: usize = (3 - 1) * envelope_size;
3436
3437            // Zero reserved fields.
3438            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3439
3440            // Safety:
3441            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3442            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3443            //   envelope_size bytes, there is always sufficient room.
3444            fidl::encoding::encode_in_envelope_optional::<u32, D>(
3445                self.buffer_alignment
3446                    .as_ref()
3447                    .map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
3448                encoder,
3449                offset + cur_offset,
3450                depth,
3451            )?;
3452
3453            _prev_end_offset = cur_offset + envelope_size;
3454            if 4 > max_ordinal {
3455                return Ok(());
3456            }
3457
3458            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3459            // are envelope_size bytes.
3460            let cur_offset: usize = (4 - 1) * envelope_size;
3461
3462            // Zero reserved fields.
3463            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3464
3465            // Safety:
3466            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3467            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3468            //   envelope_size bytes, there is always sufficient room.
3469            fidl::encoding::encode_in_envelope_optional::<u32, D>(
3470                self.max_buffer_length
3471                    .as_ref()
3472                    .map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
3473                encoder,
3474                offset + cur_offset,
3475                depth,
3476            )?;
3477
3478            _prev_end_offset = cur_offset + envelope_size;
3479            if 5 > max_ordinal {
3480                return Ok(());
3481            }
3482
3483            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3484            // are envelope_size bytes.
3485            let cur_offset: usize = (5 - 1) * envelope_size;
3486
3487            // Zero reserved fields.
3488            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3489
3490            // Safety:
3491            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3492            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3493            //   envelope_size bytes, there is always sufficient room.
3494            fidl::encoding::encode_in_envelope_optional::<u32, D>(
3495                self.min_rx_buffer_length
3496                    .as_ref()
3497                    .map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
3498                encoder,
3499                offset + cur_offset,
3500                depth,
3501            )?;
3502
3503            _prev_end_offset = cur_offset + envelope_size;
3504            if 6 > max_ordinal {
3505                return Ok(());
3506            }
3507
3508            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3509            // are envelope_size bytes.
3510            let cur_offset: usize = (6 - 1) * envelope_size;
3511
3512            // Zero reserved fields.
3513            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3514
3515            // Safety:
3516            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3517            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3518            //   envelope_size bytes, there is always sufficient room.
3519            fidl::encoding::encode_in_envelope_optional::<u32, D>(
3520                self.min_tx_buffer_length
3521                    .as_ref()
3522                    .map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
3523                encoder,
3524                offset + cur_offset,
3525                depth,
3526            )?;
3527
3528            _prev_end_offset = cur_offset + envelope_size;
3529            if 7 > max_ordinal {
3530                return Ok(());
3531            }
3532
3533            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3534            // are envelope_size bytes.
3535            let cur_offset: usize = (7 - 1) * envelope_size;
3536
3537            // Zero reserved fields.
3538            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3539
3540            // Safety:
3541            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3542            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3543            //   envelope_size bytes, there is always sufficient room.
3544            fidl::encoding::encode_in_envelope_optional::<u16, D>(
3545                self.min_tx_buffer_head
3546                    .as_ref()
3547                    .map(<u16 as fidl::encoding::ValueTypeMarker>::borrow),
3548                encoder,
3549                offset + cur_offset,
3550                depth,
3551            )?;
3552
3553            _prev_end_offset = cur_offset + envelope_size;
3554            if 8 > max_ordinal {
3555                return Ok(());
3556            }
3557
3558            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3559            // are envelope_size bytes.
3560            let cur_offset: usize = (8 - 1) * envelope_size;
3561
3562            // Zero reserved fields.
3563            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3564
3565            // Safety:
3566            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3567            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3568            //   envelope_size bytes, there is always sufficient room.
3569            fidl::encoding::encode_in_envelope_optional::<u16, D>(
3570                self.min_tx_buffer_tail
3571                    .as_ref()
3572                    .map(<u16 as fidl::encoding::ValueTypeMarker>::borrow),
3573                encoder,
3574                offset + cur_offset,
3575                depth,
3576            )?;
3577
3578            _prev_end_offset = cur_offset + envelope_size;
3579            if 9 > max_ordinal {
3580                return Ok(());
3581            }
3582
3583            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3584            // are envelope_size bytes.
3585            let cur_offset: usize = (9 - 1) * envelope_size;
3586
3587            // Zero reserved fields.
3588            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3589
3590            // Safety:
3591            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3592            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3593            //   envelope_size bytes, there is always sufficient room.
3594            fidl::encoding::encode_in_envelope_optional::<u8, D>(
3595                self.max_buffer_parts.as_ref().map(<u8 as fidl::encoding::ValueTypeMarker>::borrow),
3596                encoder,
3597                offset + cur_offset,
3598                depth,
3599            )?;
3600
3601            _prev_end_offset = cur_offset + envelope_size;
3602            if 10 > max_ordinal {
3603                return Ok(());
3604            }
3605
3606            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3607            // are envelope_size bytes.
3608            let cur_offset: usize = (10 - 1) * envelope_size;
3609
3610            // Zero reserved fields.
3611            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3612
3613            // Safety:
3614            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3615            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3616            //   envelope_size bytes, there is always sufficient room.
3617            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<RxAcceleration, 16>, D>(
3618            self.rx_accel.as_ref().map(<fidl::encoding::Vector<RxAcceleration, 16> as fidl::encoding::ValueTypeMarker>::borrow),
3619            encoder, offset + cur_offset, depth
3620        )?;
3621
3622            _prev_end_offset = cur_offset + envelope_size;
3623            if 11 > max_ordinal {
3624                return Ok(());
3625            }
3626
3627            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3628            // are envelope_size bytes.
3629            let cur_offset: usize = (11 - 1) * envelope_size;
3630
3631            // Zero reserved fields.
3632            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3633
3634            // Safety:
3635            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3636            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3637            //   envelope_size bytes, there is always sufficient room.
3638            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<TxAcceleration, 16>, D>(
3639            self.tx_accel.as_ref().map(<fidl::encoding::Vector<TxAcceleration, 16> as fidl::encoding::ValueTypeMarker>::borrow),
3640            encoder, offset + cur_offset, depth
3641        )?;
3642
3643            _prev_end_offset = cur_offset + envelope_size;
3644
3645            Ok(())
3646        }
3647    }
3648
3649    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for DeviceBaseInfo {
3650        #[inline(always)]
3651        fn new_empty() -> Self {
3652            Self::default()
3653        }
3654
3655        unsafe fn decode(
3656            &mut self,
3657            decoder: &mut fidl::encoding::Decoder<'_, D>,
3658            offset: usize,
3659            mut depth: fidl::encoding::Depth,
3660        ) -> fidl::Result<()> {
3661            decoder.debug_check_bounds::<Self>(offset);
3662            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
3663                None => return Err(fidl::Error::NotNullable),
3664                Some(len) => len,
3665            };
3666            // Calling decoder.out_of_line_offset(0) is not allowed.
3667            if len == 0 {
3668                return Ok(());
3669            };
3670            depth.increment()?;
3671            let envelope_size = 8;
3672            let bytes_len = len * envelope_size;
3673            let offset = decoder.out_of_line_offset(bytes_len)?;
3674            // Decode the envelope for each type.
3675            let mut _next_ordinal_to_read = 0;
3676            let mut next_offset = offset;
3677            let end_offset = offset + bytes_len;
3678            _next_ordinal_to_read += 1;
3679            if next_offset >= end_offset {
3680                return Ok(());
3681            }
3682
3683            // Decode unknown envelopes for gaps in ordinals.
3684            while _next_ordinal_to_read < 1 {
3685                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3686                _next_ordinal_to_read += 1;
3687                next_offset += envelope_size;
3688            }
3689
3690            let next_out_of_line = decoder.next_out_of_line();
3691            let handles_before = decoder.remaining_handles();
3692            if let Some((inlined, num_bytes, num_handles)) =
3693                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3694            {
3695                let member_inline_size =
3696                    <u16 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3697                if inlined != (member_inline_size <= 4) {
3698                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3699                }
3700                let inner_offset;
3701                let mut inner_depth = depth.clone();
3702                if inlined {
3703                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3704                    inner_offset = next_offset;
3705                } else {
3706                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3707                    inner_depth.increment()?;
3708                }
3709                let val_ref = self.rx_depth.get_or_insert_with(|| fidl::new_empty!(u16, D));
3710                fidl::decode!(u16, D, val_ref, decoder, inner_offset, inner_depth)?;
3711                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3712                {
3713                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3714                }
3715                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3716                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3717                }
3718            }
3719
3720            next_offset += envelope_size;
3721            _next_ordinal_to_read += 1;
3722            if next_offset >= end_offset {
3723                return Ok(());
3724            }
3725
3726            // Decode unknown envelopes for gaps in ordinals.
3727            while _next_ordinal_to_read < 2 {
3728                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3729                _next_ordinal_to_read += 1;
3730                next_offset += envelope_size;
3731            }
3732
3733            let next_out_of_line = decoder.next_out_of_line();
3734            let handles_before = decoder.remaining_handles();
3735            if let Some((inlined, num_bytes, num_handles)) =
3736                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3737            {
3738                let member_inline_size =
3739                    <u16 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3740                if inlined != (member_inline_size <= 4) {
3741                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3742                }
3743                let inner_offset;
3744                let mut inner_depth = depth.clone();
3745                if inlined {
3746                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3747                    inner_offset = next_offset;
3748                } else {
3749                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3750                    inner_depth.increment()?;
3751                }
3752                let val_ref = self.tx_depth.get_or_insert_with(|| fidl::new_empty!(u16, D));
3753                fidl::decode!(u16, D, val_ref, decoder, inner_offset, inner_depth)?;
3754                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3755                {
3756                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3757                }
3758                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3759                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3760                }
3761            }
3762
3763            next_offset += envelope_size;
3764            _next_ordinal_to_read += 1;
3765            if next_offset >= end_offset {
3766                return Ok(());
3767            }
3768
3769            // Decode unknown envelopes for gaps in ordinals.
3770            while _next_ordinal_to_read < 3 {
3771                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3772                _next_ordinal_to_read += 1;
3773                next_offset += envelope_size;
3774            }
3775
3776            let next_out_of_line = decoder.next_out_of_line();
3777            let handles_before = decoder.remaining_handles();
3778            if let Some((inlined, num_bytes, num_handles)) =
3779                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3780            {
3781                let member_inline_size =
3782                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3783                if inlined != (member_inline_size <= 4) {
3784                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3785                }
3786                let inner_offset;
3787                let mut inner_depth = depth.clone();
3788                if inlined {
3789                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3790                    inner_offset = next_offset;
3791                } else {
3792                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3793                    inner_depth.increment()?;
3794                }
3795                let val_ref = self.buffer_alignment.get_or_insert_with(|| fidl::new_empty!(u32, D));
3796                fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
3797                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3798                {
3799                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3800                }
3801                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3802                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3803                }
3804            }
3805
3806            next_offset += envelope_size;
3807            _next_ordinal_to_read += 1;
3808            if next_offset >= end_offset {
3809                return Ok(());
3810            }
3811
3812            // Decode unknown envelopes for gaps in ordinals.
3813            while _next_ordinal_to_read < 4 {
3814                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3815                _next_ordinal_to_read += 1;
3816                next_offset += envelope_size;
3817            }
3818
3819            let next_out_of_line = decoder.next_out_of_line();
3820            let handles_before = decoder.remaining_handles();
3821            if let Some((inlined, num_bytes, num_handles)) =
3822                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3823            {
3824                let member_inline_size =
3825                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3826                if inlined != (member_inline_size <= 4) {
3827                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3828                }
3829                let inner_offset;
3830                let mut inner_depth = depth.clone();
3831                if inlined {
3832                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3833                    inner_offset = next_offset;
3834                } else {
3835                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3836                    inner_depth.increment()?;
3837                }
3838                let val_ref =
3839                    self.max_buffer_length.get_or_insert_with(|| fidl::new_empty!(u32, D));
3840                fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
3841                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3842                {
3843                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3844                }
3845                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3846                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3847                }
3848            }
3849
3850            next_offset += envelope_size;
3851            _next_ordinal_to_read += 1;
3852            if next_offset >= end_offset {
3853                return Ok(());
3854            }
3855
3856            // Decode unknown envelopes for gaps in ordinals.
3857            while _next_ordinal_to_read < 5 {
3858                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3859                _next_ordinal_to_read += 1;
3860                next_offset += envelope_size;
3861            }
3862
3863            let next_out_of_line = decoder.next_out_of_line();
3864            let handles_before = decoder.remaining_handles();
3865            if let Some((inlined, num_bytes, num_handles)) =
3866                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3867            {
3868                let member_inline_size =
3869                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3870                if inlined != (member_inline_size <= 4) {
3871                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3872                }
3873                let inner_offset;
3874                let mut inner_depth = depth.clone();
3875                if inlined {
3876                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3877                    inner_offset = next_offset;
3878                } else {
3879                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3880                    inner_depth.increment()?;
3881                }
3882                let val_ref =
3883                    self.min_rx_buffer_length.get_or_insert_with(|| fidl::new_empty!(u32, D));
3884                fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
3885                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3886                {
3887                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3888                }
3889                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3890                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3891                }
3892            }
3893
3894            next_offset += envelope_size;
3895            _next_ordinal_to_read += 1;
3896            if next_offset >= end_offset {
3897                return Ok(());
3898            }
3899
3900            // Decode unknown envelopes for gaps in ordinals.
3901            while _next_ordinal_to_read < 6 {
3902                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3903                _next_ordinal_to_read += 1;
3904                next_offset += envelope_size;
3905            }
3906
3907            let next_out_of_line = decoder.next_out_of_line();
3908            let handles_before = decoder.remaining_handles();
3909            if let Some((inlined, num_bytes, num_handles)) =
3910                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3911            {
3912                let member_inline_size =
3913                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3914                if inlined != (member_inline_size <= 4) {
3915                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3916                }
3917                let inner_offset;
3918                let mut inner_depth = depth.clone();
3919                if inlined {
3920                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3921                    inner_offset = next_offset;
3922                } else {
3923                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3924                    inner_depth.increment()?;
3925                }
3926                let val_ref =
3927                    self.min_tx_buffer_length.get_or_insert_with(|| fidl::new_empty!(u32, D));
3928                fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
3929                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3930                {
3931                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3932                }
3933                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3934                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3935                }
3936            }
3937
3938            next_offset += envelope_size;
3939            _next_ordinal_to_read += 1;
3940            if next_offset >= end_offset {
3941                return Ok(());
3942            }
3943
3944            // Decode unknown envelopes for gaps in ordinals.
3945            while _next_ordinal_to_read < 7 {
3946                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3947                _next_ordinal_to_read += 1;
3948                next_offset += envelope_size;
3949            }
3950
3951            let next_out_of_line = decoder.next_out_of_line();
3952            let handles_before = decoder.remaining_handles();
3953            if let Some((inlined, num_bytes, num_handles)) =
3954                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3955            {
3956                let member_inline_size =
3957                    <u16 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3958                if inlined != (member_inline_size <= 4) {
3959                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3960                }
3961                let inner_offset;
3962                let mut inner_depth = depth.clone();
3963                if inlined {
3964                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3965                    inner_offset = next_offset;
3966                } else {
3967                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3968                    inner_depth.increment()?;
3969                }
3970                let val_ref =
3971                    self.min_tx_buffer_head.get_or_insert_with(|| fidl::new_empty!(u16, D));
3972                fidl::decode!(u16, D, val_ref, decoder, inner_offset, inner_depth)?;
3973                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3974                {
3975                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3976                }
3977                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3978                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3979                }
3980            }
3981
3982            next_offset += envelope_size;
3983            _next_ordinal_to_read += 1;
3984            if next_offset >= end_offset {
3985                return Ok(());
3986            }
3987
3988            // Decode unknown envelopes for gaps in ordinals.
3989            while _next_ordinal_to_read < 8 {
3990                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3991                _next_ordinal_to_read += 1;
3992                next_offset += envelope_size;
3993            }
3994
3995            let next_out_of_line = decoder.next_out_of_line();
3996            let handles_before = decoder.remaining_handles();
3997            if let Some((inlined, num_bytes, num_handles)) =
3998                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3999            {
4000                let member_inline_size =
4001                    <u16 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4002                if inlined != (member_inline_size <= 4) {
4003                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4004                }
4005                let inner_offset;
4006                let mut inner_depth = depth.clone();
4007                if inlined {
4008                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4009                    inner_offset = next_offset;
4010                } else {
4011                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4012                    inner_depth.increment()?;
4013                }
4014                let val_ref =
4015                    self.min_tx_buffer_tail.get_or_insert_with(|| fidl::new_empty!(u16, D));
4016                fidl::decode!(u16, D, val_ref, decoder, inner_offset, inner_depth)?;
4017                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4018                {
4019                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4020                }
4021                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4022                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4023                }
4024            }
4025
4026            next_offset += envelope_size;
4027            _next_ordinal_to_read += 1;
4028            if next_offset >= end_offset {
4029                return Ok(());
4030            }
4031
4032            // Decode unknown envelopes for gaps in ordinals.
4033            while _next_ordinal_to_read < 9 {
4034                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4035                _next_ordinal_to_read += 1;
4036                next_offset += envelope_size;
4037            }
4038
4039            let next_out_of_line = decoder.next_out_of_line();
4040            let handles_before = decoder.remaining_handles();
4041            if let Some((inlined, num_bytes, num_handles)) =
4042                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4043            {
4044                let member_inline_size =
4045                    <u8 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4046                if inlined != (member_inline_size <= 4) {
4047                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4048                }
4049                let inner_offset;
4050                let mut inner_depth = depth.clone();
4051                if inlined {
4052                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4053                    inner_offset = next_offset;
4054                } else {
4055                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4056                    inner_depth.increment()?;
4057                }
4058                let val_ref = self.max_buffer_parts.get_or_insert_with(|| fidl::new_empty!(u8, D));
4059                fidl::decode!(u8, D, val_ref, decoder, inner_offset, inner_depth)?;
4060                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4061                {
4062                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4063                }
4064                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4065                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4066                }
4067            }
4068
4069            next_offset += envelope_size;
4070            _next_ordinal_to_read += 1;
4071            if next_offset >= end_offset {
4072                return Ok(());
4073            }
4074
4075            // Decode unknown envelopes for gaps in ordinals.
4076            while _next_ordinal_to_read < 10 {
4077                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4078                _next_ordinal_to_read += 1;
4079                next_offset += envelope_size;
4080            }
4081
4082            let next_out_of_line = decoder.next_out_of_line();
4083            let handles_before = decoder.remaining_handles();
4084            if let Some((inlined, num_bytes, num_handles)) =
4085                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4086            {
4087                let member_inline_size = <fidl::encoding::Vector<RxAcceleration, 16> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4088                if inlined != (member_inline_size <= 4) {
4089                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4090                }
4091                let inner_offset;
4092                let mut inner_depth = depth.clone();
4093                if inlined {
4094                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4095                    inner_offset = next_offset;
4096                } else {
4097                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4098                    inner_depth.increment()?;
4099                }
4100                let val_ref = self.rx_accel.get_or_insert_with(
4101                    || fidl::new_empty!(fidl::encoding::Vector<RxAcceleration, 16>, D),
4102                );
4103                fidl::decode!(fidl::encoding::Vector<RxAcceleration, 16>, D, val_ref, decoder, inner_offset, inner_depth)?;
4104                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4105                {
4106                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4107                }
4108                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4109                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4110                }
4111            }
4112
4113            next_offset += envelope_size;
4114            _next_ordinal_to_read += 1;
4115            if next_offset >= end_offset {
4116                return Ok(());
4117            }
4118
4119            // Decode unknown envelopes for gaps in ordinals.
4120            while _next_ordinal_to_read < 11 {
4121                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4122                _next_ordinal_to_read += 1;
4123                next_offset += envelope_size;
4124            }
4125
4126            let next_out_of_line = decoder.next_out_of_line();
4127            let handles_before = decoder.remaining_handles();
4128            if let Some((inlined, num_bytes, num_handles)) =
4129                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4130            {
4131                let member_inline_size = <fidl::encoding::Vector<TxAcceleration, 16> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4132                if inlined != (member_inline_size <= 4) {
4133                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4134                }
4135                let inner_offset;
4136                let mut inner_depth = depth.clone();
4137                if inlined {
4138                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4139                    inner_offset = next_offset;
4140                } else {
4141                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4142                    inner_depth.increment()?;
4143                }
4144                let val_ref = self.tx_accel.get_or_insert_with(
4145                    || fidl::new_empty!(fidl::encoding::Vector<TxAcceleration, 16>, D),
4146                );
4147                fidl::decode!(fidl::encoding::Vector<TxAcceleration, 16>, D, val_ref, decoder, inner_offset, inner_depth)?;
4148                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4149                {
4150                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4151                }
4152                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4153                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4154                }
4155            }
4156
4157            next_offset += envelope_size;
4158
4159            // Decode the remaining unknown envelopes.
4160            while next_offset < end_offset {
4161                _next_ordinal_to_read += 1;
4162                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4163                next_offset += envelope_size;
4164            }
4165
4166            Ok(())
4167        }
4168    }
4169
4170    impl DeviceInfo {
4171        #[inline(always)]
4172        fn max_ordinal_present(&self) -> u64 {
4173            if let Some(_) = self.base_info {
4174                return 3;
4175            }
4176            if let Some(_) = self.descriptor_version {
4177                return 2;
4178            }
4179            if let Some(_) = self.min_descriptor_length {
4180                return 1;
4181            }
4182            0
4183        }
4184    }
4185
4186    impl fidl::encoding::ValueTypeMarker for DeviceInfo {
4187        type Borrowed<'a> = &'a Self;
4188        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4189            value
4190        }
4191    }
4192
4193    unsafe impl fidl::encoding::TypeMarker for DeviceInfo {
4194        type Owned = Self;
4195
4196        #[inline(always)]
4197        fn inline_align(_context: fidl::encoding::Context) -> usize {
4198            8
4199        }
4200
4201        #[inline(always)]
4202        fn inline_size(_context: fidl::encoding::Context) -> usize {
4203            16
4204        }
4205    }
4206
4207    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<DeviceInfo, D>
4208        for &DeviceInfo
4209    {
4210        unsafe fn encode(
4211            self,
4212            encoder: &mut fidl::encoding::Encoder<'_, D>,
4213            offset: usize,
4214            mut depth: fidl::encoding::Depth,
4215        ) -> fidl::Result<()> {
4216            encoder.debug_check_bounds::<DeviceInfo>(offset);
4217            // Vector header
4218            let max_ordinal: u64 = self.max_ordinal_present();
4219            encoder.write_num(max_ordinal, offset);
4220            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
4221            // Calling encoder.out_of_line_offset(0) is not allowed.
4222            if max_ordinal == 0 {
4223                return Ok(());
4224            }
4225            depth.increment()?;
4226            let envelope_size = 8;
4227            let bytes_len = max_ordinal as usize * envelope_size;
4228            #[allow(unused_variables)]
4229            let offset = encoder.out_of_line_offset(bytes_len);
4230            let mut _prev_end_offset: usize = 0;
4231            if 1 > max_ordinal {
4232                return Ok(());
4233            }
4234
4235            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4236            // are envelope_size bytes.
4237            let cur_offset: usize = (1 - 1) * envelope_size;
4238
4239            // Zero reserved fields.
4240            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4241
4242            // Safety:
4243            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4244            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4245            //   envelope_size bytes, there is always sufficient room.
4246            fidl::encoding::encode_in_envelope_optional::<u8, D>(
4247                self.min_descriptor_length
4248                    .as_ref()
4249                    .map(<u8 as fidl::encoding::ValueTypeMarker>::borrow),
4250                encoder,
4251                offset + cur_offset,
4252                depth,
4253            )?;
4254
4255            _prev_end_offset = cur_offset + envelope_size;
4256            if 2 > max_ordinal {
4257                return Ok(());
4258            }
4259
4260            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4261            // are envelope_size bytes.
4262            let cur_offset: usize = (2 - 1) * envelope_size;
4263
4264            // Zero reserved fields.
4265            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4266
4267            // Safety:
4268            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4269            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4270            //   envelope_size bytes, there is always sufficient room.
4271            fidl::encoding::encode_in_envelope_optional::<u8, D>(
4272                self.descriptor_version
4273                    .as_ref()
4274                    .map(<u8 as fidl::encoding::ValueTypeMarker>::borrow),
4275                encoder,
4276                offset + cur_offset,
4277                depth,
4278            )?;
4279
4280            _prev_end_offset = cur_offset + envelope_size;
4281            if 3 > max_ordinal {
4282                return Ok(());
4283            }
4284
4285            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4286            // are envelope_size bytes.
4287            let cur_offset: usize = (3 - 1) * envelope_size;
4288
4289            // Zero reserved fields.
4290            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4291
4292            // Safety:
4293            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4294            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4295            //   envelope_size bytes, there is always sufficient room.
4296            fidl::encoding::encode_in_envelope_optional::<DeviceBaseInfo, D>(
4297                self.base_info
4298                    .as_ref()
4299                    .map(<DeviceBaseInfo as fidl::encoding::ValueTypeMarker>::borrow),
4300                encoder,
4301                offset + cur_offset,
4302                depth,
4303            )?;
4304
4305            _prev_end_offset = cur_offset + envelope_size;
4306
4307            Ok(())
4308        }
4309    }
4310
4311    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for DeviceInfo {
4312        #[inline(always)]
4313        fn new_empty() -> Self {
4314            Self::default()
4315        }
4316
4317        unsafe fn decode(
4318            &mut self,
4319            decoder: &mut fidl::encoding::Decoder<'_, D>,
4320            offset: usize,
4321            mut depth: fidl::encoding::Depth,
4322        ) -> fidl::Result<()> {
4323            decoder.debug_check_bounds::<Self>(offset);
4324            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
4325                None => return Err(fidl::Error::NotNullable),
4326                Some(len) => len,
4327            };
4328            // Calling decoder.out_of_line_offset(0) is not allowed.
4329            if len == 0 {
4330                return Ok(());
4331            };
4332            depth.increment()?;
4333            let envelope_size = 8;
4334            let bytes_len = len * envelope_size;
4335            let offset = decoder.out_of_line_offset(bytes_len)?;
4336            // Decode the envelope for each type.
4337            let mut _next_ordinal_to_read = 0;
4338            let mut next_offset = offset;
4339            let end_offset = offset + bytes_len;
4340            _next_ordinal_to_read += 1;
4341            if next_offset >= end_offset {
4342                return Ok(());
4343            }
4344
4345            // Decode unknown envelopes for gaps in ordinals.
4346            while _next_ordinal_to_read < 1 {
4347                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4348                _next_ordinal_to_read += 1;
4349                next_offset += envelope_size;
4350            }
4351
4352            let next_out_of_line = decoder.next_out_of_line();
4353            let handles_before = decoder.remaining_handles();
4354            if let Some((inlined, num_bytes, num_handles)) =
4355                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4356            {
4357                let member_inline_size =
4358                    <u8 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4359                if inlined != (member_inline_size <= 4) {
4360                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4361                }
4362                let inner_offset;
4363                let mut inner_depth = depth.clone();
4364                if inlined {
4365                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4366                    inner_offset = next_offset;
4367                } else {
4368                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4369                    inner_depth.increment()?;
4370                }
4371                let val_ref =
4372                    self.min_descriptor_length.get_or_insert_with(|| fidl::new_empty!(u8, D));
4373                fidl::decode!(u8, D, val_ref, decoder, inner_offset, inner_depth)?;
4374                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4375                {
4376                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4377                }
4378                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4379                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4380                }
4381            }
4382
4383            next_offset += envelope_size;
4384            _next_ordinal_to_read += 1;
4385            if next_offset >= end_offset {
4386                return Ok(());
4387            }
4388
4389            // Decode unknown envelopes for gaps in ordinals.
4390            while _next_ordinal_to_read < 2 {
4391                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4392                _next_ordinal_to_read += 1;
4393                next_offset += envelope_size;
4394            }
4395
4396            let next_out_of_line = decoder.next_out_of_line();
4397            let handles_before = decoder.remaining_handles();
4398            if let Some((inlined, num_bytes, num_handles)) =
4399                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4400            {
4401                let member_inline_size =
4402                    <u8 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4403                if inlined != (member_inline_size <= 4) {
4404                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4405                }
4406                let inner_offset;
4407                let mut inner_depth = depth.clone();
4408                if inlined {
4409                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4410                    inner_offset = next_offset;
4411                } else {
4412                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4413                    inner_depth.increment()?;
4414                }
4415                let val_ref =
4416                    self.descriptor_version.get_or_insert_with(|| fidl::new_empty!(u8, D));
4417                fidl::decode!(u8, D, val_ref, decoder, inner_offset, inner_depth)?;
4418                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4419                {
4420                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4421                }
4422                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4423                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4424                }
4425            }
4426
4427            next_offset += envelope_size;
4428            _next_ordinal_to_read += 1;
4429            if next_offset >= end_offset {
4430                return Ok(());
4431            }
4432
4433            // Decode unknown envelopes for gaps in ordinals.
4434            while _next_ordinal_to_read < 3 {
4435                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4436                _next_ordinal_to_read += 1;
4437                next_offset += envelope_size;
4438            }
4439
4440            let next_out_of_line = decoder.next_out_of_line();
4441            let handles_before = decoder.remaining_handles();
4442            if let Some((inlined, num_bytes, num_handles)) =
4443                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4444            {
4445                let member_inline_size =
4446                    <DeviceBaseInfo as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4447                if inlined != (member_inline_size <= 4) {
4448                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4449                }
4450                let inner_offset;
4451                let mut inner_depth = depth.clone();
4452                if inlined {
4453                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4454                    inner_offset = next_offset;
4455                } else {
4456                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4457                    inner_depth.increment()?;
4458                }
4459                let val_ref =
4460                    self.base_info.get_or_insert_with(|| fidl::new_empty!(DeviceBaseInfo, D));
4461                fidl::decode!(DeviceBaseInfo, D, val_ref, decoder, inner_offset, inner_depth)?;
4462                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4463                {
4464                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4465                }
4466                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4467                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4468                }
4469            }
4470
4471            next_offset += envelope_size;
4472
4473            // Decode the remaining unknown envelopes.
4474            while next_offset < end_offset {
4475                _next_ordinal_to_read += 1;
4476                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4477                next_offset += envelope_size;
4478            }
4479
4480            Ok(())
4481        }
4482    }
4483
4484    impl PortBaseInfo {
4485        #[inline(always)]
4486        fn max_ordinal_present(&self) -> u64 {
4487            if let Some(_) = self.tx_types {
4488                return 3;
4489            }
4490            if let Some(_) = self.rx_types {
4491                return 2;
4492            }
4493            if let Some(_) = self.port_class {
4494                return 1;
4495            }
4496            0
4497        }
4498    }
4499
4500    impl fidl::encoding::ValueTypeMarker for PortBaseInfo {
4501        type Borrowed<'a> = &'a Self;
4502        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4503            value
4504        }
4505    }
4506
4507    unsafe impl fidl::encoding::TypeMarker for PortBaseInfo {
4508        type Owned = Self;
4509
4510        #[inline(always)]
4511        fn inline_align(_context: fidl::encoding::Context) -> usize {
4512            8
4513        }
4514
4515        #[inline(always)]
4516        fn inline_size(_context: fidl::encoding::Context) -> usize {
4517            16
4518        }
4519    }
4520
4521    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<PortBaseInfo, D>
4522        for &PortBaseInfo
4523    {
4524        unsafe fn encode(
4525            self,
4526            encoder: &mut fidl::encoding::Encoder<'_, D>,
4527            offset: usize,
4528            mut depth: fidl::encoding::Depth,
4529        ) -> fidl::Result<()> {
4530            encoder.debug_check_bounds::<PortBaseInfo>(offset);
4531            // Vector header
4532            let max_ordinal: u64 = self.max_ordinal_present();
4533            encoder.write_num(max_ordinal, offset);
4534            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
4535            // Calling encoder.out_of_line_offset(0) is not allowed.
4536            if max_ordinal == 0 {
4537                return Ok(());
4538            }
4539            depth.increment()?;
4540            let envelope_size = 8;
4541            let bytes_len = max_ordinal as usize * envelope_size;
4542            #[allow(unused_variables)]
4543            let offset = encoder.out_of_line_offset(bytes_len);
4544            let mut _prev_end_offset: usize = 0;
4545            if 1 > max_ordinal {
4546                return Ok(());
4547            }
4548
4549            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4550            // are envelope_size bytes.
4551            let cur_offset: usize = (1 - 1) * envelope_size;
4552
4553            // Zero reserved fields.
4554            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4555
4556            // Safety:
4557            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4558            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4559            //   envelope_size bytes, there is always sufficient room.
4560            fidl::encoding::encode_in_envelope_optional::<PortClass, D>(
4561                self.port_class
4562                    .as_ref()
4563                    .map(<PortClass as fidl::encoding::ValueTypeMarker>::borrow),
4564                encoder,
4565                offset + cur_offset,
4566                depth,
4567            )?;
4568
4569            _prev_end_offset = cur_offset + envelope_size;
4570            if 2 > max_ordinal {
4571                return Ok(());
4572            }
4573
4574            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4575            // are envelope_size bytes.
4576            let cur_offset: usize = (2 - 1) * envelope_size;
4577
4578            // Zero reserved fields.
4579            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4580
4581            // Safety:
4582            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4583            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4584            //   envelope_size bytes, there is always sufficient room.
4585            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<FrameType, 4>, D>(
4586            self.rx_types.as_ref().map(<fidl::encoding::Vector<FrameType, 4> as fidl::encoding::ValueTypeMarker>::borrow),
4587            encoder, offset + cur_offset, depth
4588        )?;
4589
4590            _prev_end_offset = cur_offset + envelope_size;
4591            if 3 > max_ordinal {
4592                return Ok(());
4593            }
4594
4595            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4596            // are envelope_size bytes.
4597            let cur_offset: usize = (3 - 1) * envelope_size;
4598
4599            // Zero reserved fields.
4600            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4601
4602            // Safety:
4603            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4604            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4605            //   envelope_size bytes, there is always sufficient room.
4606            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<FrameTypeSupport, 4>, D>(
4607            self.tx_types.as_ref().map(<fidl::encoding::Vector<FrameTypeSupport, 4> as fidl::encoding::ValueTypeMarker>::borrow),
4608            encoder, offset + cur_offset, depth
4609        )?;
4610
4611            _prev_end_offset = cur_offset + envelope_size;
4612
4613            Ok(())
4614        }
4615    }
4616
4617    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for PortBaseInfo {
4618        #[inline(always)]
4619        fn new_empty() -> Self {
4620            Self::default()
4621        }
4622
4623        unsafe fn decode(
4624            &mut self,
4625            decoder: &mut fidl::encoding::Decoder<'_, D>,
4626            offset: usize,
4627            mut depth: fidl::encoding::Depth,
4628        ) -> fidl::Result<()> {
4629            decoder.debug_check_bounds::<Self>(offset);
4630            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
4631                None => return Err(fidl::Error::NotNullable),
4632                Some(len) => len,
4633            };
4634            // Calling decoder.out_of_line_offset(0) is not allowed.
4635            if len == 0 {
4636                return Ok(());
4637            };
4638            depth.increment()?;
4639            let envelope_size = 8;
4640            let bytes_len = len * envelope_size;
4641            let offset = decoder.out_of_line_offset(bytes_len)?;
4642            // Decode the envelope for each type.
4643            let mut _next_ordinal_to_read = 0;
4644            let mut next_offset = offset;
4645            let end_offset = offset + bytes_len;
4646            _next_ordinal_to_read += 1;
4647            if next_offset >= end_offset {
4648                return Ok(());
4649            }
4650
4651            // Decode unknown envelopes for gaps in ordinals.
4652            while _next_ordinal_to_read < 1 {
4653                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4654                _next_ordinal_to_read += 1;
4655                next_offset += envelope_size;
4656            }
4657
4658            let next_out_of_line = decoder.next_out_of_line();
4659            let handles_before = decoder.remaining_handles();
4660            if let Some((inlined, num_bytes, num_handles)) =
4661                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4662            {
4663                let member_inline_size =
4664                    <PortClass as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4665                if inlined != (member_inline_size <= 4) {
4666                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4667                }
4668                let inner_offset;
4669                let mut inner_depth = depth.clone();
4670                if inlined {
4671                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4672                    inner_offset = next_offset;
4673                } else {
4674                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4675                    inner_depth.increment()?;
4676                }
4677                let val_ref = self.port_class.get_or_insert_with(|| fidl::new_empty!(PortClass, D));
4678                fidl::decode!(PortClass, D, val_ref, decoder, inner_offset, inner_depth)?;
4679                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4680                {
4681                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4682                }
4683                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4684                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4685                }
4686            }
4687
4688            next_offset += envelope_size;
4689            _next_ordinal_to_read += 1;
4690            if next_offset >= end_offset {
4691                return Ok(());
4692            }
4693
4694            // Decode unknown envelopes for gaps in ordinals.
4695            while _next_ordinal_to_read < 2 {
4696                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4697                _next_ordinal_to_read += 1;
4698                next_offset += envelope_size;
4699            }
4700
4701            let next_out_of_line = decoder.next_out_of_line();
4702            let handles_before = decoder.remaining_handles();
4703            if let Some((inlined, num_bytes, num_handles)) =
4704                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4705            {
4706                let member_inline_size = <fidl::encoding::Vector<FrameType, 4> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4707                if inlined != (member_inline_size <= 4) {
4708                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4709                }
4710                let inner_offset;
4711                let mut inner_depth = depth.clone();
4712                if inlined {
4713                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4714                    inner_offset = next_offset;
4715                } else {
4716                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4717                    inner_depth.increment()?;
4718                }
4719                let val_ref = self.rx_types.get_or_insert_with(
4720                    || fidl::new_empty!(fidl::encoding::Vector<FrameType, 4>, D),
4721                );
4722                fidl::decode!(fidl::encoding::Vector<FrameType, 4>, D, val_ref, decoder, inner_offset, inner_depth)?;
4723                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4724                {
4725                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4726                }
4727                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4728                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4729                }
4730            }
4731
4732            next_offset += envelope_size;
4733            _next_ordinal_to_read += 1;
4734            if next_offset >= end_offset {
4735                return Ok(());
4736            }
4737
4738            // Decode unknown envelopes for gaps in ordinals.
4739            while _next_ordinal_to_read < 3 {
4740                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4741                _next_ordinal_to_read += 1;
4742                next_offset += envelope_size;
4743            }
4744
4745            let next_out_of_line = decoder.next_out_of_line();
4746            let handles_before = decoder.remaining_handles();
4747            if let Some((inlined, num_bytes, num_handles)) =
4748                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4749            {
4750                let member_inline_size = <fidl::encoding::Vector<FrameTypeSupport, 4> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4751                if inlined != (member_inline_size <= 4) {
4752                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4753                }
4754                let inner_offset;
4755                let mut inner_depth = depth.clone();
4756                if inlined {
4757                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4758                    inner_offset = next_offset;
4759                } else {
4760                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4761                    inner_depth.increment()?;
4762                }
4763                let val_ref = self.tx_types.get_or_insert_with(
4764                    || fidl::new_empty!(fidl::encoding::Vector<FrameTypeSupport, 4>, D),
4765                );
4766                fidl::decode!(fidl::encoding::Vector<FrameTypeSupport, 4>, D, val_ref, decoder, inner_offset, inner_depth)?;
4767                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4768                {
4769                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4770                }
4771                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4772                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4773                }
4774            }
4775
4776            next_offset += envelope_size;
4777
4778            // Decode the remaining unknown envelopes.
4779            while next_offset < end_offset {
4780                _next_ordinal_to_read += 1;
4781                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4782                next_offset += envelope_size;
4783            }
4784
4785            Ok(())
4786        }
4787    }
4788
4789    impl PortGetCountersResponse {
4790        #[inline(always)]
4791        fn max_ordinal_present(&self) -> u64 {
4792            if let Some(_) = self.tx_bytes {
4793                return 4;
4794            }
4795            if let Some(_) = self.tx_frames {
4796                return 3;
4797            }
4798            if let Some(_) = self.rx_bytes {
4799                return 2;
4800            }
4801            if let Some(_) = self.rx_frames {
4802                return 1;
4803            }
4804            0
4805        }
4806    }
4807
4808    impl fidl::encoding::ValueTypeMarker for PortGetCountersResponse {
4809        type Borrowed<'a> = &'a Self;
4810        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4811            value
4812        }
4813    }
4814
4815    unsafe impl fidl::encoding::TypeMarker for PortGetCountersResponse {
4816        type Owned = Self;
4817
4818        #[inline(always)]
4819        fn inline_align(_context: fidl::encoding::Context) -> usize {
4820            8
4821        }
4822
4823        #[inline(always)]
4824        fn inline_size(_context: fidl::encoding::Context) -> usize {
4825            16
4826        }
4827    }
4828
4829    unsafe impl<D: fidl::encoding::ResourceDialect>
4830        fidl::encoding::Encode<PortGetCountersResponse, D> for &PortGetCountersResponse
4831    {
4832        unsafe fn encode(
4833            self,
4834            encoder: &mut fidl::encoding::Encoder<'_, D>,
4835            offset: usize,
4836            mut depth: fidl::encoding::Depth,
4837        ) -> fidl::Result<()> {
4838            encoder.debug_check_bounds::<PortGetCountersResponse>(offset);
4839            // Vector header
4840            let max_ordinal: u64 = self.max_ordinal_present();
4841            encoder.write_num(max_ordinal, offset);
4842            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
4843            // Calling encoder.out_of_line_offset(0) is not allowed.
4844            if max_ordinal == 0 {
4845                return Ok(());
4846            }
4847            depth.increment()?;
4848            let envelope_size = 8;
4849            let bytes_len = max_ordinal as usize * envelope_size;
4850            #[allow(unused_variables)]
4851            let offset = encoder.out_of_line_offset(bytes_len);
4852            let mut _prev_end_offset: usize = 0;
4853            if 1 > max_ordinal {
4854                return Ok(());
4855            }
4856
4857            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4858            // are envelope_size bytes.
4859            let cur_offset: usize = (1 - 1) * envelope_size;
4860
4861            // Zero reserved fields.
4862            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4863
4864            // Safety:
4865            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4866            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4867            //   envelope_size bytes, there is always sufficient room.
4868            fidl::encoding::encode_in_envelope_optional::<u64, D>(
4869                self.rx_frames.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
4870                encoder,
4871                offset + cur_offset,
4872                depth,
4873            )?;
4874
4875            _prev_end_offset = cur_offset + envelope_size;
4876            if 2 > max_ordinal {
4877                return Ok(());
4878            }
4879
4880            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4881            // are envelope_size bytes.
4882            let cur_offset: usize = (2 - 1) * envelope_size;
4883
4884            // Zero reserved fields.
4885            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4886
4887            // Safety:
4888            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4889            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4890            //   envelope_size bytes, there is always sufficient room.
4891            fidl::encoding::encode_in_envelope_optional::<u64, D>(
4892                self.rx_bytes.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
4893                encoder,
4894                offset + cur_offset,
4895                depth,
4896            )?;
4897
4898            _prev_end_offset = cur_offset + envelope_size;
4899            if 3 > max_ordinal {
4900                return Ok(());
4901            }
4902
4903            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4904            // are envelope_size bytes.
4905            let cur_offset: usize = (3 - 1) * envelope_size;
4906
4907            // Zero reserved fields.
4908            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4909
4910            // Safety:
4911            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4912            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4913            //   envelope_size bytes, there is always sufficient room.
4914            fidl::encoding::encode_in_envelope_optional::<u64, D>(
4915                self.tx_frames.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
4916                encoder,
4917                offset + cur_offset,
4918                depth,
4919            )?;
4920
4921            _prev_end_offset = cur_offset + envelope_size;
4922            if 4 > max_ordinal {
4923                return Ok(());
4924            }
4925
4926            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4927            // are envelope_size bytes.
4928            let cur_offset: usize = (4 - 1) * envelope_size;
4929
4930            // Zero reserved fields.
4931            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4932
4933            // Safety:
4934            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4935            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4936            //   envelope_size bytes, there is always sufficient room.
4937            fidl::encoding::encode_in_envelope_optional::<u64, D>(
4938                self.tx_bytes.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
4939                encoder,
4940                offset + cur_offset,
4941                depth,
4942            )?;
4943
4944            _prev_end_offset = cur_offset + envelope_size;
4945
4946            Ok(())
4947        }
4948    }
4949
4950    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
4951        for PortGetCountersResponse
4952    {
4953        #[inline(always)]
4954        fn new_empty() -> Self {
4955            Self::default()
4956        }
4957
4958        unsafe fn decode(
4959            &mut self,
4960            decoder: &mut fidl::encoding::Decoder<'_, D>,
4961            offset: usize,
4962            mut depth: fidl::encoding::Depth,
4963        ) -> fidl::Result<()> {
4964            decoder.debug_check_bounds::<Self>(offset);
4965            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
4966                None => return Err(fidl::Error::NotNullable),
4967                Some(len) => len,
4968            };
4969            // Calling decoder.out_of_line_offset(0) is not allowed.
4970            if len == 0 {
4971                return Ok(());
4972            };
4973            depth.increment()?;
4974            let envelope_size = 8;
4975            let bytes_len = len * envelope_size;
4976            let offset = decoder.out_of_line_offset(bytes_len)?;
4977            // Decode the envelope for each type.
4978            let mut _next_ordinal_to_read = 0;
4979            let mut next_offset = offset;
4980            let end_offset = offset + bytes_len;
4981            _next_ordinal_to_read += 1;
4982            if next_offset >= end_offset {
4983                return Ok(());
4984            }
4985
4986            // Decode unknown envelopes for gaps in ordinals.
4987            while _next_ordinal_to_read < 1 {
4988                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4989                _next_ordinal_to_read += 1;
4990                next_offset += envelope_size;
4991            }
4992
4993            let next_out_of_line = decoder.next_out_of_line();
4994            let handles_before = decoder.remaining_handles();
4995            if let Some((inlined, num_bytes, num_handles)) =
4996                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4997            {
4998                let member_inline_size =
4999                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5000                if inlined != (member_inline_size <= 4) {
5001                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5002                }
5003                let inner_offset;
5004                let mut inner_depth = depth.clone();
5005                if inlined {
5006                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5007                    inner_offset = next_offset;
5008                } else {
5009                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5010                    inner_depth.increment()?;
5011                }
5012                let val_ref = self.rx_frames.get_or_insert_with(|| fidl::new_empty!(u64, D));
5013                fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
5014                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5015                {
5016                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5017                }
5018                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5019                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5020                }
5021            }
5022
5023            next_offset += envelope_size;
5024            _next_ordinal_to_read += 1;
5025            if next_offset >= end_offset {
5026                return Ok(());
5027            }
5028
5029            // Decode unknown envelopes for gaps in ordinals.
5030            while _next_ordinal_to_read < 2 {
5031                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5032                _next_ordinal_to_read += 1;
5033                next_offset += envelope_size;
5034            }
5035
5036            let next_out_of_line = decoder.next_out_of_line();
5037            let handles_before = decoder.remaining_handles();
5038            if let Some((inlined, num_bytes, num_handles)) =
5039                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5040            {
5041                let member_inline_size =
5042                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5043                if inlined != (member_inline_size <= 4) {
5044                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5045                }
5046                let inner_offset;
5047                let mut inner_depth = depth.clone();
5048                if inlined {
5049                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5050                    inner_offset = next_offset;
5051                } else {
5052                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5053                    inner_depth.increment()?;
5054                }
5055                let val_ref = self.rx_bytes.get_or_insert_with(|| fidl::new_empty!(u64, D));
5056                fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
5057                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5058                {
5059                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5060                }
5061                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5062                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5063                }
5064            }
5065
5066            next_offset += envelope_size;
5067            _next_ordinal_to_read += 1;
5068            if next_offset >= end_offset {
5069                return Ok(());
5070            }
5071
5072            // Decode unknown envelopes for gaps in ordinals.
5073            while _next_ordinal_to_read < 3 {
5074                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5075                _next_ordinal_to_read += 1;
5076                next_offset += envelope_size;
5077            }
5078
5079            let next_out_of_line = decoder.next_out_of_line();
5080            let handles_before = decoder.remaining_handles();
5081            if let Some((inlined, num_bytes, num_handles)) =
5082                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5083            {
5084                let member_inline_size =
5085                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5086                if inlined != (member_inline_size <= 4) {
5087                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5088                }
5089                let inner_offset;
5090                let mut inner_depth = depth.clone();
5091                if inlined {
5092                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5093                    inner_offset = next_offset;
5094                } else {
5095                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5096                    inner_depth.increment()?;
5097                }
5098                let val_ref = self.tx_frames.get_or_insert_with(|| fidl::new_empty!(u64, D));
5099                fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
5100                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5101                {
5102                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5103                }
5104                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5105                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5106                }
5107            }
5108
5109            next_offset += envelope_size;
5110            _next_ordinal_to_read += 1;
5111            if next_offset >= end_offset {
5112                return Ok(());
5113            }
5114
5115            // Decode unknown envelopes for gaps in ordinals.
5116            while _next_ordinal_to_read < 4 {
5117                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5118                _next_ordinal_to_read += 1;
5119                next_offset += envelope_size;
5120            }
5121
5122            let next_out_of_line = decoder.next_out_of_line();
5123            let handles_before = decoder.remaining_handles();
5124            if let Some((inlined, num_bytes, num_handles)) =
5125                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5126            {
5127                let member_inline_size =
5128                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5129                if inlined != (member_inline_size <= 4) {
5130                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5131                }
5132                let inner_offset;
5133                let mut inner_depth = depth.clone();
5134                if inlined {
5135                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5136                    inner_offset = next_offset;
5137                } else {
5138                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5139                    inner_depth.increment()?;
5140                }
5141                let val_ref = self.tx_bytes.get_or_insert_with(|| fidl::new_empty!(u64, D));
5142                fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
5143                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5144                {
5145                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5146                }
5147                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5148                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5149                }
5150            }
5151
5152            next_offset += envelope_size;
5153
5154            // Decode the remaining unknown envelopes.
5155            while next_offset < end_offset {
5156                _next_ordinal_to_read += 1;
5157                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5158                next_offset += envelope_size;
5159            }
5160
5161            Ok(())
5162        }
5163    }
5164
5165    impl PortInfo {
5166        #[inline(always)]
5167        fn max_ordinal_present(&self) -> u64 {
5168            if let Some(_) = self.base_info {
5169                return 2;
5170            }
5171            if let Some(_) = self.id {
5172                return 1;
5173            }
5174            0
5175        }
5176    }
5177
5178    impl fidl::encoding::ValueTypeMarker for PortInfo {
5179        type Borrowed<'a> = &'a Self;
5180        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
5181            value
5182        }
5183    }
5184
5185    unsafe impl fidl::encoding::TypeMarker for PortInfo {
5186        type Owned = Self;
5187
5188        #[inline(always)]
5189        fn inline_align(_context: fidl::encoding::Context) -> usize {
5190            8
5191        }
5192
5193        #[inline(always)]
5194        fn inline_size(_context: fidl::encoding::Context) -> usize {
5195            16
5196        }
5197    }
5198
5199    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<PortInfo, D> for &PortInfo {
5200        unsafe fn encode(
5201            self,
5202            encoder: &mut fidl::encoding::Encoder<'_, D>,
5203            offset: usize,
5204            mut depth: fidl::encoding::Depth,
5205        ) -> fidl::Result<()> {
5206            encoder.debug_check_bounds::<PortInfo>(offset);
5207            // Vector header
5208            let max_ordinal: u64 = self.max_ordinal_present();
5209            encoder.write_num(max_ordinal, offset);
5210            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
5211            // Calling encoder.out_of_line_offset(0) is not allowed.
5212            if max_ordinal == 0 {
5213                return Ok(());
5214            }
5215            depth.increment()?;
5216            let envelope_size = 8;
5217            let bytes_len = max_ordinal as usize * envelope_size;
5218            #[allow(unused_variables)]
5219            let offset = encoder.out_of_line_offset(bytes_len);
5220            let mut _prev_end_offset: usize = 0;
5221            if 1 > max_ordinal {
5222                return Ok(());
5223            }
5224
5225            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5226            // are envelope_size bytes.
5227            let cur_offset: usize = (1 - 1) * envelope_size;
5228
5229            // Zero reserved fields.
5230            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5231
5232            // Safety:
5233            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5234            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5235            //   envelope_size bytes, there is always sufficient room.
5236            fidl::encoding::encode_in_envelope_optional::<PortId, D>(
5237                self.id.as_ref().map(<PortId as fidl::encoding::ValueTypeMarker>::borrow),
5238                encoder,
5239                offset + cur_offset,
5240                depth,
5241            )?;
5242
5243            _prev_end_offset = cur_offset + envelope_size;
5244            if 2 > max_ordinal {
5245                return Ok(());
5246            }
5247
5248            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5249            // are envelope_size bytes.
5250            let cur_offset: usize = (2 - 1) * envelope_size;
5251
5252            // Zero reserved fields.
5253            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5254
5255            // Safety:
5256            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5257            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5258            //   envelope_size bytes, there is always sufficient room.
5259            fidl::encoding::encode_in_envelope_optional::<PortBaseInfo, D>(
5260                self.base_info
5261                    .as_ref()
5262                    .map(<PortBaseInfo as fidl::encoding::ValueTypeMarker>::borrow),
5263                encoder,
5264                offset + cur_offset,
5265                depth,
5266            )?;
5267
5268            _prev_end_offset = cur_offset + envelope_size;
5269
5270            Ok(())
5271        }
5272    }
5273
5274    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for PortInfo {
5275        #[inline(always)]
5276        fn new_empty() -> Self {
5277            Self::default()
5278        }
5279
5280        unsafe fn decode(
5281            &mut self,
5282            decoder: &mut fidl::encoding::Decoder<'_, D>,
5283            offset: usize,
5284            mut depth: fidl::encoding::Depth,
5285        ) -> fidl::Result<()> {
5286            decoder.debug_check_bounds::<Self>(offset);
5287            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
5288                None => return Err(fidl::Error::NotNullable),
5289                Some(len) => len,
5290            };
5291            // Calling decoder.out_of_line_offset(0) is not allowed.
5292            if len == 0 {
5293                return Ok(());
5294            };
5295            depth.increment()?;
5296            let envelope_size = 8;
5297            let bytes_len = len * envelope_size;
5298            let offset = decoder.out_of_line_offset(bytes_len)?;
5299            // Decode the envelope for each type.
5300            let mut _next_ordinal_to_read = 0;
5301            let mut next_offset = offset;
5302            let end_offset = offset + bytes_len;
5303            _next_ordinal_to_read += 1;
5304            if next_offset >= end_offset {
5305                return Ok(());
5306            }
5307
5308            // Decode unknown envelopes for gaps in ordinals.
5309            while _next_ordinal_to_read < 1 {
5310                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5311                _next_ordinal_to_read += 1;
5312                next_offset += envelope_size;
5313            }
5314
5315            let next_out_of_line = decoder.next_out_of_line();
5316            let handles_before = decoder.remaining_handles();
5317            if let Some((inlined, num_bytes, num_handles)) =
5318                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5319            {
5320                let member_inline_size =
5321                    <PortId as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5322                if inlined != (member_inline_size <= 4) {
5323                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5324                }
5325                let inner_offset;
5326                let mut inner_depth = depth.clone();
5327                if inlined {
5328                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5329                    inner_offset = next_offset;
5330                } else {
5331                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5332                    inner_depth.increment()?;
5333                }
5334                let val_ref = self.id.get_or_insert_with(|| fidl::new_empty!(PortId, D));
5335                fidl::decode!(PortId, D, val_ref, decoder, inner_offset, inner_depth)?;
5336                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5337                {
5338                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5339                }
5340                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5341                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5342                }
5343            }
5344
5345            next_offset += envelope_size;
5346            _next_ordinal_to_read += 1;
5347            if next_offset >= end_offset {
5348                return Ok(());
5349            }
5350
5351            // Decode unknown envelopes for gaps in ordinals.
5352            while _next_ordinal_to_read < 2 {
5353                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5354                _next_ordinal_to_read += 1;
5355                next_offset += envelope_size;
5356            }
5357
5358            let next_out_of_line = decoder.next_out_of_line();
5359            let handles_before = decoder.remaining_handles();
5360            if let Some((inlined, num_bytes, num_handles)) =
5361                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5362            {
5363                let member_inline_size =
5364                    <PortBaseInfo as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5365                if inlined != (member_inline_size <= 4) {
5366                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5367                }
5368                let inner_offset;
5369                let mut inner_depth = depth.clone();
5370                if inlined {
5371                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5372                    inner_offset = next_offset;
5373                } else {
5374                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5375                    inner_depth.increment()?;
5376                }
5377                let val_ref =
5378                    self.base_info.get_or_insert_with(|| fidl::new_empty!(PortBaseInfo, D));
5379                fidl::decode!(PortBaseInfo, D, val_ref, decoder, inner_offset, inner_depth)?;
5380                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5381                {
5382                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5383                }
5384                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5385                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5386                }
5387            }
5388
5389            next_offset += envelope_size;
5390
5391            // Decode the remaining unknown envelopes.
5392            while next_offset < end_offset {
5393                _next_ordinal_to_read += 1;
5394                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5395                next_offset += envelope_size;
5396            }
5397
5398            Ok(())
5399        }
5400    }
5401
5402    impl PortStatus {
5403        #[inline(always)]
5404        fn max_ordinal_present(&self) -> u64 {
5405            if let Some(_) = self.mtu {
5406                return 2;
5407            }
5408            if let Some(_) = self.flags {
5409                return 1;
5410            }
5411            0
5412        }
5413    }
5414
5415    impl fidl::encoding::ValueTypeMarker for PortStatus {
5416        type Borrowed<'a> = &'a Self;
5417        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
5418            value
5419        }
5420    }
5421
5422    unsafe impl fidl::encoding::TypeMarker for PortStatus {
5423        type Owned = Self;
5424
5425        #[inline(always)]
5426        fn inline_align(_context: fidl::encoding::Context) -> usize {
5427            8
5428        }
5429
5430        #[inline(always)]
5431        fn inline_size(_context: fidl::encoding::Context) -> usize {
5432            16
5433        }
5434    }
5435
5436    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<PortStatus, D>
5437        for &PortStatus
5438    {
5439        unsafe fn encode(
5440            self,
5441            encoder: &mut fidl::encoding::Encoder<'_, D>,
5442            offset: usize,
5443            mut depth: fidl::encoding::Depth,
5444        ) -> fidl::Result<()> {
5445            encoder.debug_check_bounds::<PortStatus>(offset);
5446            // Vector header
5447            let max_ordinal: u64 = self.max_ordinal_present();
5448            encoder.write_num(max_ordinal, offset);
5449            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
5450            // Calling encoder.out_of_line_offset(0) is not allowed.
5451            if max_ordinal == 0 {
5452                return Ok(());
5453            }
5454            depth.increment()?;
5455            let envelope_size = 8;
5456            let bytes_len = max_ordinal as usize * envelope_size;
5457            #[allow(unused_variables)]
5458            let offset = encoder.out_of_line_offset(bytes_len);
5459            let mut _prev_end_offset: usize = 0;
5460            if 1 > max_ordinal {
5461                return Ok(());
5462            }
5463
5464            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5465            // are envelope_size bytes.
5466            let cur_offset: usize = (1 - 1) * envelope_size;
5467
5468            // Zero reserved fields.
5469            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5470
5471            // Safety:
5472            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5473            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5474            //   envelope_size bytes, there is always sufficient room.
5475            fidl::encoding::encode_in_envelope_optional::<StatusFlags, D>(
5476                self.flags.as_ref().map(<StatusFlags as fidl::encoding::ValueTypeMarker>::borrow),
5477                encoder,
5478                offset + cur_offset,
5479                depth,
5480            )?;
5481
5482            _prev_end_offset = cur_offset + envelope_size;
5483            if 2 > max_ordinal {
5484                return Ok(());
5485            }
5486
5487            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5488            // are envelope_size bytes.
5489            let cur_offset: usize = (2 - 1) * envelope_size;
5490
5491            // Zero reserved fields.
5492            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5493
5494            // Safety:
5495            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5496            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5497            //   envelope_size bytes, there is always sufficient room.
5498            fidl::encoding::encode_in_envelope_optional::<u32, D>(
5499                self.mtu.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
5500                encoder,
5501                offset + cur_offset,
5502                depth,
5503            )?;
5504
5505            _prev_end_offset = cur_offset + envelope_size;
5506
5507            Ok(())
5508        }
5509    }
5510
5511    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for PortStatus {
5512        #[inline(always)]
5513        fn new_empty() -> Self {
5514            Self::default()
5515        }
5516
5517        unsafe fn decode(
5518            &mut self,
5519            decoder: &mut fidl::encoding::Decoder<'_, D>,
5520            offset: usize,
5521            mut depth: fidl::encoding::Depth,
5522        ) -> fidl::Result<()> {
5523            decoder.debug_check_bounds::<Self>(offset);
5524            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
5525                None => return Err(fidl::Error::NotNullable),
5526                Some(len) => len,
5527            };
5528            // Calling decoder.out_of_line_offset(0) is not allowed.
5529            if len == 0 {
5530                return Ok(());
5531            };
5532            depth.increment()?;
5533            let envelope_size = 8;
5534            let bytes_len = len * envelope_size;
5535            let offset = decoder.out_of_line_offset(bytes_len)?;
5536            // Decode the envelope for each type.
5537            let mut _next_ordinal_to_read = 0;
5538            let mut next_offset = offset;
5539            let end_offset = offset + bytes_len;
5540            _next_ordinal_to_read += 1;
5541            if next_offset >= end_offset {
5542                return Ok(());
5543            }
5544
5545            // Decode unknown envelopes for gaps in ordinals.
5546            while _next_ordinal_to_read < 1 {
5547                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5548                _next_ordinal_to_read += 1;
5549                next_offset += envelope_size;
5550            }
5551
5552            let next_out_of_line = decoder.next_out_of_line();
5553            let handles_before = decoder.remaining_handles();
5554            if let Some((inlined, num_bytes, num_handles)) =
5555                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5556            {
5557                let member_inline_size =
5558                    <StatusFlags as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5559                if inlined != (member_inline_size <= 4) {
5560                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5561                }
5562                let inner_offset;
5563                let mut inner_depth = depth.clone();
5564                if inlined {
5565                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5566                    inner_offset = next_offset;
5567                } else {
5568                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5569                    inner_depth.increment()?;
5570                }
5571                let val_ref = self.flags.get_or_insert_with(|| fidl::new_empty!(StatusFlags, D));
5572                fidl::decode!(StatusFlags, D, val_ref, decoder, inner_offset, inner_depth)?;
5573                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5574                {
5575                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5576                }
5577                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5578                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5579                }
5580            }
5581
5582            next_offset += envelope_size;
5583            _next_ordinal_to_read += 1;
5584            if next_offset >= end_offset {
5585                return Ok(());
5586            }
5587
5588            // Decode unknown envelopes for gaps in ordinals.
5589            while _next_ordinal_to_read < 2 {
5590                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5591                _next_ordinal_to_read += 1;
5592                next_offset += envelope_size;
5593            }
5594
5595            let next_out_of_line = decoder.next_out_of_line();
5596            let handles_before = decoder.remaining_handles();
5597            if let Some((inlined, num_bytes, num_handles)) =
5598                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5599            {
5600                let member_inline_size =
5601                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5602                if inlined != (member_inline_size <= 4) {
5603                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5604                }
5605                let inner_offset;
5606                let mut inner_depth = depth.clone();
5607                if inlined {
5608                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5609                    inner_offset = next_offset;
5610                } else {
5611                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5612                    inner_depth.increment()?;
5613                }
5614                let val_ref = self.mtu.get_or_insert_with(|| fidl::new_empty!(u32, D));
5615                fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
5616                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5617                {
5618                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5619                }
5620                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5621                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5622                }
5623            }
5624
5625            next_offset += envelope_size;
5626
5627            // Decode the remaining unknown envelopes.
5628            while next_offset < end_offset {
5629                _next_ordinal_to_read += 1;
5630                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5631                next_offset += envelope_size;
5632            }
5633
5634            Ok(())
5635        }
5636    }
5637
5638    impl fidl::encoding::ValueTypeMarker for DevicePortEvent {
5639        type Borrowed<'a> = &'a Self;
5640        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
5641            value
5642        }
5643    }
5644
5645    unsafe impl fidl::encoding::TypeMarker for DevicePortEvent {
5646        type Owned = Self;
5647
5648        #[inline(always)]
5649        fn inline_align(_context: fidl::encoding::Context) -> usize {
5650            8
5651        }
5652
5653        #[inline(always)]
5654        fn inline_size(_context: fidl::encoding::Context) -> usize {
5655            16
5656        }
5657    }
5658
5659    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<DevicePortEvent, D>
5660        for &DevicePortEvent
5661    {
5662        #[inline]
5663        unsafe fn encode(
5664            self,
5665            encoder: &mut fidl::encoding::Encoder<'_, D>,
5666            offset: usize,
5667            _depth: fidl::encoding::Depth,
5668        ) -> fidl::Result<()> {
5669            encoder.debug_check_bounds::<DevicePortEvent>(offset);
5670            encoder.write_num::<u64>(self.ordinal(), offset);
5671            match self {
5672                DevicePortEvent::Existing(ref val) => {
5673                    fidl::encoding::encode_in_envelope::<PortId, D>(
5674                        <PortId as fidl::encoding::ValueTypeMarker>::borrow(val),
5675                        encoder,
5676                        offset + 8,
5677                        _depth,
5678                    )
5679                }
5680                DevicePortEvent::Added(ref val) => fidl::encoding::encode_in_envelope::<PortId, D>(
5681                    <PortId as fidl::encoding::ValueTypeMarker>::borrow(val),
5682                    encoder,
5683                    offset + 8,
5684                    _depth,
5685                ),
5686                DevicePortEvent::Removed(ref val) => {
5687                    fidl::encoding::encode_in_envelope::<PortId, D>(
5688                        <PortId as fidl::encoding::ValueTypeMarker>::borrow(val),
5689                        encoder,
5690                        offset + 8,
5691                        _depth,
5692                    )
5693                }
5694                DevicePortEvent::Idle(ref val) => fidl::encoding::encode_in_envelope::<Empty, D>(
5695                    <Empty as fidl::encoding::ValueTypeMarker>::borrow(val),
5696                    encoder,
5697                    offset + 8,
5698                    _depth,
5699                ),
5700            }
5701        }
5702    }
5703
5704    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for DevicePortEvent {
5705        #[inline(always)]
5706        fn new_empty() -> Self {
5707            Self::Existing(fidl::new_empty!(PortId, D))
5708        }
5709
5710        #[inline]
5711        unsafe fn decode(
5712            &mut self,
5713            decoder: &mut fidl::encoding::Decoder<'_, D>,
5714            offset: usize,
5715            mut depth: fidl::encoding::Depth,
5716        ) -> fidl::Result<()> {
5717            decoder.debug_check_bounds::<Self>(offset);
5718            #[allow(unused_variables)]
5719            let next_out_of_line = decoder.next_out_of_line();
5720            let handles_before = decoder.remaining_handles();
5721            let (ordinal, inlined, num_bytes, num_handles) =
5722                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
5723
5724            let member_inline_size = match ordinal {
5725                1 => <PortId as fidl::encoding::TypeMarker>::inline_size(decoder.context),
5726                2 => <PortId as fidl::encoding::TypeMarker>::inline_size(decoder.context),
5727                3 => <PortId as fidl::encoding::TypeMarker>::inline_size(decoder.context),
5728                4 => <Empty as fidl::encoding::TypeMarker>::inline_size(decoder.context),
5729                _ => return Err(fidl::Error::UnknownUnionTag),
5730            };
5731
5732            if inlined != (member_inline_size <= 4) {
5733                return Err(fidl::Error::InvalidInlineBitInEnvelope);
5734            }
5735            let _inner_offset;
5736            if inlined {
5737                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
5738                _inner_offset = offset + 8;
5739            } else {
5740                depth.increment()?;
5741                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5742            }
5743            match ordinal {
5744                1 => {
5745                    #[allow(irrefutable_let_patterns)]
5746                    if let DevicePortEvent::Existing(_) = self {
5747                        // Do nothing, read the value into the object
5748                    } else {
5749                        // Initialize `self` to the right variant
5750                        *self = DevicePortEvent::Existing(fidl::new_empty!(PortId, D));
5751                    }
5752                    #[allow(irrefutable_let_patterns)]
5753                    if let DevicePortEvent::Existing(ref mut val) = self {
5754                        fidl::decode!(PortId, D, val, decoder, _inner_offset, depth)?;
5755                    } else {
5756                        unreachable!()
5757                    }
5758                }
5759                2 => {
5760                    #[allow(irrefutable_let_patterns)]
5761                    if let DevicePortEvent::Added(_) = self {
5762                        // Do nothing, read the value into the object
5763                    } else {
5764                        // Initialize `self` to the right variant
5765                        *self = DevicePortEvent::Added(fidl::new_empty!(PortId, D));
5766                    }
5767                    #[allow(irrefutable_let_patterns)]
5768                    if let DevicePortEvent::Added(ref mut val) = self {
5769                        fidl::decode!(PortId, D, val, decoder, _inner_offset, depth)?;
5770                    } else {
5771                        unreachable!()
5772                    }
5773                }
5774                3 => {
5775                    #[allow(irrefutable_let_patterns)]
5776                    if let DevicePortEvent::Removed(_) = self {
5777                        // Do nothing, read the value into the object
5778                    } else {
5779                        // Initialize `self` to the right variant
5780                        *self = DevicePortEvent::Removed(fidl::new_empty!(PortId, D));
5781                    }
5782                    #[allow(irrefutable_let_patterns)]
5783                    if let DevicePortEvent::Removed(ref mut val) = self {
5784                        fidl::decode!(PortId, D, val, decoder, _inner_offset, depth)?;
5785                    } else {
5786                        unreachable!()
5787                    }
5788                }
5789                4 => {
5790                    #[allow(irrefutable_let_patterns)]
5791                    if let DevicePortEvent::Idle(_) = self {
5792                        // Do nothing, read the value into the object
5793                    } else {
5794                        // Initialize `self` to the right variant
5795                        *self = DevicePortEvent::Idle(fidl::new_empty!(Empty, D));
5796                    }
5797                    #[allow(irrefutable_let_patterns)]
5798                    if let DevicePortEvent::Idle(ref mut val) = self {
5799                        fidl::decode!(Empty, D, val, decoder, _inner_offset, depth)?;
5800                    } else {
5801                        unreachable!()
5802                    }
5803                }
5804                ordinal => panic!("unexpected ordinal {:?}", ordinal),
5805            }
5806            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
5807                return Err(fidl::Error::InvalidNumBytesInEnvelope);
5808            }
5809            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5810                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5811            }
5812            Ok(())
5813        }
5814    }
5815}