Skip to main content

fidl_fuchsia_hardware_network_common/
fidl_fuchsia_hardware_network_common.rs

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