Skip to main content

fidl_fuchsia_hardware_network__common/
fidl_fuchsia_hardware_network__common.rs

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