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