Skip to main content

fidl_fuchsia_net_matchers_common/
fidl_fuchsia_net_matchers_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
11bitflags! {
12    #[derive(Clone, Copy, Debug, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
13    pub struct TcpState: u32 {
14        const ESTABLISHED = 1;
15        const SYN_SENT = 2;
16        const SYN_RECV = 4;
17        const FIN_WAIT1 = 8;
18        const FIN_WAIT2 = 16;
19        const TIME_WAIT = 32;
20        const CLOSE = 64;
21        const CLOSE_WAIT = 128;
22        const LAST_ACK = 256;
23        const LISTEN = 512;
24        const CLOSING = 1024;
25    }
26}
27
28impl TcpState {}
29
30bitflags! {
31    #[derive(Clone, Copy, Debug, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
32    pub struct UdpState: u32 {
33        /// The UDP socket is bound but not connected.
34        const BOUND = 1;
35        /// The UDP socket is explicitly connected.
36        const CONNECTED = 2;
37    }
38}
39
40impl UdpState {}
41
42/// A matcher for IP addresses.
43#[derive(Clone, Debug, PartialEq)]
44pub struct Address {
45    pub matcher: AddressMatcherType,
46    /// Whether to check for an "inverse" or "negative" match (in which case,
47    /// if the matcher criteria do *not* apply, it *is* considered a match, and
48    /// vice versa).
49    pub invert: bool,
50}
51
52impl fidl::Persistable for Address {}
53
54#[derive(Clone, Debug, PartialEq)]
55pub struct AddressRange {
56    /// The inclusive start of the address range.
57    pub start: fidl_fuchsia_net_common::IpAddress,
58    /// The inclusive end of the address range.
59    pub end: fidl_fuchsia_net_common::IpAddress,
60}
61
62impl fidl::Persistable for AddressRange {}
63
64#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
65#[repr(C)]
66pub struct Between {
67    /// Start of the range, inclusive.
68    pub start: u32,
69    /// End of the range, inclusive.
70    pub end: u32,
71}
72
73impl fidl::Persistable for Between {}
74
75/// An empty type for use in unions.
76#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
77pub struct Empty;
78
79impl fidl::Persistable for Empty {}
80
81/// Matches the mark in a specific domain.
82#[derive(Clone, Debug, PartialEq)]
83pub struct MarkInDomain {
84    /// The mark's domain.
85    pub domain: fidl_fuchsia_net_common::MarkDomain,
86    /// The mark matcher to apply to the mark in the specified domain.
87    pub mark: Mark,
88}
89
90impl fidl::Persistable for MarkInDomain {}
91
92#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
93pub struct Marked {
94    /// Mask to apply before comparing to the range in `between`.
95    pub mask: u32,
96    /// The mark is between the given range.
97    pub between: Between,
98    /// Whether to check for an "inverse" or "negative" match.
99    ///
100    /// The mask is applied as normal, but the value is checked for
101    /// inequality.
102    pub invert: bool,
103}
104
105impl fidl::Persistable for Marked {}
106
107/// A matcher for transport-layer port numbers.
108///
109/// `start` must <= `end`.
110#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
111pub struct Port {
112    /// The inclusive start of the port range.
113    pub start: u16,
114    /// The inclusive end of the port range.
115    pub end: u16,
116    /// Whether to check for an "inverse" or "negative" match.
117    pub invert: bool,
118}
119
120impl fidl::Persistable for Port {}
121
122/// A matcher for a socket's cookie.
123#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
124pub struct SocketCookie {
125    /// The cookie value to compare for equality.
126    pub cookie: u64,
127    /// Whether to check for an "inverse" or "negative" match.
128    pub invert: bool,
129}
130
131impl fidl::Persistable for SocketCookie {}
132
133#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
134pub struct Unmarked;
135
136impl fidl::Persistable for Unmarked {}
137
138/// A matcher for ICMPv4 packets.
139#[derive(Clone, Debug, Default, PartialEq)]
140pub struct IcmpPacket {
141    #[doc(hidden)]
142    pub __source_breaking: fidl::marker::SourceBreaking,
143}
144
145impl fidl::Persistable for IcmpPacket {}
146
147/// A matcher for ICMPv6 packets.
148#[derive(Clone, Debug, Default, PartialEq)]
149pub struct Icmpv6Packet {
150    #[doc(hidden)]
151    pub __source_breaking: fidl::marker::SourceBreaking,
152}
153
154impl fidl::Persistable for Icmpv6Packet {}
155
156/// A matcher for TCP packets.
157#[derive(Clone, Debug, Default, PartialEq)]
158pub struct TcpPacket {
159    /// Matcher for the TCP source port.
160    pub src_port: Option<Port>,
161    /// Matcher for the TCP destination port.
162    pub dst_port: Option<Port>,
163    #[doc(hidden)]
164    pub __source_breaking: fidl::marker::SourceBreaking,
165}
166
167impl fidl::Persistable for TcpPacket {}
168
169/// A matcher for UDP packets.
170#[derive(Clone, Debug, Default, PartialEq)]
171pub struct UdpPacket {
172    /// Matcher for the UDP source port.
173    pub src_port: Option<Port>,
174    /// Matcher for the UDP destination port.
175    pub dst_port: Option<Port>,
176    #[doc(hidden)]
177    pub __source_breaking: fidl::marker::SourceBreaking,
178}
179
180impl fidl::Persistable for UdpPacket {}
181
182#[derive(Clone, Debug)]
183pub enum AddressMatcherType {
184    /// The subnet that must contain the IP address in the packet header in
185    /// order for it to match.
186    Subnet(fidl_fuchsia_net_common::Subnet),
187    /// The range of addresses that must include the IP address in the
188    /// packet header in order for it to match.
189    ///
190    /// The endpoints of the range must be in the same address family, and
191    /// `start` must <= `end`. (Comparisons are performed on the numerical
192    /// big-endian representation of the IP address.)
193    Range(AddressRange),
194    #[doc(hidden)]
195    __SourceBreaking { unknown_ordinal: u64 },
196}
197
198/// Pattern that matches an unknown `AddressMatcherType` member.
199#[macro_export]
200macro_rules! AddressMatcherTypeUnknown {
201    () => {
202        _
203    };
204}
205
206// Custom PartialEq so that unknown variants are not equal to themselves.
207impl PartialEq for AddressMatcherType {
208    fn eq(&self, other: &Self) -> bool {
209        match (self, other) {
210            (Self::Subnet(x), Self::Subnet(y)) => *x == *y,
211            (Self::Range(x), Self::Range(y)) => *x == *y,
212            _ => false,
213        }
214    }
215}
216
217impl AddressMatcherType {
218    #[inline]
219    pub fn ordinal(&self) -> u64 {
220        match *self {
221            Self::Subnet(_) => 1,
222            Self::Range(_) => 2,
223            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
224        }
225    }
226
227    #[inline]
228    pub fn unknown_variant_for_testing() -> Self {
229        Self::__SourceBreaking { unknown_ordinal: 0 }
230    }
231
232    #[inline]
233    pub fn is_unknown(&self) -> bool {
234        match self {
235            Self::__SourceBreaking { .. } => true,
236            _ => false,
237        }
238    }
239}
240
241impl fidl::Persistable for AddressMatcherType {}
242
243/// A matcher for IP addresses that might be unbound.
244#[derive(Clone, Debug)]
245pub enum BoundAddress {
246    /// Matches iff the address is bound to a matching address (see [`Address`]
247    /// for matching criteria.
248    Bound(Address),
249    /// Matches iff the address is unbound.
250    Unbound(Empty),
251    #[doc(hidden)]
252    __SourceBreaking { unknown_ordinal: u64 },
253}
254
255/// Pattern that matches an unknown `BoundAddress` member.
256#[macro_export]
257macro_rules! BoundAddressUnknown {
258    () => {
259        _
260    };
261}
262
263// Custom PartialEq so that unknown variants are not equal to themselves.
264impl PartialEq for BoundAddress {
265    fn eq(&self, other: &Self) -> bool {
266        match (self, other) {
267            (Self::Bound(x), Self::Bound(y)) => *x == *y,
268            (Self::Unbound(x), Self::Unbound(y)) => *x == *y,
269            _ => false,
270        }
271    }
272}
273
274impl BoundAddress {
275    #[inline]
276    pub fn ordinal(&self) -> u64 {
277        match *self {
278            Self::Bound(_) => 1,
279            Self::Unbound(_) => 2,
280            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
281        }
282    }
283
284    #[inline]
285    pub fn unknown_variant_for_testing() -> Self {
286        Self::__SourceBreaking { unknown_ordinal: 0 }
287    }
288
289    #[inline]
290    pub fn is_unknown(&self) -> bool {
291        match self {
292            Self::__SourceBreaking { .. } => true,
293            _ => false,
294        }
295    }
296}
297
298impl fidl::Persistable for BoundAddress {}
299
300/// A matcher for network interfaces where it might be unbound (`BindToDevice`
301/// has not been called).
302#[derive(Clone, Debug)]
303pub enum BoundInterface {
304    /// Matches iff the socket is bound to a matching interface (see
305    /// [`Interface`] for matching criteria).
306    Bound(Interface),
307    /// Matches iff the outgoing traffic is not bound to a device.
308    Unbound(Empty),
309    #[doc(hidden)]
310    __SourceBreaking { unknown_ordinal: u64 },
311}
312
313/// Pattern that matches an unknown `BoundInterface` member.
314#[macro_export]
315macro_rules! BoundInterfaceUnknown {
316    () => {
317        _
318    };
319}
320
321// Custom PartialEq so that unknown variants are not equal to themselves.
322impl PartialEq for BoundInterface {
323    fn eq(&self, other: &Self) -> bool {
324        match (self, other) {
325            (Self::Bound(x), Self::Bound(y)) => *x == *y,
326            (Self::Unbound(x), Self::Unbound(y)) => *x == *y,
327            _ => false,
328        }
329    }
330}
331
332impl BoundInterface {
333    #[inline]
334    pub fn ordinal(&self) -> u64 {
335        match *self {
336            Self::Bound(_) => 1,
337            Self::Unbound(_) => 2,
338            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
339        }
340    }
341
342    #[inline]
343    pub fn unknown_variant_for_testing() -> Self {
344        Self::__SourceBreaking { unknown_ordinal: 0 }
345    }
346
347    #[inline]
348    pub fn is_unknown(&self) -> bool {
349        match self {
350            Self::__SourceBreaking { .. } => true,
351            _ => false,
352        }
353    }
354}
355
356impl fidl::Persistable for BoundInterface {}
357
358/// A matcher for transport-layer port numbers that might be unbound.
359#[derive(Clone, Debug)]
360pub enum BoundPort {
361    /// Matches iff the port is bound and matches (see [`Port`] for matching
362    /// criteria).
363    Bound(Port),
364    /// Matches iff the port is unbound.
365    Unbound(Empty),
366    #[doc(hidden)]
367    __SourceBreaking { unknown_ordinal: u64 },
368}
369
370/// Pattern that matches an unknown `BoundPort` member.
371#[macro_export]
372macro_rules! BoundPortUnknown {
373    () => {
374        _
375    };
376}
377
378// Custom PartialEq so that unknown variants are not equal to themselves.
379impl PartialEq for BoundPort {
380    fn eq(&self, other: &Self) -> bool {
381        match (self, other) {
382            (Self::Bound(x), Self::Bound(y)) => *x == *y,
383            (Self::Unbound(x), Self::Unbound(y)) => *x == *y,
384            _ => false,
385        }
386    }
387}
388
389impl BoundPort {
390    #[inline]
391    pub fn ordinal(&self) -> u64 {
392        match *self {
393            Self::Bound(_) => 1,
394            Self::Unbound(_) => 2,
395            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
396        }
397    }
398
399    #[inline]
400    pub fn unknown_variant_for_testing() -> Self {
401        Self::__SourceBreaking { unknown_ordinal: 0 }
402    }
403
404    #[inline]
405    pub fn is_unknown(&self) -> bool {
406        match self {
407            Self::__SourceBreaking { .. } => true,
408            _ => false,
409        }
410    }
411}
412
413impl fidl::Persistable for BoundPort {}
414
415/// A matcher for network interfaces.
416#[derive(Clone, Debug)]
417pub enum Interface {
418    /// The ID of the interface as assigned by the netstack.
419    Id(u64),
420    /// The name of the interface.
421    Name(String),
422    /// The port class of the interface.
423    PortClass(fidl_fuchsia_net_interfaces_common::PortClass),
424    #[doc(hidden)]
425    __SourceBreaking { unknown_ordinal: u64 },
426}
427
428/// Pattern that matches an unknown `Interface` member.
429#[macro_export]
430macro_rules! InterfaceUnknown {
431    () => {
432        _
433    };
434}
435
436// Custom PartialEq so that unknown variants are not equal to themselves.
437impl PartialEq for Interface {
438    fn eq(&self, other: &Self) -> bool {
439        match (self, other) {
440            (Self::Id(x), Self::Id(y)) => *x == *y,
441            (Self::Name(x), Self::Name(y)) => *x == *y,
442            (Self::PortClass(x), Self::PortClass(y)) => *x == *y,
443            _ => false,
444        }
445    }
446}
447
448impl Interface {
449    #[inline]
450    pub fn ordinal(&self) -> u64 {
451        match *self {
452            Self::Id(_) => 1,
453            Self::Name(_) => 2,
454            Self::PortClass(_) => 3,
455            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
456        }
457    }
458
459    #[inline]
460    pub fn unknown_variant_for_testing() -> Self {
461        Self::__SourceBreaking { unknown_ordinal: 0 }
462    }
463
464    #[inline]
465    pub fn is_unknown(&self) -> bool {
466        match self {
467            Self::__SourceBreaking { .. } => true,
468            _ => false,
469        }
470    }
471}
472
473impl fidl::Persistable for Interface {}
474
475/// Matches the mark value of a packet or socket.
476#[derive(Clone, Debug)]
477pub enum Mark {
478    /// This mark domain does not have a mark.
479    Unmarked(Unmarked),
480    Marked(Marked),
481    #[doc(hidden)]
482    __SourceBreaking {
483        unknown_ordinal: u64,
484    },
485}
486
487/// Pattern that matches an unknown `Mark` member.
488#[macro_export]
489macro_rules! MarkUnknown {
490    () => {
491        _
492    };
493}
494
495// Custom PartialEq so that unknown variants are not equal to themselves.
496impl PartialEq for Mark {
497    fn eq(&self, other: &Self) -> bool {
498        match (self, other) {
499            (Self::Unmarked(x), Self::Unmarked(y)) => *x == *y,
500            (Self::Marked(x), Self::Marked(y)) => *x == *y,
501            _ => false,
502        }
503    }
504}
505
506impl Mark {
507    #[inline]
508    pub fn ordinal(&self) -> u64 {
509        match *self {
510            Self::Unmarked(_) => 1,
511            Self::Marked(_) => 2,
512            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
513        }
514    }
515
516    #[inline]
517    pub fn unknown_variant_for_testing() -> Self {
518        Self::__SourceBreaking { unknown_ordinal: 0 }
519    }
520
521    #[inline]
522    pub fn is_unknown(&self) -> bool {
523        match self {
524            Self::__SourceBreaking { .. } => true,
525            _ => false,
526        }
527    }
528}
529
530impl fidl::Persistable for Mark {}
531
532/// A matcher for transport-layer information in packets.
533#[derive(Clone, Debug)]
534pub enum PacketTransportProtocol {
535    Tcp(TcpPacket),
536    Udp(UdpPacket),
537    Icmp(IcmpPacket),
538    Icmpv6(Icmpv6Packet),
539    #[doc(hidden)]
540    __SourceBreaking {
541        unknown_ordinal: u64,
542    },
543}
544
545/// Pattern that matches an unknown `PacketTransportProtocol` member.
546#[macro_export]
547macro_rules! PacketTransportProtocolUnknown {
548    () => {
549        _
550    };
551}
552
553// Custom PartialEq so that unknown variants are not equal to themselves.
554impl PartialEq for PacketTransportProtocol {
555    fn eq(&self, other: &Self) -> bool {
556        match (self, other) {
557            (Self::Tcp(x), Self::Tcp(y)) => *x == *y,
558            (Self::Udp(x), Self::Udp(y)) => *x == *y,
559            (Self::Icmp(x), Self::Icmp(y)) => *x == *y,
560            (Self::Icmpv6(x), Self::Icmpv6(y)) => *x == *y,
561            _ => false,
562        }
563    }
564}
565
566impl PacketTransportProtocol {
567    #[inline]
568    pub fn ordinal(&self) -> u64 {
569        match *self {
570            Self::Tcp(_) => 1,
571            Self::Udp(_) => 2,
572            Self::Icmp(_) => 3,
573            Self::Icmpv6(_) => 4,
574            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
575        }
576    }
577
578    #[inline]
579    pub fn unknown_variant_for_testing() -> Self {
580        Self::__SourceBreaking { unknown_ordinal: 0 }
581    }
582
583    #[inline]
584    pub fn is_unknown(&self) -> bool {
585        match self {
586            Self::__SourceBreaking { .. } => true,
587            _ => false,
588        }
589    }
590}
591
592impl fidl::Persistable for PacketTransportProtocol {}
593
594/// A matcher for transport-layer fields of a socket.
595#[derive(Clone, Debug)]
596pub enum SocketTransportProtocol {
597    /// Matches against TCP fields.
598    Tcp(TcpSocket),
599    /// Matches against UDP fields.
600    Udp(UdpSocket),
601    #[doc(hidden)]
602    __SourceBreaking { unknown_ordinal: u64 },
603}
604
605/// Pattern that matches an unknown `SocketTransportProtocol` member.
606#[macro_export]
607macro_rules! SocketTransportProtocolUnknown {
608    () => {
609        _
610    };
611}
612
613// Custom PartialEq so that unknown variants are not equal to themselves.
614impl PartialEq for SocketTransportProtocol {
615    fn eq(&self, other: &Self) -> bool {
616        match (self, other) {
617            (Self::Tcp(x), Self::Tcp(y)) => *x == *y,
618            (Self::Udp(x), Self::Udp(y)) => *x == *y,
619            _ => false,
620        }
621    }
622}
623
624impl SocketTransportProtocol {
625    #[inline]
626    pub fn ordinal(&self) -> u64 {
627        match *self {
628            Self::Tcp(_) => 1,
629            Self::Udp(_) => 2,
630            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
631        }
632    }
633
634    #[inline]
635    pub fn unknown_variant_for_testing() -> Self {
636        Self::__SourceBreaking { unknown_ordinal: 0 }
637    }
638
639    #[inline]
640    pub fn is_unknown(&self) -> bool {
641        match self {
642            Self::__SourceBreaking { .. } => true,
643            _ => false,
644        }
645    }
646}
647
648impl fidl::Persistable for SocketTransportProtocol {}
649
650/// A matcher for TCP sockets.
651#[derive(Clone, Debug)]
652pub enum TcpSocket {
653    /// Only matches against the transport protocol and nothing else.
654    Empty(Empty),
655    /// Match against the source port of TCP sockets.
656    SrcPort(BoundPort),
657    /// Match against the destination port of TCP sockets.
658    DstPort(BoundPort),
659    /// The TCP socket's state must be contained in the set of states. If unset,
660    /// matches all states, just as if it was fully set.
661    ///
662    /// The constants are structured to correspond to the enum values of
663    /// fuchsia.net.tcp.States.
664    States(TcpState),
665    #[doc(hidden)]
666    __SourceBreaking { unknown_ordinal: u64 },
667}
668
669/// Pattern that matches an unknown `TcpSocket` member.
670#[macro_export]
671macro_rules! TcpSocketUnknown {
672    () => {
673        _
674    };
675}
676
677// Custom PartialEq so that unknown variants are not equal to themselves.
678impl PartialEq for TcpSocket {
679    fn eq(&self, other: &Self) -> bool {
680        match (self, other) {
681            (Self::Empty(x), Self::Empty(y)) => *x == *y,
682            (Self::SrcPort(x), Self::SrcPort(y)) => *x == *y,
683            (Self::DstPort(x), Self::DstPort(y)) => *x == *y,
684            (Self::States(x), Self::States(y)) => *x == *y,
685            _ => false,
686        }
687    }
688}
689
690impl TcpSocket {
691    #[inline]
692    pub fn ordinal(&self) -> u64 {
693        match *self {
694            Self::Empty(_) => 1,
695            Self::SrcPort(_) => 2,
696            Self::DstPort(_) => 3,
697            Self::States(_) => 4,
698            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
699        }
700    }
701
702    #[inline]
703    pub fn unknown_variant_for_testing() -> Self {
704        Self::__SourceBreaking { unknown_ordinal: 0 }
705    }
706
707    #[inline]
708    pub fn is_unknown(&self) -> bool {
709        match self {
710            Self::__SourceBreaking { .. } => true,
711            _ => false,
712        }
713    }
714}
715
716impl fidl::Persistable for TcpSocket {}
717
718/// A matcher for UDP sockets.
719#[derive(Clone, Debug)]
720pub enum UdpSocket {
721    /// Only matches against the transport protocol and nothing else.
722    Empty(Empty),
723    /// Match against the source port of UDP sockets.
724    SrcPort(BoundPort),
725    /// Match against the destination port of UDP sockets.
726    DstPort(BoundPort),
727    /// The UDP socket's state must be contained in the set of states.
728    ///
729    /// If unset, matches all states, just as if it was fully set.
730    States(UdpState),
731    #[doc(hidden)]
732    __SourceBreaking { unknown_ordinal: u64 },
733}
734
735/// Pattern that matches an unknown `UdpSocket` member.
736#[macro_export]
737macro_rules! UdpSocketUnknown {
738    () => {
739        _
740    };
741}
742
743// Custom PartialEq so that unknown variants are not equal to themselves.
744impl PartialEq for UdpSocket {
745    fn eq(&self, other: &Self) -> bool {
746        match (self, other) {
747            (Self::Empty(x), Self::Empty(y)) => *x == *y,
748            (Self::SrcPort(x), Self::SrcPort(y)) => *x == *y,
749            (Self::DstPort(x), Self::DstPort(y)) => *x == *y,
750            (Self::States(x), Self::States(y)) => *x == *y,
751            _ => false,
752        }
753    }
754}
755
756impl UdpSocket {
757    #[inline]
758    pub fn ordinal(&self) -> u64 {
759        match *self {
760            Self::Empty(_) => 1,
761            Self::SrcPort(_) => 2,
762            Self::DstPort(_) => 3,
763            Self::States(_) => 4,
764            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
765        }
766    }
767
768    #[inline]
769    pub fn unknown_variant_for_testing() -> Self {
770        Self::__SourceBreaking { unknown_ordinal: 0 }
771    }
772
773    #[inline]
774    pub fn is_unknown(&self) -> bool {
775        match self {
776            Self::__SourceBreaking { .. } => true,
777            _ => false,
778        }
779    }
780}
781
782impl fidl::Persistable for UdpSocket {}
783
784mod internal {
785    use super::*;
786    unsafe impl fidl::encoding::TypeMarker for TcpState {
787        type Owned = Self;
788
789        #[inline(always)]
790        fn inline_align(_context: fidl::encoding::Context) -> usize {
791            4
792        }
793
794        #[inline(always)]
795        fn inline_size(_context: fidl::encoding::Context) -> usize {
796            4
797        }
798    }
799
800    impl fidl::encoding::ValueTypeMarker for TcpState {
801        type Borrowed<'a> = Self;
802        #[inline(always)]
803        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
804            *value
805        }
806    }
807
808    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for TcpState {
809        #[inline]
810        unsafe fn encode(
811            self,
812            encoder: &mut fidl::encoding::Encoder<'_, D>,
813            offset: usize,
814            _depth: fidl::encoding::Depth,
815        ) -> fidl::Result<()> {
816            encoder.debug_check_bounds::<Self>(offset);
817            if self.bits() & Self::all().bits() != self.bits() {
818                return Err(fidl::Error::InvalidBitsValue);
819            }
820            encoder.write_num(self.bits(), offset);
821            Ok(())
822        }
823    }
824
825    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for TcpState {
826        #[inline(always)]
827        fn new_empty() -> Self {
828            Self::empty()
829        }
830
831        #[inline]
832        unsafe fn decode(
833            &mut self,
834            decoder: &mut fidl::encoding::Decoder<'_, D>,
835            offset: usize,
836            _depth: fidl::encoding::Depth,
837        ) -> fidl::Result<()> {
838            decoder.debug_check_bounds::<Self>(offset);
839            let prim = decoder.read_num::<u32>(offset);
840            *self = Self::from_bits(prim).ok_or(fidl::Error::InvalidBitsValue)?;
841            Ok(())
842        }
843    }
844    unsafe impl fidl::encoding::TypeMarker for UdpState {
845        type Owned = Self;
846
847        #[inline(always)]
848        fn inline_align(_context: fidl::encoding::Context) -> usize {
849            4
850        }
851
852        #[inline(always)]
853        fn inline_size(_context: fidl::encoding::Context) -> usize {
854            4
855        }
856    }
857
858    impl fidl::encoding::ValueTypeMarker for UdpState {
859        type Borrowed<'a> = Self;
860        #[inline(always)]
861        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
862            *value
863        }
864    }
865
866    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for UdpState {
867        #[inline]
868        unsafe fn encode(
869            self,
870            encoder: &mut fidl::encoding::Encoder<'_, D>,
871            offset: usize,
872            _depth: fidl::encoding::Depth,
873        ) -> fidl::Result<()> {
874            encoder.debug_check_bounds::<Self>(offset);
875            if self.bits() & Self::all().bits() != self.bits() {
876                return Err(fidl::Error::InvalidBitsValue);
877            }
878            encoder.write_num(self.bits(), offset);
879            Ok(())
880        }
881    }
882
883    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for UdpState {
884        #[inline(always)]
885        fn new_empty() -> Self {
886            Self::empty()
887        }
888
889        #[inline]
890        unsafe fn decode(
891            &mut self,
892            decoder: &mut fidl::encoding::Decoder<'_, D>,
893            offset: usize,
894            _depth: fidl::encoding::Depth,
895        ) -> fidl::Result<()> {
896            decoder.debug_check_bounds::<Self>(offset);
897            let prim = decoder.read_num::<u32>(offset);
898            *self = Self::from_bits(prim).ok_or(fidl::Error::InvalidBitsValue)?;
899            Ok(())
900        }
901    }
902
903    impl fidl::encoding::ValueTypeMarker for Address {
904        type Borrowed<'a> = &'a Self;
905        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
906            value
907        }
908    }
909
910    unsafe impl fidl::encoding::TypeMarker for Address {
911        type Owned = Self;
912
913        #[inline(always)]
914        fn inline_align(_context: fidl::encoding::Context) -> usize {
915            8
916        }
917
918        #[inline(always)]
919        fn inline_size(_context: fidl::encoding::Context) -> usize {
920            24
921        }
922    }
923
924    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Address, D> for &Address {
925        #[inline]
926        unsafe fn encode(
927            self,
928            encoder: &mut fidl::encoding::Encoder<'_, D>,
929            offset: usize,
930            _depth: fidl::encoding::Depth,
931        ) -> fidl::Result<()> {
932            encoder.debug_check_bounds::<Address>(offset);
933            // Delegate to tuple encoding.
934            fidl::encoding::Encode::<Address, D>::encode(
935                (
936                    <AddressMatcherType as fidl::encoding::ValueTypeMarker>::borrow(&self.matcher),
937                    <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.invert),
938                ),
939                encoder,
940                offset,
941                _depth,
942            )
943        }
944    }
945    unsafe impl<
946        D: fidl::encoding::ResourceDialect,
947        T0: fidl::encoding::Encode<AddressMatcherType, D>,
948        T1: fidl::encoding::Encode<bool, D>,
949    > fidl::encoding::Encode<Address, D> for (T0, T1)
950    {
951        #[inline]
952        unsafe fn encode(
953            self,
954            encoder: &mut fidl::encoding::Encoder<'_, D>,
955            offset: usize,
956            depth: fidl::encoding::Depth,
957        ) -> fidl::Result<()> {
958            encoder.debug_check_bounds::<Address>(offset);
959            // Zero out padding regions. There's no need to apply masks
960            // because the unmasked parts will be overwritten by fields.
961            unsafe {
962                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
963                (ptr as *mut u64).write_unaligned(0);
964            }
965            // Write the fields.
966            self.0.encode(encoder, offset + 0, depth)?;
967            self.1.encode(encoder, offset + 16, depth)?;
968            Ok(())
969        }
970    }
971
972    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Address {
973        #[inline(always)]
974        fn new_empty() -> Self {
975            Self {
976                matcher: fidl::new_empty!(AddressMatcherType, D),
977                invert: fidl::new_empty!(bool, D),
978            }
979        }
980
981        #[inline]
982        unsafe fn decode(
983            &mut self,
984            decoder: &mut fidl::encoding::Decoder<'_, D>,
985            offset: usize,
986            _depth: fidl::encoding::Depth,
987        ) -> fidl::Result<()> {
988            decoder.debug_check_bounds::<Self>(offset);
989            // Verify that padding bytes are zero.
990            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
991            let padval = unsafe { (ptr as *const u64).read_unaligned() };
992            let mask = 0xffffffffffffff00u64;
993            let maskedval = padval & mask;
994            if maskedval != 0 {
995                return Err(fidl::Error::NonZeroPadding {
996                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
997                });
998            }
999            fidl::decode!(AddressMatcherType, D, &mut self.matcher, decoder, offset + 0, _depth)?;
1000            fidl::decode!(bool, D, &mut self.invert, decoder, offset + 16, _depth)?;
1001            Ok(())
1002        }
1003    }
1004
1005    impl fidl::encoding::ValueTypeMarker for AddressRange {
1006        type Borrowed<'a> = &'a Self;
1007        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1008            value
1009        }
1010    }
1011
1012    unsafe impl fidl::encoding::TypeMarker for AddressRange {
1013        type Owned = Self;
1014
1015        #[inline(always)]
1016        fn inline_align(_context: fidl::encoding::Context) -> usize {
1017            8
1018        }
1019
1020        #[inline(always)]
1021        fn inline_size(_context: fidl::encoding::Context) -> usize {
1022            32
1023        }
1024    }
1025
1026    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<AddressRange, D>
1027        for &AddressRange
1028    {
1029        #[inline]
1030        unsafe fn encode(
1031            self,
1032            encoder: &mut fidl::encoding::Encoder<'_, D>,
1033            offset: usize,
1034            _depth: fidl::encoding::Depth,
1035        ) -> fidl::Result<()> {
1036            encoder.debug_check_bounds::<AddressRange>(offset);
1037            // Delegate to tuple encoding.
1038            fidl::encoding::Encode::<AddressRange, D>::encode(
1039                (
1040                    <fidl_fuchsia_net_common::IpAddress as fidl::encoding::ValueTypeMarker>::borrow(
1041                        &self.start,
1042                    ),
1043                    <fidl_fuchsia_net_common::IpAddress as fidl::encoding::ValueTypeMarker>::borrow(
1044                        &self.end,
1045                    ),
1046                ),
1047                encoder,
1048                offset,
1049                _depth,
1050            )
1051        }
1052    }
1053    unsafe impl<
1054        D: fidl::encoding::ResourceDialect,
1055        T0: fidl::encoding::Encode<fidl_fuchsia_net_common::IpAddress, D>,
1056        T1: fidl::encoding::Encode<fidl_fuchsia_net_common::IpAddress, D>,
1057    > fidl::encoding::Encode<AddressRange, D> for (T0, T1)
1058    {
1059        #[inline]
1060        unsafe fn encode(
1061            self,
1062            encoder: &mut fidl::encoding::Encoder<'_, D>,
1063            offset: usize,
1064            depth: fidl::encoding::Depth,
1065        ) -> fidl::Result<()> {
1066            encoder.debug_check_bounds::<AddressRange>(offset);
1067            // Zero out padding regions. There's no need to apply masks
1068            // because the unmasked parts will be overwritten by fields.
1069            // Write the fields.
1070            self.0.encode(encoder, offset + 0, depth)?;
1071            self.1.encode(encoder, offset + 16, depth)?;
1072            Ok(())
1073        }
1074    }
1075
1076    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for AddressRange {
1077        #[inline(always)]
1078        fn new_empty() -> Self {
1079            Self {
1080                start: fidl::new_empty!(fidl_fuchsia_net_common::IpAddress, D),
1081                end: fidl::new_empty!(fidl_fuchsia_net_common::IpAddress, D),
1082            }
1083        }
1084
1085        #[inline]
1086        unsafe fn decode(
1087            &mut self,
1088            decoder: &mut fidl::encoding::Decoder<'_, D>,
1089            offset: usize,
1090            _depth: fidl::encoding::Depth,
1091        ) -> fidl::Result<()> {
1092            decoder.debug_check_bounds::<Self>(offset);
1093            // Verify that padding bytes are zero.
1094            fidl::decode!(
1095                fidl_fuchsia_net_common::IpAddress,
1096                D,
1097                &mut self.start,
1098                decoder,
1099                offset + 0,
1100                _depth
1101            )?;
1102            fidl::decode!(
1103                fidl_fuchsia_net_common::IpAddress,
1104                D,
1105                &mut self.end,
1106                decoder,
1107                offset + 16,
1108                _depth
1109            )?;
1110            Ok(())
1111        }
1112    }
1113
1114    impl fidl::encoding::ValueTypeMarker for Between {
1115        type Borrowed<'a> = &'a Self;
1116        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1117            value
1118        }
1119    }
1120
1121    unsafe impl fidl::encoding::TypeMarker for Between {
1122        type Owned = Self;
1123
1124        #[inline(always)]
1125        fn inline_align(_context: fidl::encoding::Context) -> usize {
1126            4
1127        }
1128
1129        #[inline(always)]
1130        fn inline_size(_context: fidl::encoding::Context) -> usize {
1131            8
1132        }
1133        #[inline(always)]
1134        fn encode_is_copy() -> bool {
1135            true
1136        }
1137
1138        #[inline(always)]
1139        fn decode_is_copy() -> bool {
1140            true
1141        }
1142    }
1143
1144    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Between, D> for &Between {
1145        #[inline]
1146        unsafe fn encode(
1147            self,
1148            encoder: &mut fidl::encoding::Encoder<'_, D>,
1149            offset: usize,
1150            _depth: fidl::encoding::Depth,
1151        ) -> fidl::Result<()> {
1152            encoder.debug_check_bounds::<Between>(offset);
1153            unsafe {
1154                // Copy the object into the buffer.
1155                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
1156                (buf_ptr as *mut Between).write_unaligned((self as *const Between).read());
1157                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
1158                // done second because the memcpy will write garbage to these bytes.
1159            }
1160            Ok(())
1161        }
1162    }
1163    unsafe impl<
1164        D: fidl::encoding::ResourceDialect,
1165        T0: fidl::encoding::Encode<u32, D>,
1166        T1: fidl::encoding::Encode<u32, D>,
1167    > fidl::encoding::Encode<Between, D> for (T0, T1)
1168    {
1169        #[inline]
1170        unsafe fn encode(
1171            self,
1172            encoder: &mut fidl::encoding::Encoder<'_, D>,
1173            offset: usize,
1174            depth: fidl::encoding::Depth,
1175        ) -> fidl::Result<()> {
1176            encoder.debug_check_bounds::<Between>(offset);
1177            // Zero out padding regions. There's no need to apply masks
1178            // because the unmasked parts will be overwritten by fields.
1179            // Write the fields.
1180            self.0.encode(encoder, offset + 0, depth)?;
1181            self.1.encode(encoder, offset + 4, depth)?;
1182            Ok(())
1183        }
1184    }
1185
1186    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Between {
1187        #[inline(always)]
1188        fn new_empty() -> Self {
1189            Self { start: fidl::new_empty!(u32, D), end: fidl::new_empty!(u32, D) }
1190        }
1191
1192        #[inline]
1193        unsafe fn decode(
1194            &mut self,
1195            decoder: &mut fidl::encoding::Decoder<'_, D>,
1196            offset: usize,
1197            _depth: fidl::encoding::Depth,
1198        ) -> fidl::Result<()> {
1199            decoder.debug_check_bounds::<Self>(offset);
1200            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
1201            // Verify that padding bytes are zero.
1202            // Copy from the buffer into the object.
1203            unsafe {
1204                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 8);
1205            }
1206            Ok(())
1207        }
1208    }
1209
1210    impl fidl::encoding::ValueTypeMarker for Empty {
1211        type Borrowed<'a> = &'a Self;
1212        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1213            value
1214        }
1215    }
1216
1217    unsafe impl fidl::encoding::TypeMarker for Empty {
1218        type Owned = Self;
1219
1220        #[inline(always)]
1221        fn inline_align(_context: fidl::encoding::Context) -> usize {
1222            1
1223        }
1224
1225        #[inline(always)]
1226        fn inline_size(_context: fidl::encoding::Context) -> usize {
1227            1
1228        }
1229    }
1230
1231    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Empty, D> for &Empty {
1232        #[inline]
1233        unsafe fn encode(
1234            self,
1235            encoder: &mut fidl::encoding::Encoder<'_, D>,
1236            offset: usize,
1237            _depth: fidl::encoding::Depth,
1238        ) -> fidl::Result<()> {
1239            encoder.debug_check_bounds::<Empty>(offset);
1240            encoder.write_num(0u8, offset);
1241            Ok(())
1242        }
1243    }
1244
1245    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Empty {
1246        #[inline(always)]
1247        fn new_empty() -> Self {
1248            Self
1249        }
1250
1251        #[inline]
1252        unsafe fn decode(
1253            &mut self,
1254            decoder: &mut fidl::encoding::Decoder<'_, D>,
1255            offset: usize,
1256            _depth: fidl::encoding::Depth,
1257        ) -> fidl::Result<()> {
1258            decoder.debug_check_bounds::<Self>(offset);
1259            match decoder.read_num::<u8>(offset) {
1260                0 => Ok(()),
1261                _ => Err(fidl::Error::Invalid),
1262            }
1263        }
1264    }
1265
1266    impl fidl::encoding::ValueTypeMarker for MarkInDomain {
1267        type Borrowed<'a> = &'a Self;
1268        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1269            value
1270        }
1271    }
1272
1273    unsafe impl fidl::encoding::TypeMarker for MarkInDomain {
1274        type Owned = Self;
1275
1276        #[inline(always)]
1277        fn inline_align(_context: fidl::encoding::Context) -> usize {
1278            8
1279        }
1280
1281        #[inline(always)]
1282        fn inline_size(_context: fidl::encoding::Context) -> usize {
1283            24
1284        }
1285    }
1286
1287    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<MarkInDomain, D>
1288        for &MarkInDomain
1289    {
1290        #[inline]
1291        unsafe fn encode(
1292            self,
1293            encoder: &mut fidl::encoding::Encoder<'_, D>,
1294            offset: usize,
1295            _depth: fidl::encoding::Depth,
1296        ) -> fidl::Result<()> {
1297            encoder.debug_check_bounds::<MarkInDomain>(offset);
1298            // Delegate to tuple encoding.
1299            fidl::encoding::Encode::<MarkInDomain, D>::encode(
1300                (
1301                    <fidl_fuchsia_net_common::MarkDomain as fidl::encoding::ValueTypeMarker>::borrow(&self.domain),
1302                    <Mark as fidl::encoding::ValueTypeMarker>::borrow(&self.mark),
1303                ),
1304                encoder, offset, _depth
1305            )
1306        }
1307    }
1308    unsafe impl<
1309        D: fidl::encoding::ResourceDialect,
1310        T0: fidl::encoding::Encode<fidl_fuchsia_net_common::MarkDomain, D>,
1311        T1: fidl::encoding::Encode<Mark, D>,
1312    > fidl::encoding::Encode<MarkInDomain, D> for (T0, T1)
1313    {
1314        #[inline]
1315        unsafe fn encode(
1316            self,
1317            encoder: &mut fidl::encoding::Encoder<'_, D>,
1318            offset: usize,
1319            depth: fidl::encoding::Depth,
1320        ) -> fidl::Result<()> {
1321            encoder.debug_check_bounds::<MarkInDomain>(offset);
1322            // Zero out padding regions. There's no need to apply masks
1323            // because the unmasked parts will be overwritten by fields.
1324            unsafe {
1325                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
1326                (ptr as *mut u64).write_unaligned(0);
1327            }
1328            // Write the fields.
1329            self.0.encode(encoder, offset + 0, depth)?;
1330            self.1.encode(encoder, offset + 8, depth)?;
1331            Ok(())
1332        }
1333    }
1334
1335    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for MarkInDomain {
1336        #[inline(always)]
1337        fn new_empty() -> Self {
1338            Self {
1339                domain: fidl::new_empty!(fidl_fuchsia_net_common::MarkDomain, D),
1340                mark: fidl::new_empty!(Mark, D),
1341            }
1342        }
1343
1344        #[inline]
1345        unsafe fn decode(
1346            &mut self,
1347            decoder: &mut fidl::encoding::Decoder<'_, D>,
1348            offset: usize,
1349            _depth: fidl::encoding::Depth,
1350        ) -> fidl::Result<()> {
1351            decoder.debug_check_bounds::<Self>(offset);
1352            // Verify that padding bytes are zero.
1353            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
1354            let padval = unsafe { (ptr as *const u64).read_unaligned() };
1355            let mask = 0xffffffffffffff00u64;
1356            let maskedval = padval & mask;
1357            if maskedval != 0 {
1358                return Err(fidl::Error::NonZeroPadding {
1359                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
1360                });
1361            }
1362            fidl::decode!(
1363                fidl_fuchsia_net_common::MarkDomain,
1364                D,
1365                &mut self.domain,
1366                decoder,
1367                offset + 0,
1368                _depth
1369            )?;
1370            fidl::decode!(Mark, D, &mut self.mark, decoder, offset + 8, _depth)?;
1371            Ok(())
1372        }
1373    }
1374
1375    impl fidl::encoding::ValueTypeMarker for Marked {
1376        type Borrowed<'a> = &'a Self;
1377        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1378            value
1379        }
1380    }
1381
1382    unsafe impl fidl::encoding::TypeMarker for Marked {
1383        type Owned = Self;
1384
1385        #[inline(always)]
1386        fn inline_align(_context: fidl::encoding::Context) -> usize {
1387            4
1388        }
1389
1390        #[inline(always)]
1391        fn inline_size(_context: fidl::encoding::Context) -> usize {
1392            16
1393        }
1394    }
1395
1396    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Marked, D> for &Marked {
1397        #[inline]
1398        unsafe fn encode(
1399            self,
1400            encoder: &mut fidl::encoding::Encoder<'_, D>,
1401            offset: usize,
1402            _depth: fidl::encoding::Depth,
1403        ) -> fidl::Result<()> {
1404            encoder.debug_check_bounds::<Marked>(offset);
1405            // Delegate to tuple encoding.
1406            fidl::encoding::Encode::<Marked, D>::encode(
1407                (
1408                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.mask),
1409                    <Between as fidl::encoding::ValueTypeMarker>::borrow(&self.between),
1410                    <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.invert),
1411                ),
1412                encoder,
1413                offset,
1414                _depth,
1415            )
1416        }
1417    }
1418    unsafe impl<
1419        D: fidl::encoding::ResourceDialect,
1420        T0: fidl::encoding::Encode<u32, D>,
1421        T1: fidl::encoding::Encode<Between, D>,
1422        T2: fidl::encoding::Encode<bool, D>,
1423    > fidl::encoding::Encode<Marked, D> for (T0, T1, T2)
1424    {
1425        #[inline]
1426        unsafe fn encode(
1427            self,
1428            encoder: &mut fidl::encoding::Encoder<'_, D>,
1429            offset: usize,
1430            depth: fidl::encoding::Depth,
1431        ) -> fidl::Result<()> {
1432            encoder.debug_check_bounds::<Marked>(offset);
1433            // Zero out padding regions. There's no need to apply masks
1434            // because the unmasked parts will be overwritten by fields.
1435            unsafe {
1436                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(12);
1437                (ptr as *mut u32).write_unaligned(0);
1438            }
1439            // Write the fields.
1440            self.0.encode(encoder, offset + 0, depth)?;
1441            self.1.encode(encoder, offset + 4, depth)?;
1442            self.2.encode(encoder, offset + 12, depth)?;
1443            Ok(())
1444        }
1445    }
1446
1447    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Marked {
1448        #[inline(always)]
1449        fn new_empty() -> Self {
1450            Self {
1451                mask: fidl::new_empty!(u32, D),
1452                between: fidl::new_empty!(Between, D),
1453                invert: fidl::new_empty!(bool, D),
1454            }
1455        }
1456
1457        #[inline]
1458        unsafe fn decode(
1459            &mut self,
1460            decoder: &mut fidl::encoding::Decoder<'_, D>,
1461            offset: usize,
1462            _depth: fidl::encoding::Depth,
1463        ) -> fidl::Result<()> {
1464            decoder.debug_check_bounds::<Self>(offset);
1465            // Verify that padding bytes are zero.
1466            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(12) };
1467            let padval = unsafe { (ptr as *const u32).read_unaligned() };
1468            let mask = 0xffffff00u32;
1469            let maskedval = padval & mask;
1470            if maskedval != 0 {
1471                return Err(fidl::Error::NonZeroPadding {
1472                    padding_start: offset + 12 + ((mask as u64).trailing_zeros() / 8) as usize,
1473                });
1474            }
1475            fidl::decode!(u32, D, &mut self.mask, decoder, offset + 0, _depth)?;
1476            fidl::decode!(Between, D, &mut self.between, decoder, offset + 4, _depth)?;
1477            fidl::decode!(bool, D, &mut self.invert, decoder, offset + 12, _depth)?;
1478            Ok(())
1479        }
1480    }
1481
1482    impl fidl::encoding::ValueTypeMarker for Port {
1483        type Borrowed<'a> = &'a Self;
1484        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1485            value
1486        }
1487    }
1488
1489    unsafe impl fidl::encoding::TypeMarker for Port {
1490        type Owned = Self;
1491
1492        #[inline(always)]
1493        fn inline_align(_context: fidl::encoding::Context) -> usize {
1494            2
1495        }
1496
1497        #[inline(always)]
1498        fn inline_size(_context: fidl::encoding::Context) -> usize {
1499            6
1500        }
1501    }
1502
1503    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Port, D> for &Port {
1504        #[inline]
1505        unsafe fn encode(
1506            self,
1507            encoder: &mut fidl::encoding::Encoder<'_, D>,
1508            offset: usize,
1509            _depth: fidl::encoding::Depth,
1510        ) -> fidl::Result<()> {
1511            encoder.debug_check_bounds::<Port>(offset);
1512            // Delegate to tuple encoding.
1513            fidl::encoding::Encode::<Port, D>::encode(
1514                (
1515                    <u16 as fidl::encoding::ValueTypeMarker>::borrow(&self.start),
1516                    <u16 as fidl::encoding::ValueTypeMarker>::borrow(&self.end),
1517                    <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.invert),
1518                ),
1519                encoder,
1520                offset,
1521                _depth,
1522            )
1523        }
1524    }
1525    unsafe impl<
1526        D: fidl::encoding::ResourceDialect,
1527        T0: fidl::encoding::Encode<u16, D>,
1528        T1: fidl::encoding::Encode<u16, D>,
1529        T2: fidl::encoding::Encode<bool, D>,
1530    > fidl::encoding::Encode<Port, D> for (T0, T1, T2)
1531    {
1532        #[inline]
1533        unsafe fn encode(
1534            self,
1535            encoder: &mut fidl::encoding::Encoder<'_, D>,
1536            offset: usize,
1537            depth: fidl::encoding::Depth,
1538        ) -> fidl::Result<()> {
1539            encoder.debug_check_bounds::<Port>(offset);
1540            // Zero out padding regions. There's no need to apply masks
1541            // because the unmasked parts will be overwritten by fields.
1542            unsafe {
1543                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(4);
1544                (ptr as *mut u16).write_unaligned(0);
1545            }
1546            // Write the fields.
1547            self.0.encode(encoder, offset + 0, depth)?;
1548            self.1.encode(encoder, offset + 2, depth)?;
1549            self.2.encode(encoder, offset + 4, depth)?;
1550            Ok(())
1551        }
1552    }
1553
1554    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Port {
1555        #[inline(always)]
1556        fn new_empty() -> Self {
1557            Self {
1558                start: fidl::new_empty!(u16, D),
1559                end: fidl::new_empty!(u16, D),
1560                invert: fidl::new_empty!(bool, D),
1561            }
1562        }
1563
1564        #[inline]
1565        unsafe fn decode(
1566            &mut self,
1567            decoder: &mut fidl::encoding::Decoder<'_, D>,
1568            offset: usize,
1569            _depth: fidl::encoding::Depth,
1570        ) -> fidl::Result<()> {
1571            decoder.debug_check_bounds::<Self>(offset);
1572            // Verify that padding bytes are zero.
1573            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(4) };
1574            let padval = unsafe { (ptr as *const u16).read_unaligned() };
1575            let mask = 0xff00u16;
1576            let maskedval = padval & mask;
1577            if maskedval != 0 {
1578                return Err(fidl::Error::NonZeroPadding {
1579                    padding_start: offset + 4 + ((mask as u64).trailing_zeros() / 8) as usize,
1580                });
1581            }
1582            fidl::decode!(u16, D, &mut self.start, decoder, offset + 0, _depth)?;
1583            fidl::decode!(u16, D, &mut self.end, decoder, offset + 2, _depth)?;
1584            fidl::decode!(bool, D, &mut self.invert, decoder, offset + 4, _depth)?;
1585            Ok(())
1586        }
1587    }
1588
1589    impl fidl::encoding::ValueTypeMarker for SocketCookie {
1590        type Borrowed<'a> = &'a Self;
1591        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1592            value
1593        }
1594    }
1595
1596    unsafe impl fidl::encoding::TypeMarker for SocketCookie {
1597        type Owned = Self;
1598
1599        #[inline(always)]
1600        fn inline_align(_context: fidl::encoding::Context) -> usize {
1601            8
1602        }
1603
1604        #[inline(always)]
1605        fn inline_size(_context: fidl::encoding::Context) -> usize {
1606            16
1607        }
1608    }
1609
1610    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<SocketCookie, D>
1611        for &SocketCookie
1612    {
1613        #[inline]
1614        unsafe fn encode(
1615            self,
1616            encoder: &mut fidl::encoding::Encoder<'_, D>,
1617            offset: usize,
1618            _depth: fidl::encoding::Depth,
1619        ) -> fidl::Result<()> {
1620            encoder.debug_check_bounds::<SocketCookie>(offset);
1621            // Delegate to tuple encoding.
1622            fidl::encoding::Encode::<SocketCookie, D>::encode(
1623                (
1624                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.cookie),
1625                    <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.invert),
1626                ),
1627                encoder,
1628                offset,
1629                _depth,
1630            )
1631        }
1632    }
1633    unsafe impl<
1634        D: fidl::encoding::ResourceDialect,
1635        T0: fidl::encoding::Encode<u64, D>,
1636        T1: fidl::encoding::Encode<bool, D>,
1637    > fidl::encoding::Encode<SocketCookie, D> for (T0, T1)
1638    {
1639        #[inline]
1640        unsafe fn encode(
1641            self,
1642            encoder: &mut fidl::encoding::Encoder<'_, D>,
1643            offset: usize,
1644            depth: fidl::encoding::Depth,
1645        ) -> fidl::Result<()> {
1646            encoder.debug_check_bounds::<SocketCookie>(offset);
1647            // Zero out padding regions. There's no need to apply masks
1648            // because the unmasked parts will be overwritten by fields.
1649            unsafe {
1650                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
1651                (ptr as *mut u64).write_unaligned(0);
1652            }
1653            // Write the fields.
1654            self.0.encode(encoder, offset + 0, depth)?;
1655            self.1.encode(encoder, offset + 8, depth)?;
1656            Ok(())
1657        }
1658    }
1659
1660    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SocketCookie {
1661        #[inline(always)]
1662        fn new_empty() -> Self {
1663            Self { cookie: fidl::new_empty!(u64, D), invert: fidl::new_empty!(bool, D) }
1664        }
1665
1666        #[inline]
1667        unsafe fn decode(
1668            &mut self,
1669            decoder: &mut fidl::encoding::Decoder<'_, D>,
1670            offset: usize,
1671            _depth: fidl::encoding::Depth,
1672        ) -> fidl::Result<()> {
1673            decoder.debug_check_bounds::<Self>(offset);
1674            // Verify that padding bytes are zero.
1675            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(8) };
1676            let padval = unsafe { (ptr as *const u64).read_unaligned() };
1677            let mask = 0xffffffffffffff00u64;
1678            let maskedval = padval & mask;
1679            if maskedval != 0 {
1680                return Err(fidl::Error::NonZeroPadding {
1681                    padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
1682                });
1683            }
1684            fidl::decode!(u64, D, &mut self.cookie, decoder, offset + 0, _depth)?;
1685            fidl::decode!(bool, D, &mut self.invert, decoder, offset + 8, _depth)?;
1686            Ok(())
1687        }
1688    }
1689
1690    impl fidl::encoding::ValueTypeMarker for Unmarked {
1691        type Borrowed<'a> = &'a Self;
1692        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1693            value
1694        }
1695    }
1696
1697    unsafe impl fidl::encoding::TypeMarker for Unmarked {
1698        type Owned = Self;
1699
1700        #[inline(always)]
1701        fn inline_align(_context: fidl::encoding::Context) -> usize {
1702            1
1703        }
1704
1705        #[inline(always)]
1706        fn inline_size(_context: fidl::encoding::Context) -> usize {
1707            1
1708        }
1709    }
1710
1711    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Unmarked, D> for &Unmarked {
1712        #[inline]
1713        unsafe fn encode(
1714            self,
1715            encoder: &mut fidl::encoding::Encoder<'_, D>,
1716            offset: usize,
1717            _depth: fidl::encoding::Depth,
1718        ) -> fidl::Result<()> {
1719            encoder.debug_check_bounds::<Unmarked>(offset);
1720            encoder.write_num(0u8, offset);
1721            Ok(())
1722        }
1723    }
1724
1725    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Unmarked {
1726        #[inline(always)]
1727        fn new_empty() -> Self {
1728            Self
1729        }
1730
1731        #[inline]
1732        unsafe fn decode(
1733            &mut self,
1734            decoder: &mut fidl::encoding::Decoder<'_, D>,
1735            offset: usize,
1736            _depth: fidl::encoding::Depth,
1737        ) -> fidl::Result<()> {
1738            decoder.debug_check_bounds::<Self>(offset);
1739            match decoder.read_num::<u8>(offset) {
1740                0 => Ok(()),
1741                _ => Err(fidl::Error::Invalid),
1742            }
1743        }
1744    }
1745
1746    impl IcmpPacket {
1747        #[inline(always)]
1748        fn max_ordinal_present(&self) -> u64 {
1749            0
1750        }
1751    }
1752
1753    impl fidl::encoding::ValueTypeMarker for IcmpPacket {
1754        type Borrowed<'a> = &'a Self;
1755        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1756            value
1757        }
1758    }
1759
1760    unsafe impl fidl::encoding::TypeMarker for IcmpPacket {
1761        type Owned = Self;
1762
1763        #[inline(always)]
1764        fn inline_align(_context: fidl::encoding::Context) -> usize {
1765            8
1766        }
1767
1768        #[inline(always)]
1769        fn inline_size(_context: fidl::encoding::Context) -> usize {
1770            16
1771        }
1772    }
1773
1774    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<IcmpPacket, D>
1775        for &IcmpPacket
1776    {
1777        unsafe fn encode(
1778            self,
1779            encoder: &mut fidl::encoding::Encoder<'_, D>,
1780            offset: usize,
1781            mut depth: fidl::encoding::Depth,
1782        ) -> fidl::Result<()> {
1783            encoder.debug_check_bounds::<IcmpPacket>(offset);
1784            // Vector header
1785            let max_ordinal: u64 = self.max_ordinal_present();
1786            encoder.write_num(max_ordinal, offset);
1787            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
1788            // Calling encoder.out_of_line_offset(0) is not allowed.
1789            if max_ordinal == 0 {
1790                return Ok(());
1791            }
1792            depth.increment()?;
1793            let envelope_size = 8;
1794            let bytes_len = max_ordinal as usize * envelope_size;
1795            #[allow(unused_variables)]
1796            let offset = encoder.out_of_line_offset(bytes_len);
1797            let mut _prev_end_offset: usize = 0;
1798
1799            Ok(())
1800        }
1801    }
1802
1803    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for IcmpPacket {
1804        #[inline(always)]
1805        fn new_empty() -> Self {
1806            Self::default()
1807        }
1808
1809        unsafe fn decode(
1810            &mut self,
1811            decoder: &mut fidl::encoding::Decoder<'_, D>,
1812            offset: usize,
1813            mut depth: fidl::encoding::Depth,
1814        ) -> fidl::Result<()> {
1815            decoder.debug_check_bounds::<Self>(offset);
1816            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
1817                None => return Err(fidl::Error::NotNullable),
1818                Some(len) => len,
1819            };
1820            // Calling decoder.out_of_line_offset(0) is not allowed.
1821            if len == 0 {
1822                return Ok(());
1823            };
1824            depth.increment()?;
1825            let envelope_size = 8;
1826            let bytes_len = len * envelope_size;
1827            let offset = decoder.out_of_line_offset(bytes_len)?;
1828            // Decode the envelope for each type.
1829            let mut _next_ordinal_to_read = 0;
1830            let mut next_offset = offset;
1831            let end_offset = offset + bytes_len;
1832
1833            // Decode the remaining unknown envelopes.
1834            while next_offset < end_offset {
1835                _next_ordinal_to_read += 1;
1836                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1837                next_offset += envelope_size;
1838            }
1839
1840            Ok(())
1841        }
1842    }
1843
1844    impl Icmpv6Packet {
1845        #[inline(always)]
1846        fn max_ordinal_present(&self) -> u64 {
1847            0
1848        }
1849    }
1850
1851    impl fidl::encoding::ValueTypeMarker for Icmpv6Packet {
1852        type Borrowed<'a> = &'a Self;
1853        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1854            value
1855        }
1856    }
1857
1858    unsafe impl fidl::encoding::TypeMarker for Icmpv6Packet {
1859        type Owned = Self;
1860
1861        #[inline(always)]
1862        fn inline_align(_context: fidl::encoding::Context) -> usize {
1863            8
1864        }
1865
1866        #[inline(always)]
1867        fn inline_size(_context: fidl::encoding::Context) -> usize {
1868            16
1869        }
1870    }
1871
1872    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Icmpv6Packet, D>
1873        for &Icmpv6Packet
1874    {
1875        unsafe fn encode(
1876            self,
1877            encoder: &mut fidl::encoding::Encoder<'_, D>,
1878            offset: usize,
1879            mut depth: fidl::encoding::Depth,
1880        ) -> fidl::Result<()> {
1881            encoder.debug_check_bounds::<Icmpv6Packet>(offset);
1882            // Vector header
1883            let max_ordinal: u64 = self.max_ordinal_present();
1884            encoder.write_num(max_ordinal, offset);
1885            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
1886            // Calling encoder.out_of_line_offset(0) is not allowed.
1887            if max_ordinal == 0 {
1888                return Ok(());
1889            }
1890            depth.increment()?;
1891            let envelope_size = 8;
1892            let bytes_len = max_ordinal as usize * envelope_size;
1893            #[allow(unused_variables)]
1894            let offset = encoder.out_of_line_offset(bytes_len);
1895            let mut _prev_end_offset: usize = 0;
1896
1897            Ok(())
1898        }
1899    }
1900
1901    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Icmpv6Packet {
1902        #[inline(always)]
1903        fn new_empty() -> Self {
1904            Self::default()
1905        }
1906
1907        unsafe fn decode(
1908            &mut self,
1909            decoder: &mut fidl::encoding::Decoder<'_, D>,
1910            offset: usize,
1911            mut depth: fidl::encoding::Depth,
1912        ) -> fidl::Result<()> {
1913            decoder.debug_check_bounds::<Self>(offset);
1914            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
1915                None => return Err(fidl::Error::NotNullable),
1916                Some(len) => len,
1917            };
1918            // Calling decoder.out_of_line_offset(0) is not allowed.
1919            if len == 0 {
1920                return Ok(());
1921            };
1922            depth.increment()?;
1923            let envelope_size = 8;
1924            let bytes_len = len * envelope_size;
1925            let offset = decoder.out_of_line_offset(bytes_len)?;
1926            // Decode the envelope for each type.
1927            let mut _next_ordinal_to_read = 0;
1928            let mut next_offset = offset;
1929            let end_offset = offset + bytes_len;
1930
1931            // Decode the remaining unknown envelopes.
1932            while next_offset < end_offset {
1933                _next_ordinal_to_read += 1;
1934                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1935                next_offset += envelope_size;
1936            }
1937
1938            Ok(())
1939        }
1940    }
1941
1942    impl TcpPacket {
1943        #[inline(always)]
1944        fn max_ordinal_present(&self) -> u64 {
1945            if let Some(_) = self.dst_port {
1946                return 2;
1947            }
1948            if let Some(_) = self.src_port {
1949                return 1;
1950            }
1951            0
1952        }
1953    }
1954
1955    impl fidl::encoding::ValueTypeMarker for TcpPacket {
1956        type Borrowed<'a> = &'a Self;
1957        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1958            value
1959        }
1960    }
1961
1962    unsafe impl fidl::encoding::TypeMarker for TcpPacket {
1963        type Owned = Self;
1964
1965        #[inline(always)]
1966        fn inline_align(_context: fidl::encoding::Context) -> usize {
1967            8
1968        }
1969
1970        #[inline(always)]
1971        fn inline_size(_context: fidl::encoding::Context) -> usize {
1972            16
1973        }
1974    }
1975
1976    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<TcpPacket, D>
1977        for &TcpPacket
1978    {
1979        unsafe fn encode(
1980            self,
1981            encoder: &mut fidl::encoding::Encoder<'_, D>,
1982            offset: usize,
1983            mut depth: fidl::encoding::Depth,
1984        ) -> fidl::Result<()> {
1985            encoder.debug_check_bounds::<TcpPacket>(offset);
1986            // Vector header
1987            let max_ordinal: u64 = self.max_ordinal_present();
1988            encoder.write_num(max_ordinal, offset);
1989            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
1990            // Calling encoder.out_of_line_offset(0) is not allowed.
1991            if max_ordinal == 0 {
1992                return Ok(());
1993            }
1994            depth.increment()?;
1995            let envelope_size = 8;
1996            let bytes_len = max_ordinal as usize * envelope_size;
1997            #[allow(unused_variables)]
1998            let offset = encoder.out_of_line_offset(bytes_len);
1999            let mut _prev_end_offset: usize = 0;
2000            if 1 > max_ordinal {
2001                return Ok(());
2002            }
2003
2004            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2005            // are envelope_size bytes.
2006            let cur_offset: usize = (1 - 1) * envelope_size;
2007
2008            // Zero reserved fields.
2009            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2010
2011            // Safety:
2012            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2013            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2014            //   envelope_size bytes, there is always sufficient room.
2015            fidl::encoding::encode_in_envelope_optional::<Port, D>(
2016                self.src_port.as_ref().map(<Port as fidl::encoding::ValueTypeMarker>::borrow),
2017                encoder,
2018                offset + cur_offset,
2019                depth,
2020            )?;
2021
2022            _prev_end_offset = cur_offset + envelope_size;
2023            if 2 > max_ordinal {
2024                return Ok(());
2025            }
2026
2027            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2028            // are envelope_size bytes.
2029            let cur_offset: usize = (2 - 1) * envelope_size;
2030
2031            // Zero reserved fields.
2032            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2033
2034            // Safety:
2035            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2036            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2037            //   envelope_size bytes, there is always sufficient room.
2038            fidl::encoding::encode_in_envelope_optional::<Port, D>(
2039                self.dst_port.as_ref().map(<Port as fidl::encoding::ValueTypeMarker>::borrow),
2040                encoder,
2041                offset + cur_offset,
2042                depth,
2043            )?;
2044
2045            _prev_end_offset = cur_offset + envelope_size;
2046
2047            Ok(())
2048        }
2049    }
2050
2051    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for TcpPacket {
2052        #[inline(always)]
2053        fn new_empty() -> Self {
2054            Self::default()
2055        }
2056
2057        unsafe fn decode(
2058            &mut self,
2059            decoder: &mut fidl::encoding::Decoder<'_, D>,
2060            offset: usize,
2061            mut depth: fidl::encoding::Depth,
2062        ) -> fidl::Result<()> {
2063            decoder.debug_check_bounds::<Self>(offset);
2064            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
2065                None => return Err(fidl::Error::NotNullable),
2066                Some(len) => len,
2067            };
2068            // Calling decoder.out_of_line_offset(0) is not allowed.
2069            if len == 0 {
2070                return Ok(());
2071            };
2072            depth.increment()?;
2073            let envelope_size = 8;
2074            let bytes_len = len * envelope_size;
2075            let offset = decoder.out_of_line_offset(bytes_len)?;
2076            // Decode the envelope for each type.
2077            let mut _next_ordinal_to_read = 0;
2078            let mut next_offset = offset;
2079            let end_offset = offset + bytes_len;
2080            _next_ordinal_to_read += 1;
2081            if next_offset >= end_offset {
2082                return Ok(());
2083            }
2084
2085            // Decode unknown envelopes for gaps in ordinals.
2086            while _next_ordinal_to_read < 1 {
2087                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2088                _next_ordinal_to_read += 1;
2089                next_offset += envelope_size;
2090            }
2091
2092            let next_out_of_line = decoder.next_out_of_line();
2093            let handles_before = decoder.remaining_handles();
2094            if let Some((inlined, num_bytes, num_handles)) =
2095                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2096            {
2097                let member_inline_size =
2098                    <Port as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2099                if inlined != (member_inline_size <= 4) {
2100                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2101                }
2102                let inner_offset;
2103                let mut inner_depth = depth.clone();
2104                if inlined {
2105                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2106                    inner_offset = next_offset;
2107                } else {
2108                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2109                    inner_depth.increment()?;
2110                }
2111                let val_ref = self.src_port.get_or_insert_with(|| fidl::new_empty!(Port, D));
2112                fidl::decode!(Port, D, val_ref, decoder, inner_offset, inner_depth)?;
2113                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2114                {
2115                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2116                }
2117                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2118                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2119                }
2120            }
2121
2122            next_offset += envelope_size;
2123            _next_ordinal_to_read += 1;
2124            if next_offset >= end_offset {
2125                return Ok(());
2126            }
2127
2128            // Decode unknown envelopes for gaps in ordinals.
2129            while _next_ordinal_to_read < 2 {
2130                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2131                _next_ordinal_to_read += 1;
2132                next_offset += envelope_size;
2133            }
2134
2135            let next_out_of_line = decoder.next_out_of_line();
2136            let handles_before = decoder.remaining_handles();
2137            if let Some((inlined, num_bytes, num_handles)) =
2138                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2139            {
2140                let member_inline_size =
2141                    <Port as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2142                if inlined != (member_inline_size <= 4) {
2143                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2144                }
2145                let inner_offset;
2146                let mut inner_depth = depth.clone();
2147                if inlined {
2148                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2149                    inner_offset = next_offset;
2150                } else {
2151                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2152                    inner_depth.increment()?;
2153                }
2154                let val_ref = self.dst_port.get_or_insert_with(|| fidl::new_empty!(Port, D));
2155                fidl::decode!(Port, D, val_ref, decoder, inner_offset, inner_depth)?;
2156                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2157                {
2158                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2159                }
2160                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2161                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2162                }
2163            }
2164
2165            next_offset += envelope_size;
2166
2167            // Decode the remaining unknown envelopes.
2168            while next_offset < end_offset {
2169                _next_ordinal_to_read += 1;
2170                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2171                next_offset += envelope_size;
2172            }
2173
2174            Ok(())
2175        }
2176    }
2177
2178    impl UdpPacket {
2179        #[inline(always)]
2180        fn max_ordinal_present(&self) -> u64 {
2181            if let Some(_) = self.dst_port {
2182                return 2;
2183            }
2184            if let Some(_) = self.src_port {
2185                return 1;
2186            }
2187            0
2188        }
2189    }
2190
2191    impl fidl::encoding::ValueTypeMarker for UdpPacket {
2192        type Borrowed<'a> = &'a Self;
2193        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2194            value
2195        }
2196    }
2197
2198    unsafe impl fidl::encoding::TypeMarker for UdpPacket {
2199        type Owned = Self;
2200
2201        #[inline(always)]
2202        fn inline_align(_context: fidl::encoding::Context) -> usize {
2203            8
2204        }
2205
2206        #[inline(always)]
2207        fn inline_size(_context: fidl::encoding::Context) -> usize {
2208            16
2209        }
2210    }
2211
2212    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<UdpPacket, D>
2213        for &UdpPacket
2214    {
2215        unsafe fn encode(
2216            self,
2217            encoder: &mut fidl::encoding::Encoder<'_, D>,
2218            offset: usize,
2219            mut depth: fidl::encoding::Depth,
2220        ) -> fidl::Result<()> {
2221            encoder.debug_check_bounds::<UdpPacket>(offset);
2222            // Vector header
2223            let max_ordinal: u64 = self.max_ordinal_present();
2224            encoder.write_num(max_ordinal, offset);
2225            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
2226            // Calling encoder.out_of_line_offset(0) is not allowed.
2227            if max_ordinal == 0 {
2228                return Ok(());
2229            }
2230            depth.increment()?;
2231            let envelope_size = 8;
2232            let bytes_len = max_ordinal as usize * envelope_size;
2233            #[allow(unused_variables)]
2234            let offset = encoder.out_of_line_offset(bytes_len);
2235            let mut _prev_end_offset: usize = 0;
2236            if 1 > max_ordinal {
2237                return Ok(());
2238            }
2239
2240            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2241            // are envelope_size bytes.
2242            let cur_offset: usize = (1 - 1) * envelope_size;
2243
2244            // Zero reserved fields.
2245            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2246
2247            // Safety:
2248            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2249            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2250            //   envelope_size bytes, there is always sufficient room.
2251            fidl::encoding::encode_in_envelope_optional::<Port, D>(
2252                self.src_port.as_ref().map(<Port as fidl::encoding::ValueTypeMarker>::borrow),
2253                encoder,
2254                offset + cur_offset,
2255                depth,
2256            )?;
2257
2258            _prev_end_offset = cur_offset + envelope_size;
2259            if 2 > max_ordinal {
2260                return Ok(());
2261            }
2262
2263            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2264            // are envelope_size bytes.
2265            let cur_offset: usize = (2 - 1) * envelope_size;
2266
2267            // Zero reserved fields.
2268            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2269
2270            // Safety:
2271            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2272            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2273            //   envelope_size bytes, there is always sufficient room.
2274            fidl::encoding::encode_in_envelope_optional::<Port, D>(
2275                self.dst_port.as_ref().map(<Port as fidl::encoding::ValueTypeMarker>::borrow),
2276                encoder,
2277                offset + cur_offset,
2278                depth,
2279            )?;
2280
2281            _prev_end_offset = cur_offset + envelope_size;
2282
2283            Ok(())
2284        }
2285    }
2286
2287    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for UdpPacket {
2288        #[inline(always)]
2289        fn new_empty() -> Self {
2290            Self::default()
2291        }
2292
2293        unsafe fn decode(
2294            &mut self,
2295            decoder: &mut fidl::encoding::Decoder<'_, D>,
2296            offset: usize,
2297            mut depth: fidl::encoding::Depth,
2298        ) -> fidl::Result<()> {
2299            decoder.debug_check_bounds::<Self>(offset);
2300            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
2301                None => return Err(fidl::Error::NotNullable),
2302                Some(len) => len,
2303            };
2304            // Calling decoder.out_of_line_offset(0) is not allowed.
2305            if len == 0 {
2306                return Ok(());
2307            };
2308            depth.increment()?;
2309            let envelope_size = 8;
2310            let bytes_len = len * envelope_size;
2311            let offset = decoder.out_of_line_offset(bytes_len)?;
2312            // Decode the envelope for each type.
2313            let mut _next_ordinal_to_read = 0;
2314            let mut next_offset = offset;
2315            let end_offset = offset + bytes_len;
2316            _next_ordinal_to_read += 1;
2317            if next_offset >= end_offset {
2318                return Ok(());
2319            }
2320
2321            // Decode unknown envelopes for gaps in ordinals.
2322            while _next_ordinal_to_read < 1 {
2323                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2324                _next_ordinal_to_read += 1;
2325                next_offset += envelope_size;
2326            }
2327
2328            let next_out_of_line = decoder.next_out_of_line();
2329            let handles_before = decoder.remaining_handles();
2330            if let Some((inlined, num_bytes, num_handles)) =
2331                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2332            {
2333                let member_inline_size =
2334                    <Port as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2335                if inlined != (member_inline_size <= 4) {
2336                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2337                }
2338                let inner_offset;
2339                let mut inner_depth = depth.clone();
2340                if inlined {
2341                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2342                    inner_offset = next_offset;
2343                } else {
2344                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2345                    inner_depth.increment()?;
2346                }
2347                let val_ref = self.src_port.get_or_insert_with(|| fidl::new_empty!(Port, D));
2348                fidl::decode!(Port, D, val_ref, decoder, inner_offset, inner_depth)?;
2349                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2350                {
2351                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2352                }
2353                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2354                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2355                }
2356            }
2357
2358            next_offset += envelope_size;
2359            _next_ordinal_to_read += 1;
2360            if next_offset >= end_offset {
2361                return Ok(());
2362            }
2363
2364            // Decode unknown envelopes for gaps in ordinals.
2365            while _next_ordinal_to_read < 2 {
2366                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2367                _next_ordinal_to_read += 1;
2368                next_offset += envelope_size;
2369            }
2370
2371            let next_out_of_line = decoder.next_out_of_line();
2372            let handles_before = decoder.remaining_handles();
2373            if let Some((inlined, num_bytes, num_handles)) =
2374                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2375            {
2376                let member_inline_size =
2377                    <Port as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2378                if inlined != (member_inline_size <= 4) {
2379                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2380                }
2381                let inner_offset;
2382                let mut inner_depth = depth.clone();
2383                if inlined {
2384                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2385                    inner_offset = next_offset;
2386                } else {
2387                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2388                    inner_depth.increment()?;
2389                }
2390                let val_ref = self.dst_port.get_or_insert_with(|| fidl::new_empty!(Port, D));
2391                fidl::decode!(Port, D, val_ref, decoder, inner_offset, inner_depth)?;
2392                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2393                {
2394                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2395                }
2396                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2397                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2398                }
2399            }
2400
2401            next_offset += envelope_size;
2402
2403            // Decode the remaining unknown envelopes.
2404            while next_offset < end_offset {
2405                _next_ordinal_to_read += 1;
2406                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2407                next_offset += envelope_size;
2408            }
2409
2410            Ok(())
2411        }
2412    }
2413
2414    impl fidl::encoding::ValueTypeMarker for AddressMatcherType {
2415        type Borrowed<'a> = &'a Self;
2416        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2417            value
2418        }
2419    }
2420
2421    unsafe impl fidl::encoding::TypeMarker for AddressMatcherType {
2422        type Owned = Self;
2423
2424        #[inline(always)]
2425        fn inline_align(_context: fidl::encoding::Context) -> usize {
2426            8
2427        }
2428
2429        #[inline(always)]
2430        fn inline_size(_context: fidl::encoding::Context) -> usize {
2431            16
2432        }
2433    }
2434
2435    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<AddressMatcherType, D>
2436        for &AddressMatcherType
2437    {
2438        #[inline]
2439        unsafe fn encode(
2440            self,
2441            encoder: &mut fidl::encoding::Encoder<'_, D>,
2442            offset: usize,
2443            _depth: fidl::encoding::Depth,
2444        ) -> fidl::Result<()> {
2445            encoder.debug_check_bounds::<AddressMatcherType>(offset);
2446            encoder.write_num::<u64>(self.ordinal(), offset);
2447            match self {
2448                AddressMatcherType::Subnet(ref val) => fidl::encoding::encode_in_envelope::<
2449                    fidl_fuchsia_net_common::Subnet,
2450                    D,
2451                >(
2452                    <fidl_fuchsia_net_common::Subnet as fidl::encoding::ValueTypeMarker>::borrow(
2453                        val,
2454                    ),
2455                    encoder,
2456                    offset + 8,
2457                    _depth,
2458                ),
2459                AddressMatcherType::Range(ref val) => {
2460                    fidl::encoding::encode_in_envelope::<AddressRange, D>(
2461                        <AddressRange as fidl::encoding::ValueTypeMarker>::borrow(val),
2462                        encoder,
2463                        offset + 8,
2464                        _depth,
2465                    )
2466                }
2467                AddressMatcherType::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
2468            }
2469        }
2470    }
2471
2472    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for AddressMatcherType {
2473        #[inline(always)]
2474        fn new_empty() -> Self {
2475            Self::__SourceBreaking { unknown_ordinal: 0 }
2476        }
2477
2478        #[inline]
2479        unsafe fn decode(
2480            &mut self,
2481            decoder: &mut fidl::encoding::Decoder<'_, D>,
2482            offset: usize,
2483            mut depth: fidl::encoding::Depth,
2484        ) -> fidl::Result<()> {
2485            decoder.debug_check_bounds::<Self>(offset);
2486            #[allow(unused_variables)]
2487            let next_out_of_line = decoder.next_out_of_line();
2488            let handles_before = decoder.remaining_handles();
2489            let (ordinal, inlined, num_bytes, num_handles) =
2490                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
2491
2492            let member_inline_size = match ordinal {
2493                1 => <fidl_fuchsia_net_common::Subnet as fidl::encoding::TypeMarker>::inline_size(
2494                    decoder.context,
2495                ),
2496                2 => <AddressRange as fidl::encoding::TypeMarker>::inline_size(decoder.context),
2497                0 => return Err(fidl::Error::UnknownUnionTag),
2498                _ => num_bytes as usize,
2499            };
2500
2501            if inlined != (member_inline_size <= 4) {
2502                return Err(fidl::Error::InvalidInlineBitInEnvelope);
2503            }
2504            let _inner_offset;
2505            if inlined {
2506                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
2507                _inner_offset = offset + 8;
2508            } else {
2509                depth.increment()?;
2510                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2511            }
2512            match ordinal {
2513                1 => {
2514                    #[allow(irrefutable_let_patterns)]
2515                    if let AddressMatcherType::Subnet(_) = self {
2516                        // Do nothing, read the value into the object
2517                    } else {
2518                        // Initialize `self` to the right variant
2519                        *self = AddressMatcherType::Subnet(fidl::new_empty!(
2520                            fidl_fuchsia_net_common::Subnet,
2521                            D
2522                        ));
2523                    }
2524                    #[allow(irrefutable_let_patterns)]
2525                    if let AddressMatcherType::Subnet(ref mut val) = self {
2526                        fidl::decode!(
2527                            fidl_fuchsia_net_common::Subnet,
2528                            D,
2529                            val,
2530                            decoder,
2531                            _inner_offset,
2532                            depth
2533                        )?;
2534                    } else {
2535                        unreachable!()
2536                    }
2537                }
2538                2 => {
2539                    #[allow(irrefutable_let_patterns)]
2540                    if let AddressMatcherType::Range(_) = self {
2541                        // Do nothing, read the value into the object
2542                    } else {
2543                        // Initialize `self` to the right variant
2544                        *self = AddressMatcherType::Range(fidl::new_empty!(AddressRange, D));
2545                    }
2546                    #[allow(irrefutable_let_patterns)]
2547                    if let AddressMatcherType::Range(ref mut val) = self {
2548                        fidl::decode!(AddressRange, D, val, decoder, _inner_offset, depth)?;
2549                    } else {
2550                        unreachable!()
2551                    }
2552                }
2553                #[allow(deprecated)]
2554                ordinal => {
2555                    for _ in 0..num_handles {
2556                        decoder.drop_next_handle()?;
2557                    }
2558                    *self = AddressMatcherType::__SourceBreaking { unknown_ordinal: ordinal };
2559                }
2560            }
2561            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
2562                return Err(fidl::Error::InvalidNumBytesInEnvelope);
2563            }
2564            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2565                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2566            }
2567            Ok(())
2568        }
2569    }
2570
2571    impl fidl::encoding::ValueTypeMarker for BoundAddress {
2572        type Borrowed<'a> = &'a Self;
2573        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2574            value
2575        }
2576    }
2577
2578    unsafe impl fidl::encoding::TypeMarker for BoundAddress {
2579        type Owned = Self;
2580
2581        #[inline(always)]
2582        fn inline_align(_context: fidl::encoding::Context) -> usize {
2583            8
2584        }
2585
2586        #[inline(always)]
2587        fn inline_size(_context: fidl::encoding::Context) -> usize {
2588            16
2589        }
2590    }
2591
2592    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<BoundAddress, D>
2593        for &BoundAddress
2594    {
2595        #[inline]
2596        unsafe fn encode(
2597            self,
2598            encoder: &mut fidl::encoding::Encoder<'_, D>,
2599            offset: usize,
2600            _depth: fidl::encoding::Depth,
2601        ) -> fidl::Result<()> {
2602            encoder.debug_check_bounds::<BoundAddress>(offset);
2603            encoder.write_num::<u64>(self.ordinal(), offset);
2604            match self {
2605                BoundAddress::Bound(ref val) => fidl::encoding::encode_in_envelope::<Address, D>(
2606                    <Address as fidl::encoding::ValueTypeMarker>::borrow(val),
2607                    encoder,
2608                    offset + 8,
2609                    _depth,
2610                ),
2611                BoundAddress::Unbound(ref val) => fidl::encoding::encode_in_envelope::<Empty, D>(
2612                    <Empty as fidl::encoding::ValueTypeMarker>::borrow(val),
2613                    encoder,
2614                    offset + 8,
2615                    _depth,
2616                ),
2617                BoundAddress::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
2618            }
2619        }
2620    }
2621
2622    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for BoundAddress {
2623        #[inline(always)]
2624        fn new_empty() -> Self {
2625            Self::__SourceBreaking { unknown_ordinal: 0 }
2626        }
2627
2628        #[inline]
2629        unsafe fn decode(
2630            &mut self,
2631            decoder: &mut fidl::encoding::Decoder<'_, D>,
2632            offset: usize,
2633            mut depth: fidl::encoding::Depth,
2634        ) -> fidl::Result<()> {
2635            decoder.debug_check_bounds::<Self>(offset);
2636            #[allow(unused_variables)]
2637            let next_out_of_line = decoder.next_out_of_line();
2638            let handles_before = decoder.remaining_handles();
2639            let (ordinal, inlined, num_bytes, num_handles) =
2640                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
2641
2642            let member_inline_size = match ordinal {
2643                1 => <Address as fidl::encoding::TypeMarker>::inline_size(decoder.context),
2644                2 => <Empty as fidl::encoding::TypeMarker>::inline_size(decoder.context),
2645                0 => return Err(fidl::Error::UnknownUnionTag),
2646                _ => num_bytes as usize,
2647            };
2648
2649            if inlined != (member_inline_size <= 4) {
2650                return Err(fidl::Error::InvalidInlineBitInEnvelope);
2651            }
2652            let _inner_offset;
2653            if inlined {
2654                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
2655                _inner_offset = offset + 8;
2656            } else {
2657                depth.increment()?;
2658                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2659            }
2660            match ordinal {
2661                1 => {
2662                    #[allow(irrefutable_let_patterns)]
2663                    if let BoundAddress::Bound(_) = self {
2664                        // Do nothing, read the value into the object
2665                    } else {
2666                        // Initialize `self` to the right variant
2667                        *self = BoundAddress::Bound(fidl::new_empty!(Address, D));
2668                    }
2669                    #[allow(irrefutable_let_patterns)]
2670                    if let BoundAddress::Bound(ref mut val) = self {
2671                        fidl::decode!(Address, D, val, decoder, _inner_offset, depth)?;
2672                    } else {
2673                        unreachable!()
2674                    }
2675                }
2676                2 => {
2677                    #[allow(irrefutable_let_patterns)]
2678                    if let BoundAddress::Unbound(_) = self {
2679                        // Do nothing, read the value into the object
2680                    } else {
2681                        // Initialize `self` to the right variant
2682                        *self = BoundAddress::Unbound(fidl::new_empty!(Empty, D));
2683                    }
2684                    #[allow(irrefutable_let_patterns)]
2685                    if let BoundAddress::Unbound(ref mut val) = self {
2686                        fidl::decode!(Empty, D, val, decoder, _inner_offset, depth)?;
2687                    } else {
2688                        unreachable!()
2689                    }
2690                }
2691                #[allow(deprecated)]
2692                ordinal => {
2693                    for _ in 0..num_handles {
2694                        decoder.drop_next_handle()?;
2695                    }
2696                    *self = BoundAddress::__SourceBreaking { unknown_ordinal: ordinal };
2697                }
2698            }
2699            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
2700                return Err(fidl::Error::InvalidNumBytesInEnvelope);
2701            }
2702            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2703                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2704            }
2705            Ok(())
2706        }
2707    }
2708
2709    impl fidl::encoding::ValueTypeMarker for BoundInterface {
2710        type Borrowed<'a> = &'a Self;
2711        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2712            value
2713        }
2714    }
2715
2716    unsafe impl fidl::encoding::TypeMarker for BoundInterface {
2717        type Owned = Self;
2718
2719        #[inline(always)]
2720        fn inline_align(_context: fidl::encoding::Context) -> usize {
2721            8
2722        }
2723
2724        #[inline(always)]
2725        fn inline_size(_context: fidl::encoding::Context) -> usize {
2726            16
2727        }
2728    }
2729
2730    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<BoundInterface, D>
2731        for &BoundInterface
2732    {
2733        #[inline]
2734        unsafe fn encode(
2735            self,
2736            encoder: &mut fidl::encoding::Encoder<'_, D>,
2737            offset: usize,
2738            _depth: fidl::encoding::Depth,
2739        ) -> fidl::Result<()> {
2740            encoder.debug_check_bounds::<BoundInterface>(offset);
2741            encoder.write_num::<u64>(self.ordinal(), offset);
2742            match self {
2743                BoundInterface::Bound(ref val) => {
2744                    fidl::encoding::encode_in_envelope::<Interface, D>(
2745                        <Interface as fidl::encoding::ValueTypeMarker>::borrow(val),
2746                        encoder,
2747                        offset + 8,
2748                        _depth,
2749                    )
2750                }
2751                BoundInterface::Unbound(ref val) => fidl::encoding::encode_in_envelope::<Empty, D>(
2752                    <Empty as fidl::encoding::ValueTypeMarker>::borrow(val),
2753                    encoder,
2754                    offset + 8,
2755                    _depth,
2756                ),
2757                BoundInterface::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
2758            }
2759        }
2760    }
2761
2762    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for BoundInterface {
2763        #[inline(always)]
2764        fn new_empty() -> Self {
2765            Self::__SourceBreaking { unknown_ordinal: 0 }
2766        }
2767
2768        #[inline]
2769        unsafe fn decode(
2770            &mut self,
2771            decoder: &mut fidl::encoding::Decoder<'_, D>,
2772            offset: usize,
2773            mut depth: fidl::encoding::Depth,
2774        ) -> fidl::Result<()> {
2775            decoder.debug_check_bounds::<Self>(offset);
2776            #[allow(unused_variables)]
2777            let next_out_of_line = decoder.next_out_of_line();
2778            let handles_before = decoder.remaining_handles();
2779            let (ordinal, inlined, num_bytes, num_handles) =
2780                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
2781
2782            let member_inline_size = match ordinal {
2783                1 => <Interface as fidl::encoding::TypeMarker>::inline_size(decoder.context),
2784                2 => <Empty as fidl::encoding::TypeMarker>::inline_size(decoder.context),
2785                0 => return Err(fidl::Error::UnknownUnionTag),
2786                _ => num_bytes as usize,
2787            };
2788
2789            if inlined != (member_inline_size <= 4) {
2790                return Err(fidl::Error::InvalidInlineBitInEnvelope);
2791            }
2792            let _inner_offset;
2793            if inlined {
2794                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
2795                _inner_offset = offset + 8;
2796            } else {
2797                depth.increment()?;
2798                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2799            }
2800            match ordinal {
2801                1 => {
2802                    #[allow(irrefutable_let_patterns)]
2803                    if let BoundInterface::Bound(_) = self {
2804                        // Do nothing, read the value into the object
2805                    } else {
2806                        // Initialize `self` to the right variant
2807                        *self = BoundInterface::Bound(fidl::new_empty!(Interface, D));
2808                    }
2809                    #[allow(irrefutable_let_patterns)]
2810                    if let BoundInterface::Bound(ref mut val) = self {
2811                        fidl::decode!(Interface, D, val, decoder, _inner_offset, depth)?;
2812                    } else {
2813                        unreachable!()
2814                    }
2815                }
2816                2 => {
2817                    #[allow(irrefutable_let_patterns)]
2818                    if let BoundInterface::Unbound(_) = self {
2819                        // Do nothing, read the value into the object
2820                    } else {
2821                        // Initialize `self` to the right variant
2822                        *self = BoundInterface::Unbound(fidl::new_empty!(Empty, D));
2823                    }
2824                    #[allow(irrefutable_let_patterns)]
2825                    if let BoundInterface::Unbound(ref mut val) = self {
2826                        fidl::decode!(Empty, D, val, decoder, _inner_offset, depth)?;
2827                    } else {
2828                        unreachable!()
2829                    }
2830                }
2831                #[allow(deprecated)]
2832                ordinal => {
2833                    for _ in 0..num_handles {
2834                        decoder.drop_next_handle()?;
2835                    }
2836                    *self = BoundInterface::__SourceBreaking { unknown_ordinal: ordinal };
2837                }
2838            }
2839            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
2840                return Err(fidl::Error::InvalidNumBytesInEnvelope);
2841            }
2842            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2843                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2844            }
2845            Ok(())
2846        }
2847    }
2848
2849    impl fidl::encoding::ValueTypeMarker for BoundPort {
2850        type Borrowed<'a> = &'a Self;
2851        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2852            value
2853        }
2854    }
2855
2856    unsafe impl fidl::encoding::TypeMarker for BoundPort {
2857        type Owned = Self;
2858
2859        #[inline(always)]
2860        fn inline_align(_context: fidl::encoding::Context) -> usize {
2861            8
2862        }
2863
2864        #[inline(always)]
2865        fn inline_size(_context: fidl::encoding::Context) -> usize {
2866            16
2867        }
2868    }
2869
2870    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<BoundPort, D>
2871        for &BoundPort
2872    {
2873        #[inline]
2874        unsafe fn encode(
2875            self,
2876            encoder: &mut fidl::encoding::Encoder<'_, D>,
2877            offset: usize,
2878            _depth: fidl::encoding::Depth,
2879        ) -> fidl::Result<()> {
2880            encoder.debug_check_bounds::<BoundPort>(offset);
2881            encoder.write_num::<u64>(self.ordinal(), offset);
2882            match self {
2883                BoundPort::Bound(ref val) => fidl::encoding::encode_in_envelope::<Port, D>(
2884                    <Port as fidl::encoding::ValueTypeMarker>::borrow(val),
2885                    encoder,
2886                    offset + 8,
2887                    _depth,
2888                ),
2889                BoundPort::Unbound(ref val) => fidl::encoding::encode_in_envelope::<Empty, D>(
2890                    <Empty as fidl::encoding::ValueTypeMarker>::borrow(val),
2891                    encoder,
2892                    offset + 8,
2893                    _depth,
2894                ),
2895                BoundPort::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
2896            }
2897        }
2898    }
2899
2900    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for BoundPort {
2901        #[inline(always)]
2902        fn new_empty() -> Self {
2903            Self::__SourceBreaking { unknown_ordinal: 0 }
2904        }
2905
2906        #[inline]
2907        unsafe fn decode(
2908            &mut self,
2909            decoder: &mut fidl::encoding::Decoder<'_, D>,
2910            offset: usize,
2911            mut depth: fidl::encoding::Depth,
2912        ) -> fidl::Result<()> {
2913            decoder.debug_check_bounds::<Self>(offset);
2914            #[allow(unused_variables)]
2915            let next_out_of_line = decoder.next_out_of_line();
2916            let handles_before = decoder.remaining_handles();
2917            let (ordinal, inlined, num_bytes, num_handles) =
2918                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
2919
2920            let member_inline_size = match ordinal {
2921                1 => <Port as fidl::encoding::TypeMarker>::inline_size(decoder.context),
2922                2 => <Empty as fidl::encoding::TypeMarker>::inline_size(decoder.context),
2923                0 => return Err(fidl::Error::UnknownUnionTag),
2924                _ => num_bytes as usize,
2925            };
2926
2927            if inlined != (member_inline_size <= 4) {
2928                return Err(fidl::Error::InvalidInlineBitInEnvelope);
2929            }
2930            let _inner_offset;
2931            if inlined {
2932                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
2933                _inner_offset = offset + 8;
2934            } else {
2935                depth.increment()?;
2936                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2937            }
2938            match ordinal {
2939                1 => {
2940                    #[allow(irrefutable_let_patterns)]
2941                    if let BoundPort::Bound(_) = self {
2942                        // Do nothing, read the value into the object
2943                    } else {
2944                        // Initialize `self` to the right variant
2945                        *self = BoundPort::Bound(fidl::new_empty!(Port, D));
2946                    }
2947                    #[allow(irrefutable_let_patterns)]
2948                    if let BoundPort::Bound(ref mut val) = self {
2949                        fidl::decode!(Port, D, val, decoder, _inner_offset, depth)?;
2950                    } else {
2951                        unreachable!()
2952                    }
2953                }
2954                2 => {
2955                    #[allow(irrefutable_let_patterns)]
2956                    if let BoundPort::Unbound(_) = self {
2957                        // Do nothing, read the value into the object
2958                    } else {
2959                        // Initialize `self` to the right variant
2960                        *self = BoundPort::Unbound(fidl::new_empty!(Empty, D));
2961                    }
2962                    #[allow(irrefutable_let_patterns)]
2963                    if let BoundPort::Unbound(ref mut val) = self {
2964                        fidl::decode!(Empty, D, val, decoder, _inner_offset, depth)?;
2965                    } else {
2966                        unreachable!()
2967                    }
2968                }
2969                #[allow(deprecated)]
2970                ordinal => {
2971                    for _ in 0..num_handles {
2972                        decoder.drop_next_handle()?;
2973                    }
2974                    *self = BoundPort::__SourceBreaking { unknown_ordinal: ordinal };
2975                }
2976            }
2977            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
2978                return Err(fidl::Error::InvalidNumBytesInEnvelope);
2979            }
2980            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2981                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2982            }
2983            Ok(())
2984        }
2985    }
2986
2987    impl fidl::encoding::ValueTypeMarker for Interface {
2988        type Borrowed<'a> = &'a Self;
2989        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2990            value
2991        }
2992    }
2993
2994    unsafe impl fidl::encoding::TypeMarker for Interface {
2995        type Owned = Self;
2996
2997        #[inline(always)]
2998        fn inline_align(_context: fidl::encoding::Context) -> usize {
2999            8
3000        }
3001
3002        #[inline(always)]
3003        fn inline_size(_context: fidl::encoding::Context) -> usize {
3004            16
3005        }
3006    }
3007
3008    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Interface, D>
3009        for &Interface
3010    {
3011        #[inline]
3012        unsafe fn encode(
3013            self,
3014            encoder: &mut fidl::encoding::Encoder<'_, D>,
3015            offset: usize,
3016            _depth: fidl::encoding::Depth,
3017        ) -> fidl::Result<()> {
3018            encoder.debug_check_bounds::<Interface>(offset);
3019            encoder.write_num::<u64>(self.ordinal(), offset);
3020            match self {
3021            Interface::Id(ref val) => {
3022                fidl::encoding::encode_in_envelope::<u64, D>(
3023                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(val),
3024                    encoder, offset + 8, _depth
3025                )
3026            }
3027            Interface::Name(ref val) => {
3028                fidl::encoding::encode_in_envelope::<fidl::encoding::BoundedString<15>, D>(
3029                    <fidl::encoding::BoundedString<15> as fidl::encoding::ValueTypeMarker>::borrow(val),
3030                    encoder, offset + 8, _depth
3031                )
3032            }
3033            Interface::PortClass(ref val) => {
3034                fidl::encoding::encode_in_envelope::<fidl_fuchsia_net_interfaces_common::PortClass, D>(
3035                    <fidl_fuchsia_net_interfaces_common::PortClass as fidl::encoding::ValueTypeMarker>::borrow(val),
3036                    encoder, offset + 8, _depth
3037                )
3038            }
3039            Interface::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
3040        }
3041        }
3042    }
3043
3044    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Interface {
3045        #[inline(always)]
3046        fn new_empty() -> Self {
3047            Self::__SourceBreaking { unknown_ordinal: 0 }
3048        }
3049
3050        #[inline]
3051        unsafe fn decode(
3052            &mut self,
3053            decoder: &mut fidl::encoding::Decoder<'_, D>,
3054            offset: usize,
3055            mut depth: fidl::encoding::Depth,
3056        ) -> fidl::Result<()> {
3057            decoder.debug_check_bounds::<Self>(offset);
3058            #[allow(unused_variables)]
3059            let next_out_of_line = decoder.next_out_of_line();
3060            let handles_before = decoder.remaining_handles();
3061            let (ordinal, inlined, num_bytes, num_handles) =
3062                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
3063
3064            let member_inline_size = match ordinal {
3065            1 => <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context),
3066            2 => <fidl::encoding::BoundedString<15> as fidl::encoding::TypeMarker>::inline_size(decoder.context),
3067            3 => <fidl_fuchsia_net_interfaces_common::PortClass as fidl::encoding::TypeMarker>::inline_size(decoder.context),
3068            0 => return Err(fidl::Error::UnknownUnionTag),
3069            _ => num_bytes as usize,
3070        };
3071
3072            if inlined != (member_inline_size <= 4) {
3073                return Err(fidl::Error::InvalidInlineBitInEnvelope);
3074            }
3075            let _inner_offset;
3076            if inlined {
3077                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
3078                _inner_offset = offset + 8;
3079            } else {
3080                depth.increment()?;
3081                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3082            }
3083            match ordinal {
3084                1 => {
3085                    #[allow(irrefutable_let_patterns)]
3086                    if let Interface::Id(_) = self {
3087                        // Do nothing, read the value into the object
3088                    } else {
3089                        // Initialize `self` to the right variant
3090                        *self = Interface::Id(fidl::new_empty!(u64, D));
3091                    }
3092                    #[allow(irrefutable_let_patterns)]
3093                    if let Interface::Id(ref mut val) = self {
3094                        fidl::decode!(u64, D, val, decoder, _inner_offset, depth)?;
3095                    } else {
3096                        unreachable!()
3097                    }
3098                }
3099                2 => {
3100                    #[allow(irrefutable_let_patterns)]
3101                    if let Interface::Name(_) = self {
3102                        // Do nothing, read the value into the object
3103                    } else {
3104                        // Initialize `self` to the right variant
3105                        *self =
3106                            Interface::Name(fidl::new_empty!(fidl::encoding::BoundedString<15>, D));
3107                    }
3108                    #[allow(irrefutable_let_patterns)]
3109                    if let Interface::Name(ref mut val) = self {
3110                        fidl::decode!(
3111                            fidl::encoding::BoundedString<15>,
3112                            D,
3113                            val,
3114                            decoder,
3115                            _inner_offset,
3116                            depth
3117                        )?;
3118                    } else {
3119                        unreachable!()
3120                    }
3121                }
3122                3 => {
3123                    #[allow(irrefutable_let_patterns)]
3124                    if let Interface::PortClass(_) = self {
3125                        // Do nothing, read the value into the object
3126                    } else {
3127                        // Initialize `self` to the right variant
3128                        *self = Interface::PortClass(fidl::new_empty!(
3129                            fidl_fuchsia_net_interfaces_common::PortClass,
3130                            D
3131                        ));
3132                    }
3133                    #[allow(irrefutable_let_patterns)]
3134                    if let Interface::PortClass(ref mut val) = self {
3135                        fidl::decode!(
3136                            fidl_fuchsia_net_interfaces_common::PortClass,
3137                            D,
3138                            val,
3139                            decoder,
3140                            _inner_offset,
3141                            depth
3142                        )?;
3143                    } else {
3144                        unreachable!()
3145                    }
3146                }
3147                #[allow(deprecated)]
3148                ordinal => {
3149                    for _ in 0..num_handles {
3150                        decoder.drop_next_handle()?;
3151                    }
3152                    *self = Interface::__SourceBreaking { unknown_ordinal: ordinal };
3153                }
3154            }
3155            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
3156                return Err(fidl::Error::InvalidNumBytesInEnvelope);
3157            }
3158            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3159                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3160            }
3161            Ok(())
3162        }
3163    }
3164
3165    impl fidl::encoding::ValueTypeMarker for Mark {
3166        type Borrowed<'a> = &'a Self;
3167        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3168            value
3169        }
3170    }
3171
3172    unsafe impl fidl::encoding::TypeMarker for Mark {
3173        type Owned = Self;
3174
3175        #[inline(always)]
3176        fn inline_align(_context: fidl::encoding::Context) -> usize {
3177            8
3178        }
3179
3180        #[inline(always)]
3181        fn inline_size(_context: fidl::encoding::Context) -> usize {
3182            16
3183        }
3184    }
3185
3186    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Mark, D> for &Mark {
3187        #[inline]
3188        unsafe fn encode(
3189            self,
3190            encoder: &mut fidl::encoding::Encoder<'_, D>,
3191            offset: usize,
3192            _depth: fidl::encoding::Depth,
3193        ) -> fidl::Result<()> {
3194            encoder.debug_check_bounds::<Mark>(offset);
3195            encoder.write_num::<u64>(self.ordinal(), offset);
3196            match self {
3197                Mark::Unmarked(ref val) => fidl::encoding::encode_in_envelope::<Unmarked, D>(
3198                    <Unmarked as fidl::encoding::ValueTypeMarker>::borrow(val),
3199                    encoder,
3200                    offset + 8,
3201                    _depth,
3202                ),
3203                Mark::Marked(ref val) => fidl::encoding::encode_in_envelope::<Marked, D>(
3204                    <Marked as fidl::encoding::ValueTypeMarker>::borrow(val),
3205                    encoder,
3206                    offset + 8,
3207                    _depth,
3208                ),
3209                Mark::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
3210            }
3211        }
3212    }
3213
3214    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Mark {
3215        #[inline(always)]
3216        fn new_empty() -> Self {
3217            Self::__SourceBreaking { unknown_ordinal: 0 }
3218        }
3219
3220        #[inline]
3221        unsafe fn decode(
3222            &mut self,
3223            decoder: &mut fidl::encoding::Decoder<'_, D>,
3224            offset: usize,
3225            mut depth: fidl::encoding::Depth,
3226        ) -> fidl::Result<()> {
3227            decoder.debug_check_bounds::<Self>(offset);
3228            #[allow(unused_variables)]
3229            let next_out_of_line = decoder.next_out_of_line();
3230            let handles_before = decoder.remaining_handles();
3231            let (ordinal, inlined, num_bytes, num_handles) =
3232                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
3233
3234            let member_inline_size = match ordinal {
3235                1 => <Unmarked as fidl::encoding::TypeMarker>::inline_size(decoder.context),
3236                2 => <Marked as fidl::encoding::TypeMarker>::inline_size(decoder.context),
3237                0 => return Err(fidl::Error::UnknownUnionTag),
3238                _ => num_bytes as usize,
3239            };
3240
3241            if inlined != (member_inline_size <= 4) {
3242                return Err(fidl::Error::InvalidInlineBitInEnvelope);
3243            }
3244            let _inner_offset;
3245            if inlined {
3246                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
3247                _inner_offset = offset + 8;
3248            } else {
3249                depth.increment()?;
3250                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3251            }
3252            match ordinal {
3253                1 => {
3254                    #[allow(irrefutable_let_patterns)]
3255                    if let Mark::Unmarked(_) = self {
3256                        // Do nothing, read the value into the object
3257                    } else {
3258                        // Initialize `self` to the right variant
3259                        *self = Mark::Unmarked(fidl::new_empty!(Unmarked, D));
3260                    }
3261                    #[allow(irrefutable_let_patterns)]
3262                    if let Mark::Unmarked(ref mut val) = self {
3263                        fidl::decode!(Unmarked, D, val, decoder, _inner_offset, depth)?;
3264                    } else {
3265                        unreachable!()
3266                    }
3267                }
3268                2 => {
3269                    #[allow(irrefutable_let_patterns)]
3270                    if let Mark::Marked(_) = self {
3271                        // Do nothing, read the value into the object
3272                    } else {
3273                        // Initialize `self` to the right variant
3274                        *self = Mark::Marked(fidl::new_empty!(Marked, D));
3275                    }
3276                    #[allow(irrefutable_let_patterns)]
3277                    if let Mark::Marked(ref mut val) = self {
3278                        fidl::decode!(Marked, D, val, decoder, _inner_offset, depth)?;
3279                    } else {
3280                        unreachable!()
3281                    }
3282                }
3283                #[allow(deprecated)]
3284                ordinal => {
3285                    for _ in 0..num_handles {
3286                        decoder.drop_next_handle()?;
3287                    }
3288                    *self = Mark::__SourceBreaking { unknown_ordinal: ordinal };
3289                }
3290            }
3291            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
3292                return Err(fidl::Error::InvalidNumBytesInEnvelope);
3293            }
3294            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3295                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3296            }
3297            Ok(())
3298        }
3299    }
3300
3301    impl fidl::encoding::ValueTypeMarker for PacketTransportProtocol {
3302        type Borrowed<'a> = &'a Self;
3303        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3304            value
3305        }
3306    }
3307
3308    unsafe impl fidl::encoding::TypeMarker for PacketTransportProtocol {
3309        type Owned = Self;
3310
3311        #[inline(always)]
3312        fn inline_align(_context: fidl::encoding::Context) -> usize {
3313            8
3314        }
3315
3316        #[inline(always)]
3317        fn inline_size(_context: fidl::encoding::Context) -> usize {
3318            16
3319        }
3320    }
3321
3322    unsafe impl<D: fidl::encoding::ResourceDialect>
3323        fidl::encoding::Encode<PacketTransportProtocol, D> for &PacketTransportProtocol
3324    {
3325        #[inline]
3326        unsafe fn encode(
3327            self,
3328            encoder: &mut fidl::encoding::Encoder<'_, D>,
3329            offset: usize,
3330            _depth: fidl::encoding::Depth,
3331        ) -> fidl::Result<()> {
3332            encoder.debug_check_bounds::<PacketTransportProtocol>(offset);
3333            encoder.write_num::<u64>(self.ordinal(), offset);
3334            match self {
3335                PacketTransportProtocol::Tcp(ref val) => {
3336                    fidl::encoding::encode_in_envelope::<TcpPacket, D>(
3337                        <TcpPacket as fidl::encoding::ValueTypeMarker>::borrow(val),
3338                        encoder,
3339                        offset + 8,
3340                        _depth,
3341                    )
3342                }
3343                PacketTransportProtocol::Udp(ref val) => {
3344                    fidl::encoding::encode_in_envelope::<UdpPacket, D>(
3345                        <UdpPacket as fidl::encoding::ValueTypeMarker>::borrow(val),
3346                        encoder,
3347                        offset + 8,
3348                        _depth,
3349                    )
3350                }
3351                PacketTransportProtocol::Icmp(ref val) => {
3352                    fidl::encoding::encode_in_envelope::<IcmpPacket, D>(
3353                        <IcmpPacket as fidl::encoding::ValueTypeMarker>::borrow(val),
3354                        encoder,
3355                        offset + 8,
3356                        _depth,
3357                    )
3358                }
3359                PacketTransportProtocol::Icmpv6(ref val) => {
3360                    fidl::encoding::encode_in_envelope::<Icmpv6Packet, D>(
3361                        <Icmpv6Packet as fidl::encoding::ValueTypeMarker>::borrow(val),
3362                        encoder,
3363                        offset + 8,
3364                        _depth,
3365                    )
3366                }
3367                PacketTransportProtocol::__SourceBreaking { .. } => {
3368                    Err(fidl::Error::UnknownUnionTag)
3369                }
3370            }
3371        }
3372    }
3373
3374    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3375        for PacketTransportProtocol
3376    {
3377        #[inline(always)]
3378        fn new_empty() -> Self {
3379            Self::__SourceBreaking { unknown_ordinal: 0 }
3380        }
3381
3382        #[inline]
3383        unsafe fn decode(
3384            &mut self,
3385            decoder: &mut fidl::encoding::Decoder<'_, D>,
3386            offset: usize,
3387            mut depth: fidl::encoding::Depth,
3388        ) -> fidl::Result<()> {
3389            decoder.debug_check_bounds::<Self>(offset);
3390            #[allow(unused_variables)]
3391            let next_out_of_line = decoder.next_out_of_line();
3392            let handles_before = decoder.remaining_handles();
3393            let (ordinal, inlined, num_bytes, num_handles) =
3394                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
3395
3396            let member_inline_size = match ordinal {
3397                1 => <TcpPacket as fidl::encoding::TypeMarker>::inline_size(decoder.context),
3398                2 => <UdpPacket as fidl::encoding::TypeMarker>::inline_size(decoder.context),
3399                3 => <IcmpPacket as fidl::encoding::TypeMarker>::inline_size(decoder.context),
3400                4 => <Icmpv6Packet as fidl::encoding::TypeMarker>::inline_size(decoder.context),
3401                0 => return Err(fidl::Error::UnknownUnionTag),
3402                _ => num_bytes as usize,
3403            };
3404
3405            if inlined != (member_inline_size <= 4) {
3406                return Err(fidl::Error::InvalidInlineBitInEnvelope);
3407            }
3408            let _inner_offset;
3409            if inlined {
3410                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
3411                _inner_offset = offset + 8;
3412            } else {
3413                depth.increment()?;
3414                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3415            }
3416            match ordinal {
3417                1 => {
3418                    #[allow(irrefutable_let_patterns)]
3419                    if let PacketTransportProtocol::Tcp(_) = self {
3420                        // Do nothing, read the value into the object
3421                    } else {
3422                        // Initialize `self` to the right variant
3423                        *self = PacketTransportProtocol::Tcp(fidl::new_empty!(TcpPacket, D));
3424                    }
3425                    #[allow(irrefutable_let_patterns)]
3426                    if let PacketTransportProtocol::Tcp(ref mut val) = self {
3427                        fidl::decode!(TcpPacket, D, val, decoder, _inner_offset, depth)?;
3428                    } else {
3429                        unreachable!()
3430                    }
3431                }
3432                2 => {
3433                    #[allow(irrefutable_let_patterns)]
3434                    if let PacketTransportProtocol::Udp(_) = self {
3435                        // Do nothing, read the value into the object
3436                    } else {
3437                        // Initialize `self` to the right variant
3438                        *self = PacketTransportProtocol::Udp(fidl::new_empty!(UdpPacket, D));
3439                    }
3440                    #[allow(irrefutable_let_patterns)]
3441                    if let PacketTransportProtocol::Udp(ref mut val) = self {
3442                        fidl::decode!(UdpPacket, D, val, decoder, _inner_offset, depth)?;
3443                    } else {
3444                        unreachable!()
3445                    }
3446                }
3447                3 => {
3448                    #[allow(irrefutable_let_patterns)]
3449                    if let PacketTransportProtocol::Icmp(_) = self {
3450                        // Do nothing, read the value into the object
3451                    } else {
3452                        // Initialize `self` to the right variant
3453                        *self = PacketTransportProtocol::Icmp(fidl::new_empty!(IcmpPacket, D));
3454                    }
3455                    #[allow(irrefutable_let_patterns)]
3456                    if let PacketTransportProtocol::Icmp(ref mut val) = self {
3457                        fidl::decode!(IcmpPacket, D, val, decoder, _inner_offset, depth)?;
3458                    } else {
3459                        unreachable!()
3460                    }
3461                }
3462                4 => {
3463                    #[allow(irrefutable_let_patterns)]
3464                    if let PacketTransportProtocol::Icmpv6(_) = self {
3465                        // Do nothing, read the value into the object
3466                    } else {
3467                        // Initialize `self` to the right variant
3468                        *self = PacketTransportProtocol::Icmpv6(fidl::new_empty!(Icmpv6Packet, D));
3469                    }
3470                    #[allow(irrefutable_let_patterns)]
3471                    if let PacketTransportProtocol::Icmpv6(ref mut val) = self {
3472                        fidl::decode!(Icmpv6Packet, D, val, decoder, _inner_offset, depth)?;
3473                    } else {
3474                        unreachable!()
3475                    }
3476                }
3477                #[allow(deprecated)]
3478                ordinal => {
3479                    for _ in 0..num_handles {
3480                        decoder.drop_next_handle()?;
3481                    }
3482                    *self = PacketTransportProtocol::__SourceBreaking { unknown_ordinal: ordinal };
3483                }
3484            }
3485            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
3486                return Err(fidl::Error::InvalidNumBytesInEnvelope);
3487            }
3488            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3489                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3490            }
3491            Ok(())
3492        }
3493    }
3494
3495    impl fidl::encoding::ValueTypeMarker for SocketTransportProtocol {
3496        type Borrowed<'a> = &'a Self;
3497        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3498            value
3499        }
3500    }
3501
3502    unsafe impl fidl::encoding::TypeMarker for SocketTransportProtocol {
3503        type Owned = Self;
3504
3505        #[inline(always)]
3506        fn inline_align(_context: fidl::encoding::Context) -> usize {
3507            8
3508        }
3509
3510        #[inline(always)]
3511        fn inline_size(_context: fidl::encoding::Context) -> usize {
3512            16
3513        }
3514    }
3515
3516    unsafe impl<D: fidl::encoding::ResourceDialect>
3517        fidl::encoding::Encode<SocketTransportProtocol, D> for &SocketTransportProtocol
3518    {
3519        #[inline]
3520        unsafe fn encode(
3521            self,
3522            encoder: &mut fidl::encoding::Encoder<'_, D>,
3523            offset: usize,
3524            _depth: fidl::encoding::Depth,
3525        ) -> fidl::Result<()> {
3526            encoder.debug_check_bounds::<SocketTransportProtocol>(offset);
3527            encoder.write_num::<u64>(self.ordinal(), offset);
3528            match self {
3529                SocketTransportProtocol::Tcp(ref val) => {
3530                    fidl::encoding::encode_in_envelope::<TcpSocket, D>(
3531                        <TcpSocket as fidl::encoding::ValueTypeMarker>::borrow(val),
3532                        encoder,
3533                        offset + 8,
3534                        _depth,
3535                    )
3536                }
3537                SocketTransportProtocol::Udp(ref val) => {
3538                    fidl::encoding::encode_in_envelope::<UdpSocket, D>(
3539                        <UdpSocket as fidl::encoding::ValueTypeMarker>::borrow(val),
3540                        encoder,
3541                        offset + 8,
3542                        _depth,
3543                    )
3544                }
3545                SocketTransportProtocol::__SourceBreaking { .. } => {
3546                    Err(fidl::Error::UnknownUnionTag)
3547                }
3548            }
3549        }
3550    }
3551
3552    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3553        for SocketTransportProtocol
3554    {
3555        #[inline(always)]
3556        fn new_empty() -> Self {
3557            Self::__SourceBreaking { unknown_ordinal: 0 }
3558        }
3559
3560        #[inline]
3561        unsafe fn decode(
3562            &mut self,
3563            decoder: &mut fidl::encoding::Decoder<'_, D>,
3564            offset: usize,
3565            mut depth: fidl::encoding::Depth,
3566        ) -> fidl::Result<()> {
3567            decoder.debug_check_bounds::<Self>(offset);
3568            #[allow(unused_variables)]
3569            let next_out_of_line = decoder.next_out_of_line();
3570            let handles_before = decoder.remaining_handles();
3571            let (ordinal, inlined, num_bytes, num_handles) =
3572                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
3573
3574            let member_inline_size = match ordinal {
3575                1 => <TcpSocket as fidl::encoding::TypeMarker>::inline_size(decoder.context),
3576                2 => <UdpSocket as fidl::encoding::TypeMarker>::inline_size(decoder.context),
3577                0 => return Err(fidl::Error::UnknownUnionTag),
3578                _ => num_bytes as usize,
3579            };
3580
3581            if inlined != (member_inline_size <= 4) {
3582                return Err(fidl::Error::InvalidInlineBitInEnvelope);
3583            }
3584            let _inner_offset;
3585            if inlined {
3586                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
3587                _inner_offset = offset + 8;
3588            } else {
3589                depth.increment()?;
3590                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3591            }
3592            match ordinal {
3593                1 => {
3594                    #[allow(irrefutable_let_patterns)]
3595                    if let SocketTransportProtocol::Tcp(_) = self {
3596                        // Do nothing, read the value into the object
3597                    } else {
3598                        // Initialize `self` to the right variant
3599                        *self = SocketTransportProtocol::Tcp(fidl::new_empty!(TcpSocket, D));
3600                    }
3601                    #[allow(irrefutable_let_patterns)]
3602                    if let SocketTransportProtocol::Tcp(ref mut val) = self {
3603                        fidl::decode!(TcpSocket, D, val, decoder, _inner_offset, depth)?;
3604                    } else {
3605                        unreachable!()
3606                    }
3607                }
3608                2 => {
3609                    #[allow(irrefutable_let_patterns)]
3610                    if let SocketTransportProtocol::Udp(_) = self {
3611                        // Do nothing, read the value into the object
3612                    } else {
3613                        // Initialize `self` to the right variant
3614                        *self = SocketTransportProtocol::Udp(fidl::new_empty!(UdpSocket, D));
3615                    }
3616                    #[allow(irrefutable_let_patterns)]
3617                    if let SocketTransportProtocol::Udp(ref mut val) = self {
3618                        fidl::decode!(UdpSocket, D, val, decoder, _inner_offset, depth)?;
3619                    } else {
3620                        unreachable!()
3621                    }
3622                }
3623                #[allow(deprecated)]
3624                ordinal => {
3625                    for _ in 0..num_handles {
3626                        decoder.drop_next_handle()?;
3627                    }
3628                    *self = SocketTransportProtocol::__SourceBreaking { unknown_ordinal: ordinal };
3629                }
3630            }
3631            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
3632                return Err(fidl::Error::InvalidNumBytesInEnvelope);
3633            }
3634            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3635                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3636            }
3637            Ok(())
3638        }
3639    }
3640
3641    impl fidl::encoding::ValueTypeMarker for TcpSocket {
3642        type Borrowed<'a> = &'a Self;
3643        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3644            value
3645        }
3646    }
3647
3648    unsafe impl fidl::encoding::TypeMarker for TcpSocket {
3649        type Owned = Self;
3650
3651        #[inline(always)]
3652        fn inline_align(_context: fidl::encoding::Context) -> usize {
3653            8
3654        }
3655
3656        #[inline(always)]
3657        fn inline_size(_context: fidl::encoding::Context) -> usize {
3658            16
3659        }
3660    }
3661
3662    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<TcpSocket, D>
3663        for &TcpSocket
3664    {
3665        #[inline]
3666        unsafe fn encode(
3667            self,
3668            encoder: &mut fidl::encoding::Encoder<'_, D>,
3669            offset: usize,
3670            _depth: fidl::encoding::Depth,
3671        ) -> fidl::Result<()> {
3672            encoder.debug_check_bounds::<TcpSocket>(offset);
3673            encoder.write_num::<u64>(self.ordinal(), offset);
3674            match self {
3675                TcpSocket::Empty(ref val) => fidl::encoding::encode_in_envelope::<Empty, D>(
3676                    <Empty as fidl::encoding::ValueTypeMarker>::borrow(val),
3677                    encoder,
3678                    offset + 8,
3679                    _depth,
3680                ),
3681                TcpSocket::SrcPort(ref val) => fidl::encoding::encode_in_envelope::<BoundPort, D>(
3682                    <BoundPort as fidl::encoding::ValueTypeMarker>::borrow(val),
3683                    encoder,
3684                    offset + 8,
3685                    _depth,
3686                ),
3687                TcpSocket::DstPort(ref val) => fidl::encoding::encode_in_envelope::<BoundPort, D>(
3688                    <BoundPort as fidl::encoding::ValueTypeMarker>::borrow(val),
3689                    encoder,
3690                    offset + 8,
3691                    _depth,
3692                ),
3693                TcpSocket::States(ref val) => fidl::encoding::encode_in_envelope::<TcpState, D>(
3694                    <TcpState as fidl::encoding::ValueTypeMarker>::borrow(val),
3695                    encoder,
3696                    offset + 8,
3697                    _depth,
3698                ),
3699                TcpSocket::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
3700            }
3701        }
3702    }
3703
3704    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for TcpSocket {
3705        #[inline(always)]
3706        fn new_empty() -> Self {
3707            Self::__SourceBreaking { unknown_ordinal: 0 }
3708        }
3709
3710        #[inline]
3711        unsafe fn decode(
3712            &mut self,
3713            decoder: &mut fidl::encoding::Decoder<'_, D>,
3714            offset: usize,
3715            mut depth: fidl::encoding::Depth,
3716        ) -> fidl::Result<()> {
3717            decoder.debug_check_bounds::<Self>(offset);
3718            #[allow(unused_variables)]
3719            let next_out_of_line = decoder.next_out_of_line();
3720            let handles_before = decoder.remaining_handles();
3721            let (ordinal, inlined, num_bytes, num_handles) =
3722                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
3723
3724            let member_inline_size = match ordinal {
3725                1 => <Empty as fidl::encoding::TypeMarker>::inline_size(decoder.context),
3726                2 => <BoundPort as fidl::encoding::TypeMarker>::inline_size(decoder.context),
3727                3 => <BoundPort as fidl::encoding::TypeMarker>::inline_size(decoder.context),
3728                4 => <TcpState as fidl::encoding::TypeMarker>::inline_size(decoder.context),
3729                0 => return Err(fidl::Error::UnknownUnionTag),
3730                _ => num_bytes as usize,
3731            };
3732
3733            if inlined != (member_inline_size <= 4) {
3734                return Err(fidl::Error::InvalidInlineBitInEnvelope);
3735            }
3736            let _inner_offset;
3737            if inlined {
3738                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
3739                _inner_offset = offset + 8;
3740            } else {
3741                depth.increment()?;
3742                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3743            }
3744            match ordinal {
3745                1 => {
3746                    #[allow(irrefutable_let_patterns)]
3747                    if let TcpSocket::Empty(_) = self {
3748                        // Do nothing, read the value into the object
3749                    } else {
3750                        // Initialize `self` to the right variant
3751                        *self = TcpSocket::Empty(fidl::new_empty!(Empty, D));
3752                    }
3753                    #[allow(irrefutable_let_patterns)]
3754                    if let TcpSocket::Empty(ref mut val) = self {
3755                        fidl::decode!(Empty, D, val, decoder, _inner_offset, depth)?;
3756                    } else {
3757                        unreachable!()
3758                    }
3759                }
3760                2 => {
3761                    #[allow(irrefutable_let_patterns)]
3762                    if let TcpSocket::SrcPort(_) = self {
3763                        // Do nothing, read the value into the object
3764                    } else {
3765                        // Initialize `self` to the right variant
3766                        *self = TcpSocket::SrcPort(fidl::new_empty!(BoundPort, D));
3767                    }
3768                    #[allow(irrefutable_let_patterns)]
3769                    if let TcpSocket::SrcPort(ref mut val) = self {
3770                        fidl::decode!(BoundPort, D, val, decoder, _inner_offset, depth)?;
3771                    } else {
3772                        unreachable!()
3773                    }
3774                }
3775                3 => {
3776                    #[allow(irrefutable_let_patterns)]
3777                    if let TcpSocket::DstPort(_) = self {
3778                        // Do nothing, read the value into the object
3779                    } else {
3780                        // Initialize `self` to the right variant
3781                        *self = TcpSocket::DstPort(fidl::new_empty!(BoundPort, D));
3782                    }
3783                    #[allow(irrefutable_let_patterns)]
3784                    if let TcpSocket::DstPort(ref mut val) = self {
3785                        fidl::decode!(BoundPort, D, val, decoder, _inner_offset, depth)?;
3786                    } else {
3787                        unreachable!()
3788                    }
3789                }
3790                4 => {
3791                    #[allow(irrefutable_let_patterns)]
3792                    if let TcpSocket::States(_) = self {
3793                        // Do nothing, read the value into the object
3794                    } else {
3795                        // Initialize `self` to the right variant
3796                        *self = TcpSocket::States(fidl::new_empty!(TcpState, D));
3797                    }
3798                    #[allow(irrefutable_let_patterns)]
3799                    if let TcpSocket::States(ref mut val) = self {
3800                        fidl::decode!(TcpState, D, val, decoder, _inner_offset, depth)?;
3801                    } else {
3802                        unreachable!()
3803                    }
3804                }
3805                #[allow(deprecated)]
3806                ordinal => {
3807                    for _ in 0..num_handles {
3808                        decoder.drop_next_handle()?;
3809                    }
3810                    *self = TcpSocket::__SourceBreaking { unknown_ordinal: ordinal };
3811                }
3812            }
3813            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
3814                return Err(fidl::Error::InvalidNumBytesInEnvelope);
3815            }
3816            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3817                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3818            }
3819            Ok(())
3820        }
3821    }
3822
3823    impl fidl::encoding::ValueTypeMarker for UdpSocket {
3824        type Borrowed<'a> = &'a Self;
3825        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3826            value
3827        }
3828    }
3829
3830    unsafe impl fidl::encoding::TypeMarker for UdpSocket {
3831        type Owned = Self;
3832
3833        #[inline(always)]
3834        fn inline_align(_context: fidl::encoding::Context) -> usize {
3835            8
3836        }
3837
3838        #[inline(always)]
3839        fn inline_size(_context: fidl::encoding::Context) -> usize {
3840            16
3841        }
3842    }
3843
3844    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<UdpSocket, D>
3845        for &UdpSocket
3846    {
3847        #[inline]
3848        unsafe fn encode(
3849            self,
3850            encoder: &mut fidl::encoding::Encoder<'_, D>,
3851            offset: usize,
3852            _depth: fidl::encoding::Depth,
3853        ) -> fidl::Result<()> {
3854            encoder.debug_check_bounds::<UdpSocket>(offset);
3855            encoder.write_num::<u64>(self.ordinal(), offset);
3856            match self {
3857                UdpSocket::Empty(ref val) => fidl::encoding::encode_in_envelope::<Empty, D>(
3858                    <Empty as fidl::encoding::ValueTypeMarker>::borrow(val),
3859                    encoder,
3860                    offset + 8,
3861                    _depth,
3862                ),
3863                UdpSocket::SrcPort(ref val) => fidl::encoding::encode_in_envelope::<BoundPort, D>(
3864                    <BoundPort as fidl::encoding::ValueTypeMarker>::borrow(val),
3865                    encoder,
3866                    offset + 8,
3867                    _depth,
3868                ),
3869                UdpSocket::DstPort(ref val) => fidl::encoding::encode_in_envelope::<BoundPort, D>(
3870                    <BoundPort as fidl::encoding::ValueTypeMarker>::borrow(val),
3871                    encoder,
3872                    offset + 8,
3873                    _depth,
3874                ),
3875                UdpSocket::States(ref val) => fidl::encoding::encode_in_envelope::<UdpState, D>(
3876                    <UdpState as fidl::encoding::ValueTypeMarker>::borrow(val),
3877                    encoder,
3878                    offset + 8,
3879                    _depth,
3880                ),
3881                UdpSocket::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
3882            }
3883        }
3884    }
3885
3886    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for UdpSocket {
3887        #[inline(always)]
3888        fn new_empty() -> Self {
3889            Self::__SourceBreaking { unknown_ordinal: 0 }
3890        }
3891
3892        #[inline]
3893        unsafe fn decode(
3894            &mut self,
3895            decoder: &mut fidl::encoding::Decoder<'_, D>,
3896            offset: usize,
3897            mut depth: fidl::encoding::Depth,
3898        ) -> fidl::Result<()> {
3899            decoder.debug_check_bounds::<Self>(offset);
3900            #[allow(unused_variables)]
3901            let next_out_of_line = decoder.next_out_of_line();
3902            let handles_before = decoder.remaining_handles();
3903            let (ordinal, inlined, num_bytes, num_handles) =
3904                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
3905
3906            let member_inline_size = match ordinal {
3907                1 => <Empty as fidl::encoding::TypeMarker>::inline_size(decoder.context),
3908                2 => <BoundPort as fidl::encoding::TypeMarker>::inline_size(decoder.context),
3909                3 => <BoundPort as fidl::encoding::TypeMarker>::inline_size(decoder.context),
3910                4 => <UdpState as fidl::encoding::TypeMarker>::inline_size(decoder.context),
3911                0 => return Err(fidl::Error::UnknownUnionTag),
3912                _ => num_bytes as usize,
3913            };
3914
3915            if inlined != (member_inline_size <= 4) {
3916                return Err(fidl::Error::InvalidInlineBitInEnvelope);
3917            }
3918            let _inner_offset;
3919            if inlined {
3920                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
3921                _inner_offset = offset + 8;
3922            } else {
3923                depth.increment()?;
3924                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3925            }
3926            match ordinal {
3927                1 => {
3928                    #[allow(irrefutable_let_patterns)]
3929                    if let UdpSocket::Empty(_) = self {
3930                        // Do nothing, read the value into the object
3931                    } else {
3932                        // Initialize `self` to the right variant
3933                        *self = UdpSocket::Empty(fidl::new_empty!(Empty, D));
3934                    }
3935                    #[allow(irrefutable_let_patterns)]
3936                    if let UdpSocket::Empty(ref mut val) = self {
3937                        fidl::decode!(Empty, D, val, decoder, _inner_offset, depth)?;
3938                    } else {
3939                        unreachable!()
3940                    }
3941                }
3942                2 => {
3943                    #[allow(irrefutable_let_patterns)]
3944                    if let UdpSocket::SrcPort(_) = self {
3945                        // Do nothing, read the value into the object
3946                    } else {
3947                        // Initialize `self` to the right variant
3948                        *self = UdpSocket::SrcPort(fidl::new_empty!(BoundPort, D));
3949                    }
3950                    #[allow(irrefutable_let_patterns)]
3951                    if let UdpSocket::SrcPort(ref mut val) = self {
3952                        fidl::decode!(BoundPort, D, val, decoder, _inner_offset, depth)?;
3953                    } else {
3954                        unreachable!()
3955                    }
3956                }
3957                3 => {
3958                    #[allow(irrefutable_let_patterns)]
3959                    if let UdpSocket::DstPort(_) = self {
3960                        // Do nothing, read the value into the object
3961                    } else {
3962                        // Initialize `self` to the right variant
3963                        *self = UdpSocket::DstPort(fidl::new_empty!(BoundPort, D));
3964                    }
3965                    #[allow(irrefutable_let_patterns)]
3966                    if let UdpSocket::DstPort(ref mut val) = self {
3967                        fidl::decode!(BoundPort, D, val, decoder, _inner_offset, depth)?;
3968                    } else {
3969                        unreachable!()
3970                    }
3971                }
3972                4 => {
3973                    #[allow(irrefutable_let_patterns)]
3974                    if let UdpSocket::States(_) = self {
3975                        // Do nothing, read the value into the object
3976                    } else {
3977                        // Initialize `self` to the right variant
3978                        *self = UdpSocket::States(fidl::new_empty!(UdpState, D));
3979                    }
3980                    #[allow(irrefutable_let_patterns)]
3981                    if let UdpSocket::States(ref mut val) = self {
3982                        fidl::decode!(UdpState, D, val, decoder, _inner_offset, depth)?;
3983                    } else {
3984                        unreachable!()
3985                    }
3986                }
3987                #[allow(deprecated)]
3988                ordinal => {
3989                    for _ in 0..num_handles {
3990                        decoder.drop_next_handle()?;
3991                    }
3992                    *self = UdpSocket::__SourceBreaking { unknown_ordinal: ordinal };
3993                }
3994            }
3995            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
3996                return Err(fidl::Error::InvalidNumBytesInEnvelope);
3997            }
3998            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3999                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4000            }
4001            Ok(())
4002        }
4003    }
4004}