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(&self.start),
1041                    <fidl_fuchsia_net__common::IpAddress as fidl::encoding::ValueTypeMarker>::borrow(&self.end),
1042                ),
1043                encoder, offset, _depth
1044            )
1045        }
1046    }
1047    unsafe impl<
1048        D: fidl::encoding::ResourceDialect,
1049        T0: fidl::encoding::Encode<fidl_fuchsia_net__common::IpAddress, D>,
1050        T1: fidl::encoding::Encode<fidl_fuchsia_net__common::IpAddress, D>,
1051    > fidl::encoding::Encode<AddressRange, D> for (T0, T1)
1052    {
1053        #[inline]
1054        unsafe fn encode(
1055            self,
1056            encoder: &mut fidl::encoding::Encoder<'_, D>,
1057            offset: usize,
1058            depth: fidl::encoding::Depth,
1059        ) -> fidl::Result<()> {
1060            encoder.debug_check_bounds::<AddressRange>(offset);
1061            // Zero out padding regions. There's no need to apply masks
1062            // because the unmasked parts will be overwritten by fields.
1063            // Write the fields.
1064            self.0.encode(encoder, offset + 0, depth)?;
1065            self.1.encode(encoder, offset + 16, depth)?;
1066            Ok(())
1067        }
1068    }
1069
1070    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for AddressRange {
1071        #[inline(always)]
1072        fn new_empty() -> Self {
1073            Self {
1074                start: fidl::new_empty!(fidl_fuchsia_net__common::IpAddress, D),
1075                end: fidl::new_empty!(fidl_fuchsia_net__common::IpAddress, D),
1076            }
1077        }
1078
1079        #[inline]
1080        unsafe fn decode(
1081            &mut self,
1082            decoder: &mut fidl::encoding::Decoder<'_, D>,
1083            offset: usize,
1084            _depth: fidl::encoding::Depth,
1085        ) -> fidl::Result<()> {
1086            decoder.debug_check_bounds::<Self>(offset);
1087            // Verify that padding bytes are zero.
1088            fidl::decode!(
1089                fidl_fuchsia_net__common::IpAddress,
1090                D,
1091                &mut self.start,
1092                decoder,
1093                offset + 0,
1094                _depth
1095            )?;
1096            fidl::decode!(
1097                fidl_fuchsia_net__common::IpAddress,
1098                D,
1099                &mut self.end,
1100                decoder,
1101                offset + 16,
1102                _depth
1103            )?;
1104            Ok(())
1105        }
1106    }
1107
1108    impl fidl::encoding::ValueTypeMarker for Between {
1109        type Borrowed<'a> = &'a Self;
1110        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1111            value
1112        }
1113    }
1114
1115    unsafe impl fidl::encoding::TypeMarker for Between {
1116        type Owned = Self;
1117
1118        #[inline(always)]
1119        fn inline_align(_context: fidl::encoding::Context) -> usize {
1120            4
1121        }
1122
1123        #[inline(always)]
1124        fn inline_size(_context: fidl::encoding::Context) -> usize {
1125            8
1126        }
1127        #[inline(always)]
1128        fn encode_is_copy() -> bool {
1129            true
1130        }
1131
1132        #[inline(always)]
1133        fn decode_is_copy() -> bool {
1134            true
1135        }
1136    }
1137
1138    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Between, D> for &Between {
1139        #[inline]
1140        unsafe fn encode(
1141            self,
1142            encoder: &mut fidl::encoding::Encoder<'_, D>,
1143            offset: usize,
1144            _depth: fidl::encoding::Depth,
1145        ) -> fidl::Result<()> {
1146            encoder.debug_check_bounds::<Between>(offset);
1147            unsafe {
1148                // Copy the object into the buffer.
1149                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
1150                (buf_ptr as *mut Between).write_unaligned((self as *const Between).read());
1151                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
1152                // done second because the memcpy will write garbage to these bytes.
1153            }
1154            Ok(())
1155        }
1156    }
1157    unsafe impl<
1158        D: fidl::encoding::ResourceDialect,
1159        T0: fidl::encoding::Encode<u32, D>,
1160        T1: fidl::encoding::Encode<u32, D>,
1161    > fidl::encoding::Encode<Between, D> for (T0, T1)
1162    {
1163        #[inline]
1164        unsafe fn encode(
1165            self,
1166            encoder: &mut fidl::encoding::Encoder<'_, D>,
1167            offset: usize,
1168            depth: fidl::encoding::Depth,
1169        ) -> fidl::Result<()> {
1170            encoder.debug_check_bounds::<Between>(offset);
1171            // Zero out padding regions. There's no need to apply masks
1172            // because the unmasked parts will be overwritten by fields.
1173            // Write the fields.
1174            self.0.encode(encoder, offset + 0, depth)?;
1175            self.1.encode(encoder, offset + 4, depth)?;
1176            Ok(())
1177        }
1178    }
1179
1180    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Between {
1181        #[inline(always)]
1182        fn new_empty() -> Self {
1183            Self { start: fidl::new_empty!(u32, D), end: fidl::new_empty!(u32, D) }
1184        }
1185
1186        #[inline]
1187        unsafe fn decode(
1188            &mut self,
1189            decoder: &mut fidl::encoding::Decoder<'_, D>,
1190            offset: usize,
1191            _depth: fidl::encoding::Depth,
1192        ) -> fidl::Result<()> {
1193            decoder.debug_check_bounds::<Self>(offset);
1194            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
1195            // Verify that padding bytes are zero.
1196            // Copy from the buffer into the object.
1197            unsafe {
1198                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 8);
1199            }
1200            Ok(())
1201        }
1202    }
1203
1204    impl fidl::encoding::ValueTypeMarker for Empty {
1205        type Borrowed<'a> = &'a Self;
1206        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1207            value
1208        }
1209    }
1210
1211    unsafe impl fidl::encoding::TypeMarker for Empty {
1212        type Owned = Self;
1213
1214        #[inline(always)]
1215        fn inline_align(_context: fidl::encoding::Context) -> usize {
1216            1
1217        }
1218
1219        #[inline(always)]
1220        fn inline_size(_context: fidl::encoding::Context) -> usize {
1221            1
1222        }
1223    }
1224
1225    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Empty, D> for &Empty {
1226        #[inline]
1227        unsafe fn encode(
1228            self,
1229            encoder: &mut fidl::encoding::Encoder<'_, D>,
1230            offset: usize,
1231            _depth: fidl::encoding::Depth,
1232        ) -> fidl::Result<()> {
1233            encoder.debug_check_bounds::<Empty>(offset);
1234            encoder.write_num(0u8, offset);
1235            Ok(())
1236        }
1237    }
1238
1239    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Empty {
1240        #[inline(always)]
1241        fn new_empty() -> Self {
1242            Self
1243        }
1244
1245        #[inline]
1246        unsafe fn decode(
1247            &mut self,
1248            decoder: &mut fidl::encoding::Decoder<'_, D>,
1249            offset: usize,
1250            _depth: fidl::encoding::Depth,
1251        ) -> fidl::Result<()> {
1252            decoder.debug_check_bounds::<Self>(offset);
1253            match decoder.read_num::<u8>(offset) {
1254                0 => Ok(()),
1255                _ => Err(fidl::Error::Invalid),
1256            }
1257        }
1258    }
1259
1260    impl fidl::encoding::ValueTypeMarker for MarkInDomain {
1261        type Borrowed<'a> = &'a Self;
1262        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1263            value
1264        }
1265    }
1266
1267    unsafe impl fidl::encoding::TypeMarker for MarkInDomain {
1268        type Owned = Self;
1269
1270        #[inline(always)]
1271        fn inline_align(_context: fidl::encoding::Context) -> usize {
1272            8
1273        }
1274
1275        #[inline(always)]
1276        fn inline_size(_context: fidl::encoding::Context) -> usize {
1277            24
1278        }
1279    }
1280
1281    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<MarkInDomain, D>
1282        for &MarkInDomain
1283    {
1284        #[inline]
1285        unsafe fn encode(
1286            self,
1287            encoder: &mut fidl::encoding::Encoder<'_, D>,
1288            offset: usize,
1289            _depth: fidl::encoding::Depth,
1290        ) -> fidl::Result<()> {
1291            encoder.debug_check_bounds::<MarkInDomain>(offset);
1292            // Delegate to tuple encoding.
1293            fidl::encoding::Encode::<MarkInDomain, D>::encode(
1294                (
1295                    <fidl_fuchsia_net__common::MarkDomain as fidl::encoding::ValueTypeMarker>::borrow(&self.domain),
1296                    <Mark as fidl::encoding::ValueTypeMarker>::borrow(&self.mark),
1297                ),
1298                encoder, offset, _depth
1299            )
1300        }
1301    }
1302    unsafe impl<
1303        D: fidl::encoding::ResourceDialect,
1304        T0: fidl::encoding::Encode<fidl_fuchsia_net__common::MarkDomain, D>,
1305        T1: fidl::encoding::Encode<Mark, D>,
1306    > fidl::encoding::Encode<MarkInDomain, D> for (T0, T1)
1307    {
1308        #[inline]
1309        unsafe fn encode(
1310            self,
1311            encoder: &mut fidl::encoding::Encoder<'_, D>,
1312            offset: usize,
1313            depth: fidl::encoding::Depth,
1314        ) -> fidl::Result<()> {
1315            encoder.debug_check_bounds::<MarkInDomain>(offset);
1316            // Zero out padding regions. There's no need to apply masks
1317            // because the unmasked parts will be overwritten by fields.
1318            unsafe {
1319                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
1320                (ptr as *mut u64).write_unaligned(0);
1321            }
1322            // Write the fields.
1323            self.0.encode(encoder, offset + 0, depth)?;
1324            self.1.encode(encoder, offset + 8, depth)?;
1325            Ok(())
1326        }
1327    }
1328
1329    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for MarkInDomain {
1330        #[inline(always)]
1331        fn new_empty() -> Self {
1332            Self {
1333                domain: fidl::new_empty!(fidl_fuchsia_net__common::MarkDomain, D),
1334                mark: fidl::new_empty!(Mark, D),
1335            }
1336        }
1337
1338        #[inline]
1339        unsafe fn decode(
1340            &mut self,
1341            decoder: &mut fidl::encoding::Decoder<'_, D>,
1342            offset: usize,
1343            _depth: fidl::encoding::Depth,
1344        ) -> fidl::Result<()> {
1345            decoder.debug_check_bounds::<Self>(offset);
1346            // Verify that padding bytes are zero.
1347            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
1348            let padval = unsafe { (ptr as *const u64).read_unaligned() };
1349            let mask = 0xffffffffffffff00u64;
1350            let maskedval = padval & mask;
1351            if maskedval != 0 {
1352                return Err(fidl::Error::NonZeroPadding {
1353                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
1354                });
1355            }
1356            fidl::decode!(
1357                fidl_fuchsia_net__common::MarkDomain,
1358                D,
1359                &mut self.domain,
1360                decoder,
1361                offset + 0,
1362                _depth
1363            )?;
1364            fidl::decode!(Mark, D, &mut self.mark, decoder, offset + 8, _depth)?;
1365            Ok(())
1366        }
1367    }
1368
1369    impl fidl::encoding::ValueTypeMarker for Marked {
1370        type Borrowed<'a> = &'a Self;
1371        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1372            value
1373        }
1374    }
1375
1376    unsafe impl fidl::encoding::TypeMarker for Marked {
1377        type Owned = Self;
1378
1379        #[inline(always)]
1380        fn inline_align(_context: fidl::encoding::Context) -> usize {
1381            4
1382        }
1383
1384        #[inline(always)]
1385        fn inline_size(_context: fidl::encoding::Context) -> usize {
1386            16
1387        }
1388    }
1389
1390    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Marked, D> for &Marked {
1391        #[inline]
1392        unsafe fn encode(
1393            self,
1394            encoder: &mut fidl::encoding::Encoder<'_, D>,
1395            offset: usize,
1396            _depth: fidl::encoding::Depth,
1397        ) -> fidl::Result<()> {
1398            encoder.debug_check_bounds::<Marked>(offset);
1399            // Delegate to tuple encoding.
1400            fidl::encoding::Encode::<Marked, D>::encode(
1401                (
1402                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.mask),
1403                    <Between as fidl::encoding::ValueTypeMarker>::borrow(&self.between),
1404                    <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.invert),
1405                ),
1406                encoder,
1407                offset,
1408                _depth,
1409            )
1410        }
1411    }
1412    unsafe impl<
1413        D: fidl::encoding::ResourceDialect,
1414        T0: fidl::encoding::Encode<u32, D>,
1415        T1: fidl::encoding::Encode<Between, D>,
1416        T2: fidl::encoding::Encode<bool, D>,
1417    > fidl::encoding::Encode<Marked, D> for (T0, T1, T2)
1418    {
1419        #[inline]
1420        unsafe fn encode(
1421            self,
1422            encoder: &mut fidl::encoding::Encoder<'_, D>,
1423            offset: usize,
1424            depth: fidl::encoding::Depth,
1425        ) -> fidl::Result<()> {
1426            encoder.debug_check_bounds::<Marked>(offset);
1427            // Zero out padding regions. There's no need to apply masks
1428            // because the unmasked parts will be overwritten by fields.
1429            unsafe {
1430                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(12);
1431                (ptr as *mut u32).write_unaligned(0);
1432            }
1433            // Write the fields.
1434            self.0.encode(encoder, offset + 0, depth)?;
1435            self.1.encode(encoder, offset + 4, depth)?;
1436            self.2.encode(encoder, offset + 12, depth)?;
1437            Ok(())
1438        }
1439    }
1440
1441    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Marked {
1442        #[inline(always)]
1443        fn new_empty() -> Self {
1444            Self {
1445                mask: fidl::new_empty!(u32, D),
1446                between: fidl::new_empty!(Between, D),
1447                invert: fidl::new_empty!(bool, D),
1448            }
1449        }
1450
1451        #[inline]
1452        unsafe fn decode(
1453            &mut self,
1454            decoder: &mut fidl::encoding::Decoder<'_, D>,
1455            offset: usize,
1456            _depth: fidl::encoding::Depth,
1457        ) -> fidl::Result<()> {
1458            decoder.debug_check_bounds::<Self>(offset);
1459            // Verify that padding bytes are zero.
1460            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(12) };
1461            let padval = unsafe { (ptr as *const u32).read_unaligned() };
1462            let mask = 0xffffff00u32;
1463            let maskedval = padval & mask;
1464            if maskedval != 0 {
1465                return Err(fidl::Error::NonZeroPadding {
1466                    padding_start: offset + 12 + ((mask as u64).trailing_zeros() / 8) as usize,
1467                });
1468            }
1469            fidl::decode!(u32, D, &mut self.mask, decoder, offset + 0, _depth)?;
1470            fidl::decode!(Between, D, &mut self.between, decoder, offset + 4, _depth)?;
1471            fidl::decode!(bool, D, &mut self.invert, decoder, offset + 12, _depth)?;
1472            Ok(())
1473        }
1474    }
1475
1476    impl fidl::encoding::ValueTypeMarker for Port {
1477        type Borrowed<'a> = &'a Self;
1478        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1479            value
1480        }
1481    }
1482
1483    unsafe impl fidl::encoding::TypeMarker for Port {
1484        type Owned = Self;
1485
1486        #[inline(always)]
1487        fn inline_align(_context: fidl::encoding::Context) -> usize {
1488            2
1489        }
1490
1491        #[inline(always)]
1492        fn inline_size(_context: fidl::encoding::Context) -> usize {
1493            6
1494        }
1495    }
1496
1497    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Port, D> for &Port {
1498        #[inline]
1499        unsafe fn encode(
1500            self,
1501            encoder: &mut fidl::encoding::Encoder<'_, D>,
1502            offset: usize,
1503            _depth: fidl::encoding::Depth,
1504        ) -> fidl::Result<()> {
1505            encoder.debug_check_bounds::<Port>(offset);
1506            // Delegate to tuple encoding.
1507            fidl::encoding::Encode::<Port, D>::encode(
1508                (
1509                    <u16 as fidl::encoding::ValueTypeMarker>::borrow(&self.start),
1510                    <u16 as fidl::encoding::ValueTypeMarker>::borrow(&self.end),
1511                    <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.invert),
1512                ),
1513                encoder,
1514                offset,
1515                _depth,
1516            )
1517        }
1518    }
1519    unsafe impl<
1520        D: fidl::encoding::ResourceDialect,
1521        T0: fidl::encoding::Encode<u16, D>,
1522        T1: fidl::encoding::Encode<u16, D>,
1523        T2: fidl::encoding::Encode<bool, D>,
1524    > fidl::encoding::Encode<Port, D> for (T0, T1, T2)
1525    {
1526        #[inline]
1527        unsafe fn encode(
1528            self,
1529            encoder: &mut fidl::encoding::Encoder<'_, D>,
1530            offset: usize,
1531            depth: fidl::encoding::Depth,
1532        ) -> fidl::Result<()> {
1533            encoder.debug_check_bounds::<Port>(offset);
1534            // Zero out padding regions. There's no need to apply masks
1535            // because the unmasked parts will be overwritten by fields.
1536            unsafe {
1537                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(4);
1538                (ptr as *mut u16).write_unaligned(0);
1539            }
1540            // Write the fields.
1541            self.0.encode(encoder, offset + 0, depth)?;
1542            self.1.encode(encoder, offset + 2, depth)?;
1543            self.2.encode(encoder, offset + 4, depth)?;
1544            Ok(())
1545        }
1546    }
1547
1548    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Port {
1549        #[inline(always)]
1550        fn new_empty() -> Self {
1551            Self {
1552                start: fidl::new_empty!(u16, D),
1553                end: fidl::new_empty!(u16, D),
1554                invert: fidl::new_empty!(bool, D),
1555            }
1556        }
1557
1558        #[inline]
1559        unsafe fn decode(
1560            &mut self,
1561            decoder: &mut fidl::encoding::Decoder<'_, D>,
1562            offset: usize,
1563            _depth: fidl::encoding::Depth,
1564        ) -> fidl::Result<()> {
1565            decoder.debug_check_bounds::<Self>(offset);
1566            // Verify that padding bytes are zero.
1567            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(4) };
1568            let padval = unsafe { (ptr as *const u16).read_unaligned() };
1569            let mask = 0xff00u16;
1570            let maskedval = padval & mask;
1571            if maskedval != 0 {
1572                return Err(fidl::Error::NonZeroPadding {
1573                    padding_start: offset + 4 + ((mask as u64).trailing_zeros() / 8) as usize,
1574                });
1575            }
1576            fidl::decode!(u16, D, &mut self.start, decoder, offset + 0, _depth)?;
1577            fidl::decode!(u16, D, &mut self.end, decoder, offset + 2, _depth)?;
1578            fidl::decode!(bool, D, &mut self.invert, decoder, offset + 4, _depth)?;
1579            Ok(())
1580        }
1581    }
1582
1583    impl fidl::encoding::ValueTypeMarker for SocketCookie {
1584        type Borrowed<'a> = &'a Self;
1585        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1586            value
1587        }
1588    }
1589
1590    unsafe impl fidl::encoding::TypeMarker for SocketCookie {
1591        type Owned = Self;
1592
1593        #[inline(always)]
1594        fn inline_align(_context: fidl::encoding::Context) -> usize {
1595            8
1596        }
1597
1598        #[inline(always)]
1599        fn inline_size(_context: fidl::encoding::Context) -> usize {
1600            16
1601        }
1602    }
1603
1604    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<SocketCookie, D>
1605        for &SocketCookie
1606    {
1607        #[inline]
1608        unsafe fn encode(
1609            self,
1610            encoder: &mut fidl::encoding::Encoder<'_, D>,
1611            offset: usize,
1612            _depth: fidl::encoding::Depth,
1613        ) -> fidl::Result<()> {
1614            encoder.debug_check_bounds::<SocketCookie>(offset);
1615            // Delegate to tuple encoding.
1616            fidl::encoding::Encode::<SocketCookie, D>::encode(
1617                (
1618                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.cookie),
1619                    <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.invert),
1620                ),
1621                encoder,
1622                offset,
1623                _depth,
1624            )
1625        }
1626    }
1627    unsafe impl<
1628        D: fidl::encoding::ResourceDialect,
1629        T0: fidl::encoding::Encode<u64, D>,
1630        T1: fidl::encoding::Encode<bool, D>,
1631    > fidl::encoding::Encode<SocketCookie, D> for (T0, T1)
1632    {
1633        #[inline]
1634        unsafe fn encode(
1635            self,
1636            encoder: &mut fidl::encoding::Encoder<'_, D>,
1637            offset: usize,
1638            depth: fidl::encoding::Depth,
1639        ) -> fidl::Result<()> {
1640            encoder.debug_check_bounds::<SocketCookie>(offset);
1641            // Zero out padding regions. There's no need to apply masks
1642            // because the unmasked parts will be overwritten by fields.
1643            unsafe {
1644                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
1645                (ptr as *mut u64).write_unaligned(0);
1646            }
1647            // Write the fields.
1648            self.0.encode(encoder, offset + 0, depth)?;
1649            self.1.encode(encoder, offset + 8, depth)?;
1650            Ok(())
1651        }
1652    }
1653
1654    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SocketCookie {
1655        #[inline(always)]
1656        fn new_empty() -> Self {
1657            Self { cookie: fidl::new_empty!(u64, D), invert: fidl::new_empty!(bool, D) }
1658        }
1659
1660        #[inline]
1661        unsafe fn decode(
1662            &mut self,
1663            decoder: &mut fidl::encoding::Decoder<'_, D>,
1664            offset: usize,
1665            _depth: fidl::encoding::Depth,
1666        ) -> fidl::Result<()> {
1667            decoder.debug_check_bounds::<Self>(offset);
1668            // Verify that padding bytes are zero.
1669            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(8) };
1670            let padval = unsafe { (ptr as *const u64).read_unaligned() };
1671            let mask = 0xffffffffffffff00u64;
1672            let maskedval = padval & mask;
1673            if maskedval != 0 {
1674                return Err(fidl::Error::NonZeroPadding {
1675                    padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
1676                });
1677            }
1678            fidl::decode!(u64, D, &mut self.cookie, decoder, offset + 0, _depth)?;
1679            fidl::decode!(bool, D, &mut self.invert, decoder, offset + 8, _depth)?;
1680            Ok(())
1681        }
1682    }
1683
1684    impl fidl::encoding::ValueTypeMarker for Unmarked {
1685        type Borrowed<'a> = &'a Self;
1686        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1687            value
1688        }
1689    }
1690
1691    unsafe impl fidl::encoding::TypeMarker for Unmarked {
1692        type Owned = Self;
1693
1694        #[inline(always)]
1695        fn inline_align(_context: fidl::encoding::Context) -> usize {
1696            1
1697        }
1698
1699        #[inline(always)]
1700        fn inline_size(_context: fidl::encoding::Context) -> usize {
1701            1
1702        }
1703    }
1704
1705    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Unmarked, D> for &Unmarked {
1706        #[inline]
1707        unsafe fn encode(
1708            self,
1709            encoder: &mut fidl::encoding::Encoder<'_, D>,
1710            offset: usize,
1711            _depth: fidl::encoding::Depth,
1712        ) -> fidl::Result<()> {
1713            encoder.debug_check_bounds::<Unmarked>(offset);
1714            encoder.write_num(0u8, offset);
1715            Ok(())
1716        }
1717    }
1718
1719    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Unmarked {
1720        #[inline(always)]
1721        fn new_empty() -> Self {
1722            Self
1723        }
1724
1725        #[inline]
1726        unsafe fn decode(
1727            &mut self,
1728            decoder: &mut fidl::encoding::Decoder<'_, D>,
1729            offset: usize,
1730            _depth: fidl::encoding::Depth,
1731        ) -> fidl::Result<()> {
1732            decoder.debug_check_bounds::<Self>(offset);
1733            match decoder.read_num::<u8>(offset) {
1734                0 => Ok(()),
1735                _ => Err(fidl::Error::Invalid),
1736            }
1737        }
1738    }
1739
1740    impl IcmpPacket {
1741        #[inline(always)]
1742        fn max_ordinal_present(&self) -> u64 {
1743            0
1744        }
1745    }
1746
1747    impl fidl::encoding::ValueTypeMarker for IcmpPacket {
1748        type Borrowed<'a> = &'a Self;
1749        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1750            value
1751        }
1752    }
1753
1754    unsafe impl fidl::encoding::TypeMarker for IcmpPacket {
1755        type Owned = Self;
1756
1757        #[inline(always)]
1758        fn inline_align(_context: fidl::encoding::Context) -> usize {
1759            8
1760        }
1761
1762        #[inline(always)]
1763        fn inline_size(_context: fidl::encoding::Context) -> usize {
1764            16
1765        }
1766    }
1767
1768    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<IcmpPacket, D>
1769        for &IcmpPacket
1770    {
1771        unsafe fn encode(
1772            self,
1773            encoder: &mut fidl::encoding::Encoder<'_, D>,
1774            offset: usize,
1775            mut depth: fidl::encoding::Depth,
1776        ) -> fidl::Result<()> {
1777            encoder.debug_check_bounds::<IcmpPacket>(offset);
1778            // Vector header
1779            let max_ordinal: u64 = self.max_ordinal_present();
1780            encoder.write_num(max_ordinal, offset);
1781            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
1782            // Calling encoder.out_of_line_offset(0) is not allowed.
1783            if max_ordinal == 0 {
1784                return Ok(());
1785            }
1786            depth.increment()?;
1787            let envelope_size = 8;
1788            let bytes_len = max_ordinal as usize * envelope_size;
1789            #[allow(unused_variables)]
1790            let offset = encoder.out_of_line_offset(bytes_len);
1791            let mut _prev_end_offset: usize = 0;
1792
1793            Ok(())
1794        }
1795    }
1796
1797    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for IcmpPacket {
1798        #[inline(always)]
1799        fn new_empty() -> Self {
1800            Self::default()
1801        }
1802
1803        unsafe fn decode(
1804            &mut self,
1805            decoder: &mut fidl::encoding::Decoder<'_, D>,
1806            offset: usize,
1807            mut depth: fidl::encoding::Depth,
1808        ) -> fidl::Result<()> {
1809            decoder.debug_check_bounds::<Self>(offset);
1810            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
1811                None => return Err(fidl::Error::NotNullable),
1812                Some(len) => len,
1813            };
1814            // Calling decoder.out_of_line_offset(0) is not allowed.
1815            if len == 0 {
1816                return Ok(());
1817            };
1818            depth.increment()?;
1819            let envelope_size = 8;
1820            let bytes_len = len * envelope_size;
1821            let offset = decoder.out_of_line_offset(bytes_len)?;
1822            // Decode the envelope for each type.
1823            let mut _next_ordinal_to_read = 0;
1824            let mut next_offset = offset;
1825            let end_offset = offset + bytes_len;
1826
1827            // Decode the remaining unknown envelopes.
1828            while next_offset < end_offset {
1829                _next_ordinal_to_read += 1;
1830                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1831                next_offset += envelope_size;
1832            }
1833
1834            Ok(())
1835        }
1836    }
1837
1838    impl Icmpv6Packet {
1839        #[inline(always)]
1840        fn max_ordinal_present(&self) -> u64 {
1841            0
1842        }
1843    }
1844
1845    impl fidl::encoding::ValueTypeMarker for Icmpv6Packet {
1846        type Borrowed<'a> = &'a Self;
1847        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1848            value
1849        }
1850    }
1851
1852    unsafe impl fidl::encoding::TypeMarker for Icmpv6Packet {
1853        type Owned = Self;
1854
1855        #[inline(always)]
1856        fn inline_align(_context: fidl::encoding::Context) -> usize {
1857            8
1858        }
1859
1860        #[inline(always)]
1861        fn inline_size(_context: fidl::encoding::Context) -> usize {
1862            16
1863        }
1864    }
1865
1866    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Icmpv6Packet, D>
1867        for &Icmpv6Packet
1868    {
1869        unsafe fn encode(
1870            self,
1871            encoder: &mut fidl::encoding::Encoder<'_, D>,
1872            offset: usize,
1873            mut depth: fidl::encoding::Depth,
1874        ) -> fidl::Result<()> {
1875            encoder.debug_check_bounds::<Icmpv6Packet>(offset);
1876            // Vector header
1877            let max_ordinal: u64 = self.max_ordinal_present();
1878            encoder.write_num(max_ordinal, offset);
1879            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
1880            // Calling encoder.out_of_line_offset(0) is not allowed.
1881            if max_ordinal == 0 {
1882                return Ok(());
1883            }
1884            depth.increment()?;
1885            let envelope_size = 8;
1886            let bytes_len = max_ordinal as usize * envelope_size;
1887            #[allow(unused_variables)]
1888            let offset = encoder.out_of_line_offset(bytes_len);
1889            let mut _prev_end_offset: usize = 0;
1890
1891            Ok(())
1892        }
1893    }
1894
1895    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Icmpv6Packet {
1896        #[inline(always)]
1897        fn new_empty() -> Self {
1898            Self::default()
1899        }
1900
1901        unsafe fn decode(
1902            &mut self,
1903            decoder: &mut fidl::encoding::Decoder<'_, D>,
1904            offset: usize,
1905            mut depth: fidl::encoding::Depth,
1906        ) -> fidl::Result<()> {
1907            decoder.debug_check_bounds::<Self>(offset);
1908            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
1909                None => return Err(fidl::Error::NotNullable),
1910                Some(len) => len,
1911            };
1912            // Calling decoder.out_of_line_offset(0) is not allowed.
1913            if len == 0 {
1914                return Ok(());
1915            };
1916            depth.increment()?;
1917            let envelope_size = 8;
1918            let bytes_len = len * envelope_size;
1919            let offset = decoder.out_of_line_offset(bytes_len)?;
1920            // Decode the envelope for each type.
1921            let mut _next_ordinal_to_read = 0;
1922            let mut next_offset = offset;
1923            let end_offset = offset + bytes_len;
1924
1925            // Decode the remaining unknown envelopes.
1926            while next_offset < end_offset {
1927                _next_ordinal_to_read += 1;
1928                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1929                next_offset += envelope_size;
1930            }
1931
1932            Ok(())
1933        }
1934    }
1935
1936    impl TcpPacket {
1937        #[inline(always)]
1938        fn max_ordinal_present(&self) -> u64 {
1939            if let Some(_) = self.dst_port {
1940                return 2;
1941            }
1942            if let Some(_) = self.src_port {
1943                return 1;
1944            }
1945            0
1946        }
1947    }
1948
1949    impl fidl::encoding::ValueTypeMarker for TcpPacket {
1950        type Borrowed<'a> = &'a Self;
1951        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1952            value
1953        }
1954    }
1955
1956    unsafe impl fidl::encoding::TypeMarker for TcpPacket {
1957        type Owned = Self;
1958
1959        #[inline(always)]
1960        fn inline_align(_context: fidl::encoding::Context) -> usize {
1961            8
1962        }
1963
1964        #[inline(always)]
1965        fn inline_size(_context: fidl::encoding::Context) -> usize {
1966            16
1967        }
1968    }
1969
1970    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<TcpPacket, D>
1971        for &TcpPacket
1972    {
1973        unsafe fn encode(
1974            self,
1975            encoder: &mut fidl::encoding::Encoder<'_, D>,
1976            offset: usize,
1977            mut depth: fidl::encoding::Depth,
1978        ) -> fidl::Result<()> {
1979            encoder.debug_check_bounds::<TcpPacket>(offset);
1980            // Vector header
1981            let max_ordinal: u64 = self.max_ordinal_present();
1982            encoder.write_num(max_ordinal, offset);
1983            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
1984            // Calling encoder.out_of_line_offset(0) is not allowed.
1985            if max_ordinal == 0 {
1986                return Ok(());
1987            }
1988            depth.increment()?;
1989            let envelope_size = 8;
1990            let bytes_len = max_ordinal as usize * envelope_size;
1991            #[allow(unused_variables)]
1992            let offset = encoder.out_of_line_offset(bytes_len);
1993            let mut _prev_end_offset: usize = 0;
1994            if 1 > max_ordinal {
1995                return Ok(());
1996            }
1997
1998            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1999            // are envelope_size bytes.
2000            let cur_offset: usize = (1 - 1) * envelope_size;
2001
2002            // Zero reserved fields.
2003            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2004
2005            // Safety:
2006            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2007            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2008            //   envelope_size bytes, there is always sufficient room.
2009            fidl::encoding::encode_in_envelope_optional::<Port, D>(
2010                self.src_port.as_ref().map(<Port as fidl::encoding::ValueTypeMarker>::borrow),
2011                encoder,
2012                offset + cur_offset,
2013                depth,
2014            )?;
2015
2016            _prev_end_offset = cur_offset + envelope_size;
2017            if 2 > max_ordinal {
2018                return Ok(());
2019            }
2020
2021            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2022            // are envelope_size bytes.
2023            let cur_offset: usize = (2 - 1) * envelope_size;
2024
2025            // Zero reserved fields.
2026            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2027
2028            // Safety:
2029            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2030            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2031            //   envelope_size bytes, there is always sufficient room.
2032            fidl::encoding::encode_in_envelope_optional::<Port, D>(
2033                self.dst_port.as_ref().map(<Port as fidl::encoding::ValueTypeMarker>::borrow),
2034                encoder,
2035                offset + cur_offset,
2036                depth,
2037            )?;
2038
2039            _prev_end_offset = cur_offset + envelope_size;
2040
2041            Ok(())
2042        }
2043    }
2044
2045    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for TcpPacket {
2046        #[inline(always)]
2047        fn new_empty() -> Self {
2048            Self::default()
2049        }
2050
2051        unsafe fn decode(
2052            &mut self,
2053            decoder: &mut fidl::encoding::Decoder<'_, D>,
2054            offset: usize,
2055            mut depth: fidl::encoding::Depth,
2056        ) -> fidl::Result<()> {
2057            decoder.debug_check_bounds::<Self>(offset);
2058            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
2059                None => return Err(fidl::Error::NotNullable),
2060                Some(len) => len,
2061            };
2062            // Calling decoder.out_of_line_offset(0) is not allowed.
2063            if len == 0 {
2064                return Ok(());
2065            };
2066            depth.increment()?;
2067            let envelope_size = 8;
2068            let bytes_len = len * envelope_size;
2069            let offset = decoder.out_of_line_offset(bytes_len)?;
2070            // Decode the envelope for each type.
2071            let mut _next_ordinal_to_read = 0;
2072            let mut next_offset = offset;
2073            let end_offset = offset + bytes_len;
2074            _next_ordinal_to_read += 1;
2075            if next_offset >= end_offset {
2076                return Ok(());
2077            }
2078
2079            // Decode unknown envelopes for gaps in ordinals.
2080            while _next_ordinal_to_read < 1 {
2081                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2082                _next_ordinal_to_read += 1;
2083                next_offset += envelope_size;
2084            }
2085
2086            let next_out_of_line = decoder.next_out_of_line();
2087            let handles_before = decoder.remaining_handles();
2088            if let Some((inlined, num_bytes, num_handles)) =
2089                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2090            {
2091                let member_inline_size =
2092                    <Port as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2093                if inlined != (member_inline_size <= 4) {
2094                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2095                }
2096                let inner_offset;
2097                let mut inner_depth = depth.clone();
2098                if inlined {
2099                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2100                    inner_offset = next_offset;
2101                } else {
2102                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2103                    inner_depth.increment()?;
2104                }
2105                let val_ref = self.src_port.get_or_insert_with(|| fidl::new_empty!(Port, D));
2106                fidl::decode!(Port, D, val_ref, decoder, inner_offset, inner_depth)?;
2107                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2108                {
2109                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2110                }
2111                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2112                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2113                }
2114            }
2115
2116            next_offset += envelope_size;
2117            _next_ordinal_to_read += 1;
2118            if next_offset >= end_offset {
2119                return Ok(());
2120            }
2121
2122            // Decode unknown envelopes for gaps in ordinals.
2123            while _next_ordinal_to_read < 2 {
2124                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2125                _next_ordinal_to_read += 1;
2126                next_offset += envelope_size;
2127            }
2128
2129            let next_out_of_line = decoder.next_out_of_line();
2130            let handles_before = decoder.remaining_handles();
2131            if let Some((inlined, num_bytes, num_handles)) =
2132                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2133            {
2134                let member_inline_size =
2135                    <Port as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2136                if inlined != (member_inline_size <= 4) {
2137                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2138                }
2139                let inner_offset;
2140                let mut inner_depth = depth.clone();
2141                if inlined {
2142                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2143                    inner_offset = next_offset;
2144                } else {
2145                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2146                    inner_depth.increment()?;
2147                }
2148                let val_ref = self.dst_port.get_or_insert_with(|| fidl::new_empty!(Port, D));
2149                fidl::decode!(Port, D, val_ref, decoder, inner_offset, inner_depth)?;
2150                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2151                {
2152                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2153                }
2154                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2155                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2156                }
2157            }
2158
2159            next_offset += envelope_size;
2160
2161            // Decode the remaining unknown envelopes.
2162            while next_offset < end_offset {
2163                _next_ordinal_to_read += 1;
2164                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2165                next_offset += envelope_size;
2166            }
2167
2168            Ok(())
2169        }
2170    }
2171
2172    impl UdpPacket {
2173        #[inline(always)]
2174        fn max_ordinal_present(&self) -> u64 {
2175            if let Some(_) = self.dst_port {
2176                return 2;
2177            }
2178            if let Some(_) = self.src_port {
2179                return 1;
2180            }
2181            0
2182        }
2183    }
2184
2185    impl fidl::encoding::ValueTypeMarker for UdpPacket {
2186        type Borrowed<'a> = &'a Self;
2187        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2188            value
2189        }
2190    }
2191
2192    unsafe impl fidl::encoding::TypeMarker for UdpPacket {
2193        type Owned = Self;
2194
2195        #[inline(always)]
2196        fn inline_align(_context: fidl::encoding::Context) -> usize {
2197            8
2198        }
2199
2200        #[inline(always)]
2201        fn inline_size(_context: fidl::encoding::Context) -> usize {
2202            16
2203        }
2204    }
2205
2206    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<UdpPacket, D>
2207        for &UdpPacket
2208    {
2209        unsafe fn encode(
2210            self,
2211            encoder: &mut fidl::encoding::Encoder<'_, D>,
2212            offset: usize,
2213            mut depth: fidl::encoding::Depth,
2214        ) -> fidl::Result<()> {
2215            encoder.debug_check_bounds::<UdpPacket>(offset);
2216            // Vector header
2217            let max_ordinal: u64 = self.max_ordinal_present();
2218            encoder.write_num(max_ordinal, offset);
2219            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
2220            // Calling encoder.out_of_line_offset(0) is not allowed.
2221            if max_ordinal == 0 {
2222                return Ok(());
2223            }
2224            depth.increment()?;
2225            let envelope_size = 8;
2226            let bytes_len = max_ordinal as usize * envelope_size;
2227            #[allow(unused_variables)]
2228            let offset = encoder.out_of_line_offset(bytes_len);
2229            let mut _prev_end_offset: usize = 0;
2230            if 1 > max_ordinal {
2231                return Ok(());
2232            }
2233
2234            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2235            // are envelope_size bytes.
2236            let cur_offset: usize = (1 - 1) * envelope_size;
2237
2238            // Zero reserved fields.
2239            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2240
2241            // Safety:
2242            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2243            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2244            //   envelope_size bytes, there is always sufficient room.
2245            fidl::encoding::encode_in_envelope_optional::<Port, D>(
2246                self.src_port.as_ref().map(<Port as fidl::encoding::ValueTypeMarker>::borrow),
2247                encoder,
2248                offset + cur_offset,
2249                depth,
2250            )?;
2251
2252            _prev_end_offset = cur_offset + envelope_size;
2253            if 2 > max_ordinal {
2254                return Ok(());
2255            }
2256
2257            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2258            // are envelope_size bytes.
2259            let cur_offset: usize = (2 - 1) * envelope_size;
2260
2261            // Zero reserved fields.
2262            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2263
2264            // Safety:
2265            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2266            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2267            //   envelope_size bytes, there is always sufficient room.
2268            fidl::encoding::encode_in_envelope_optional::<Port, D>(
2269                self.dst_port.as_ref().map(<Port as fidl::encoding::ValueTypeMarker>::borrow),
2270                encoder,
2271                offset + cur_offset,
2272                depth,
2273            )?;
2274
2275            _prev_end_offset = cur_offset + envelope_size;
2276
2277            Ok(())
2278        }
2279    }
2280
2281    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for UdpPacket {
2282        #[inline(always)]
2283        fn new_empty() -> Self {
2284            Self::default()
2285        }
2286
2287        unsafe fn decode(
2288            &mut self,
2289            decoder: &mut fidl::encoding::Decoder<'_, D>,
2290            offset: usize,
2291            mut depth: fidl::encoding::Depth,
2292        ) -> fidl::Result<()> {
2293            decoder.debug_check_bounds::<Self>(offset);
2294            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
2295                None => return Err(fidl::Error::NotNullable),
2296                Some(len) => len,
2297            };
2298            // Calling decoder.out_of_line_offset(0) is not allowed.
2299            if len == 0 {
2300                return Ok(());
2301            };
2302            depth.increment()?;
2303            let envelope_size = 8;
2304            let bytes_len = len * envelope_size;
2305            let offset = decoder.out_of_line_offset(bytes_len)?;
2306            // Decode the envelope for each type.
2307            let mut _next_ordinal_to_read = 0;
2308            let mut next_offset = offset;
2309            let end_offset = offset + bytes_len;
2310            _next_ordinal_to_read += 1;
2311            if next_offset >= end_offset {
2312                return Ok(());
2313            }
2314
2315            // Decode unknown envelopes for gaps in ordinals.
2316            while _next_ordinal_to_read < 1 {
2317                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2318                _next_ordinal_to_read += 1;
2319                next_offset += envelope_size;
2320            }
2321
2322            let next_out_of_line = decoder.next_out_of_line();
2323            let handles_before = decoder.remaining_handles();
2324            if let Some((inlined, num_bytes, num_handles)) =
2325                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2326            {
2327                let member_inline_size =
2328                    <Port as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2329                if inlined != (member_inline_size <= 4) {
2330                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2331                }
2332                let inner_offset;
2333                let mut inner_depth = depth.clone();
2334                if inlined {
2335                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2336                    inner_offset = next_offset;
2337                } else {
2338                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2339                    inner_depth.increment()?;
2340                }
2341                let val_ref = self.src_port.get_or_insert_with(|| fidl::new_empty!(Port, D));
2342                fidl::decode!(Port, D, val_ref, decoder, inner_offset, inner_depth)?;
2343                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2344                {
2345                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2346                }
2347                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2348                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2349                }
2350            }
2351
2352            next_offset += envelope_size;
2353            _next_ordinal_to_read += 1;
2354            if next_offset >= end_offset {
2355                return Ok(());
2356            }
2357
2358            // Decode unknown envelopes for gaps in ordinals.
2359            while _next_ordinal_to_read < 2 {
2360                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2361                _next_ordinal_to_read += 1;
2362                next_offset += envelope_size;
2363            }
2364
2365            let next_out_of_line = decoder.next_out_of_line();
2366            let handles_before = decoder.remaining_handles();
2367            if let Some((inlined, num_bytes, num_handles)) =
2368                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2369            {
2370                let member_inline_size =
2371                    <Port as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2372                if inlined != (member_inline_size <= 4) {
2373                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2374                }
2375                let inner_offset;
2376                let mut inner_depth = depth.clone();
2377                if inlined {
2378                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2379                    inner_offset = next_offset;
2380                } else {
2381                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2382                    inner_depth.increment()?;
2383                }
2384                let val_ref = self.dst_port.get_or_insert_with(|| fidl::new_empty!(Port, D));
2385                fidl::decode!(Port, D, val_ref, decoder, inner_offset, inner_depth)?;
2386                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2387                {
2388                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2389                }
2390                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2391                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2392                }
2393            }
2394
2395            next_offset += envelope_size;
2396
2397            // Decode the remaining unknown envelopes.
2398            while next_offset < end_offset {
2399                _next_ordinal_to_read += 1;
2400                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2401                next_offset += envelope_size;
2402            }
2403
2404            Ok(())
2405        }
2406    }
2407
2408    impl fidl::encoding::ValueTypeMarker for AddressMatcherType {
2409        type Borrowed<'a> = &'a Self;
2410        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2411            value
2412        }
2413    }
2414
2415    unsafe impl fidl::encoding::TypeMarker for AddressMatcherType {
2416        type Owned = Self;
2417
2418        #[inline(always)]
2419        fn inline_align(_context: fidl::encoding::Context) -> usize {
2420            8
2421        }
2422
2423        #[inline(always)]
2424        fn inline_size(_context: fidl::encoding::Context) -> usize {
2425            16
2426        }
2427    }
2428
2429    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<AddressMatcherType, D>
2430        for &AddressMatcherType
2431    {
2432        #[inline]
2433        unsafe fn encode(
2434            self,
2435            encoder: &mut fidl::encoding::Encoder<'_, D>,
2436            offset: usize,
2437            _depth: fidl::encoding::Depth,
2438        ) -> fidl::Result<()> {
2439            encoder.debug_check_bounds::<AddressMatcherType>(offset);
2440            encoder.write_num::<u64>(self.ordinal(), offset);
2441            match self {
2442                AddressMatcherType::Subnet(ref val) => fidl::encoding::encode_in_envelope::<
2443                    fidl_fuchsia_net__common::Subnet,
2444                    D,
2445                >(
2446                    <fidl_fuchsia_net__common::Subnet as fidl::encoding::ValueTypeMarker>::borrow(
2447                        val,
2448                    ),
2449                    encoder,
2450                    offset + 8,
2451                    _depth,
2452                ),
2453                AddressMatcherType::Range(ref val) => {
2454                    fidl::encoding::encode_in_envelope::<AddressRange, D>(
2455                        <AddressRange as fidl::encoding::ValueTypeMarker>::borrow(val),
2456                        encoder,
2457                        offset + 8,
2458                        _depth,
2459                    )
2460                }
2461                AddressMatcherType::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
2462            }
2463        }
2464    }
2465
2466    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for AddressMatcherType {
2467        #[inline(always)]
2468        fn new_empty() -> Self {
2469            Self::__SourceBreaking { unknown_ordinal: 0 }
2470        }
2471
2472        #[inline]
2473        unsafe fn decode(
2474            &mut self,
2475            decoder: &mut fidl::encoding::Decoder<'_, D>,
2476            offset: usize,
2477            mut depth: fidl::encoding::Depth,
2478        ) -> fidl::Result<()> {
2479            decoder.debug_check_bounds::<Self>(offset);
2480            #[allow(unused_variables)]
2481            let next_out_of_line = decoder.next_out_of_line();
2482            let handles_before = decoder.remaining_handles();
2483            let (ordinal, inlined, num_bytes, num_handles) =
2484                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
2485
2486            let member_inline_size = match ordinal {
2487                1 => <fidl_fuchsia_net__common::Subnet as fidl::encoding::TypeMarker>::inline_size(
2488                    decoder.context,
2489                ),
2490                2 => <AddressRange as fidl::encoding::TypeMarker>::inline_size(decoder.context),
2491                0 => return Err(fidl::Error::UnknownUnionTag),
2492                _ => num_bytes as usize,
2493            };
2494
2495            if inlined != (member_inline_size <= 4) {
2496                return Err(fidl::Error::InvalidInlineBitInEnvelope);
2497            }
2498            let _inner_offset;
2499            if inlined {
2500                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
2501                _inner_offset = offset + 8;
2502            } else {
2503                depth.increment()?;
2504                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2505            }
2506            match ordinal {
2507                1 => {
2508                    #[allow(irrefutable_let_patterns)]
2509                    if let AddressMatcherType::Subnet(_) = self {
2510                        // Do nothing, read the value into the object
2511                    } else {
2512                        // Initialize `self` to the right variant
2513                        *self = AddressMatcherType::Subnet(fidl::new_empty!(
2514                            fidl_fuchsia_net__common::Subnet,
2515                            D
2516                        ));
2517                    }
2518                    #[allow(irrefutable_let_patterns)]
2519                    if let AddressMatcherType::Subnet(ref mut val) = self {
2520                        fidl::decode!(
2521                            fidl_fuchsia_net__common::Subnet,
2522                            D,
2523                            val,
2524                            decoder,
2525                            _inner_offset,
2526                            depth
2527                        )?;
2528                    } else {
2529                        unreachable!()
2530                    }
2531                }
2532                2 => {
2533                    #[allow(irrefutable_let_patterns)]
2534                    if let AddressMatcherType::Range(_) = self {
2535                        // Do nothing, read the value into the object
2536                    } else {
2537                        // Initialize `self` to the right variant
2538                        *self = AddressMatcherType::Range(fidl::new_empty!(AddressRange, D));
2539                    }
2540                    #[allow(irrefutable_let_patterns)]
2541                    if let AddressMatcherType::Range(ref mut val) = self {
2542                        fidl::decode!(AddressRange, D, val, decoder, _inner_offset, depth)?;
2543                    } else {
2544                        unreachable!()
2545                    }
2546                }
2547                #[allow(deprecated)]
2548                ordinal => {
2549                    for _ in 0..num_handles {
2550                        decoder.drop_next_handle()?;
2551                    }
2552                    *self = AddressMatcherType::__SourceBreaking { unknown_ordinal: ordinal };
2553                }
2554            }
2555            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
2556                return Err(fidl::Error::InvalidNumBytesInEnvelope);
2557            }
2558            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2559                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2560            }
2561            Ok(())
2562        }
2563    }
2564
2565    impl fidl::encoding::ValueTypeMarker for BoundAddress {
2566        type Borrowed<'a> = &'a Self;
2567        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2568            value
2569        }
2570    }
2571
2572    unsafe impl fidl::encoding::TypeMarker for BoundAddress {
2573        type Owned = Self;
2574
2575        #[inline(always)]
2576        fn inline_align(_context: fidl::encoding::Context) -> usize {
2577            8
2578        }
2579
2580        #[inline(always)]
2581        fn inline_size(_context: fidl::encoding::Context) -> usize {
2582            16
2583        }
2584    }
2585
2586    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<BoundAddress, D>
2587        for &BoundAddress
2588    {
2589        #[inline]
2590        unsafe fn encode(
2591            self,
2592            encoder: &mut fidl::encoding::Encoder<'_, D>,
2593            offset: usize,
2594            _depth: fidl::encoding::Depth,
2595        ) -> fidl::Result<()> {
2596            encoder.debug_check_bounds::<BoundAddress>(offset);
2597            encoder.write_num::<u64>(self.ordinal(), offset);
2598            match self {
2599                BoundAddress::Bound(ref val) => fidl::encoding::encode_in_envelope::<Address, D>(
2600                    <Address as fidl::encoding::ValueTypeMarker>::borrow(val),
2601                    encoder,
2602                    offset + 8,
2603                    _depth,
2604                ),
2605                BoundAddress::Unbound(ref val) => fidl::encoding::encode_in_envelope::<Empty, D>(
2606                    <Empty as fidl::encoding::ValueTypeMarker>::borrow(val),
2607                    encoder,
2608                    offset + 8,
2609                    _depth,
2610                ),
2611                BoundAddress::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
2612            }
2613        }
2614    }
2615
2616    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for BoundAddress {
2617        #[inline(always)]
2618        fn new_empty() -> Self {
2619            Self::__SourceBreaking { unknown_ordinal: 0 }
2620        }
2621
2622        #[inline]
2623        unsafe fn decode(
2624            &mut self,
2625            decoder: &mut fidl::encoding::Decoder<'_, D>,
2626            offset: usize,
2627            mut depth: fidl::encoding::Depth,
2628        ) -> fidl::Result<()> {
2629            decoder.debug_check_bounds::<Self>(offset);
2630            #[allow(unused_variables)]
2631            let next_out_of_line = decoder.next_out_of_line();
2632            let handles_before = decoder.remaining_handles();
2633            let (ordinal, inlined, num_bytes, num_handles) =
2634                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
2635
2636            let member_inline_size = match ordinal {
2637                1 => <Address as fidl::encoding::TypeMarker>::inline_size(decoder.context),
2638                2 => <Empty as fidl::encoding::TypeMarker>::inline_size(decoder.context),
2639                0 => return Err(fidl::Error::UnknownUnionTag),
2640                _ => num_bytes as usize,
2641            };
2642
2643            if inlined != (member_inline_size <= 4) {
2644                return Err(fidl::Error::InvalidInlineBitInEnvelope);
2645            }
2646            let _inner_offset;
2647            if inlined {
2648                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
2649                _inner_offset = offset + 8;
2650            } else {
2651                depth.increment()?;
2652                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2653            }
2654            match ordinal {
2655                1 => {
2656                    #[allow(irrefutable_let_patterns)]
2657                    if let BoundAddress::Bound(_) = self {
2658                        // Do nothing, read the value into the object
2659                    } else {
2660                        // Initialize `self` to the right variant
2661                        *self = BoundAddress::Bound(fidl::new_empty!(Address, D));
2662                    }
2663                    #[allow(irrefutable_let_patterns)]
2664                    if let BoundAddress::Bound(ref mut val) = self {
2665                        fidl::decode!(Address, D, val, decoder, _inner_offset, depth)?;
2666                    } else {
2667                        unreachable!()
2668                    }
2669                }
2670                2 => {
2671                    #[allow(irrefutable_let_patterns)]
2672                    if let BoundAddress::Unbound(_) = self {
2673                        // Do nothing, read the value into the object
2674                    } else {
2675                        // Initialize `self` to the right variant
2676                        *self = BoundAddress::Unbound(fidl::new_empty!(Empty, D));
2677                    }
2678                    #[allow(irrefutable_let_patterns)]
2679                    if let BoundAddress::Unbound(ref mut val) = self {
2680                        fidl::decode!(Empty, D, val, decoder, _inner_offset, depth)?;
2681                    } else {
2682                        unreachable!()
2683                    }
2684                }
2685                #[allow(deprecated)]
2686                ordinal => {
2687                    for _ in 0..num_handles {
2688                        decoder.drop_next_handle()?;
2689                    }
2690                    *self = BoundAddress::__SourceBreaking { unknown_ordinal: ordinal };
2691                }
2692            }
2693            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
2694                return Err(fidl::Error::InvalidNumBytesInEnvelope);
2695            }
2696            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2697                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2698            }
2699            Ok(())
2700        }
2701    }
2702
2703    impl fidl::encoding::ValueTypeMarker for BoundInterface {
2704        type Borrowed<'a> = &'a Self;
2705        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2706            value
2707        }
2708    }
2709
2710    unsafe impl fidl::encoding::TypeMarker for BoundInterface {
2711        type Owned = Self;
2712
2713        #[inline(always)]
2714        fn inline_align(_context: fidl::encoding::Context) -> usize {
2715            8
2716        }
2717
2718        #[inline(always)]
2719        fn inline_size(_context: fidl::encoding::Context) -> usize {
2720            16
2721        }
2722    }
2723
2724    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<BoundInterface, D>
2725        for &BoundInterface
2726    {
2727        #[inline]
2728        unsafe fn encode(
2729            self,
2730            encoder: &mut fidl::encoding::Encoder<'_, D>,
2731            offset: usize,
2732            _depth: fidl::encoding::Depth,
2733        ) -> fidl::Result<()> {
2734            encoder.debug_check_bounds::<BoundInterface>(offset);
2735            encoder.write_num::<u64>(self.ordinal(), offset);
2736            match self {
2737                BoundInterface::Bound(ref val) => {
2738                    fidl::encoding::encode_in_envelope::<Interface, D>(
2739                        <Interface as fidl::encoding::ValueTypeMarker>::borrow(val),
2740                        encoder,
2741                        offset + 8,
2742                        _depth,
2743                    )
2744                }
2745                BoundInterface::Unbound(ref val) => fidl::encoding::encode_in_envelope::<Empty, D>(
2746                    <Empty as fidl::encoding::ValueTypeMarker>::borrow(val),
2747                    encoder,
2748                    offset + 8,
2749                    _depth,
2750                ),
2751                BoundInterface::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
2752            }
2753        }
2754    }
2755
2756    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for BoundInterface {
2757        #[inline(always)]
2758        fn new_empty() -> Self {
2759            Self::__SourceBreaking { unknown_ordinal: 0 }
2760        }
2761
2762        #[inline]
2763        unsafe fn decode(
2764            &mut self,
2765            decoder: &mut fidl::encoding::Decoder<'_, D>,
2766            offset: usize,
2767            mut depth: fidl::encoding::Depth,
2768        ) -> fidl::Result<()> {
2769            decoder.debug_check_bounds::<Self>(offset);
2770            #[allow(unused_variables)]
2771            let next_out_of_line = decoder.next_out_of_line();
2772            let handles_before = decoder.remaining_handles();
2773            let (ordinal, inlined, num_bytes, num_handles) =
2774                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
2775
2776            let member_inline_size = match ordinal {
2777                1 => <Interface as fidl::encoding::TypeMarker>::inline_size(decoder.context),
2778                2 => <Empty as fidl::encoding::TypeMarker>::inline_size(decoder.context),
2779                0 => return Err(fidl::Error::UnknownUnionTag),
2780                _ => num_bytes as usize,
2781            };
2782
2783            if inlined != (member_inline_size <= 4) {
2784                return Err(fidl::Error::InvalidInlineBitInEnvelope);
2785            }
2786            let _inner_offset;
2787            if inlined {
2788                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
2789                _inner_offset = offset + 8;
2790            } else {
2791                depth.increment()?;
2792                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2793            }
2794            match ordinal {
2795                1 => {
2796                    #[allow(irrefutable_let_patterns)]
2797                    if let BoundInterface::Bound(_) = self {
2798                        // Do nothing, read the value into the object
2799                    } else {
2800                        // Initialize `self` to the right variant
2801                        *self = BoundInterface::Bound(fidl::new_empty!(Interface, D));
2802                    }
2803                    #[allow(irrefutable_let_patterns)]
2804                    if let BoundInterface::Bound(ref mut val) = self {
2805                        fidl::decode!(Interface, D, val, decoder, _inner_offset, depth)?;
2806                    } else {
2807                        unreachable!()
2808                    }
2809                }
2810                2 => {
2811                    #[allow(irrefutable_let_patterns)]
2812                    if let BoundInterface::Unbound(_) = self {
2813                        // Do nothing, read the value into the object
2814                    } else {
2815                        // Initialize `self` to the right variant
2816                        *self = BoundInterface::Unbound(fidl::new_empty!(Empty, D));
2817                    }
2818                    #[allow(irrefutable_let_patterns)]
2819                    if let BoundInterface::Unbound(ref mut val) = self {
2820                        fidl::decode!(Empty, D, val, decoder, _inner_offset, depth)?;
2821                    } else {
2822                        unreachable!()
2823                    }
2824                }
2825                #[allow(deprecated)]
2826                ordinal => {
2827                    for _ in 0..num_handles {
2828                        decoder.drop_next_handle()?;
2829                    }
2830                    *self = BoundInterface::__SourceBreaking { unknown_ordinal: ordinal };
2831                }
2832            }
2833            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
2834                return Err(fidl::Error::InvalidNumBytesInEnvelope);
2835            }
2836            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2837                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2838            }
2839            Ok(())
2840        }
2841    }
2842
2843    impl fidl::encoding::ValueTypeMarker for BoundPort {
2844        type Borrowed<'a> = &'a Self;
2845        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2846            value
2847        }
2848    }
2849
2850    unsafe impl fidl::encoding::TypeMarker for BoundPort {
2851        type Owned = Self;
2852
2853        #[inline(always)]
2854        fn inline_align(_context: fidl::encoding::Context) -> usize {
2855            8
2856        }
2857
2858        #[inline(always)]
2859        fn inline_size(_context: fidl::encoding::Context) -> usize {
2860            16
2861        }
2862    }
2863
2864    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<BoundPort, D>
2865        for &BoundPort
2866    {
2867        #[inline]
2868        unsafe fn encode(
2869            self,
2870            encoder: &mut fidl::encoding::Encoder<'_, D>,
2871            offset: usize,
2872            _depth: fidl::encoding::Depth,
2873        ) -> fidl::Result<()> {
2874            encoder.debug_check_bounds::<BoundPort>(offset);
2875            encoder.write_num::<u64>(self.ordinal(), offset);
2876            match self {
2877                BoundPort::Bound(ref val) => fidl::encoding::encode_in_envelope::<Port, D>(
2878                    <Port as fidl::encoding::ValueTypeMarker>::borrow(val),
2879                    encoder,
2880                    offset + 8,
2881                    _depth,
2882                ),
2883                BoundPort::Unbound(ref val) => fidl::encoding::encode_in_envelope::<Empty, D>(
2884                    <Empty as fidl::encoding::ValueTypeMarker>::borrow(val),
2885                    encoder,
2886                    offset + 8,
2887                    _depth,
2888                ),
2889                BoundPort::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
2890            }
2891        }
2892    }
2893
2894    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for BoundPort {
2895        #[inline(always)]
2896        fn new_empty() -> Self {
2897            Self::__SourceBreaking { unknown_ordinal: 0 }
2898        }
2899
2900        #[inline]
2901        unsafe fn decode(
2902            &mut self,
2903            decoder: &mut fidl::encoding::Decoder<'_, D>,
2904            offset: usize,
2905            mut depth: fidl::encoding::Depth,
2906        ) -> fidl::Result<()> {
2907            decoder.debug_check_bounds::<Self>(offset);
2908            #[allow(unused_variables)]
2909            let next_out_of_line = decoder.next_out_of_line();
2910            let handles_before = decoder.remaining_handles();
2911            let (ordinal, inlined, num_bytes, num_handles) =
2912                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
2913
2914            let member_inline_size = match ordinal {
2915                1 => <Port as fidl::encoding::TypeMarker>::inline_size(decoder.context),
2916                2 => <Empty as fidl::encoding::TypeMarker>::inline_size(decoder.context),
2917                0 => return Err(fidl::Error::UnknownUnionTag),
2918                _ => num_bytes as usize,
2919            };
2920
2921            if inlined != (member_inline_size <= 4) {
2922                return Err(fidl::Error::InvalidInlineBitInEnvelope);
2923            }
2924            let _inner_offset;
2925            if inlined {
2926                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
2927                _inner_offset = offset + 8;
2928            } else {
2929                depth.increment()?;
2930                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2931            }
2932            match ordinal {
2933                1 => {
2934                    #[allow(irrefutable_let_patterns)]
2935                    if let BoundPort::Bound(_) = self {
2936                        // Do nothing, read the value into the object
2937                    } else {
2938                        // Initialize `self` to the right variant
2939                        *self = BoundPort::Bound(fidl::new_empty!(Port, D));
2940                    }
2941                    #[allow(irrefutable_let_patterns)]
2942                    if let BoundPort::Bound(ref mut val) = self {
2943                        fidl::decode!(Port, D, val, decoder, _inner_offset, depth)?;
2944                    } else {
2945                        unreachable!()
2946                    }
2947                }
2948                2 => {
2949                    #[allow(irrefutable_let_patterns)]
2950                    if let BoundPort::Unbound(_) = self {
2951                        // Do nothing, read the value into the object
2952                    } else {
2953                        // Initialize `self` to the right variant
2954                        *self = BoundPort::Unbound(fidl::new_empty!(Empty, D));
2955                    }
2956                    #[allow(irrefutable_let_patterns)]
2957                    if let BoundPort::Unbound(ref mut val) = self {
2958                        fidl::decode!(Empty, D, val, decoder, _inner_offset, depth)?;
2959                    } else {
2960                        unreachable!()
2961                    }
2962                }
2963                #[allow(deprecated)]
2964                ordinal => {
2965                    for _ in 0..num_handles {
2966                        decoder.drop_next_handle()?;
2967                    }
2968                    *self = BoundPort::__SourceBreaking { unknown_ordinal: ordinal };
2969                }
2970            }
2971            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
2972                return Err(fidl::Error::InvalidNumBytesInEnvelope);
2973            }
2974            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2975                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2976            }
2977            Ok(())
2978        }
2979    }
2980
2981    impl fidl::encoding::ValueTypeMarker for Interface {
2982        type Borrowed<'a> = &'a Self;
2983        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2984            value
2985        }
2986    }
2987
2988    unsafe impl fidl::encoding::TypeMarker for Interface {
2989        type Owned = Self;
2990
2991        #[inline(always)]
2992        fn inline_align(_context: fidl::encoding::Context) -> usize {
2993            8
2994        }
2995
2996        #[inline(always)]
2997        fn inline_size(_context: fidl::encoding::Context) -> usize {
2998            16
2999        }
3000    }
3001
3002    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Interface, D>
3003        for &Interface
3004    {
3005        #[inline]
3006        unsafe fn encode(
3007            self,
3008            encoder: &mut fidl::encoding::Encoder<'_, D>,
3009            offset: usize,
3010            _depth: fidl::encoding::Depth,
3011        ) -> fidl::Result<()> {
3012            encoder.debug_check_bounds::<Interface>(offset);
3013            encoder.write_num::<u64>(self.ordinal(), offset);
3014            match self {
3015            Interface::Id(ref val) => {
3016                fidl::encoding::encode_in_envelope::<u64, D>(
3017                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(val),
3018                    encoder, offset + 8, _depth
3019                )
3020            }
3021            Interface::Name(ref val) => {
3022                fidl::encoding::encode_in_envelope::<fidl::encoding::BoundedString<15>, D>(
3023                    <fidl::encoding::BoundedString<15> as fidl::encoding::ValueTypeMarker>::borrow(val),
3024                    encoder, offset + 8, _depth
3025                )
3026            }
3027            Interface::PortClass(ref val) => {
3028                fidl::encoding::encode_in_envelope::<fidl_fuchsia_net_interfaces__common::PortClass, D>(
3029                    <fidl_fuchsia_net_interfaces__common::PortClass as fidl::encoding::ValueTypeMarker>::borrow(val),
3030                    encoder, offset + 8, _depth
3031                )
3032            }
3033            Interface::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
3034        }
3035        }
3036    }
3037
3038    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Interface {
3039        #[inline(always)]
3040        fn new_empty() -> Self {
3041            Self::__SourceBreaking { unknown_ordinal: 0 }
3042        }
3043
3044        #[inline]
3045        unsafe fn decode(
3046            &mut self,
3047            decoder: &mut fidl::encoding::Decoder<'_, D>,
3048            offset: usize,
3049            mut depth: fidl::encoding::Depth,
3050        ) -> fidl::Result<()> {
3051            decoder.debug_check_bounds::<Self>(offset);
3052            #[allow(unused_variables)]
3053            let next_out_of_line = decoder.next_out_of_line();
3054            let handles_before = decoder.remaining_handles();
3055            let (ordinal, inlined, num_bytes, num_handles) =
3056                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
3057
3058            let member_inline_size = match ordinal {
3059            1 => <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context),
3060            2 => <fidl::encoding::BoundedString<15> as fidl::encoding::TypeMarker>::inline_size(decoder.context),
3061            3 => <fidl_fuchsia_net_interfaces__common::PortClass as fidl::encoding::TypeMarker>::inline_size(decoder.context),
3062            0 => return Err(fidl::Error::UnknownUnionTag),
3063            _ => num_bytes as usize,
3064        };
3065
3066            if inlined != (member_inline_size <= 4) {
3067                return Err(fidl::Error::InvalidInlineBitInEnvelope);
3068            }
3069            let _inner_offset;
3070            if inlined {
3071                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
3072                _inner_offset = offset + 8;
3073            } else {
3074                depth.increment()?;
3075                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3076            }
3077            match ordinal {
3078                1 => {
3079                    #[allow(irrefutable_let_patterns)]
3080                    if let Interface::Id(_) = self {
3081                        // Do nothing, read the value into the object
3082                    } else {
3083                        // Initialize `self` to the right variant
3084                        *self = Interface::Id(fidl::new_empty!(u64, D));
3085                    }
3086                    #[allow(irrefutable_let_patterns)]
3087                    if let Interface::Id(ref mut val) = self {
3088                        fidl::decode!(u64, D, val, decoder, _inner_offset, depth)?;
3089                    } else {
3090                        unreachable!()
3091                    }
3092                }
3093                2 => {
3094                    #[allow(irrefutable_let_patterns)]
3095                    if let Interface::Name(_) = self {
3096                        // Do nothing, read the value into the object
3097                    } else {
3098                        // Initialize `self` to the right variant
3099                        *self =
3100                            Interface::Name(fidl::new_empty!(fidl::encoding::BoundedString<15>, D));
3101                    }
3102                    #[allow(irrefutable_let_patterns)]
3103                    if let Interface::Name(ref mut val) = self {
3104                        fidl::decode!(
3105                            fidl::encoding::BoundedString<15>,
3106                            D,
3107                            val,
3108                            decoder,
3109                            _inner_offset,
3110                            depth
3111                        )?;
3112                    } else {
3113                        unreachable!()
3114                    }
3115                }
3116                3 => {
3117                    #[allow(irrefutable_let_patterns)]
3118                    if let Interface::PortClass(_) = self {
3119                        // Do nothing, read the value into the object
3120                    } else {
3121                        // Initialize `self` to the right variant
3122                        *self = Interface::PortClass(fidl::new_empty!(
3123                            fidl_fuchsia_net_interfaces__common::PortClass,
3124                            D
3125                        ));
3126                    }
3127                    #[allow(irrefutable_let_patterns)]
3128                    if let Interface::PortClass(ref mut val) = self {
3129                        fidl::decode!(
3130                            fidl_fuchsia_net_interfaces__common::PortClass,
3131                            D,
3132                            val,
3133                            decoder,
3134                            _inner_offset,
3135                            depth
3136                        )?;
3137                    } else {
3138                        unreachable!()
3139                    }
3140                }
3141                #[allow(deprecated)]
3142                ordinal => {
3143                    for _ in 0..num_handles {
3144                        decoder.drop_next_handle()?;
3145                    }
3146                    *self = Interface::__SourceBreaking { unknown_ordinal: ordinal };
3147                }
3148            }
3149            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
3150                return Err(fidl::Error::InvalidNumBytesInEnvelope);
3151            }
3152            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3153                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3154            }
3155            Ok(())
3156        }
3157    }
3158
3159    impl fidl::encoding::ValueTypeMarker for Mark {
3160        type Borrowed<'a> = &'a Self;
3161        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3162            value
3163        }
3164    }
3165
3166    unsafe impl fidl::encoding::TypeMarker for Mark {
3167        type Owned = Self;
3168
3169        #[inline(always)]
3170        fn inline_align(_context: fidl::encoding::Context) -> usize {
3171            8
3172        }
3173
3174        #[inline(always)]
3175        fn inline_size(_context: fidl::encoding::Context) -> usize {
3176            16
3177        }
3178    }
3179
3180    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Mark, D> for &Mark {
3181        #[inline]
3182        unsafe fn encode(
3183            self,
3184            encoder: &mut fidl::encoding::Encoder<'_, D>,
3185            offset: usize,
3186            _depth: fidl::encoding::Depth,
3187        ) -> fidl::Result<()> {
3188            encoder.debug_check_bounds::<Mark>(offset);
3189            encoder.write_num::<u64>(self.ordinal(), offset);
3190            match self {
3191                Mark::Unmarked(ref val) => fidl::encoding::encode_in_envelope::<Unmarked, D>(
3192                    <Unmarked as fidl::encoding::ValueTypeMarker>::borrow(val),
3193                    encoder,
3194                    offset + 8,
3195                    _depth,
3196                ),
3197                Mark::Marked(ref val) => fidl::encoding::encode_in_envelope::<Marked, D>(
3198                    <Marked as fidl::encoding::ValueTypeMarker>::borrow(val),
3199                    encoder,
3200                    offset + 8,
3201                    _depth,
3202                ),
3203                Mark::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
3204            }
3205        }
3206    }
3207
3208    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Mark {
3209        #[inline(always)]
3210        fn new_empty() -> Self {
3211            Self::__SourceBreaking { unknown_ordinal: 0 }
3212        }
3213
3214        #[inline]
3215        unsafe fn decode(
3216            &mut self,
3217            decoder: &mut fidl::encoding::Decoder<'_, D>,
3218            offset: usize,
3219            mut depth: fidl::encoding::Depth,
3220        ) -> fidl::Result<()> {
3221            decoder.debug_check_bounds::<Self>(offset);
3222            #[allow(unused_variables)]
3223            let next_out_of_line = decoder.next_out_of_line();
3224            let handles_before = decoder.remaining_handles();
3225            let (ordinal, inlined, num_bytes, num_handles) =
3226                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
3227
3228            let member_inline_size = match ordinal {
3229                1 => <Unmarked as fidl::encoding::TypeMarker>::inline_size(decoder.context),
3230                2 => <Marked as fidl::encoding::TypeMarker>::inline_size(decoder.context),
3231                0 => return Err(fidl::Error::UnknownUnionTag),
3232                _ => num_bytes as usize,
3233            };
3234
3235            if inlined != (member_inline_size <= 4) {
3236                return Err(fidl::Error::InvalidInlineBitInEnvelope);
3237            }
3238            let _inner_offset;
3239            if inlined {
3240                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
3241                _inner_offset = offset + 8;
3242            } else {
3243                depth.increment()?;
3244                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3245            }
3246            match ordinal {
3247                1 => {
3248                    #[allow(irrefutable_let_patterns)]
3249                    if let Mark::Unmarked(_) = self {
3250                        // Do nothing, read the value into the object
3251                    } else {
3252                        // Initialize `self` to the right variant
3253                        *self = Mark::Unmarked(fidl::new_empty!(Unmarked, D));
3254                    }
3255                    #[allow(irrefutable_let_patterns)]
3256                    if let Mark::Unmarked(ref mut val) = self {
3257                        fidl::decode!(Unmarked, D, val, decoder, _inner_offset, depth)?;
3258                    } else {
3259                        unreachable!()
3260                    }
3261                }
3262                2 => {
3263                    #[allow(irrefutable_let_patterns)]
3264                    if let Mark::Marked(_) = self {
3265                        // Do nothing, read the value into the object
3266                    } else {
3267                        // Initialize `self` to the right variant
3268                        *self = Mark::Marked(fidl::new_empty!(Marked, D));
3269                    }
3270                    #[allow(irrefutable_let_patterns)]
3271                    if let Mark::Marked(ref mut val) = self {
3272                        fidl::decode!(Marked, D, val, decoder, _inner_offset, depth)?;
3273                    } else {
3274                        unreachable!()
3275                    }
3276                }
3277                #[allow(deprecated)]
3278                ordinal => {
3279                    for _ in 0..num_handles {
3280                        decoder.drop_next_handle()?;
3281                    }
3282                    *self = Mark::__SourceBreaking { unknown_ordinal: ordinal };
3283                }
3284            }
3285            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
3286                return Err(fidl::Error::InvalidNumBytesInEnvelope);
3287            }
3288            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3289                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3290            }
3291            Ok(())
3292        }
3293    }
3294
3295    impl fidl::encoding::ValueTypeMarker for PacketTransportProtocol {
3296        type Borrowed<'a> = &'a Self;
3297        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3298            value
3299        }
3300    }
3301
3302    unsafe impl fidl::encoding::TypeMarker for PacketTransportProtocol {
3303        type Owned = Self;
3304
3305        #[inline(always)]
3306        fn inline_align(_context: fidl::encoding::Context) -> usize {
3307            8
3308        }
3309
3310        #[inline(always)]
3311        fn inline_size(_context: fidl::encoding::Context) -> usize {
3312            16
3313        }
3314    }
3315
3316    unsafe impl<D: fidl::encoding::ResourceDialect>
3317        fidl::encoding::Encode<PacketTransportProtocol, D> for &PacketTransportProtocol
3318    {
3319        #[inline]
3320        unsafe fn encode(
3321            self,
3322            encoder: &mut fidl::encoding::Encoder<'_, D>,
3323            offset: usize,
3324            _depth: fidl::encoding::Depth,
3325        ) -> fidl::Result<()> {
3326            encoder.debug_check_bounds::<PacketTransportProtocol>(offset);
3327            encoder.write_num::<u64>(self.ordinal(), offset);
3328            match self {
3329                PacketTransportProtocol::Tcp(ref val) => {
3330                    fidl::encoding::encode_in_envelope::<TcpPacket, D>(
3331                        <TcpPacket as fidl::encoding::ValueTypeMarker>::borrow(val),
3332                        encoder,
3333                        offset + 8,
3334                        _depth,
3335                    )
3336                }
3337                PacketTransportProtocol::Udp(ref val) => {
3338                    fidl::encoding::encode_in_envelope::<UdpPacket, D>(
3339                        <UdpPacket as fidl::encoding::ValueTypeMarker>::borrow(val),
3340                        encoder,
3341                        offset + 8,
3342                        _depth,
3343                    )
3344                }
3345                PacketTransportProtocol::Icmp(ref val) => {
3346                    fidl::encoding::encode_in_envelope::<IcmpPacket, D>(
3347                        <IcmpPacket as fidl::encoding::ValueTypeMarker>::borrow(val),
3348                        encoder,
3349                        offset + 8,
3350                        _depth,
3351                    )
3352                }
3353                PacketTransportProtocol::Icmpv6(ref val) => {
3354                    fidl::encoding::encode_in_envelope::<Icmpv6Packet, D>(
3355                        <Icmpv6Packet as fidl::encoding::ValueTypeMarker>::borrow(val),
3356                        encoder,
3357                        offset + 8,
3358                        _depth,
3359                    )
3360                }
3361                PacketTransportProtocol::__SourceBreaking { .. } => {
3362                    Err(fidl::Error::UnknownUnionTag)
3363                }
3364            }
3365        }
3366    }
3367
3368    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3369        for PacketTransportProtocol
3370    {
3371        #[inline(always)]
3372        fn new_empty() -> Self {
3373            Self::__SourceBreaking { unknown_ordinal: 0 }
3374        }
3375
3376        #[inline]
3377        unsafe fn decode(
3378            &mut self,
3379            decoder: &mut fidl::encoding::Decoder<'_, D>,
3380            offset: usize,
3381            mut depth: fidl::encoding::Depth,
3382        ) -> fidl::Result<()> {
3383            decoder.debug_check_bounds::<Self>(offset);
3384            #[allow(unused_variables)]
3385            let next_out_of_line = decoder.next_out_of_line();
3386            let handles_before = decoder.remaining_handles();
3387            let (ordinal, inlined, num_bytes, num_handles) =
3388                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
3389
3390            let member_inline_size = match ordinal {
3391                1 => <TcpPacket as fidl::encoding::TypeMarker>::inline_size(decoder.context),
3392                2 => <UdpPacket as fidl::encoding::TypeMarker>::inline_size(decoder.context),
3393                3 => <IcmpPacket as fidl::encoding::TypeMarker>::inline_size(decoder.context),
3394                4 => <Icmpv6Packet as fidl::encoding::TypeMarker>::inline_size(decoder.context),
3395                0 => return Err(fidl::Error::UnknownUnionTag),
3396                _ => num_bytes as usize,
3397            };
3398
3399            if inlined != (member_inline_size <= 4) {
3400                return Err(fidl::Error::InvalidInlineBitInEnvelope);
3401            }
3402            let _inner_offset;
3403            if inlined {
3404                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
3405                _inner_offset = offset + 8;
3406            } else {
3407                depth.increment()?;
3408                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3409            }
3410            match ordinal {
3411                1 => {
3412                    #[allow(irrefutable_let_patterns)]
3413                    if let PacketTransportProtocol::Tcp(_) = self {
3414                        // Do nothing, read the value into the object
3415                    } else {
3416                        // Initialize `self` to the right variant
3417                        *self = PacketTransportProtocol::Tcp(fidl::new_empty!(TcpPacket, D));
3418                    }
3419                    #[allow(irrefutable_let_patterns)]
3420                    if let PacketTransportProtocol::Tcp(ref mut val) = self {
3421                        fidl::decode!(TcpPacket, D, val, decoder, _inner_offset, depth)?;
3422                    } else {
3423                        unreachable!()
3424                    }
3425                }
3426                2 => {
3427                    #[allow(irrefutable_let_patterns)]
3428                    if let PacketTransportProtocol::Udp(_) = self {
3429                        // Do nothing, read the value into the object
3430                    } else {
3431                        // Initialize `self` to the right variant
3432                        *self = PacketTransportProtocol::Udp(fidl::new_empty!(UdpPacket, D));
3433                    }
3434                    #[allow(irrefutable_let_patterns)]
3435                    if let PacketTransportProtocol::Udp(ref mut val) = self {
3436                        fidl::decode!(UdpPacket, D, val, decoder, _inner_offset, depth)?;
3437                    } else {
3438                        unreachable!()
3439                    }
3440                }
3441                3 => {
3442                    #[allow(irrefutable_let_patterns)]
3443                    if let PacketTransportProtocol::Icmp(_) = self {
3444                        // Do nothing, read the value into the object
3445                    } else {
3446                        // Initialize `self` to the right variant
3447                        *self = PacketTransportProtocol::Icmp(fidl::new_empty!(IcmpPacket, D));
3448                    }
3449                    #[allow(irrefutable_let_patterns)]
3450                    if let PacketTransportProtocol::Icmp(ref mut val) = self {
3451                        fidl::decode!(IcmpPacket, D, val, decoder, _inner_offset, depth)?;
3452                    } else {
3453                        unreachable!()
3454                    }
3455                }
3456                4 => {
3457                    #[allow(irrefutable_let_patterns)]
3458                    if let PacketTransportProtocol::Icmpv6(_) = self {
3459                        // Do nothing, read the value into the object
3460                    } else {
3461                        // Initialize `self` to the right variant
3462                        *self = PacketTransportProtocol::Icmpv6(fidl::new_empty!(Icmpv6Packet, D));
3463                    }
3464                    #[allow(irrefutable_let_patterns)]
3465                    if let PacketTransportProtocol::Icmpv6(ref mut val) = self {
3466                        fidl::decode!(Icmpv6Packet, D, val, decoder, _inner_offset, depth)?;
3467                    } else {
3468                        unreachable!()
3469                    }
3470                }
3471                #[allow(deprecated)]
3472                ordinal => {
3473                    for _ in 0..num_handles {
3474                        decoder.drop_next_handle()?;
3475                    }
3476                    *self = PacketTransportProtocol::__SourceBreaking { unknown_ordinal: ordinal };
3477                }
3478            }
3479            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
3480                return Err(fidl::Error::InvalidNumBytesInEnvelope);
3481            }
3482            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3483                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3484            }
3485            Ok(())
3486        }
3487    }
3488
3489    impl fidl::encoding::ValueTypeMarker for SocketTransportProtocol {
3490        type Borrowed<'a> = &'a Self;
3491        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3492            value
3493        }
3494    }
3495
3496    unsafe impl fidl::encoding::TypeMarker for SocketTransportProtocol {
3497        type Owned = Self;
3498
3499        #[inline(always)]
3500        fn inline_align(_context: fidl::encoding::Context) -> usize {
3501            8
3502        }
3503
3504        #[inline(always)]
3505        fn inline_size(_context: fidl::encoding::Context) -> usize {
3506            16
3507        }
3508    }
3509
3510    unsafe impl<D: fidl::encoding::ResourceDialect>
3511        fidl::encoding::Encode<SocketTransportProtocol, D> for &SocketTransportProtocol
3512    {
3513        #[inline]
3514        unsafe fn encode(
3515            self,
3516            encoder: &mut fidl::encoding::Encoder<'_, D>,
3517            offset: usize,
3518            _depth: fidl::encoding::Depth,
3519        ) -> fidl::Result<()> {
3520            encoder.debug_check_bounds::<SocketTransportProtocol>(offset);
3521            encoder.write_num::<u64>(self.ordinal(), offset);
3522            match self {
3523                SocketTransportProtocol::Tcp(ref val) => {
3524                    fidl::encoding::encode_in_envelope::<TcpSocket, D>(
3525                        <TcpSocket as fidl::encoding::ValueTypeMarker>::borrow(val),
3526                        encoder,
3527                        offset + 8,
3528                        _depth,
3529                    )
3530                }
3531                SocketTransportProtocol::Udp(ref val) => {
3532                    fidl::encoding::encode_in_envelope::<UdpSocket, D>(
3533                        <UdpSocket as fidl::encoding::ValueTypeMarker>::borrow(val),
3534                        encoder,
3535                        offset + 8,
3536                        _depth,
3537                    )
3538                }
3539                SocketTransportProtocol::__SourceBreaking { .. } => {
3540                    Err(fidl::Error::UnknownUnionTag)
3541                }
3542            }
3543        }
3544    }
3545
3546    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3547        for SocketTransportProtocol
3548    {
3549        #[inline(always)]
3550        fn new_empty() -> Self {
3551            Self::__SourceBreaking { unknown_ordinal: 0 }
3552        }
3553
3554        #[inline]
3555        unsafe fn decode(
3556            &mut self,
3557            decoder: &mut fidl::encoding::Decoder<'_, D>,
3558            offset: usize,
3559            mut depth: fidl::encoding::Depth,
3560        ) -> fidl::Result<()> {
3561            decoder.debug_check_bounds::<Self>(offset);
3562            #[allow(unused_variables)]
3563            let next_out_of_line = decoder.next_out_of_line();
3564            let handles_before = decoder.remaining_handles();
3565            let (ordinal, inlined, num_bytes, num_handles) =
3566                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
3567
3568            let member_inline_size = match ordinal {
3569                1 => <TcpSocket as fidl::encoding::TypeMarker>::inline_size(decoder.context),
3570                2 => <UdpSocket as fidl::encoding::TypeMarker>::inline_size(decoder.context),
3571                0 => return Err(fidl::Error::UnknownUnionTag),
3572                _ => num_bytes as usize,
3573            };
3574
3575            if inlined != (member_inline_size <= 4) {
3576                return Err(fidl::Error::InvalidInlineBitInEnvelope);
3577            }
3578            let _inner_offset;
3579            if inlined {
3580                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
3581                _inner_offset = offset + 8;
3582            } else {
3583                depth.increment()?;
3584                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3585            }
3586            match ordinal {
3587                1 => {
3588                    #[allow(irrefutable_let_patterns)]
3589                    if let SocketTransportProtocol::Tcp(_) = self {
3590                        // Do nothing, read the value into the object
3591                    } else {
3592                        // Initialize `self` to the right variant
3593                        *self = SocketTransportProtocol::Tcp(fidl::new_empty!(TcpSocket, D));
3594                    }
3595                    #[allow(irrefutable_let_patterns)]
3596                    if let SocketTransportProtocol::Tcp(ref mut val) = self {
3597                        fidl::decode!(TcpSocket, D, val, decoder, _inner_offset, depth)?;
3598                    } else {
3599                        unreachable!()
3600                    }
3601                }
3602                2 => {
3603                    #[allow(irrefutable_let_patterns)]
3604                    if let SocketTransportProtocol::Udp(_) = self {
3605                        // Do nothing, read the value into the object
3606                    } else {
3607                        // Initialize `self` to the right variant
3608                        *self = SocketTransportProtocol::Udp(fidl::new_empty!(UdpSocket, D));
3609                    }
3610                    #[allow(irrefutable_let_patterns)]
3611                    if let SocketTransportProtocol::Udp(ref mut val) = self {
3612                        fidl::decode!(UdpSocket, D, val, decoder, _inner_offset, depth)?;
3613                    } else {
3614                        unreachable!()
3615                    }
3616                }
3617                #[allow(deprecated)]
3618                ordinal => {
3619                    for _ in 0..num_handles {
3620                        decoder.drop_next_handle()?;
3621                    }
3622                    *self = SocketTransportProtocol::__SourceBreaking { unknown_ordinal: ordinal };
3623                }
3624            }
3625            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
3626                return Err(fidl::Error::InvalidNumBytesInEnvelope);
3627            }
3628            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3629                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3630            }
3631            Ok(())
3632        }
3633    }
3634
3635    impl fidl::encoding::ValueTypeMarker for TcpSocket {
3636        type Borrowed<'a> = &'a Self;
3637        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3638            value
3639        }
3640    }
3641
3642    unsafe impl fidl::encoding::TypeMarker for TcpSocket {
3643        type Owned = Self;
3644
3645        #[inline(always)]
3646        fn inline_align(_context: fidl::encoding::Context) -> usize {
3647            8
3648        }
3649
3650        #[inline(always)]
3651        fn inline_size(_context: fidl::encoding::Context) -> usize {
3652            16
3653        }
3654    }
3655
3656    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<TcpSocket, D>
3657        for &TcpSocket
3658    {
3659        #[inline]
3660        unsafe fn encode(
3661            self,
3662            encoder: &mut fidl::encoding::Encoder<'_, D>,
3663            offset: usize,
3664            _depth: fidl::encoding::Depth,
3665        ) -> fidl::Result<()> {
3666            encoder.debug_check_bounds::<TcpSocket>(offset);
3667            encoder.write_num::<u64>(self.ordinal(), offset);
3668            match self {
3669                TcpSocket::Empty(ref val) => fidl::encoding::encode_in_envelope::<Empty, D>(
3670                    <Empty as fidl::encoding::ValueTypeMarker>::borrow(val),
3671                    encoder,
3672                    offset + 8,
3673                    _depth,
3674                ),
3675                TcpSocket::SrcPort(ref val) => fidl::encoding::encode_in_envelope::<BoundPort, D>(
3676                    <BoundPort as fidl::encoding::ValueTypeMarker>::borrow(val),
3677                    encoder,
3678                    offset + 8,
3679                    _depth,
3680                ),
3681                TcpSocket::DstPort(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::States(ref val) => fidl::encoding::encode_in_envelope::<TcpState, D>(
3688                    <TcpState as fidl::encoding::ValueTypeMarker>::borrow(val),
3689                    encoder,
3690                    offset + 8,
3691                    _depth,
3692                ),
3693                TcpSocket::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
3694            }
3695        }
3696    }
3697
3698    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for TcpSocket {
3699        #[inline(always)]
3700        fn new_empty() -> Self {
3701            Self::__SourceBreaking { unknown_ordinal: 0 }
3702        }
3703
3704        #[inline]
3705        unsafe fn decode(
3706            &mut self,
3707            decoder: &mut fidl::encoding::Decoder<'_, D>,
3708            offset: usize,
3709            mut depth: fidl::encoding::Depth,
3710        ) -> fidl::Result<()> {
3711            decoder.debug_check_bounds::<Self>(offset);
3712            #[allow(unused_variables)]
3713            let next_out_of_line = decoder.next_out_of_line();
3714            let handles_before = decoder.remaining_handles();
3715            let (ordinal, inlined, num_bytes, num_handles) =
3716                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
3717
3718            let member_inline_size = match ordinal {
3719                1 => <Empty as fidl::encoding::TypeMarker>::inline_size(decoder.context),
3720                2 => <BoundPort as fidl::encoding::TypeMarker>::inline_size(decoder.context),
3721                3 => <BoundPort as fidl::encoding::TypeMarker>::inline_size(decoder.context),
3722                4 => <TcpState as fidl::encoding::TypeMarker>::inline_size(decoder.context),
3723                0 => return Err(fidl::Error::UnknownUnionTag),
3724                _ => num_bytes as usize,
3725            };
3726
3727            if inlined != (member_inline_size <= 4) {
3728                return Err(fidl::Error::InvalidInlineBitInEnvelope);
3729            }
3730            let _inner_offset;
3731            if inlined {
3732                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
3733                _inner_offset = offset + 8;
3734            } else {
3735                depth.increment()?;
3736                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3737            }
3738            match ordinal {
3739                1 => {
3740                    #[allow(irrefutable_let_patterns)]
3741                    if let TcpSocket::Empty(_) = self {
3742                        // Do nothing, read the value into the object
3743                    } else {
3744                        // Initialize `self` to the right variant
3745                        *self = TcpSocket::Empty(fidl::new_empty!(Empty, D));
3746                    }
3747                    #[allow(irrefutable_let_patterns)]
3748                    if let TcpSocket::Empty(ref mut val) = self {
3749                        fidl::decode!(Empty, D, val, decoder, _inner_offset, depth)?;
3750                    } else {
3751                        unreachable!()
3752                    }
3753                }
3754                2 => {
3755                    #[allow(irrefutable_let_patterns)]
3756                    if let TcpSocket::SrcPort(_) = self {
3757                        // Do nothing, read the value into the object
3758                    } else {
3759                        // Initialize `self` to the right variant
3760                        *self = TcpSocket::SrcPort(fidl::new_empty!(BoundPort, D));
3761                    }
3762                    #[allow(irrefutable_let_patterns)]
3763                    if let TcpSocket::SrcPort(ref mut val) = self {
3764                        fidl::decode!(BoundPort, D, val, decoder, _inner_offset, depth)?;
3765                    } else {
3766                        unreachable!()
3767                    }
3768                }
3769                3 => {
3770                    #[allow(irrefutable_let_patterns)]
3771                    if let TcpSocket::DstPort(_) = self {
3772                        // Do nothing, read the value into the object
3773                    } else {
3774                        // Initialize `self` to the right variant
3775                        *self = TcpSocket::DstPort(fidl::new_empty!(BoundPort, D));
3776                    }
3777                    #[allow(irrefutable_let_patterns)]
3778                    if let TcpSocket::DstPort(ref mut val) = self {
3779                        fidl::decode!(BoundPort, D, val, decoder, _inner_offset, depth)?;
3780                    } else {
3781                        unreachable!()
3782                    }
3783                }
3784                4 => {
3785                    #[allow(irrefutable_let_patterns)]
3786                    if let TcpSocket::States(_) = self {
3787                        // Do nothing, read the value into the object
3788                    } else {
3789                        // Initialize `self` to the right variant
3790                        *self = TcpSocket::States(fidl::new_empty!(TcpState, D));
3791                    }
3792                    #[allow(irrefutable_let_patterns)]
3793                    if let TcpSocket::States(ref mut val) = self {
3794                        fidl::decode!(TcpState, D, val, decoder, _inner_offset, depth)?;
3795                    } else {
3796                        unreachable!()
3797                    }
3798                }
3799                #[allow(deprecated)]
3800                ordinal => {
3801                    for _ in 0..num_handles {
3802                        decoder.drop_next_handle()?;
3803                    }
3804                    *self = TcpSocket::__SourceBreaking { unknown_ordinal: ordinal };
3805                }
3806            }
3807            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
3808                return Err(fidl::Error::InvalidNumBytesInEnvelope);
3809            }
3810            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3811                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3812            }
3813            Ok(())
3814        }
3815    }
3816
3817    impl fidl::encoding::ValueTypeMarker for UdpSocket {
3818        type Borrowed<'a> = &'a Self;
3819        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3820            value
3821        }
3822    }
3823
3824    unsafe impl fidl::encoding::TypeMarker for UdpSocket {
3825        type Owned = Self;
3826
3827        #[inline(always)]
3828        fn inline_align(_context: fidl::encoding::Context) -> usize {
3829            8
3830        }
3831
3832        #[inline(always)]
3833        fn inline_size(_context: fidl::encoding::Context) -> usize {
3834            16
3835        }
3836    }
3837
3838    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<UdpSocket, D>
3839        for &UdpSocket
3840    {
3841        #[inline]
3842        unsafe fn encode(
3843            self,
3844            encoder: &mut fidl::encoding::Encoder<'_, D>,
3845            offset: usize,
3846            _depth: fidl::encoding::Depth,
3847        ) -> fidl::Result<()> {
3848            encoder.debug_check_bounds::<UdpSocket>(offset);
3849            encoder.write_num::<u64>(self.ordinal(), offset);
3850            match self {
3851                UdpSocket::Empty(ref val) => fidl::encoding::encode_in_envelope::<Empty, D>(
3852                    <Empty as fidl::encoding::ValueTypeMarker>::borrow(val),
3853                    encoder,
3854                    offset + 8,
3855                    _depth,
3856                ),
3857                UdpSocket::SrcPort(ref val) => fidl::encoding::encode_in_envelope::<BoundPort, D>(
3858                    <BoundPort as fidl::encoding::ValueTypeMarker>::borrow(val),
3859                    encoder,
3860                    offset + 8,
3861                    _depth,
3862                ),
3863                UdpSocket::DstPort(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::States(ref val) => fidl::encoding::encode_in_envelope::<UdpState, D>(
3870                    <UdpState as fidl::encoding::ValueTypeMarker>::borrow(val),
3871                    encoder,
3872                    offset + 8,
3873                    _depth,
3874                ),
3875                UdpSocket::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
3876            }
3877        }
3878    }
3879
3880    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for UdpSocket {
3881        #[inline(always)]
3882        fn new_empty() -> Self {
3883            Self::__SourceBreaking { unknown_ordinal: 0 }
3884        }
3885
3886        #[inline]
3887        unsafe fn decode(
3888            &mut self,
3889            decoder: &mut fidl::encoding::Decoder<'_, D>,
3890            offset: usize,
3891            mut depth: fidl::encoding::Depth,
3892        ) -> fidl::Result<()> {
3893            decoder.debug_check_bounds::<Self>(offset);
3894            #[allow(unused_variables)]
3895            let next_out_of_line = decoder.next_out_of_line();
3896            let handles_before = decoder.remaining_handles();
3897            let (ordinal, inlined, num_bytes, num_handles) =
3898                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
3899
3900            let member_inline_size = match ordinal {
3901                1 => <Empty as fidl::encoding::TypeMarker>::inline_size(decoder.context),
3902                2 => <BoundPort as fidl::encoding::TypeMarker>::inline_size(decoder.context),
3903                3 => <BoundPort as fidl::encoding::TypeMarker>::inline_size(decoder.context),
3904                4 => <UdpState as fidl::encoding::TypeMarker>::inline_size(decoder.context),
3905                0 => return Err(fidl::Error::UnknownUnionTag),
3906                _ => num_bytes as usize,
3907            };
3908
3909            if inlined != (member_inline_size <= 4) {
3910                return Err(fidl::Error::InvalidInlineBitInEnvelope);
3911            }
3912            let _inner_offset;
3913            if inlined {
3914                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
3915                _inner_offset = offset + 8;
3916            } else {
3917                depth.increment()?;
3918                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3919            }
3920            match ordinal {
3921                1 => {
3922                    #[allow(irrefutable_let_patterns)]
3923                    if let UdpSocket::Empty(_) = self {
3924                        // Do nothing, read the value into the object
3925                    } else {
3926                        // Initialize `self` to the right variant
3927                        *self = UdpSocket::Empty(fidl::new_empty!(Empty, D));
3928                    }
3929                    #[allow(irrefutable_let_patterns)]
3930                    if let UdpSocket::Empty(ref mut val) = self {
3931                        fidl::decode!(Empty, D, val, decoder, _inner_offset, depth)?;
3932                    } else {
3933                        unreachable!()
3934                    }
3935                }
3936                2 => {
3937                    #[allow(irrefutable_let_patterns)]
3938                    if let UdpSocket::SrcPort(_) = self {
3939                        // Do nothing, read the value into the object
3940                    } else {
3941                        // Initialize `self` to the right variant
3942                        *self = UdpSocket::SrcPort(fidl::new_empty!(BoundPort, D));
3943                    }
3944                    #[allow(irrefutable_let_patterns)]
3945                    if let UdpSocket::SrcPort(ref mut val) = self {
3946                        fidl::decode!(BoundPort, D, val, decoder, _inner_offset, depth)?;
3947                    } else {
3948                        unreachable!()
3949                    }
3950                }
3951                3 => {
3952                    #[allow(irrefutable_let_patterns)]
3953                    if let UdpSocket::DstPort(_) = self {
3954                        // Do nothing, read the value into the object
3955                    } else {
3956                        // Initialize `self` to the right variant
3957                        *self = UdpSocket::DstPort(fidl::new_empty!(BoundPort, D));
3958                    }
3959                    #[allow(irrefutable_let_patterns)]
3960                    if let UdpSocket::DstPort(ref mut val) = self {
3961                        fidl::decode!(BoundPort, D, val, decoder, _inner_offset, depth)?;
3962                    } else {
3963                        unreachable!()
3964                    }
3965                }
3966                4 => {
3967                    #[allow(irrefutable_let_patterns)]
3968                    if let UdpSocket::States(_) = self {
3969                        // Do nothing, read the value into the object
3970                    } else {
3971                        // Initialize `self` to the right variant
3972                        *self = UdpSocket::States(fidl::new_empty!(UdpState, D));
3973                    }
3974                    #[allow(irrefutable_let_patterns)]
3975                    if let UdpSocket::States(ref mut val) = self {
3976                        fidl::decode!(UdpState, D, val, decoder, _inner_offset, depth)?;
3977                    } else {
3978                        unreachable!()
3979                    }
3980                }
3981                #[allow(deprecated)]
3982                ordinal => {
3983                    for _ in 0..num_handles {
3984                        decoder.drop_next_handle()?;
3985                    }
3986                    *self = UdpSocket::__SourceBreaking { unknown_ordinal: ordinal };
3987                }
3988            }
3989            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
3990                return Err(fidl::Error::InvalidNumBytesInEnvelope);
3991            }
3992            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3993                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3994            }
3995            Ok(())
3996        }
3997    }
3998}