Skip to main content

fidl_fuchsia_net_sockets_common/
fidl_fuchsia_net_sockets_common.rs

1// WARNING: This file is machine generated by fidlgen.
2
3#![warn(clippy::all)]
4#![allow(unused_parens, unused_mut, unused_imports, nonstandard_style)]
5
6use bitflags::bitflags;
7use fidl::encoding::{MessageBufFor, ProxyChannelBox, ResourceDialect};
8use futures::future::{self, MaybeDone, TryFutureExt};
9use zx_status;
10
11/// The largest number of results that can be returned in one call to
12/// `IpIterator.Next` or `DestructionWatcher.Watch`.
13///
14/// This limit is calculated to fit the maximum number of items into a single
15/// 64 KiB Zircon channel message. In the current FIDL wire format, the fixed
16/// overhead of the `IpIterator.Next()` response is 40 bytes, and the worst-case
17/// size of a single `IpSocketState` is 706 bytes, so we selected the maximum N
18/// where 40 + N * 706 <= 65535.
19pub const MAX_IP_SOCKET_BATCH_SIZE: u32 = 92;
20
21/// The maximum number of `IpSocketMatcher`s that can be specified in a request.
22///
23/// The theoretical maximum imposed by the 64 KiB Zircon channel message limit
24/// is 629 (64 bytes of fixed overhead and 104 bytes per `IpSocketMatcher`).
25/// However, as a practical limit to avoid unreasonable numbers of matchers.
26pub const MAX_IP_SOCKET_MATCHERS: u32 = 128;
27
28bitflags! {
29    #[derive(Clone, Copy, Debug, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
30    pub struct Extensions: u32 {
31        /// Populates the `tcp_info` field on returned TCP sockets.
32        const TCP_INFO = 1;
33    }
34}
35
36impl Extensions {
37    #[inline(always)]
38    pub fn from_bits_allow_unknown(bits: u32) -> Self {
39        Self::from_bits_retain(bits)
40    }
41
42    #[inline(always)]
43    pub fn has_unknown_bits(&self) -> bool {
44        self.get_unknown_bits() != 0
45    }
46
47    #[inline(always)]
48    pub fn get_unknown_bits(&self) -> u32 {
49        self.bits() & !Self::all().bits()
50    }
51}
52
53#[derive(Clone, Debug, PartialEq)]
54pub struct DestructionWatcherWatchResponse {
55    pub sockets: Vec<IpSocketState>,
56}
57
58impl fidl::Persistable for DestructionWatcherWatchResponse {}
59
60#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
61#[repr(C)]
62pub struct DisconnectIpResponse {
63    /// The number of disconnected sockets.
64    pub disconnected: u32,
65}
66
67impl fidl::Persistable for DisconnectIpResponse {}
68
69#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
70pub struct Empty;
71
72impl fidl::Persistable for Empty {}
73
74/// Error information for a matcher in a request.
75#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
76#[repr(C)]
77pub struct InvalidMatcher {
78    /// The index of the matcher in the request that caused the error.
79    pub index: u32,
80}
81
82impl fidl::Persistable for InvalidMatcher {}
83
84#[derive(Clone, Debug, PartialEq)]
85pub struct IpIteratorNextResponse {
86    /// The sockets for this batch.
87    ///
88    /// Empty iff has_more is false.
89    pub sockets: Vec<IpSocketState>,
90    /// Whether there are more results available. the server immediately
91    /// closes its end of the channel after yielding a response with
92    /// `has_more = false`.
93    pub has_more: bool,
94}
95
96impl fidl::Persistable for IpIteratorNextResponse {}
97
98#[derive(Clone, Debug, Default, PartialEq)]
99pub struct ControlDisconnectIpRequest {
100    /// Sockets matching all matchers will be disconnected (see above).
101    ///
102    /// More information on the semantics of the matchers can be found in
103    /// [`fuchsia.net.sockets.IpSocketMatcher`].
104    ///
105    /// Required.
106    pub matchers: Option<Vec<IpSocketMatcher>>,
107    #[doc(hidden)]
108    pub __source_breaking: fidl::marker::SourceBreaking,
109}
110
111impl fidl::Persistable for ControlDisconnectIpRequest {}
112
113/// The state for each individual socket returned from `IpIterator.Next()`.
114#[derive(Clone, Debug, Default, PartialEq)]
115pub struct IpSocketState {
116    /// The address family of the socket's addresses. This, `src_addr`, and
117    /// `dst_addr` are guaranteed to be the same address family.
118    ///
119    /// Required.
120    pub family: Option<fidl_fuchsia_net_common::IpVersion>,
121    /// The source address of the socket.
122    ///
123    /// Present if the socket is bound to a local address.
124    pub src_addr: Option<fidl_fuchsia_net_common::IpAddress>,
125    /// The destination address of the socket.
126    ///
127    /// Present if the socket is connected.
128    pub dst_addr: Option<fidl_fuchsia_net_common::IpAddress>,
129    /// The cookie of the socket, which is unique during this boot. May be
130    /// used in subsequent requests in addition to the tuple to identify this
131    /// particular socket, even if the tuple is reused.
132    ///
133    /// Required.
134    pub cookie: Option<u64>,
135    /// All of the marks on the socket.
136    ///
137    /// Required.
138    pub marks: Option<fidl_fuchsia_net_common::Marks>,
139    /// Transport protocol-level information about the socket.
140    ///
141    /// Required.
142    pub transport: Option<IpSocketTransportState>,
143    #[doc(hidden)]
144    pub __source_breaking: fidl::marker::SourceBreaking,
145}
146
147impl fidl::Persistable for IpSocketState {}
148
149#[derive(Clone, Debug, Default, PartialEq)]
150pub struct IpSocketTcpState {
151    /// The source port of the TCP socket.
152    ///
153    /// Present if the socket is bound to a local port.
154    pub src_port: Option<u16>,
155    /// The destination port of the TCP socket.
156    ///
157    /// Present if the socket is connected.
158    pub dst_port: Option<u16>,
159    /// The current TCP state machine state of the socket.
160    ///
161    /// Required.
162    pub state: Option<fidl_fuchsia_net_tcp_common::State>,
163    /// Extended TCP state.
164    ///
165    /// Present if the `TCP_INFO` extension is specified in the request.
166    pub tcp_info: Option<fidl_fuchsia_net_tcp_common::Info>,
167    #[doc(hidden)]
168    pub __source_breaking: fidl::marker::SourceBreaking,
169}
170
171impl fidl::Persistable for IpSocketTcpState {}
172
173#[derive(Clone, Debug, Default, PartialEq)]
174pub struct IpSocketUdpState {
175    /// The source port of the UDP socket.
176    ///
177    /// Present if the socket is bound to a local port.
178    pub src_port: Option<u16>,
179    /// The destination port of the UDP socket.
180    ///
181    /// Present if the socket is connected.
182    pub dst_port: Option<u16>,
183    /// Pseudo-state machine state for the UDP socket.
184    ///
185    /// Required.
186    pub state: Option<fidl_fuchsia_net_udp_common::State>,
187    #[doc(hidden)]
188    pub __source_breaking: fidl::marker::SourceBreaking,
189}
190
191impl fidl::Persistable for IpSocketUdpState {}
192
193#[derive(Clone, Debug)]
194pub enum DisconnectIpResult {
195    /// The request was valid.
196    Ok(DisconnectIpResponse),
197    /// A matcher in the request was invalid.
198    ///
199    /// NOTE: Only the first matcher error encountered is returned.
200    InvalidMatcher(InvalidMatcher),
201    /// The specified set of matchers would disconnect all sockets. This
202    /// indicates a bug in the request.
203    UnconstrainedMatchers(Empty),
204    #[doc(hidden)]
205    __SourceBreaking { unknown_ordinal: u64 },
206}
207
208/// Pattern that matches an unknown `DisconnectIpResult` member.
209#[macro_export]
210macro_rules! DisconnectIpResultUnknown {
211    () => {
212        _
213    };
214}
215
216// Custom PartialEq so that unknown variants are not equal to themselves.
217impl PartialEq for DisconnectIpResult {
218    fn eq(&self, other: &Self) -> bool {
219        match (self, other) {
220            (Self::Ok(x), Self::Ok(y)) => *x == *y,
221            (Self::InvalidMatcher(x), Self::InvalidMatcher(y)) => *x == *y,
222            (Self::UnconstrainedMatchers(x), Self::UnconstrainedMatchers(y)) => *x == *y,
223            _ => false,
224        }
225    }
226}
227
228impl DisconnectIpResult {
229    #[inline]
230    pub fn ordinal(&self) -> u64 {
231        match *self {
232            Self::Ok(_) => 1,
233            Self::InvalidMatcher(_) => 2,
234            Self::UnconstrainedMatchers(_) => 3,
235            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
236        }
237    }
238
239    #[inline]
240    pub fn unknown_variant_for_testing() -> Self {
241        Self::__SourceBreaking { unknown_ordinal: 0 }
242    }
243
244    #[inline]
245    pub fn is_unknown(&self) -> bool {
246        match self {
247            Self::__SourceBreaking { .. } => true,
248            _ => false,
249        }
250    }
251}
252
253impl fidl::Persistable for DisconnectIpResult {}
254
255/// The top-level socket matcher for use in diagnostics protocols.
256#[derive(Clone, Debug)]
257pub enum IpSocketMatcher {
258    /// Matches only a specific IP version.
259    Family(fidl_fuchsia_net_common::IpVersion),
260    /// Matches the source address of the socket.
261    SrcAddr(fidl_fuchsia_net_matchers_common::BoundAddress),
262    /// Matches the address of the socket.
263    DstAddr(fidl_fuchsia_net_matchers_common::BoundAddress),
264    /// Matches transport-level information for the socket.
265    Proto(fidl_fuchsia_net_matchers_common::SocketTransportProtocol),
266    /// Matches the network interface the socket was bound to (e.g. using
267    /// `SetBindToDevice`).
268    BoundInterface(fidl_fuchsia_net_matchers_common::BoundInterface),
269    /// Matches the cookie of the socket.
270    Cookie(fidl_fuchsia_net_matchers_common::SocketCookie),
271    /// Matches a single mark on the socket.
272    Mark(fidl_fuchsia_net_matchers_common::MarkInDomain),
273    #[doc(hidden)]
274    __SourceBreaking { unknown_ordinal: u64 },
275}
276
277/// Pattern that matches an unknown `IpSocketMatcher` member.
278#[macro_export]
279macro_rules! IpSocketMatcherUnknown {
280    () => {
281        _
282    };
283}
284
285// Custom PartialEq so that unknown variants are not equal to themselves.
286impl PartialEq for IpSocketMatcher {
287    fn eq(&self, other: &Self) -> bool {
288        match (self, other) {
289            (Self::Family(x), Self::Family(y)) => *x == *y,
290            (Self::SrcAddr(x), Self::SrcAddr(y)) => *x == *y,
291            (Self::DstAddr(x), Self::DstAddr(y)) => *x == *y,
292            (Self::Proto(x), Self::Proto(y)) => *x == *y,
293            (Self::BoundInterface(x), Self::BoundInterface(y)) => *x == *y,
294            (Self::Cookie(x), Self::Cookie(y)) => *x == *y,
295            (Self::Mark(x), Self::Mark(y)) => *x == *y,
296            _ => false,
297        }
298    }
299}
300
301impl IpSocketMatcher {
302    #[inline]
303    pub fn ordinal(&self) -> u64 {
304        match *self {
305            Self::Family(_) => 1,
306            Self::SrcAddr(_) => 2,
307            Self::DstAddr(_) => 3,
308            Self::Proto(_) => 4,
309            Self::BoundInterface(_) => 5,
310            Self::Cookie(_) => 6,
311            Self::Mark(_) => 7,
312            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
313        }
314    }
315
316    #[inline]
317    pub fn unknown_variant_for_testing() -> Self {
318        Self::__SourceBreaking { unknown_ordinal: 0 }
319    }
320
321    #[inline]
322    pub fn is_unknown(&self) -> bool {
323        match self {
324            Self::__SourceBreaking { .. } => true,
325            _ => false,
326        }
327    }
328}
329
330impl fidl::Persistable for IpSocketMatcher {}
331
332#[derive(Clone, Debug)]
333pub enum IpSocketTransportState {
334    Tcp(IpSocketTcpState),
335    Udp(IpSocketUdpState),
336    #[doc(hidden)]
337    __SourceBreaking {
338        unknown_ordinal: u64,
339    },
340}
341
342/// Pattern that matches an unknown `IpSocketTransportState` member.
343#[macro_export]
344macro_rules! IpSocketTransportStateUnknown {
345    () => {
346        _
347    };
348}
349
350// Custom PartialEq so that unknown variants are not equal to themselves.
351impl PartialEq for IpSocketTransportState {
352    fn eq(&self, other: &Self) -> bool {
353        match (self, other) {
354            (Self::Tcp(x), Self::Tcp(y)) => *x == *y,
355            (Self::Udp(x), Self::Udp(y)) => *x == *y,
356            _ => false,
357        }
358    }
359}
360
361impl IpSocketTransportState {
362    #[inline]
363    pub fn ordinal(&self) -> u64 {
364        match *self {
365            Self::Tcp(_) => 1,
366            Self::Udp(_) => 2,
367            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
368        }
369    }
370
371    #[inline]
372    pub fn unknown_variant_for_testing() -> Self {
373        Self::__SourceBreaking { unknown_ordinal: 0 }
374    }
375
376    #[inline]
377    pub fn is_unknown(&self) -> bool {
378        match self {
379            Self::__SourceBreaking { .. } => true,
380            _ => false,
381        }
382    }
383}
384
385impl fidl::Persistable for IpSocketTransportState {}
386
387#[derive(Clone, Debug)]
388pub enum IterateIpResult {
389    /// The request was valid.
390    Ok(Empty),
391    /// A matcher in the request was invalid.
392    ///
393    /// NOTE: Only the first matcher error encountered is returned.
394    InvalidMatcher(InvalidMatcher),
395    #[doc(hidden)]
396    __SourceBreaking { unknown_ordinal: u64 },
397}
398
399/// Pattern that matches an unknown `IterateIpResult` member.
400#[macro_export]
401macro_rules! IterateIpResultUnknown {
402    () => {
403        _
404    };
405}
406
407// Custom PartialEq so that unknown variants are not equal to themselves.
408impl PartialEq for IterateIpResult {
409    fn eq(&self, other: &Self) -> bool {
410        match (self, other) {
411            (Self::Ok(x), Self::Ok(y)) => *x == *y,
412            (Self::InvalidMatcher(x), Self::InvalidMatcher(y)) => *x == *y,
413            _ => false,
414        }
415    }
416}
417
418impl IterateIpResult {
419    #[inline]
420    pub fn ordinal(&self) -> u64 {
421        match *self {
422            Self::Ok(_) => 1,
423            Self::InvalidMatcher(_) => 2,
424            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
425        }
426    }
427
428    #[inline]
429    pub fn unknown_variant_for_testing() -> Self {
430        Self::__SourceBreaking { unknown_ordinal: 0 }
431    }
432
433    #[inline]
434    pub fn is_unknown(&self) -> bool {
435        match self {
436            Self::__SourceBreaking { .. } => true,
437            _ => false,
438        }
439    }
440}
441
442impl fidl::Persistable for IterateIpResult {}
443
444pub mod control_ordinals {
445    pub const DISCONNECT_IP: u64 = 0xbdaa66fbb4241a4;
446}
447
448pub mod destruction_watcher_ordinals {
449    pub const WATCH: u64 = 0x7ce86d7c39821f10;
450}
451
452pub mod diagnostics_ordinals {
453    pub const ITERATE_IP: u64 = 0x7b05425e48d07605;
454    pub const GET_DESTRUCTION_WATCHER: u64 = 0x4b5d70a35a21964f;
455}
456
457pub mod ip_iterator_ordinals {
458    pub const NEXT: u64 = 0x3d50aa08ce641a6b;
459}
460
461mod internal {
462    use super::*;
463    unsafe impl fidl::encoding::TypeMarker for Extensions {
464        type Owned = Self;
465
466        #[inline(always)]
467        fn inline_align(_context: fidl::encoding::Context) -> usize {
468            4
469        }
470
471        #[inline(always)]
472        fn inline_size(_context: fidl::encoding::Context) -> usize {
473            4
474        }
475    }
476
477    impl fidl::encoding::ValueTypeMarker for Extensions {
478        type Borrowed<'a> = Self;
479        #[inline(always)]
480        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
481            *value
482        }
483    }
484
485    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for Extensions {
486        #[inline]
487        unsafe fn encode(
488            self,
489            encoder: &mut fidl::encoding::Encoder<'_, D>,
490            offset: usize,
491            _depth: fidl::encoding::Depth,
492        ) -> fidl::Result<()> {
493            encoder.debug_check_bounds::<Self>(offset);
494            encoder.write_num(self.bits(), offset);
495            Ok(())
496        }
497    }
498
499    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Extensions {
500        #[inline(always)]
501        fn new_empty() -> Self {
502            Self::empty()
503        }
504
505        #[inline]
506        unsafe fn decode(
507            &mut self,
508            decoder: &mut fidl::encoding::Decoder<'_, D>,
509            offset: usize,
510            _depth: fidl::encoding::Depth,
511        ) -> fidl::Result<()> {
512            decoder.debug_check_bounds::<Self>(offset);
513            let prim = decoder.read_num::<u32>(offset);
514            *self = Self::from_bits_allow_unknown(prim);
515            Ok(())
516        }
517    }
518
519    impl fidl::encoding::ValueTypeMarker for DestructionWatcherWatchResponse {
520        type Borrowed<'a> = &'a Self;
521        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
522            value
523        }
524    }
525
526    unsafe impl fidl::encoding::TypeMarker for DestructionWatcherWatchResponse {
527        type Owned = Self;
528
529        #[inline(always)]
530        fn inline_align(_context: fidl::encoding::Context) -> usize {
531            8
532        }
533
534        #[inline(always)]
535        fn inline_size(_context: fidl::encoding::Context) -> usize {
536            16
537        }
538    }
539
540    unsafe impl<D: fidl::encoding::ResourceDialect>
541        fidl::encoding::Encode<DestructionWatcherWatchResponse, D>
542        for &DestructionWatcherWatchResponse
543    {
544        #[inline]
545        unsafe fn encode(
546            self,
547            encoder: &mut fidl::encoding::Encoder<'_, D>,
548            offset: usize,
549            _depth: fidl::encoding::Depth,
550        ) -> fidl::Result<()> {
551            encoder.debug_check_bounds::<DestructionWatcherWatchResponse>(offset);
552            // Delegate to tuple encoding.
553            fidl::encoding::Encode::<DestructionWatcherWatchResponse, D>::encode(
554                (
555                    <fidl::encoding::Vector<IpSocketState, 92> as fidl::encoding::ValueTypeMarker>::borrow(&self.sockets),
556                ),
557                encoder, offset, _depth
558            )
559        }
560    }
561    unsafe impl<
562        D: fidl::encoding::ResourceDialect,
563        T0: fidl::encoding::Encode<fidl::encoding::Vector<IpSocketState, 92>, D>,
564    > fidl::encoding::Encode<DestructionWatcherWatchResponse, D> for (T0,)
565    {
566        #[inline]
567        unsafe fn encode(
568            self,
569            encoder: &mut fidl::encoding::Encoder<'_, D>,
570            offset: usize,
571            depth: fidl::encoding::Depth,
572        ) -> fidl::Result<()> {
573            encoder.debug_check_bounds::<DestructionWatcherWatchResponse>(offset);
574            // Zero out padding regions. There's no need to apply masks
575            // because the unmasked parts will be overwritten by fields.
576            // Write the fields.
577            self.0.encode(encoder, offset + 0, depth)?;
578            Ok(())
579        }
580    }
581
582    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
583        for DestructionWatcherWatchResponse
584    {
585        #[inline(always)]
586        fn new_empty() -> Self {
587            Self { sockets: fidl::new_empty!(fidl::encoding::Vector<IpSocketState, 92>, D) }
588        }
589
590        #[inline]
591        unsafe fn decode(
592            &mut self,
593            decoder: &mut fidl::encoding::Decoder<'_, D>,
594            offset: usize,
595            _depth: fidl::encoding::Depth,
596        ) -> fidl::Result<()> {
597            decoder.debug_check_bounds::<Self>(offset);
598            // Verify that padding bytes are zero.
599            fidl::decode!(fidl::encoding::Vector<IpSocketState, 92>, D, &mut self.sockets, decoder, offset + 0, _depth)?;
600            Ok(())
601        }
602    }
603
604    impl fidl::encoding::ValueTypeMarker for DisconnectIpResponse {
605        type Borrowed<'a> = &'a Self;
606        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
607            value
608        }
609    }
610
611    unsafe impl fidl::encoding::TypeMarker for DisconnectIpResponse {
612        type Owned = Self;
613
614        #[inline(always)]
615        fn inline_align(_context: fidl::encoding::Context) -> usize {
616            4
617        }
618
619        #[inline(always)]
620        fn inline_size(_context: fidl::encoding::Context) -> usize {
621            4
622        }
623        #[inline(always)]
624        fn encode_is_copy() -> bool {
625            true
626        }
627
628        #[inline(always)]
629        fn decode_is_copy() -> bool {
630            true
631        }
632    }
633
634    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<DisconnectIpResponse, D>
635        for &DisconnectIpResponse
636    {
637        #[inline]
638        unsafe fn encode(
639            self,
640            encoder: &mut fidl::encoding::Encoder<'_, D>,
641            offset: usize,
642            _depth: fidl::encoding::Depth,
643        ) -> fidl::Result<()> {
644            encoder.debug_check_bounds::<DisconnectIpResponse>(offset);
645            unsafe {
646                // Copy the object into the buffer.
647                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
648                (buf_ptr as *mut DisconnectIpResponse)
649                    .write_unaligned((self as *const DisconnectIpResponse).read());
650                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
651                // done second because the memcpy will write garbage to these bytes.
652            }
653            Ok(())
654        }
655    }
656    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u32, D>>
657        fidl::encoding::Encode<DisconnectIpResponse, D> for (T0,)
658    {
659        #[inline]
660        unsafe fn encode(
661            self,
662            encoder: &mut fidl::encoding::Encoder<'_, D>,
663            offset: usize,
664            depth: fidl::encoding::Depth,
665        ) -> fidl::Result<()> {
666            encoder.debug_check_bounds::<DisconnectIpResponse>(offset);
667            // Zero out padding regions. There's no need to apply masks
668            // because the unmasked parts will be overwritten by fields.
669            // Write the fields.
670            self.0.encode(encoder, offset + 0, depth)?;
671            Ok(())
672        }
673    }
674
675    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for DisconnectIpResponse {
676        #[inline(always)]
677        fn new_empty() -> Self {
678            Self { disconnected: fidl::new_empty!(u32, D) }
679        }
680
681        #[inline]
682        unsafe fn decode(
683            &mut self,
684            decoder: &mut fidl::encoding::Decoder<'_, D>,
685            offset: usize,
686            _depth: fidl::encoding::Depth,
687        ) -> fidl::Result<()> {
688            decoder.debug_check_bounds::<Self>(offset);
689            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
690            // Verify that padding bytes are zero.
691            // Copy from the buffer into the object.
692            unsafe {
693                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
694            }
695            Ok(())
696        }
697    }
698
699    impl fidl::encoding::ValueTypeMarker for Empty {
700        type Borrowed<'a> = &'a Self;
701        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
702            value
703        }
704    }
705
706    unsafe impl fidl::encoding::TypeMarker for Empty {
707        type Owned = Self;
708
709        #[inline(always)]
710        fn inline_align(_context: fidl::encoding::Context) -> usize {
711            1
712        }
713
714        #[inline(always)]
715        fn inline_size(_context: fidl::encoding::Context) -> usize {
716            1
717        }
718    }
719
720    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Empty, D> for &Empty {
721        #[inline]
722        unsafe fn encode(
723            self,
724            encoder: &mut fidl::encoding::Encoder<'_, D>,
725            offset: usize,
726            _depth: fidl::encoding::Depth,
727        ) -> fidl::Result<()> {
728            encoder.debug_check_bounds::<Empty>(offset);
729            encoder.write_num(0u8, offset);
730            Ok(())
731        }
732    }
733
734    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Empty {
735        #[inline(always)]
736        fn new_empty() -> Self {
737            Self
738        }
739
740        #[inline]
741        unsafe fn decode(
742            &mut self,
743            decoder: &mut fidl::encoding::Decoder<'_, D>,
744            offset: usize,
745            _depth: fidl::encoding::Depth,
746        ) -> fidl::Result<()> {
747            decoder.debug_check_bounds::<Self>(offset);
748            match decoder.read_num::<u8>(offset) {
749                0 => Ok(()),
750                _ => Err(fidl::Error::Invalid),
751            }
752        }
753    }
754
755    impl fidl::encoding::ValueTypeMarker for InvalidMatcher {
756        type Borrowed<'a> = &'a Self;
757        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
758            value
759        }
760    }
761
762    unsafe impl fidl::encoding::TypeMarker for InvalidMatcher {
763        type Owned = Self;
764
765        #[inline(always)]
766        fn inline_align(_context: fidl::encoding::Context) -> usize {
767            4
768        }
769
770        #[inline(always)]
771        fn inline_size(_context: fidl::encoding::Context) -> usize {
772            4
773        }
774        #[inline(always)]
775        fn encode_is_copy() -> bool {
776            true
777        }
778
779        #[inline(always)]
780        fn decode_is_copy() -> bool {
781            true
782        }
783    }
784
785    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<InvalidMatcher, D>
786        for &InvalidMatcher
787    {
788        #[inline]
789        unsafe fn encode(
790            self,
791            encoder: &mut fidl::encoding::Encoder<'_, D>,
792            offset: usize,
793            _depth: fidl::encoding::Depth,
794        ) -> fidl::Result<()> {
795            encoder.debug_check_bounds::<InvalidMatcher>(offset);
796            unsafe {
797                // Copy the object into the buffer.
798                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
799                (buf_ptr as *mut InvalidMatcher)
800                    .write_unaligned((self as *const InvalidMatcher).read());
801                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
802                // done second because the memcpy will write garbage to these bytes.
803            }
804            Ok(())
805        }
806    }
807    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u32, D>>
808        fidl::encoding::Encode<InvalidMatcher, D> for (T0,)
809    {
810        #[inline]
811        unsafe fn encode(
812            self,
813            encoder: &mut fidl::encoding::Encoder<'_, D>,
814            offset: usize,
815            depth: fidl::encoding::Depth,
816        ) -> fidl::Result<()> {
817            encoder.debug_check_bounds::<InvalidMatcher>(offset);
818            // Zero out padding regions. There's no need to apply masks
819            // because the unmasked parts will be overwritten by fields.
820            // Write the fields.
821            self.0.encode(encoder, offset + 0, depth)?;
822            Ok(())
823        }
824    }
825
826    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for InvalidMatcher {
827        #[inline(always)]
828        fn new_empty() -> Self {
829            Self { index: fidl::new_empty!(u32, D) }
830        }
831
832        #[inline]
833        unsafe fn decode(
834            &mut self,
835            decoder: &mut fidl::encoding::Decoder<'_, D>,
836            offset: usize,
837            _depth: fidl::encoding::Depth,
838        ) -> fidl::Result<()> {
839            decoder.debug_check_bounds::<Self>(offset);
840            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
841            // Verify that padding bytes are zero.
842            // Copy from the buffer into the object.
843            unsafe {
844                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
845            }
846            Ok(())
847        }
848    }
849
850    impl fidl::encoding::ValueTypeMarker for IpIteratorNextResponse {
851        type Borrowed<'a> = &'a Self;
852        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
853            value
854        }
855    }
856
857    unsafe impl fidl::encoding::TypeMarker for IpIteratorNextResponse {
858        type Owned = Self;
859
860        #[inline(always)]
861        fn inline_align(_context: fidl::encoding::Context) -> usize {
862            8
863        }
864
865        #[inline(always)]
866        fn inline_size(_context: fidl::encoding::Context) -> usize {
867            24
868        }
869    }
870
871    unsafe impl<D: fidl::encoding::ResourceDialect>
872        fidl::encoding::Encode<IpIteratorNextResponse, D> for &IpIteratorNextResponse
873    {
874        #[inline]
875        unsafe fn encode(
876            self,
877            encoder: &mut fidl::encoding::Encoder<'_, D>,
878            offset: usize,
879            _depth: fidl::encoding::Depth,
880        ) -> fidl::Result<()> {
881            encoder.debug_check_bounds::<IpIteratorNextResponse>(offset);
882            // Delegate to tuple encoding.
883            fidl::encoding::Encode::<IpIteratorNextResponse, D>::encode(
884                (
885                    <fidl::encoding::Vector<IpSocketState, 92> as fidl::encoding::ValueTypeMarker>::borrow(&self.sockets),
886                    <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.has_more),
887                ),
888                encoder, offset, _depth
889            )
890        }
891    }
892    unsafe impl<
893        D: fidl::encoding::ResourceDialect,
894        T0: fidl::encoding::Encode<fidl::encoding::Vector<IpSocketState, 92>, D>,
895        T1: fidl::encoding::Encode<bool, D>,
896    > fidl::encoding::Encode<IpIteratorNextResponse, D> for (T0, T1)
897    {
898        #[inline]
899        unsafe fn encode(
900            self,
901            encoder: &mut fidl::encoding::Encoder<'_, D>,
902            offset: usize,
903            depth: fidl::encoding::Depth,
904        ) -> fidl::Result<()> {
905            encoder.debug_check_bounds::<IpIteratorNextResponse>(offset);
906            // Zero out padding regions. There's no need to apply masks
907            // because the unmasked parts will be overwritten by fields.
908            unsafe {
909                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
910                (ptr as *mut u64).write_unaligned(0);
911            }
912            // Write the fields.
913            self.0.encode(encoder, offset + 0, depth)?;
914            self.1.encode(encoder, offset + 16, depth)?;
915            Ok(())
916        }
917    }
918
919    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
920        for IpIteratorNextResponse
921    {
922        #[inline(always)]
923        fn new_empty() -> Self {
924            Self {
925                sockets: fidl::new_empty!(fidl::encoding::Vector<IpSocketState, 92>, D),
926                has_more: fidl::new_empty!(bool, D),
927            }
928        }
929
930        #[inline]
931        unsafe fn decode(
932            &mut self,
933            decoder: &mut fidl::encoding::Decoder<'_, D>,
934            offset: usize,
935            _depth: fidl::encoding::Depth,
936        ) -> fidl::Result<()> {
937            decoder.debug_check_bounds::<Self>(offset);
938            // Verify that padding bytes are zero.
939            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
940            let padval = unsafe { (ptr as *const u64).read_unaligned() };
941            let mask = 0xffffffffffffff00u64;
942            let maskedval = padval & mask;
943            if maskedval != 0 {
944                return Err(fidl::Error::NonZeroPadding {
945                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
946                });
947            }
948            fidl::decode!(fidl::encoding::Vector<IpSocketState, 92>, D, &mut self.sockets, decoder, offset + 0, _depth)?;
949            fidl::decode!(bool, D, &mut self.has_more, decoder, offset + 16, _depth)?;
950            Ok(())
951        }
952    }
953
954    impl ControlDisconnectIpRequest {
955        #[inline(always)]
956        fn max_ordinal_present(&self) -> u64 {
957            if let Some(_) = self.matchers {
958                return 1;
959            }
960            0
961        }
962    }
963
964    impl fidl::encoding::ValueTypeMarker for ControlDisconnectIpRequest {
965        type Borrowed<'a> = &'a Self;
966        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
967            value
968        }
969    }
970
971    unsafe impl fidl::encoding::TypeMarker for ControlDisconnectIpRequest {
972        type Owned = Self;
973
974        #[inline(always)]
975        fn inline_align(_context: fidl::encoding::Context) -> usize {
976            8
977        }
978
979        #[inline(always)]
980        fn inline_size(_context: fidl::encoding::Context) -> usize {
981            16
982        }
983    }
984
985    unsafe impl<D: fidl::encoding::ResourceDialect>
986        fidl::encoding::Encode<ControlDisconnectIpRequest, D> for &ControlDisconnectIpRequest
987    {
988        unsafe fn encode(
989            self,
990            encoder: &mut fidl::encoding::Encoder<'_, D>,
991            offset: usize,
992            mut depth: fidl::encoding::Depth,
993        ) -> fidl::Result<()> {
994            encoder.debug_check_bounds::<ControlDisconnectIpRequest>(offset);
995            // Vector header
996            let max_ordinal: u64 = self.max_ordinal_present();
997            encoder.write_num(max_ordinal, offset);
998            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
999            // Calling encoder.out_of_line_offset(0) is not allowed.
1000            if max_ordinal == 0 {
1001                return Ok(());
1002            }
1003            depth.increment()?;
1004            let envelope_size = 8;
1005            let bytes_len = max_ordinal as usize * envelope_size;
1006            #[allow(unused_variables)]
1007            let offset = encoder.out_of_line_offset(bytes_len);
1008            let mut _prev_end_offset: usize = 0;
1009            if 1 > max_ordinal {
1010                return Ok(());
1011            }
1012
1013            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1014            // are envelope_size bytes.
1015            let cur_offset: usize = (1 - 1) * envelope_size;
1016
1017            // Zero reserved fields.
1018            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1019
1020            // Safety:
1021            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1022            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1023            //   envelope_size bytes, there is always sufficient room.
1024            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<IpSocketMatcher, 128>, D>(
1025            self.matchers.as_ref().map(<fidl::encoding::Vector<IpSocketMatcher, 128> as fidl::encoding::ValueTypeMarker>::borrow),
1026            encoder, offset + cur_offset, depth
1027        )?;
1028
1029            _prev_end_offset = cur_offset + envelope_size;
1030
1031            Ok(())
1032        }
1033    }
1034
1035    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1036        for ControlDisconnectIpRequest
1037    {
1038        #[inline(always)]
1039        fn new_empty() -> Self {
1040            Self::default()
1041        }
1042
1043        unsafe fn decode(
1044            &mut self,
1045            decoder: &mut fidl::encoding::Decoder<'_, D>,
1046            offset: usize,
1047            mut depth: fidl::encoding::Depth,
1048        ) -> fidl::Result<()> {
1049            decoder.debug_check_bounds::<Self>(offset);
1050            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
1051                None => return Err(fidl::Error::NotNullable),
1052                Some(len) => len,
1053            };
1054            // Calling decoder.out_of_line_offset(0) is not allowed.
1055            if len == 0 {
1056                return Ok(());
1057            };
1058            depth.increment()?;
1059            let envelope_size = 8;
1060            let bytes_len = len * envelope_size;
1061            let offset = decoder.out_of_line_offset(bytes_len)?;
1062            // Decode the envelope for each type.
1063            let mut _next_ordinal_to_read = 0;
1064            let mut next_offset = offset;
1065            let end_offset = offset + bytes_len;
1066            _next_ordinal_to_read += 1;
1067            if next_offset >= end_offset {
1068                return Ok(());
1069            }
1070
1071            // Decode unknown envelopes for gaps in ordinals.
1072            while _next_ordinal_to_read < 1 {
1073                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1074                _next_ordinal_to_read += 1;
1075                next_offset += envelope_size;
1076            }
1077
1078            let next_out_of_line = decoder.next_out_of_line();
1079            let handles_before = decoder.remaining_handles();
1080            if let Some((inlined, num_bytes, num_handles)) =
1081                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1082            {
1083                let member_inline_size = <fidl::encoding::Vector<IpSocketMatcher, 128> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1084                if inlined != (member_inline_size <= 4) {
1085                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1086                }
1087                let inner_offset;
1088                let mut inner_depth = depth.clone();
1089                if inlined {
1090                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1091                    inner_offset = next_offset;
1092                } else {
1093                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1094                    inner_depth.increment()?;
1095                }
1096                let val_ref = self.matchers.get_or_insert_with(
1097                    || fidl::new_empty!(fidl::encoding::Vector<IpSocketMatcher, 128>, D),
1098                );
1099                fidl::decode!(fidl::encoding::Vector<IpSocketMatcher, 128>, D, val_ref, decoder, inner_offset, inner_depth)?;
1100                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1101                {
1102                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
1103                }
1104                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1105                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1106                }
1107            }
1108
1109            next_offset += envelope_size;
1110
1111            // Decode the remaining unknown envelopes.
1112            while next_offset < end_offset {
1113                _next_ordinal_to_read += 1;
1114                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1115                next_offset += envelope_size;
1116            }
1117
1118            Ok(())
1119        }
1120    }
1121
1122    impl IpSocketState {
1123        #[inline(always)]
1124        fn max_ordinal_present(&self) -> u64 {
1125            if let Some(_) = self.transport {
1126                return 7;
1127            }
1128            if let Some(_) = self.marks {
1129                return 6;
1130            }
1131            if let Some(_) = self.cookie {
1132                return 5;
1133            }
1134            if let Some(_) = self.dst_addr {
1135                return 3;
1136            }
1137            if let Some(_) = self.src_addr {
1138                return 2;
1139            }
1140            if let Some(_) = self.family {
1141                return 1;
1142            }
1143            0
1144        }
1145    }
1146
1147    impl fidl::encoding::ValueTypeMarker for IpSocketState {
1148        type Borrowed<'a> = &'a Self;
1149        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1150            value
1151        }
1152    }
1153
1154    unsafe impl fidl::encoding::TypeMarker for IpSocketState {
1155        type Owned = Self;
1156
1157        #[inline(always)]
1158        fn inline_align(_context: fidl::encoding::Context) -> usize {
1159            8
1160        }
1161
1162        #[inline(always)]
1163        fn inline_size(_context: fidl::encoding::Context) -> usize {
1164            16
1165        }
1166    }
1167
1168    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<IpSocketState, D>
1169        for &IpSocketState
1170    {
1171        unsafe fn encode(
1172            self,
1173            encoder: &mut fidl::encoding::Encoder<'_, D>,
1174            offset: usize,
1175            mut depth: fidl::encoding::Depth,
1176        ) -> fidl::Result<()> {
1177            encoder.debug_check_bounds::<IpSocketState>(offset);
1178            // Vector header
1179            let max_ordinal: u64 = self.max_ordinal_present();
1180            encoder.write_num(max_ordinal, offset);
1181            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
1182            // Calling encoder.out_of_line_offset(0) is not allowed.
1183            if max_ordinal == 0 {
1184                return Ok(());
1185            }
1186            depth.increment()?;
1187            let envelope_size = 8;
1188            let bytes_len = max_ordinal as usize * envelope_size;
1189            #[allow(unused_variables)]
1190            let offset = encoder.out_of_line_offset(bytes_len);
1191            let mut _prev_end_offset: usize = 0;
1192            if 1 > max_ordinal {
1193                return Ok(());
1194            }
1195
1196            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1197            // are envelope_size bytes.
1198            let cur_offset: usize = (1 - 1) * envelope_size;
1199
1200            // Zero reserved fields.
1201            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1202
1203            // Safety:
1204            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1205            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1206            //   envelope_size bytes, there is always sufficient room.
1207            fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_net_common::IpVersion, D>(
1208                self.family.as_ref().map(
1209                    <fidl_fuchsia_net_common::IpVersion as fidl::encoding::ValueTypeMarker>::borrow,
1210                ),
1211                encoder,
1212                offset + cur_offset,
1213                depth,
1214            )?;
1215
1216            _prev_end_offset = cur_offset + envelope_size;
1217            if 2 > max_ordinal {
1218                return Ok(());
1219            }
1220
1221            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1222            // are envelope_size bytes.
1223            let cur_offset: usize = (2 - 1) * envelope_size;
1224
1225            // Zero reserved fields.
1226            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1227
1228            // Safety:
1229            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1230            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1231            //   envelope_size bytes, there is always sufficient room.
1232            fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_net_common::IpAddress, D>(
1233                self.src_addr.as_ref().map(
1234                    <fidl_fuchsia_net_common::IpAddress as fidl::encoding::ValueTypeMarker>::borrow,
1235                ),
1236                encoder,
1237                offset + cur_offset,
1238                depth,
1239            )?;
1240
1241            _prev_end_offset = cur_offset + envelope_size;
1242            if 3 > max_ordinal {
1243                return Ok(());
1244            }
1245
1246            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1247            // are envelope_size bytes.
1248            let cur_offset: usize = (3 - 1) * envelope_size;
1249
1250            // Zero reserved fields.
1251            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1252
1253            // Safety:
1254            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1255            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1256            //   envelope_size bytes, there is always sufficient room.
1257            fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_net_common::IpAddress, D>(
1258                self.dst_addr.as_ref().map(
1259                    <fidl_fuchsia_net_common::IpAddress as fidl::encoding::ValueTypeMarker>::borrow,
1260                ),
1261                encoder,
1262                offset + cur_offset,
1263                depth,
1264            )?;
1265
1266            _prev_end_offset = cur_offset + envelope_size;
1267            if 5 > max_ordinal {
1268                return Ok(());
1269            }
1270
1271            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1272            // are envelope_size bytes.
1273            let cur_offset: usize = (5 - 1) * envelope_size;
1274
1275            // Zero reserved fields.
1276            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1277
1278            // Safety:
1279            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1280            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1281            //   envelope_size bytes, there is always sufficient room.
1282            fidl::encoding::encode_in_envelope_optional::<u64, D>(
1283                self.cookie.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
1284                encoder,
1285                offset + cur_offset,
1286                depth,
1287            )?;
1288
1289            _prev_end_offset = cur_offset + envelope_size;
1290            if 6 > max_ordinal {
1291                return Ok(());
1292            }
1293
1294            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1295            // are envelope_size bytes.
1296            let cur_offset: usize = (6 - 1) * envelope_size;
1297
1298            // Zero reserved fields.
1299            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1300
1301            // Safety:
1302            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1303            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1304            //   envelope_size bytes, there is always sufficient room.
1305            fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_net_common::Marks, D>(
1306                self.marks.as_ref().map(
1307                    <fidl_fuchsia_net_common::Marks as fidl::encoding::ValueTypeMarker>::borrow,
1308                ),
1309                encoder,
1310                offset + cur_offset,
1311                depth,
1312            )?;
1313
1314            _prev_end_offset = cur_offset + envelope_size;
1315            if 7 > max_ordinal {
1316                return Ok(());
1317            }
1318
1319            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1320            // are envelope_size bytes.
1321            let cur_offset: usize = (7 - 1) * envelope_size;
1322
1323            // Zero reserved fields.
1324            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1325
1326            // Safety:
1327            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1328            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1329            //   envelope_size bytes, there is always sufficient room.
1330            fidl::encoding::encode_in_envelope_optional::<IpSocketTransportState, D>(
1331                self.transport
1332                    .as_ref()
1333                    .map(<IpSocketTransportState as fidl::encoding::ValueTypeMarker>::borrow),
1334                encoder,
1335                offset + cur_offset,
1336                depth,
1337            )?;
1338
1339            _prev_end_offset = cur_offset + envelope_size;
1340
1341            Ok(())
1342        }
1343    }
1344
1345    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for IpSocketState {
1346        #[inline(always)]
1347        fn new_empty() -> Self {
1348            Self::default()
1349        }
1350
1351        unsafe fn decode(
1352            &mut self,
1353            decoder: &mut fidl::encoding::Decoder<'_, D>,
1354            offset: usize,
1355            mut depth: fidl::encoding::Depth,
1356        ) -> fidl::Result<()> {
1357            decoder.debug_check_bounds::<Self>(offset);
1358            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
1359                None => return Err(fidl::Error::NotNullable),
1360                Some(len) => len,
1361            };
1362            // Calling decoder.out_of_line_offset(0) is not allowed.
1363            if len == 0 {
1364                return Ok(());
1365            };
1366            depth.increment()?;
1367            let envelope_size = 8;
1368            let bytes_len = len * envelope_size;
1369            let offset = decoder.out_of_line_offset(bytes_len)?;
1370            // Decode the envelope for each type.
1371            let mut _next_ordinal_to_read = 0;
1372            let mut next_offset = offset;
1373            let end_offset = offset + bytes_len;
1374            _next_ordinal_to_read += 1;
1375            if next_offset >= end_offset {
1376                return Ok(());
1377            }
1378
1379            // Decode unknown envelopes for gaps in ordinals.
1380            while _next_ordinal_to_read < 1 {
1381                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1382                _next_ordinal_to_read += 1;
1383                next_offset += envelope_size;
1384            }
1385
1386            let next_out_of_line = decoder.next_out_of_line();
1387            let handles_before = decoder.remaining_handles();
1388            if let Some((inlined, num_bytes, num_handles)) =
1389                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1390            {
1391                let member_inline_size =
1392                    <fidl_fuchsia_net_common::IpVersion as fidl::encoding::TypeMarker>::inline_size(
1393                        decoder.context,
1394                    );
1395                if inlined != (member_inline_size <= 4) {
1396                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1397                }
1398                let inner_offset;
1399                let mut inner_depth = depth.clone();
1400                if inlined {
1401                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1402                    inner_offset = next_offset;
1403                } else {
1404                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1405                    inner_depth.increment()?;
1406                }
1407                let val_ref = self
1408                    .family
1409                    .get_or_insert_with(|| fidl::new_empty!(fidl_fuchsia_net_common::IpVersion, D));
1410                fidl::decode!(
1411                    fidl_fuchsia_net_common::IpVersion,
1412                    D,
1413                    val_ref,
1414                    decoder,
1415                    inner_offset,
1416                    inner_depth
1417                )?;
1418                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1419                {
1420                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
1421                }
1422                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1423                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1424                }
1425            }
1426
1427            next_offset += envelope_size;
1428            _next_ordinal_to_read += 1;
1429            if next_offset >= end_offset {
1430                return Ok(());
1431            }
1432
1433            // Decode unknown envelopes for gaps in ordinals.
1434            while _next_ordinal_to_read < 2 {
1435                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1436                _next_ordinal_to_read += 1;
1437                next_offset += envelope_size;
1438            }
1439
1440            let next_out_of_line = decoder.next_out_of_line();
1441            let handles_before = decoder.remaining_handles();
1442            if let Some((inlined, num_bytes, num_handles)) =
1443                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1444            {
1445                let member_inline_size =
1446                    <fidl_fuchsia_net_common::IpAddress as fidl::encoding::TypeMarker>::inline_size(
1447                        decoder.context,
1448                    );
1449                if inlined != (member_inline_size <= 4) {
1450                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1451                }
1452                let inner_offset;
1453                let mut inner_depth = depth.clone();
1454                if inlined {
1455                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1456                    inner_offset = next_offset;
1457                } else {
1458                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1459                    inner_depth.increment()?;
1460                }
1461                let val_ref = self
1462                    .src_addr
1463                    .get_or_insert_with(|| fidl::new_empty!(fidl_fuchsia_net_common::IpAddress, D));
1464                fidl::decode!(
1465                    fidl_fuchsia_net_common::IpAddress,
1466                    D,
1467                    val_ref,
1468                    decoder,
1469                    inner_offset,
1470                    inner_depth
1471                )?;
1472                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1473                {
1474                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
1475                }
1476                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1477                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1478                }
1479            }
1480
1481            next_offset += envelope_size;
1482            _next_ordinal_to_read += 1;
1483            if next_offset >= end_offset {
1484                return Ok(());
1485            }
1486
1487            // Decode unknown envelopes for gaps in ordinals.
1488            while _next_ordinal_to_read < 3 {
1489                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1490                _next_ordinal_to_read += 1;
1491                next_offset += envelope_size;
1492            }
1493
1494            let next_out_of_line = decoder.next_out_of_line();
1495            let handles_before = decoder.remaining_handles();
1496            if let Some((inlined, num_bytes, num_handles)) =
1497                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1498            {
1499                let member_inline_size =
1500                    <fidl_fuchsia_net_common::IpAddress as fidl::encoding::TypeMarker>::inline_size(
1501                        decoder.context,
1502                    );
1503                if inlined != (member_inline_size <= 4) {
1504                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1505                }
1506                let inner_offset;
1507                let mut inner_depth = depth.clone();
1508                if inlined {
1509                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1510                    inner_offset = next_offset;
1511                } else {
1512                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1513                    inner_depth.increment()?;
1514                }
1515                let val_ref = self
1516                    .dst_addr
1517                    .get_or_insert_with(|| fidl::new_empty!(fidl_fuchsia_net_common::IpAddress, D));
1518                fidl::decode!(
1519                    fidl_fuchsia_net_common::IpAddress,
1520                    D,
1521                    val_ref,
1522                    decoder,
1523                    inner_offset,
1524                    inner_depth
1525                )?;
1526                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1527                {
1528                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
1529                }
1530                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1531                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1532                }
1533            }
1534
1535            next_offset += envelope_size;
1536            _next_ordinal_to_read += 1;
1537            if next_offset >= end_offset {
1538                return Ok(());
1539            }
1540
1541            // Decode unknown envelopes for gaps in ordinals.
1542            while _next_ordinal_to_read < 5 {
1543                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1544                _next_ordinal_to_read += 1;
1545                next_offset += envelope_size;
1546            }
1547
1548            let next_out_of_line = decoder.next_out_of_line();
1549            let handles_before = decoder.remaining_handles();
1550            if let Some((inlined, num_bytes, num_handles)) =
1551                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1552            {
1553                let member_inline_size =
1554                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1555                if inlined != (member_inline_size <= 4) {
1556                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1557                }
1558                let inner_offset;
1559                let mut inner_depth = depth.clone();
1560                if inlined {
1561                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1562                    inner_offset = next_offset;
1563                } else {
1564                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1565                    inner_depth.increment()?;
1566                }
1567                let val_ref = self.cookie.get_or_insert_with(|| fidl::new_empty!(u64, D));
1568                fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
1569                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1570                {
1571                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
1572                }
1573                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1574                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1575                }
1576            }
1577
1578            next_offset += envelope_size;
1579            _next_ordinal_to_read += 1;
1580            if next_offset >= end_offset {
1581                return Ok(());
1582            }
1583
1584            // Decode unknown envelopes for gaps in ordinals.
1585            while _next_ordinal_to_read < 6 {
1586                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1587                _next_ordinal_to_read += 1;
1588                next_offset += envelope_size;
1589            }
1590
1591            let next_out_of_line = decoder.next_out_of_line();
1592            let handles_before = decoder.remaining_handles();
1593            if let Some((inlined, num_bytes, num_handles)) =
1594                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1595            {
1596                let member_inline_size =
1597                    <fidl_fuchsia_net_common::Marks as fidl::encoding::TypeMarker>::inline_size(
1598                        decoder.context,
1599                    );
1600                if inlined != (member_inline_size <= 4) {
1601                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1602                }
1603                let inner_offset;
1604                let mut inner_depth = depth.clone();
1605                if inlined {
1606                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1607                    inner_offset = next_offset;
1608                } else {
1609                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1610                    inner_depth.increment()?;
1611                }
1612                let val_ref = self
1613                    .marks
1614                    .get_or_insert_with(|| fidl::new_empty!(fidl_fuchsia_net_common::Marks, D));
1615                fidl::decode!(
1616                    fidl_fuchsia_net_common::Marks,
1617                    D,
1618                    val_ref,
1619                    decoder,
1620                    inner_offset,
1621                    inner_depth
1622                )?;
1623                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1624                {
1625                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
1626                }
1627                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1628                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1629                }
1630            }
1631
1632            next_offset += envelope_size;
1633            _next_ordinal_to_read += 1;
1634            if next_offset >= end_offset {
1635                return Ok(());
1636            }
1637
1638            // Decode unknown envelopes for gaps in ordinals.
1639            while _next_ordinal_to_read < 7 {
1640                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1641                _next_ordinal_to_read += 1;
1642                next_offset += envelope_size;
1643            }
1644
1645            let next_out_of_line = decoder.next_out_of_line();
1646            let handles_before = decoder.remaining_handles();
1647            if let Some((inlined, num_bytes, num_handles)) =
1648                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1649            {
1650                let member_inline_size =
1651                    <IpSocketTransportState as fidl::encoding::TypeMarker>::inline_size(
1652                        decoder.context,
1653                    );
1654                if inlined != (member_inline_size <= 4) {
1655                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1656                }
1657                let inner_offset;
1658                let mut inner_depth = depth.clone();
1659                if inlined {
1660                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1661                    inner_offset = next_offset;
1662                } else {
1663                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1664                    inner_depth.increment()?;
1665                }
1666                let val_ref = self
1667                    .transport
1668                    .get_or_insert_with(|| fidl::new_empty!(IpSocketTransportState, D));
1669                fidl::decode!(
1670                    IpSocketTransportState,
1671                    D,
1672                    val_ref,
1673                    decoder,
1674                    inner_offset,
1675                    inner_depth
1676                )?;
1677                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1678                {
1679                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
1680                }
1681                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1682                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1683                }
1684            }
1685
1686            next_offset += envelope_size;
1687
1688            // Decode the remaining unknown envelopes.
1689            while next_offset < end_offset {
1690                _next_ordinal_to_read += 1;
1691                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1692                next_offset += envelope_size;
1693            }
1694
1695            Ok(())
1696        }
1697    }
1698
1699    impl IpSocketTcpState {
1700        #[inline(always)]
1701        fn max_ordinal_present(&self) -> u64 {
1702            if let Some(_) = self.tcp_info {
1703                return 4;
1704            }
1705            if let Some(_) = self.state {
1706                return 3;
1707            }
1708            if let Some(_) = self.dst_port {
1709                return 2;
1710            }
1711            if let Some(_) = self.src_port {
1712                return 1;
1713            }
1714            0
1715        }
1716    }
1717
1718    impl fidl::encoding::ValueTypeMarker for IpSocketTcpState {
1719        type Borrowed<'a> = &'a Self;
1720        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1721            value
1722        }
1723    }
1724
1725    unsafe impl fidl::encoding::TypeMarker for IpSocketTcpState {
1726        type Owned = Self;
1727
1728        #[inline(always)]
1729        fn inline_align(_context: fidl::encoding::Context) -> usize {
1730            8
1731        }
1732
1733        #[inline(always)]
1734        fn inline_size(_context: fidl::encoding::Context) -> usize {
1735            16
1736        }
1737    }
1738
1739    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<IpSocketTcpState, D>
1740        for &IpSocketTcpState
1741    {
1742        unsafe fn encode(
1743            self,
1744            encoder: &mut fidl::encoding::Encoder<'_, D>,
1745            offset: usize,
1746            mut depth: fidl::encoding::Depth,
1747        ) -> fidl::Result<()> {
1748            encoder.debug_check_bounds::<IpSocketTcpState>(offset);
1749            // Vector header
1750            let max_ordinal: u64 = self.max_ordinal_present();
1751            encoder.write_num(max_ordinal, offset);
1752            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
1753            // Calling encoder.out_of_line_offset(0) is not allowed.
1754            if max_ordinal == 0 {
1755                return Ok(());
1756            }
1757            depth.increment()?;
1758            let envelope_size = 8;
1759            let bytes_len = max_ordinal as usize * envelope_size;
1760            #[allow(unused_variables)]
1761            let offset = encoder.out_of_line_offset(bytes_len);
1762            let mut _prev_end_offset: usize = 0;
1763            if 1 > max_ordinal {
1764                return Ok(());
1765            }
1766
1767            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1768            // are envelope_size bytes.
1769            let cur_offset: usize = (1 - 1) * envelope_size;
1770
1771            // Zero reserved fields.
1772            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1773
1774            // Safety:
1775            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1776            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1777            //   envelope_size bytes, there is always sufficient room.
1778            fidl::encoding::encode_in_envelope_optional::<u16, D>(
1779                self.src_port.as_ref().map(<u16 as fidl::encoding::ValueTypeMarker>::borrow),
1780                encoder,
1781                offset + cur_offset,
1782                depth,
1783            )?;
1784
1785            _prev_end_offset = cur_offset + envelope_size;
1786            if 2 > max_ordinal {
1787                return Ok(());
1788            }
1789
1790            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1791            // are envelope_size bytes.
1792            let cur_offset: usize = (2 - 1) * envelope_size;
1793
1794            // Zero reserved fields.
1795            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1796
1797            // Safety:
1798            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1799            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1800            //   envelope_size bytes, there is always sufficient room.
1801            fidl::encoding::encode_in_envelope_optional::<u16, D>(
1802                self.dst_port.as_ref().map(<u16 as fidl::encoding::ValueTypeMarker>::borrow),
1803                encoder,
1804                offset + cur_offset,
1805                depth,
1806            )?;
1807
1808            _prev_end_offset = cur_offset + envelope_size;
1809            if 3 > max_ordinal {
1810                return Ok(());
1811            }
1812
1813            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1814            // are envelope_size bytes.
1815            let cur_offset: usize = (3 - 1) * envelope_size;
1816
1817            // Zero reserved fields.
1818            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1819
1820            // Safety:
1821            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1822            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1823            //   envelope_size bytes, there is always sufficient room.
1824            fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_net_tcp_common::State, D>(
1825                self.state.as_ref().map(
1826                    <fidl_fuchsia_net_tcp_common::State as fidl::encoding::ValueTypeMarker>::borrow,
1827                ),
1828                encoder,
1829                offset + cur_offset,
1830                depth,
1831            )?;
1832
1833            _prev_end_offset = cur_offset + envelope_size;
1834            if 4 > max_ordinal {
1835                return Ok(());
1836            }
1837
1838            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1839            // are envelope_size bytes.
1840            let cur_offset: usize = (4 - 1) * envelope_size;
1841
1842            // Zero reserved fields.
1843            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1844
1845            // Safety:
1846            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1847            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1848            //   envelope_size bytes, there is always sufficient room.
1849            fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_net_tcp_common::Info, D>(
1850                self.tcp_info.as_ref().map(
1851                    <fidl_fuchsia_net_tcp_common::Info as fidl::encoding::ValueTypeMarker>::borrow,
1852                ),
1853                encoder,
1854                offset + cur_offset,
1855                depth,
1856            )?;
1857
1858            _prev_end_offset = cur_offset + envelope_size;
1859
1860            Ok(())
1861        }
1862    }
1863
1864    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for IpSocketTcpState {
1865        #[inline(always)]
1866        fn new_empty() -> Self {
1867            Self::default()
1868        }
1869
1870        unsafe fn decode(
1871            &mut self,
1872            decoder: &mut fidl::encoding::Decoder<'_, D>,
1873            offset: usize,
1874            mut depth: fidl::encoding::Depth,
1875        ) -> fidl::Result<()> {
1876            decoder.debug_check_bounds::<Self>(offset);
1877            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
1878                None => return Err(fidl::Error::NotNullable),
1879                Some(len) => len,
1880            };
1881            // Calling decoder.out_of_line_offset(0) is not allowed.
1882            if len == 0 {
1883                return Ok(());
1884            };
1885            depth.increment()?;
1886            let envelope_size = 8;
1887            let bytes_len = len * envelope_size;
1888            let offset = decoder.out_of_line_offset(bytes_len)?;
1889            // Decode the envelope for each type.
1890            let mut _next_ordinal_to_read = 0;
1891            let mut next_offset = offset;
1892            let end_offset = offset + bytes_len;
1893            _next_ordinal_to_read += 1;
1894            if next_offset >= end_offset {
1895                return Ok(());
1896            }
1897
1898            // Decode unknown envelopes for gaps in ordinals.
1899            while _next_ordinal_to_read < 1 {
1900                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1901                _next_ordinal_to_read += 1;
1902                next_offset += envelope_size;
1903            }
1904
1905            let next_out_of_line = decoder.next_out_of_line();
1906            let handles_before = decoder.remaining_handles();
1907            if let Some((inlined, num_bytes, num_handles)) =
1908                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1909            {
1910                let member_inline_size =
1911                    <u16 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1912                if inlined != (member_inline_size <= 4) {
1913                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1914                }
1915                let inner_offset;
1916                let mut inner_depth = depth.clone();
1917                if inlined {
1918                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1919                    inner_offset = next_offset;
1920                } else {
1921                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1922                    inner_depth.increment()?;
1923                }
1924                let val_ref = self.src_port.get_or_insert_with(|| fidl::new_empty!(u16, D));
1925                fidl::decode!(u16, D, val_ref, decoder, inner_offset, inner_depth)?;
1926                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1927                {
1928                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
1929                }
1930                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1931                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1932                }
1933            }
1934
1935            next_offset += envelope_size;
1936            _next_ordinal_to_read += 1;
1937            if next_offset >= end_offset {
1938                return Ok(());
1939            }
1940
1941            // Decode unknown envelopes for gaps in ordinals.
1942            while _next_ordinal_to_read < 2 {
1943                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1944                _next_ordinal_to_read += 1;
1945                next_offset += envelope_size;
1946            }
1947
1948            let next_out_of_line = decoder.next_out_of_line();
1949            let handles_before = decoder.remaining_handles();
1950            if let Some((inlined, num_bytes, num_handles)) =
1951                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1952            {
1953                let member_inline_size =
1954                    <u16 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1955                if inlined != (member_inline_size <= 4) {
1956                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1957                }
1958                let inner_offset;
1959                let mut inner_depth = depth.clone();
1960                if inlined {
1961                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1962                    inner_offset = next_offset;
1963                } else {
1964                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1965                    inner_depth.increment()?;
1966                }
1967                let val_ref = self.dst_port.get_or_insert_with(|| fidl::new_empty!(u16, D));
1968                fidl::decode!(u16, D, val_ref, decoder, inner_offset, inner_depth)?;
1969                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1970                {
1971                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
1972                }
1973                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1974                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1975                }
1976            }
1977
1978            next_offset += envelope_size;
1979            _next_ordinal_to_read += 1;
1980            if next_offset >= end_offset {
1981                return Ok(());
1982            }
1983
1984            // Decode unknown envelopes for gaps in ordinals.
1985            while _next_ordinal_to_read < 3 {
1986                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1987                _next_ordinal_to_read += 1;
1988                next_offset += envelope_size;
1989            }
1990
1991            let next_out_of_line = decoder.next_out_of_line();
1992            let handles_before = decoder.remaining_handles();
1993            if let Some((inlined, num_bytes, num_handles)) =
1994                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1995            {
1996                let member_inline_size =
1997                    <fidl_fuchsia_net_tcp_common::State as fidl::encoding::TypeMarker>::inline_size(
1998                        decoder.context,
1999                    );
2000                if inlined != (member_inline_size <= 4) {
2001                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2002                }
2003                let inner_offset;
2004                let mut inner_depth = depth.clone();
2005                if inlined {
2006                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2007                    inner_offset = next_offset;
2008                } else {
2009                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2010                    inner_depth.increment()?;
2011                }
2012                let val_ref = self
2013                    .state
2014                    .get_or_insert_with(|| fidl::new_empty!(fidl_fuchsia_net_tcp_common::State, D));
2015                fidl::decode!(
2016                    fidl_fuchsia_net_tcp_common::State,
2017                    D,
2018                    val_ref,
2019                    decoder,
2020                    inner_offset,
2021                    inner_depth
2022                )?;
2023                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2024                {
2025                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2026                }
2027                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2028                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2029                }
2030            }
2031
2032            next_offset += envelope_size;
2033            _next_ordinal_to_read += 1;
2034            if next_offset >= end_offset {
2035                return Ok(());
2036            }
2037
2038            // Decode unknown envelopes for gaps in ordinals.
2039            while _next_ordinal_to_read < 4 {
2040                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2041                _next_ordinal_to_read += 1;
2042                next_offset += envelope_size;
2043            }
2044
2045            let next_out_of_line = decoder.next_out_of_line();
2046            let handles_before = decoder.remaining_handles();
2047            if let Some((inlined, num_bytes, num_handles)) =
2048                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2049            {
2050                let member_inline_size =
2051                    <fidl_fuchsia_net_tcp_common::Info as fidl::encoding::TypeMarker>::inline_size(
2052                        decoder.context,
2053                    );
2054                if inlined != (member_inline_size <= 4) {
2055                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2056                }
2057                let inner_offset;
2058                let mut inner_depth = depth.clone();
2059                if inlined {
2060                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2061                    inner_offset = next_offset;
2062                } else {
2063                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2064                    inner_depth.increment()?;
2065                }
2066                let val_ref = self
2067                    .tcp_info
2068                    .get_or_insert_with(|| fidl::new_empty!(fidl_fuchsia_net_tcp_common::Info, D));
2069                fidl::decode!(
2070                    fidl_fuchsia_net_tcp_common::Info,
2071                    D,
2072                    val_ref,
2073                    decoder,
2074                    inner_offset,
2075                    inner_depth
2076                )?;
2077                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2078                {
2079                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2080                }
2081                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2082                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2083                }
2084            }
2085
2086            next_offset += envelope_size;
2087
2088            // Decode the remaining unknown envelopes.
2089            while next_offset < end_offset {
2090                _next_ordinal_to_read += 1;
2091                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2092                next_offset += envelope_size;
2093            }
2094
2095            Ok(())
2096        }
2097    }
2098
2099    impl IpSocketUdpState {
2100        #[inline(always)]
2101        fn max_ordinal_present(&self) -> u64 {
2102            if let Some(_) = self.state {
2103                return 3;
2104            }
2105            if let Some(_) = self.dst_port {
2106                return 2;
2107            }
2108            if let Some(_) = self.src_port {
2109                return 1;
2110            }
2111            0
2112        }
2113    }
2114
2115    impl fidl::encoding::ValueTypeMarker for IpSocketUdpState {
2116        type Borrowed<'a> = &'a Self;
2117        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2118            value
2119        }
2120    }
2121
2122    unsafe impl fidl::encoding::TypeMarker for IpSocketUdpState {
2123        type Owned = Self;
2124
2125        #[inline(always)]
2126        fn inline_align(_context: fidl::encoding::Context) -> usize {
2127            8
2128        }
2129
2130        #[inline(always)]
2131        fn inline_size(_context: fidl::encoding::Context) -> usize {
2132            16
2133        }
2134    }
2135
2136    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<IpSocketUdpState, D>
2137        for &IpSocketUdpState
2138    {
2139        unsafe fn encode(
2140            self,
2141            encoder: &mut fidl::encoding::Encoder<'_, D>,
2142            offset: usize,
2143            mut depth: fidl::encoding::Depth,
2144        ) -> fidl::Result<()> {
2145            encoder.debug_check_bounds::<IpSocketUdpState>(offset);
2146            // Vector header
2147            let max_ordinal: u64 = self.max_ordinal_present();
2148            encoder.write_num(max_ordinal, offset);
2149            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
2150            // Calling encoder.out_of_line_offset(0) is not allowed.
2151            if max_ordinal == 0 {
2152                return Ok(());
2153            }
2154            depth.increment()?;
2155            let envelope_size = 8;
2156            let bytes_len = max_ordinal as usize * envelope_size;
2157            #[allow(unused_variables)]
2158            let offset = encoder.out_of_line_offset(bytes_len);
2159            let mut _prev_end_offset: usize = 0;
2160            if 1 > max_ordinal {
2161                return Ok(());
2162            }
2163
2164            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2165            // are envelope_size bytes.
2166            let cur_offset: usize = (1 - 1) * envelope_size;
2167
2168            // Zero reserved fields.
2169            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2170
2171            // Safety:
2172            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2173            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2174            //   envelope_size bytes, there is always sufficient room.
2175            fidl::encoding::encode_in_envelope_optional::<u16, D>(
2176                self.src_port.as_ref().map(<u16 as fidl::encoding::ValueTypeMarker>::borrow),
2177                encoder,
2178                offset + cur_offset,
2179                depth,
2180            )?;
2181
2182            _prev_end_offset = cur_offset + envelope_size;
2183            if 2 > max_ordinal {
2184                return Ok(());
2185            }
2186
2187            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2188            // are envelope_size bytes.
2189            let cur_offset: usize = (2 - 1) * envelope_size;
2190
2191            // Zero reserved fields.
2192            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2193
2194            // Safety:
2195            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2196            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2197            //   envelope_size bytes, there is always sufficient room.
2198            fidl::encoding::encode_in_envelope_optional::<u16, D>(
2199                self.dst_port.as_ref().map(<u16 as fidl::encoding::ValueTypeMarker>::borrow),
2200                encoder,
2201                offset + cur_offset,
2202                depth,
2203            )?;
2204
2205            _prev_end_offset = cur_offset + envelope_size;
2206            if 3 > max_ordinal {
2207                return Ok(());
2208            }
2209
2210            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2211            // are envelope_size bytes.
2212            let cur_offset: usize = (3 - 1) * envelope_size;
2213
2214            // Zero reserved fields.
2215            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2216
2217            // Safety:
2218            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2219            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2220            //   envelope_size bytes, there is always sufficient room.
2221            fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_net_udp_common::State, D>(
2222                self.state.as_ref().map(
2223                    <fidl_fuchsia_net_udp_common::State as fidl::encoding::ValueTypeMarker>::borrow,
2224                ),
2225                encoder,
2226                offset + cur_offset,
2227                depth,
2228            )?;
2229
2230            _prev_end_offset = cur_offset + envelope_size;
2231
2232            Ok(())
2233        }
2234    }
2235
2236    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for IpSocketUdpState {
2237        #[inline(always)]
2238        fn new_empty() -> Self {
2239            Self::default()
2240        }
2241
2242        unsafe fn decode(
2243            &mut self,
2244            decoder: &mut fidl::encoding::Decoder<'_, D>,
2245            offset: usize,
2246            mut depth: fidl::encoding::Depth,
2247        ) -> fidl::Result<()> {
2248            decoder.debug_check_bounds::<Self>(offset);
2249            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
2250                None => return Err(fidl::Error::NotNullable),
2251                Some(len) => len,
2252            };
2253            // Calling decoder.out_of_line_offset(0) is not allowed.
2254            if len == 0 {
2255                return Ok(());
2256            };
2257            depth.increment()?;
2258            let envelope_size = 8;
2259            let bytes_len = len * envelope_size;
2260            let offset = decoder.out_of_line_offset(bytes_len)?;
2261            // Decode the envelope for each type.
2262            let mut _next_ordinal_to_read = 0;
2263            let mut next_offset = offset;
2264            let end_offset = offset + bytes_len;
2265            _next_ordinal_to_read += 1;
2266            if next_offset >= end_offset {
2267                return Ok(());
2268            }
2269
2270            // Decode unknown envelopes for gaps in ordinals.
2271            while _next_ordinal_to_read < 1 {
2272                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2273                _next_ordinal_to_read += 1;
2274                next_offset += envelope_size;
2275            }
2276
2277            let next_out_of_line = decoder.next_out_of_line();
2278            let handles_before = decoder.remaining_handles();
2279            if let Some((inlined, num_bytes, num_handles)) =
2280                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2281            {
2282                let member_inline_size =
2283                    <u16 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2284                if inlined != (member_inline_size <= 4) {
2285                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2286                }
2287                let inner_offset;
2288                let mut inner_depth = depth.clone();
2289                if inlined {
2290                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2291                    inner_offset = next_offset;
2292                } else {
2293                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2294                    inner_depth.increment()?;
2295                }
2296                let val_ref = self.src_port.get_or_insert_with(|| fidl::new_empty!(u16, D));
2297                fidl::decode!(u16, D, val_ref, decoder, inner_offset, inner_depth)?;
2298                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2299                {
2300                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2301                }
2302                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2303                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2304                }
2305            }
2306
2307            next_offset += envelope_size;
2308            _next_ordinal_to_read += 1;
2309            if next_offset >= end_offset {
2310                return Ok(());
2311            }
2312
2313            // Decode unknown envelopes for gaps in ordinals.
2314            while _next_ordinal_to_read < 2 {
2315                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2316                _next_ordinal_to_read += 1;
2317                next_offset += envelope_size;
2318            }
2319
2320            let next_out_of_line = decoder.next_out_of_line();
2321            let handles_before = decoder.remaining_handles();
2322            if let Some((inlined, num_bytes, num_handles)) =
2323                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2324            {
2325                let member_inline_size =
2326                    <u16 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2327                if inlined != (member_inline_size <= 4) {
2328                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2329                }
2330                let inner_offset;
2331                let mut inner_depth = depth.clone();
2332                if inlined {
2333                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2334                    inner_offset = next_offset;
2335                } else {
2336                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2337                    inner_depth.increment()?;
2338                }
2339                let val_ref = self.dst_port.get_or_insert_with(|| fidl::new_empty!(u16, D));
2340                fidl::decode!(u16, D, val_ref, decoder, inner_offset, inner_depth)?;
2341                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2342                {
2343                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2344                }
2345                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2346                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2347                }
2348            }
2349
2350            next_offset += envelope_size;
2351            _next_ordinal_to_read += 1;
2352            if next_offset >= end_offset {
2353                return Ok(());
2354            }
2355
2356            // Decode unknown envelopes for gaps in ordinals.
2357            while _next_ordinal_to_read < 3 {
2358                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2359                _next_ordinal_to_read += 1;
2360                next_offset += envelope_size;
2361            }
2362
2363            let next_out_of_line = decoder.next_out_of_line();
2364            let handles_before = decoder.remaining_handles();
2365            if let Some((inlined, num_bytes, num_handles)) =
2366                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2367            {
2368                let member_inline_size =
2369                    <fidl_fuchsia_net_udp_common::State as fidl::encoding::TypeMarker>::inline_size(
2370                        decoder.context,
2371                    );
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
2385                    .state
2386                    .get_or_insert_with(|| fidl::new_empty!(fidl_fuchsia_net_udp_common::State, D));
2387                fidl::decode!(
2388                    fidl_fuchsia_net_udp_common::State,
2389                    D,
2390                    val_ref,
2391                    decoder,
2392                    inner_offset,
2393                    inner_depth
2394                )?;
2395                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2396                {
2397                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2398                }
2399                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2400                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2401                }
2402            }
2403
2404            next_offset += envelope_size;
2405
2406            // Decode the remaining unknown envelopes.
2407            while next_offset < end_offset {
2408                _next_ordinal_to_read += 1;
2409                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2410                next_offset += envelope_size;
2411            }
2412
2413            Ok(())
2414        }
2415    }
2416
2417    impl fidl::encoding::ValueTypeMarker for DisconnectIpResult {
2418        type Borrowed<'a> = &'a Self;
2419        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2420            value
2421        }
2422    }
2423
2424    unsafe impl fidl::encoding::TypeMarker for DisconnectIpResult {
2425        type Owned = Self;
2426
2427        #[inline(always)]
2428        fn inline_align(_context: fidl::encoding::Context) -> usize {
2429            8
2430        }
2431
2432        #[inline(always)]
2433        fn inline_size(_context: fidl::encoding::Context) -> usize {
2434            16
2435        }
2436    }
2437
2438    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<DisconnectIpResult, D>
2439        for &DisconnectIpResult
2440    {
2441        #[inline]
2442        unsafe fn encode(
2443            self,
2444            encoder: &mut fidl::encoding::Encoder<'_, D>,
2445            offset: usize,
2446            _depth: fidl::encoding::Depth,
2447        ) -> fidl::Result<()> {
2448            encoder.debug_check_bounds::<DisconnectIpResult>(offset);
2449            encoder.write_num::<u64>(self.ordinal(), offset);
2450            match self {
2451                DisconnectIpResult::Ok(ref val) => {
2452                    fidl::encoding::encode_in_envelope::<DisconnectIpResponse, D>(
2453                        <DisconnectIpResponse as fidl::encoding::ValueTypeMarker>::borrow(val),
2454                        encoder,
2455                        offset + 8,
2456                        _depth,
2457                    )
2458                }
2459                DisconnectIpResult::InvalidMatcher(ref val) => {
2460                    fidl::encoding::encode_in_envelope::<InvalidMatcher, D>(
2461                        <InvalidMatcher as fidl::encoding::ValueTypeMarker>::borrow(val),
2462                        encoder,
2463                        offset + 8,
2464                        _depth,
2465                    )
2466                }
2467                DisconnectIpResult::UnconstrainedMatchers(ref val) => {
2468                    fidl::encoding::encode_in_envelope::<Empty, D>(
2469                        <Empty as fidl::encoding::ValueTypeMarker>::borrow(val),
2470                        encoder,
2471                        offset + 8,
2472                        _depth,
2473                    )
2474                }
2475                DisconnectIpResult::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
2476            }
2477        }
2478    }
2479
2480    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for DisconnectIpResult {
2481        #[inline(always)]
2482        fn new_empty() -> Self {
2483            Self::__SourceBreaking { unknown_ordinal: 0 }
2484        }
2485
2486        #[inline]
2487        unsafe fn decode(
2488            &mut self,
2489            decoder: &mut fidl::encoding::Decoder<'_, D>,
2490            offset: usize,
2491            mut depth: fidl::encoding::Depth,
2492        ) -> fidl::Result<()> {
2493            decoder.debug_check_bounds::<Self>(offset);
2494            #[allow(unused_variables)]
2495            let next_out_of_line = decoder.next_out_of_line();
2496            let handles_before = decoder.remaining_handles();
2497            let (ordinal, inlined, num_bytes, num_handles) =
2498                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
2499
2500            let member_inline_size = match ordinal {
2501                1 => <DisconnectIpResponse as fidl::encoding::TypeMarker>::inline_size(
2502                    decoder.context,
2503                ),
2504                2 => <InvalidMatcher as fidl::encoding::TypeMarker>::inline_size(decoder.context),
2505                3 => <Empty as fidl::encoding::TypeMarker>::inline_size(decoder.context),
2506                0 => return Err(fidl::Error::UnknownUnionTag),
2507                _ => num_bytes as usize,
2508            };
2509
2510            if inlined != (member_inline_size <= 4) {
2511                return Err(fidl::Error::InvalidInlineBitInEnvelope);
2512            }
2513            let _inner_offset;
2514            if inlined {
2515                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
2516                _inner_offset = offset + 8;
2517            } else {
2518                depth.increment()?;
2519                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2520            }
2521            match ordinal {
2522                1 => {
2523                    #[allow(irrefutable_let_patterns)]
2524                    if let DisconnectIpResult::Ok(_) = self {
2525                        // Do nothing, read the value into the object
2526                    } else {
2527                        // Initialize `self` to the right variant
2528                        *self = DisconnectIpResult::Ok(fidl::new_empty!(DisconnectIpResponse, D));
2529                    }
2530                    #[allow(irrefutable_let_patterns)]
2531                    if let DisconnectIpResult::Ok(ref mut val) = self {
2532                        fidl::decode!(DisconnectIpResponse, D, val, decoder, _inner_offset, depth)?;
2533                    } else {
2534                        unreachable!()
2535                    }
2536                }
2537                2 => {
2538                    #[allow(irrefutable_let_patterns)]
2539                    if let DisconnectIpResult::InvalidMatcher(_) = self {
2540                        // Do nothing, read the value into the object
2541                    } else {
2542                        // Initialize `self` to the right variant
2543                        *self =
2544                            DisconnectIpResult::InvalidMatcher(fidl::new_empty!(InvalidMatcher, D));
2545                    }
2546                    #[allow(irrefutable_let_patterns)]
2547                    if let DisconnectIpResult::InvalidMatcher(ref mut val) = self {
2548                        fidl::decode!(InvalidMatcher, D, val, decoder, _inner_offset, depth)?;
2549                    } else {
2550                        unreachable!()
2551                    }
2552                }
2553                3 => {
2554                    #[allow(irrefutable_let_patterns)]
2555                    if let DisconnectIpResult::UnconstrainedMatchers(_) = self {
2556                        // Do nothing, read the value into the object
2557                    } else {
2558                        // Initialize `self` to the right variant
2559                        *self =
2560                            DisconnectIpResult::UnconstrainedMatchers(fidl::new_empty!(Empty, D));
2561                    }
2562                    #[allow(irrefutable_let_patterns)]
2563                    if let DisconnectIpResult::UnconstrainedMatchers(ref mut val) = self {
2564                        fidl::decode!(Empty, D, val, decoder, _inner_offset, depth)?;
2565                    } else {
2566                        unreachable!()
2567                    }
2568                }
2569                #[allow(deprecated)]
2570                ordinal => {
2571                    for _ in 0..num_handles {
2572                        decoder.drop_next_handle()?;
2573                    }
2574                    *self = DisconnectIpResult::__SourceBreaking { unknown_ordinal: ordinal };
2575                }
2576            }
2577            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
2578                return Err(fidl::Error::InvalidNumBytesInEnvelope);
2579            }
2580            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2581                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2582            }
2583            Ok(())
2584        }
2585    }
2586
2587    impl fidl::encoding::ValueTypeMarker for IpSocketMatcher {
2588        type Borrowed<'a> = &'a Self;
2589        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2590            value
2591        }
2592    }
2593
2594    unsafe impl fidl::encoding::TypeMarker for IpSocketMatcher {
2595        type Owned = Self;
2596
2597        #[inline(always)]
2598        fn inline_align(_context: fidl::encoding::Context) -> usize {
2599            8
2600        }
2601
2602        #[inline(always)]
2603        fn inline_size(_context: fidl::encoding::Context) -> usize {
2604            16
2605        }
2606    }
2607
2608    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<IpSocketMatcher, D>
2609        for &IpSocketMatcher
2610    {
2611        #[inline]
2612        unsafe fn encode(
2613            self,
2614            encoder: &mut fidl::encoding::Encoder<'_, D>,
2615            offset: usize,
2616            _depth: fidl::encoding::Depth,
2617        ) -> fidl::Result<()> {
2618            encoder.debug_check_bounds::<IpSocketMatcher>(offset);
2619            encoder.write_num::<u64>(self.ordinal(), offset);
2620            match self {
2621            IpSocketMatcher::Family(ref val) => {
2622                fidl::encoding::encode_in_envelope::<fidl_fuchsia_net_common::IpVersion, D>(
2623                    <fidl_fuchsia_net_common::IpVersion as fidl::encoding::ValueTypeMarker>::borrow(val),
2624                    encoder, offset + 8, _depth
2625                )
2626            }
2627            IpSocketMatcher::SrcAddr(ref val) => {
2628                fidl::encoding::encode_in_envelope::<fidl_fuchsia_net_matchers_common::BoundAddress, D>(
2629                    <fidl_fuchsia_net_matchers_common::BoundAddress as fidl::encoding::ValueTypeMarker>::borrow(val),
2630                    encoder, offset + 8, _depth
2631                )
2632            }
2633            IpSocketMatcher::DstAddr(ref val) => {
2634                fidl::encoding::encode_in_envelope::<fidl_fuchsia_net_matchers_common::BoundAddress, D>(
2635                    <fidl_fuchsia_net_matchers_common::BoundAddress as fidl::encoding::ValueTypeMarker>::borrow(val),
2636                    encoder, offset + 8, _depth
2637                )
2638            }
2639            IpSocketMatcher::Proto(ref val) => {
2640                fidl::encoding::encode_in_envelope::<fidl_fuchsia_net_matchers_common::SocketTransportProtocol, D>(
2641                    <fidl_fuchsia_net_matchers_common::SocketTransportProtocol as fidl::encoding::ValueTypeMarker>::borrow(val),
2642                    encoder, offset + 8, _depth
2643                )
2644            }
2645            IpSocketMatcher::BoundInterface(ref val) => {
2646                fidl::encoding::encode_in_envelope::<fidl_fuchsia_net_matchers_common::BoundInterface, D>(
2647                    <fidl_fuchsia_net_matchers_common::BoundInterface as fidl::encoding::ValueTypeMarker>::borrow(val),
2648                    encoder, offset + 8, _depth
2649                )
2650            }
2651            IpSocketMatcher::Cookie(ref val) => {
2652                fidl::encoding::encode_in_envelope::<fidl_fuchsia_net_matchers_common::SocketCookie, D>(
2653                    <fidl_fuchsia_net_matchers_common::SocketCookie as fidl::encoding::ValueTypeMarker>::borrow(val),
2654                    encoder, offset + 8, _depth
2655                )
2656            }
2657            IpSocketMatcher::Mark(ref val) => {
2658                fidl::encoding::encode_in_envelope::<fidl_fuchsia_net_matchers_common::MarkInDomain, D>(
2659                    <fidl_fuchsia_net_matchers_common::MarkInDomain as fidl::encoding::ValueTypeMarker>::borrow(val),
2660                    encoder, offset + 8, _depth
2661                )
2662            }
2663            IpSocketMatcher::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
2664        }
2665        }
2666    }
2667
2668    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for IpSocketMatcher {
2669        #[inline(always)]
2670        fn new_empty() -> Self {
2671            Self::__SourceBreaking { unknown_ordinal: 0 }
2672        }
2673
2674        #[inline]
2675        unsafe fn decode(
2676            &mut self,
2677            decoder: &mut fidl::encoding::Decoder<'_, D>,
2678            offset: usize,
2679            mut depth: fidl::encoding::Depth,
2680        ) -> fidl::Result<()> {
2681            decoder.debug_check_bounds::<Self>(offset);
2682            #[allow(unused_variables)]
2683            let next_out_of_line = decoder.next_out_of_line();
2684            let handles_before = decoder.remaining_handles();
2685            let (ordinal, inlined, num_bytes, num_handles) =
2686                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
2687
2688            let member_inline_size = match ordinal {
2689            1 => <fidl_fuchsia_net_common::IpVersion as fidl::encoding::TypeMarker>::inline_size(decoder.context),
2690            2 => <fidl_fuchsia_net_matchers_common::BoundAddress as fidl::encoding::TypeMarker>::inline_size(decoder.context),
2691            3 => <fidl_fuchsia_net_matchers_common::BoundAddress as fidl::encoding::TypeMarker>::inline_size(decoder.context),
2692            4 => <fidl_fuchsia_net_matchers_common::SocketTransportProtocol as fidl::encoding::TypeMarker>::inline_size(decoder.context),
2693            5 => <fidl_fuchsia_net_matchers_common::BoundInterface as fidl::encoding::TypeMarker>::inline_size(decoder.context),
2694            6 => <fidl_fuchsia_net_matchers_common::SocketCookie as fidl::encoding::TypeMarker>::inline_size(decoder.context),
2695            7 => <fidl_fuchsia_net_matchers_common::MarkInDomain as fidl::encoding::TypeMarker>::inline_size(decoder.context),
2696            0 => return Err(fidl::Error::UnknownUnionTag),
2697            _ => num_bytes as usize,
2698        };
2699
2700            if inlined != (member_inline_size <= 4) {
2701                return Err(fidl::Error::InvalidInlineBitInEnvelope);
2702            }
2703            let _inner_offset;
2704            if inlined {
2705                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
2706                _inner_offset = offset + 8;
2707            } else {
2708                depth.increment()?;
2709                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2710            }
2711            match ordinal {
2712                1 => {
2713                    #[allow(irrefutable_let_patterns)]
2714                    if let IpSocketMatcher::Family(_) = self {
2715                        // Do nothing, read the value into the object
2716                    } else {
2717                        // Initialize `self` to the right variant
2718                        *self = IpSocketMatcher::Family(fidl::new_empty!(
2719                            fidl_fuchsia_net_common::IpVersion,
2720                            D
2721                        ));
2722                    }
2723                    #[allow(irrefutable_let_patterns)]
2724                    if let IpSocketMatcher::Family(ref mut val) = self {
2725                        fidl::decode!(
2726                            fidl_fuchsia_net_common::IpVersion,
2727                            D,
2728                            val,
2729                            decoder,
2730                            _inner_offset,
2731                            depth
2732                        )?;
2733                    } else {
2734                        unreachable!()
2735                    }
2736                }
2737                2 => {
2738                    #[allow(irrefutable_let_patterns)]
2739                    if let IpSocketMatcher::SrcAddr(_) = self {
2740                        // Do nothing, read the value into the object
2741                    } else {
2742                        // Initialize `self` to the right variant
2743                        *self = IpSocketMatcher::SrcAddr(fidl::new_empty!(
2744                            fidl_fuchsia_net_matchers_common::BoundAddress,
2745                            D
2746                        ));
2747                    }
2748                    #[allow(irrefutable_let_patterns)]
2749                    if let IpSocketMatcher::SrcAddr(ref mut val) = self {
2750                        fidl::decode!(
2751                            fidl_fuchsia_net_matchers_common::BoundAddress,
2752                            D,
2753                            val,
2754                            decoder,
2755                            _inner_offset,
2756                            depth
2757                        )?;
2758                    } else {
2759                        unreachable!()
2760                    }
2761                }
2762                3 => {
2763                    #[allow(irrefutable_let_patterns)]
2764                    if let IpSocketMatcher::DstAddr(_) = self {
2765                        // Do nothing, read the value into the object
2766                    } else {
2767                        // Initialize `self` to the right variant
2768                        *self = IpSocketMatcher::DstAddr(fidl::new_empty!(
2769                            fidl_fuchsia_net_matchers_common::BoundAddress,
2770                            D
2771                        ));
2772                    }
2773                    #[allow(irrefutable_let_patterns)]
2774                    if let IpSocketMatcher::DstAddr(ref mut val) = self {
2775                        fidl::decode!(
2776                            fidl_fuchsia_net_matchers_common::BoundAddress,
2777                            D,
2778                            val,
2779                            decoder,
2780                            _inner_offset,
2781                            depth
2782                        )?;
2783                    } else {
2784                        unreachable!()
2785                    }
2786                }
2787                4 => {
2788                    #[allow(irrefutable_let_patterns)]
2789                    if let IpSocketMatcher::Proto(_) = self {
2790                        // Do nothing, read the value into the object
2791                    } else {
2792                        // Initialize `self` to the right variant
2793                        *self = IpSocketMatcher::Proto(fidl::new_empty!(
2794                            fidl_fuchsia_net_matchers_common::SocketTransportProtocol,
2795                            D
2796                        ));
2797                    }
2798                    #[allow(irrefutable_let_patterns)]
2799                    if let IpSocketMatcher::Proto(ref mut val) = self {
2800                        fidl::decode!(
2801                            fidl_fuchsia_net_matchers_common::SocketTransportProtocol,
2802                            D,
2803                            val,
2804                            decoder,
2805                            _inner_offset,
2806                            depth
2807                        )?;
2808                    } else {
2809                        unreachable!()
2810                    }
2811                }
2812                5 => {
2813                    #[allow(irrefutable_let_patterns)]
2814                    if let IpSocketMatcher::BoundInterface(_) = self {
2815                        // Do nothing, read the value into the object
2816                    } else {
2817                        // Initialize `self` to the right variant
2818                        *self = IpSocketMatcher::BoundInterface(fidl::new_empty!(
2819                            fidl_fuchsia_net_matchers_common::BoundInterface,
2820                            D
2821                        ));
2822                    }
2823                    #[allow(irrefutable_let_patterns)]
2824                    if let IpSocketMatcher::BoundInterface(ref mut val) = self {
2825                        fidl::decode!(
2826                            fidl_fuchsia_net_matchers_common::BoundInterface,
2827                            D,
2828                            val,
2829                            decoder,
2830                            _inner_offset,
2831                            depth
2832                        )?;
2833                    } else {
2834                        unreachable!()
2835                    }
2836                }
2837                6 => {
2838                    #[allow(irrefutable_let_patterns)]
2839                    if let IpSocketMatcher::Cookie(_) = self {
2840                        // Do nothing, read the value into the object
2841                    } else {
2842                        // Initialize `self` to the right variant
2843                        *self = IpSocketMatcher::Cookie(fidl::new_empty!(
2844                            fidl_fuchsia_net_matchers_common::SocketCookie,
2845                            D
2846                        ));
2847                    }
2848                    #[allow(irrefutable_let_patterns)]
2849                    if let IpSocketMatcher::Cookie(ref mut val) = self {
2850                        fidl::decode!(
2851                            fidl_fuchsia_net_matchers_common::SocketCookie,
2852                            D,
2853                            val,
2854                            decoder,
2855                            _inner_offset,
2856                            depth
2857                        )?;
2858                    } else {
2859                        unreachable!()
2860                    }
2861                }
2862                7 => {
2863                    #[allow(irrefutable_let_patterns)]
2864                    if let IpSocketMatcher::Mark(_) = self {
2865                        // Do nothing, read the value into the object
2866                    } else {
2867                        // Initialize `self` to the right variant
2868                        *self = IpSocketMatcher::Mark(fidl::new_empty!(
2869                            fidl_fuchsia_net_matchers_common::MarkInDomain,
2870                            D
2871                        ));
2872                    }
2873                    #[allow(irrefutable_let_patterns)]
2874                    if let IpSocketMatcher::Mark(ref mut val) = self {
2875                        fidl::decode!(
2876                            fidl_fuchsia_net_matchers_common::MarkInDomain,
2877                            D,
2878                            val,
2879                            decoder,
2880                            _inner_offset,
2881                            depth
2882                        )?;
2883                    } else {
2884                        unreachable!()
2885                    }
2886                }
2887                #[allow(deprecated)]
2888                ordinal => {
2889                    for _ in 0..num_handles {
2890                        decoder.drop_next_handle()?;
2891                    }
2892                    *self = IpSocketMatcher::__SourceBreaking { unknown_ordinal: ordinal };
2893                }
2894            }
2895            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
2896                return Err(fidl::Error::InvalidNumBytesInEnvelope);
2897            }
2898            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2899                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2900            }
2901            Ok(())
2902        }
2903    }
2904
2905    impl fidl::encoding::ValueTypeMarker for IpSocketTransportState {
2906        type Borrowed<'a> = &'a Self;
2907        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2908            value
2909        }
2910    }
2911
2912    unsafe impl fidl::encoding::TypeMarker for IpSocketTransportState {
2913        type Owned = Self;
2914
2915        #[inline(always)]
2916        fn inline_align(_context: fidl::encoding::Context) -> usize {
2917            8
2918        }
2919
2920        #[inline(always)]
2921        fn inline_size(_context: fidl::encoding::Context) -> usize {
2922            16
2923        }
2924    }
2925
2926    unsafe impl<D: fidl::encoding::ResourceDialect>
2927        fidl::encoding::Encode<IpSocketTransportState, D> for &IpSocketTransportState
2928    {
2929        #[inline]
2930        unsafe fn encode(
2931            self,
2932            encoder: &mut fidl::encoding::Encoder<'_, D>,
2933            offset: usize,
2934            _depth: fidl::encoding::Depth,
2935        ) -> fidl::Result<()> {
2936            encoder.debug_check_bounds::<IpSocketTransportState>(offset);
2937            encoder.write_num::<u64>(self.ordinal(), offset);
2938            match self {
2939                IpSocketTransportState::Tcp(ref val) => {
2940                    fidl::encoding::encode_in_envelope::<IpSocketTcpState, D>(
2941                        <IpSocketTcpState as fidl::encoding::ValueTypeMarker>::borrow(val),
2942                        encoder,
2943                        offset + 8,
2944                        _depth,
2945                    )
2946                }
2947                IpSocketTransportState::Udp(ref val) => {
2948                    fidl::encoding::encode_in_envelope::<IpSocketUdpState, D>(
2949                        <IpSocketUdpState as fidl::encoding::ValueTypeMarker>::borrow(val),
2950                        encoder,
2951                        offset + 8,
2952                        _depth,
2953                    )
2954                }
2955                IpSocketTransportState::__SourceBreaking { .. } => {
2956                    Err(fidl::Error::UnknownUnionTag)
2957                }
2958            }
2959        }
2960    }
2961
2962    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2963        for IpSocketTransportState
2964    {
2965        #[inline(always)]
2966        fn new_empty() -> Self {
2967            Self::__SourceBreaking { unknown_ordinal: 0 }
2968        }
2969
2970        #[inline]
2971        unsafe fn decode(
2972            &mut self,
2973            decoder: &mut fidl::encoding::Decoder<'_, D>,
2974            offset: usize,
2975            mut depth: fidl::encoding::Depth,
2976        ) -> fidl::Result<()> {
2977            decoder.debug_check_bounds::<Self>(offset);
2978            #[allow(unused_variables)]
2979            let next_out_of_line = decoder.next_out_of_line();
2980            let handles_before = decoder.remaining_handles();
2981            let (ordinal, inlined, num_bytes, num_handles) =
2982                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
2983
2984            let member_inline_size = match ordinal {
2985                1 => <IpSocketTcpState as fidl::encoding::TypeMarker>::inline_size(decoder.context),
2986                2 => <IpSocketUdpState as fidl::encoding::TypeMarker>::inline_size(decoder.context),
2987                0 => return Err(fidl::Error::UnknownUnionTag),
2988                _ => num_bytes as usize,
2989            };
2990
2991            if inlined != (member_inline_size <= 4) {
2992                return Err(fidl::Error::InvalidInlineBitInEnvelope);
2993            }
2994            let _inner_offset;
2995            if inlined {
2996                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
2997                _inner_offset = offset + 8;
2998            } else {
2999                depth.increment()?;
3000                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3001            }
3002            match ordinal {
3003                1 => {
3004                    #[allow(irrefutable_let_patterns)]
3005                    if let IpSocketTransportState::Tcp(_) = self {
3006                        // Do nothing, read the value into the object
3007                    } else {
3008                        // Initialize `self` to the right variant
3009                        *self = IpSocketTransportState::Tcp(fidl::new_empty!(IpSocketTcpState, D));
3010                    }
3011                    #[allow(irrefutable_let_patterns)]
3012                    if let IpSocketTransportState::Tcp(ref mut val) = self {
3013                        fidl::decode!(IpSocketTcpState, D, val, decoder, _inner_offset, depth)?;
3014                    } else {
3015                        unreachable!()
3016                    }
3017                }
3018                2 => {
3019                    #[allow(irrefutable_let_patterns)]
3020                    if let IpSocketTransportState::Udp(_) = self {
3021                        // Do nothing, read the value into the object
3022                    } else {
3023                        // Initialize `self` to the right variant
3024                        *self = IpSocketTransportState::Udp(fidl::new_empty!(IpSocketUdpState, D));
3025                    }
3026                    #[allow(irrefutable_let_patterns)]
3027                    if let IpSocketTransportState::Udp(ref mut val) = self {
3028                        fidl::decode!(IpSocketUdpState, D, val, decoder, _inner_offset, depth)?;
3029                    } else {
3030                        unreachable!()
3031                    }
3032                }
3033                #[allow(deprecated)]
3034                ordinal => {
3035                    for _ in 0..num_handles {
3036                        decoder.drop_next_handle()?;
3037                    }
3038                    *self = IpSocketTransportState::__SourceBreaking { unknown_ordinal: ordinal };
3039                }
3040            }
3041            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
3042                return Err(fidl::Error::InvalidNumBytesInEnvelope);
3043            }
3044            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3045                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3046            }
3047            Ok(())
3048        }
3049    }
3050
3051    impl fidl::encoding::ValueTypeMarker for IterateIpResult {
3052        type Borrowed<'a> = &'a Self;
3053        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3054            value
3055        }
3056    }
3057
3058    unsafe impl fidl::encoding::TypeMarker for IterateIpResult {
3059        type Owned = Self;
3060
3061        #[inline(always)]
3062        fn inline_align(_context: fidl::encoding::Context) -> usize {
3063            8
3064        }
3065
3066        #[inline(always)]
3067        fn inline_size(_context: fidl::encoding::Context) -> usize {
3068            16
3069        }
3070    }
3071
3072    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<IterateIpResult, D>
3073        for &IterateIpResult
3074    {
3075        #[inline]
3076        unsafe fn encode(
3077            self,
3078            encoder: &mut fidl::encoding::Encoder<'_, D>,
3079            offset: usize,
3080            _depth: fidl::encoding::Depth,
3081        ) -> fidl::Result<()> {
3082            encoder.debug_check_bounds::<IterateIpResult>(offset);
3083            encoder.write_num::<u64>(self.ordinal(), offset);
3084            match self {
3085                IterateIpResult::Ok(ref val) => fidl::encoding::encode_in_envelope::<Empty, D>(
3086                    <Empty as fidl::encoding::ValueTypeMarker>::borrow(val),
3087                    encoder,
3088                    offset + 8,
3089                    _depth,
3090                ),
3091                IterateIpResult::InvalidMatcher(ref val) => {
3092                    fidl::encoding::encode_in_envelope::<InvalidMatcher, D>(
3093                        <InvalidMatcher as fidl::encoding::ValueTypeMarker>::borrow(val),
3094                        encoder,
3095                        offset + 8,
3096                        _depth,
3097                    )
3098                }
3099                IterateIpResult::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
3100            }
3101        }
3102    }
3103
3104    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for IterateIpResult {
3105        #[inline(always)]
3106        fn new_empty() -> Self {
3107            Self::__SourceBreaking { unknown_ordinal: 0 }
3108        }
3109
3110        #[inline]
3111        unsafe fn decode(
3112            &mut self,
3113            decoder: &mut fidl::encoding::Decoder<'_, D>,
3114            offset: usize,
3115            mut depth: fidl::encoding::Depth,
3116        ) -> fidl::Result<()> {
3117            decoder.debug_check_bounds::<Self>(offset);
3118            #[allow(unused_variables)]
3119            let next_out_of_line = decoder.next_out_of_line();
3120            let handles_before = decoder.remaining_handles();
3121            let (ordinal, inlined, num_bytes, num_handles) =
3122                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
3123
3124            let member_inline_size = match ordinal {
3125                1 => <Empty as fidl::encoding::TypeMarker>::inline_size(decoder.context),
3126                2 => <InvalidMatcher as fidl::encoding::TypeMarker>::inline_size(decoder.context),
3127                0 => return Err(fidl::Error::UnknownUnionTag),
3128                _ => num_bytes as usize,
3129            };
3130
3131            if inlined != (member_inline_size <= 4) {
3132                return Err(fidl::Error::InvalidInlineBitInEnvelope);
3133            }
3134            let _inner_offset;
3135            if inlined {
3136                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
3137                _inner_offset = offset + 8;
3138            } else {
3139                depth.increment()?;
3140                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3141            }
3142            match ordinal {
3143                1 => {
3144                    #[allow(irrefutable_let_patterns)]
3145                    if let IterateIpResult::Ok(_) = self {
3146                        // Do nothing, read the value into the object
3147                    } else {
3148                        // Initialize `self` to the right variant
3149                        *self = IterateIpResult::Ok(fidl::new_empty!(Empty, D));
3150                    }
3151                    #[allow(irrefutable_let_patterns)]
3152                    if let IterateIpResult::Ok(ref mut val) = self {
3153                        fidl::decode!(Empty, D, val, decoder, _inner_offset, depth)?;
3154                    } else {
3155                        unreachable!()
3156                    }
3157                }
3158                2 => {
3159                    #[allow(irrefutable_let_patterns)]
3160                    if let IterateIpResult::InvalidMatcher(_) = self {
3161                        // Do nothing, read the value into the object
3162                    } else {
3163                        // Initialize `self` to the right variant
3164                        *self =
3165                            IterateIpResult::InvalidMatcher(fidl::new_empty!(InvalidMatcher, D));
3166                    }
3167                    #[allow(irrefutable_let_patterns)]
3168                    if let IterateIpResult::InvalidMatcher(ref mut val) = self {
3169                        fidl::decode!(InvalidMatcher, D, val, decoder, _inner_offset, depth)?;
3170                    } else {
3171                        unreachable!()
3172                    }
3173                }
3174                #[allow(deprecated)]
3175                ordinal => {
3176                    for _ in 0..num_handles {
3177                        decoder.drop_next_handle()?;
3178                    }
3179                    *self = IterateIpResult::__SourceBreaking { unknown_ordinal: ordinal };
3180                }
3181            }
3182            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
3183                return Err(fidl::Error::InvalidNumBytesInEnvelope);
3184            }
3185            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3186                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3187            }
3188            Ok(())
3189        }
3190    }
3191}