Skip to main content

fidl_fuchsia_posix_socket_packet_common/
fidl_fuchsia_posix_socket_packet_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/// A network-layer protocol (above link-layer).
12///
13/// Values are defined by
14/// https://www.iana.org/assignments/ieee-802-numbers/ieee-802-numbers.xhtml.
15pub type Protocol = u16;
16
17/// Legacy protocol name. Use the generated discoverable protocol name instead.
18pub const SOCKET_PROTOCOL_NAME: &str = "fuchsia.posix.socket.packet/Socket";
19
20/// The type of a hardware.
21#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
22#[repr(u32)]
23pub enum HardwareType {
24    /// Hardware that operates only at the network layer; a pure L3 interface.
25    ///
26    /// Hardware of this type have no L2 headers/addressing.
27    NetworkOnly = 1,
28    /// Hardware that operates on ethernet-based links.
29    Ethernet = 2,
30    /// Hardware that loops back packets.
31    Loopback = 3,
32}
33
34impl HardwareType {
35    #[inline]
36    pub fn from_primitive(prim: u32) -> Option<Self> {
37        match prim {
38            1 => Some(Self::NetworkOnly),
39            2 => Some(Self::Ethernet),
40            3 => Some(Self::Loopback),
41            _ => None,
42        }
43    }
44
45    #[inline]
46    pub const fn into_primitive(self) -> u32 {
47        self as u32
48    }
49}
50
51/// A kind of packet socket.
52#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
53#[repr(u32)]
54pub enum Kind {
55    /// A packet socket that operates with network-layer packets.
56    Network = 1,
57    /// A packet socket that operates with link-layer packets.
58    ///
59    /// Packets are passed unmodified between the wire and client when the
60    /// packet socket is of this kind.
61    Link = 2,
62}
63
64impl Kind {
65    #[inline]
66    pub fn from_primitive(prim: u32) -> Option<Self> {
67        match prim {
68            1 => Some(Self::Network),
69            2 => Some(Self::Link),
70            _ => None,
71        }
72    }
73
74    #[inline]
75    pub const fn into_primitive(self) -> u32 {
76        self as u32
77    }
78}
79
80/// The type of a packet.
81#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
82#[repr(u32)]
83pub enum PacketType {
84    /// A packet that arrived at its destination.
85    Host = 1,
86    /// A packet that was broadcasted.
87    Broadcast = 2,
88    /// A packet that was multicasted.
89    Multicast = 3,
90    /// A packet that arrived at a host that isn't its destination.
91    OtherHost = 4,
92    /// A packet that is being sent on a local interface, regardless of how it
93    /// is being sent (unicasted, multicasted, broadcasted).
94    Outgoing = 5,
95}
96
97impl PacketType {
98    #[inline]
99    pub fn from_primitive(prim: u32) -> Option<Self> {
100        match prim {
101            1 => Some(Self::Host),
102            2 => Some(Self::Broadcast),
103            3 => Some(Self::Multicast),
104            4 => Some(Self::OtherHost),
105            5 => Some(Self::Outgoing),
106            _ => None,
107        }
108    }
109
110    #[inline]
111    pub const fn into_primitive(self) -> u32 {
112        self as u32
113    }
114}
115
116#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
117pub struct Empty;
118
119impl fidl::Persistable for Empty {}
120
121/// An interface's properties.
122#[derive(Clone, Debug, PartialEq)]
123pub struct InterfaceProperties {
124    /// The interface's ID.
125    pub id: u64,
126    /// The interface's hardware address.
127    pub addr: HardwareAddress,
128    /// The interface's hardware type.
129    pub type_: HardwareType,
130}
131
132impl fidl::Persistable for InterfaceProperties {}
133
134/// Information about a packet.
135#[derive(Clone, Debug, PartialEq)]
136pub struct PacketInfo {
137    pub protocol: u16,
138    pub interface_id: u64,
139    pub addr: HardwareAddress,
140}
141
142impl fidl::Persistable for PacketInfo {}
143
144#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
145pub struct ProviderSocketRequest {
146    pub kind: Kind,
147}
148
149impl fidl::Persistable for ProviderSocketRequest {}
150
151#[derive(Clone, Debug, PartialEq)]
152pub struct RecvPacketInfo {
153    pub packet_info: PacketInfo,
154    pub packet_type: PacketType,
155    pub interface_type: HardwareType,
156}
157
158impl fidl::Persistable for RecvPacketInfo {}
159
160#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
161pub struct SocketBindRequest {
162    pub protocol: Option<Box<ProtocolAssociation>>,
163    pub bound_interface_id: BoundInterfaceId,
164}
165
166impl fidl::Persistable for SocketBindRequest {}
167
168#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
169pub struct SocketRecvMsgRequest {
170    pub want_packet_info: bool,
171    pub data_len: u32,
172    pub want_control: bool,
173    pub flags: fidl_fuchsia_posix_socket_common::RecvMsgFlags,
174}
175
176impl fidl::Persistable for SocketRecvMsgRequest {}
177
178#[derive(Clone, Debug, PartialEq)]
179pub struct SocketSendMsgRequest {
180    pub packet_info: Option<Box<PacketInfo>>,
181    pub data: Vec<u8>,
182    pub control: SendControlData,
183    pub flags: fidl_fuchsia_posix_socket_common::SendMsgFlags,
184}
185
186impl fidl::Persistable for SocketSendMsgRequest {}
187
188#[derive(Clone, Debug, PartialEq)]
189pub struct SocketGetInfoResponse {
190    pub kind: Kind,
191    pub protocol: Option<Box<ProtocolAssociation>>,
192    pub bound_interface: BoundInterface,
193}
194
195impl fidl::Persistable for SocketGetInfoResponse {}
196
197#[derive(Clone, Debug, PartialEq)]
198pub struct SocketRecvMsgResponse {
199    pub packet_info: Option<Box<RecvPacketInfo>>,
200    pub data: Vec<u8>,
201    pub control: RecvControlData,
202    pub truncated: u32,
203}
204
205impl fidl::Persistable for SocketRecvMsgResponse {}
206
207#[derive(Clone, Debug, Default, PartialEq)]
208pub struct RecvControlData {
209    /// Socket level ancillary data.
210    pub socket: Option<fidl_fuchsia_posix_socket_common::SocketRecvControlData>,
211    #[doc(hidden)]
212    pub __source_breaking: fidl::marker::SourceBreaking,
213}
214
215impl fidl::Persistable for RecvControlData {}
216
217#[derive(Clone, Debug, Default, PartialEq)]
218pub struct SendControlData {
219    /// Socket level ancillary data.
220    pub socket: Option<fidl_fuchsia_posix_socket_common::SocketSendControlData>,
221    #[doc(hidden)]
222    pub __source_breaking: fidl::marker::SourceBreaking,
223}
224
225impl fidl::Persistable for SendControlData {}
226
227#[derive(Clone, Debug, PartialEq)]
228pub enum BoundInterface {
229    All(Empty),
230    Specified(InterfaceProperties),
231}
232
233impl BoundInterface {
234    #[inline]
235    pub fn ordinal(&self) -> u64 {
236        match *self {
237            Self::All(_) => 1,
238            Self::Specified(_) => 2,
239        }
240    }
241}
242
243impl fidl::Persistable for BoundInterface {}
244
245#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
246pub enum BoundInterfaceId {
247    All(Empty),
248    Specified(u64),
249}
250
251impl BoundInterfaceId {
252    #[inline]
253    pub fn ordinal(&self) -> u64 {
254        match *self {
255            Self::All(_) => 1,
256            Self::Specified(_) => 2,
257        }
258    }
259}
260
261impl fidl::Persistable for BoundInterfaceId {}
262
263/// A hardware address.
264#[derive(Clone, Debug)]
265pub enum HardwareAddress {
266    /// Indicates that the hardware does not support link-layer addressing.
267    None(Empty),
268    /// An EUI-48 based address.
269    Eui48(fidl_fuchsia_net_common::MacAddress),
270    #[doc(hidden)]
271    __SourceBreaking { unknown_ordinal: u64 },
272}
273
274/// Pattern that matches an unknown `HardwareAddress` member.
275#[macro_export]
276macro_rules! HardwareAddressUnknown {
277    () => {
278        _
279    };
280}
281
282// Custom PartialEq so that unknown variants are not equal to themselves.
283impl PartialEq for HardwareAddress {
284    fn eq(&self, other: &Self) -> bool {
285        match (self, other) {
286            (Self::None(x), Self::None(y)) => *x == *y,
287            (Self::Eui48(x), Self::Eui48(y)) => *x == *y,
288            _ => false,
289        }
290    }
291}
292
293impl HardwareAddress {
294    #[inline]
295    pub fn ordinal(&self) -> u64 {
296        match *self {
297            Self::None(_) => 1,
298            Self::Eui48(_) => 2,
299            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
300        }
301    }
302
303    #[inline]
304    pub fn unknown_variant_for_testing() -> Self {
305        Self::__SourceBreaking { unknown_ordinal: 0 }
306    }
307
308    #[inline]
309    pub fn is_unknown(&self) -> bool {
310        match self {
311            Self::__SourceBreaking { .. } => true,
312            _ => false,
313        }
314    }
315}
316
317impl fidl::Persistable for HardwareAddress {}
318
319/// The protocol association for a packet socket.
320#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
321pub enum ProtocolAssociation {
322    /// An association with all protocols.
323    All(Empty),
324    /// An association with a protocol.
325    Specified(u16),
326}
327
328impl ProtocolAssociation {
329    #[inline]
330    pub fn ordinal(&self) -> u64 {
331        match *self {
332            Self::All(_) => 1,
333            Self::Specified(_) => 2,
334        }
335    }
336}
337
338impl fidl::Persistable for ProtocolAssociation {}
339
340pub mod provider_ordinals {
341    pub const SOCKET: u64 = 0x3aad2da99889858e;
342    pub const SOCKET_WITH_OPTIONS: u64 = 0x2cc3e654e776d7c8;
343}
344
345pub mod socket_ordinals {
346    pub const CLONE: u64 = 0x20d8a7aba2168a79;
347    pub const CLOSE: u64 = 0x5ac5d459ad7f657e;
348    pub const QUERY: u64 = 0x2658edee9decfc06;
349    pub const SET_REUSE_ADDRESS: u64 = 0x1fd74ee8b9a4a876;
350    pub const GET_REUSE_ADDRESS: u64 = 0x67b7206b8d1bc0a5;
351    pub const GET_ERROR: u64 = 0x5aad39b33e5f6ebb;
352    pub const SET_BROADCAST: u64 = 0x6023e081ce3cd947;
353    pub const GET_BROADCAST: u64 = 0x68796fc556f9780d;
354    pub const SET_SEND_BUFFER: u64 = 0x756eac32d73a7a70;
355    pub const GET_SEND_BUFFER: u64 = 0x78a52fd9c7b2410b;
356    pub const SET_RECEIVE_BUFFER: u64 = 0x6b0cf2f1919c7001;
357    pub const GET_RECEIVE_BUFFER: u64 = 0x14c1a4b64f709e5c;
358    pub const SET_KEEP_ALIVE: u64 = 0x572df8f0b920d2c7;
359    pub const GET_KEEP_ALIVE: u64 = 0x2dd29d3215f2c9d2;
360    pub const SET_OUT_OF_BAND_INLINE: u64 = 0x3ecb49968bee439;
361    pub const GET_OUT_OF_BAND_INLINE: u64 = 0x348c1ab3aeca1745;
362    pub const SET_NO_CHECK: u64 = 0x6bbf00c53a4c78c2;
363    pub const GET_NO_CHECK: u64 = 0x2cd4249286417694;
364    pub const SET_LINGER: u64 = 0x45386351246e998e;
365    pub const GET_LINGER: u64 = 0x48eb20fc5ccb0e45;
366    pub const SET_REUSE_PORT: u64 = 0x547dc9cc0455189e;
367    pub const SET_REUSE_PORT_DEPRECATED: u64 = 0x24dd3e5cb36d9ccb;
368    pub const GET_REUSE_PORT: u64 = 0x7a112c1ab54ff828;
369    pub const GET_ACCEPT_CONN: u64 = 0x67ce6db6c2ec8966;
370    pub const SET_BIND_TO_DEVICE: u64 = 0x2118b483f28aafc4;
371    pub const GET_BIND_TO_DEVICE: u64 = 0x1ab1fbf0ef7906c8;
372    pub const SET_BIND_TO_INTERFACE_INDEX: u64 = 0x6e387a0def00821;
373    pub const GET_BIND_TO_INTERFACE_INDEX: u64 = 0x59c31dd3e3078295;
374    pub const SET_TIMESTAMP: u64 = 0x285d6516c263d839;
375    pub const GET_TIMESTAMP: u64 = 0x49f2fffbbcc2bd27;
376    pub const SET_MARK: u64 = 0x6ead6de09f653236;
377    pub const GET_MARK: u64 = 0x57a2752c61d93d47;
378    pub const GET_COOKIE: u64 = 0x2c2f47fd8f924e52;
379    pub const DESCRIBE: u64 = 0x4fd7c08c9c804484;
380    pub const BIND: u64 = 0x6caedb2d31b56db8;
381    pub const GET_INFO: u64 = 0x7f67457e85c3914c;
382    pub const RECV_MSG: u64 = 0x52b95ba982826a61;
383    pub const SEND_MSG: u64 = 0x150c9ff91f944922;
384    pub const ATTACH_BPF_FILTER_UNSAFE: u64 = 0x593998d38670f823;
385}
386
387mod internal {
388    use super::*;
389    unsafe impl fidl::encoding::TypeMarker for HardwareType {
390        type Owned = Self;
391
392        #[inline(always)]
393        fn inline_align(_context: fidl::encoding::Context) -> usize {
394            std::mem::align_of::<u32>()
395        }
396
397        #[inline(always)]
398        fn inline_size(_context: fidl::encoding::Context) -> usize {
399            std::mem::size_of::<u32>()
400        }
401
402        #[inline(always)]
403        fn encode_is_copy() -> bool {
404            true
405        }
406
407        #[inline(always)]
408        fn decode_is_copy() -> bool {
409            false
410        }
411    }
412
413    impl fidl::encoding::ValueTypeMarker for HardwareType {
414        type Borrowed<'a> = Self;
415        #[inline(always)]
416        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
417            *value
418        }
419    }
420
421    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for HardwareType {
422        #[inline]
423        unsafe fn encode(
424            self,
425            encoder: &mut fidl::encoding::Encoder<'_, D>,
426            offset: usize,
427            _depth: fidl::encoding::Depth,
428        ) -> fidl::Result<()> {
429            encoder.debug_check_bounds::<Self>(offset);
430            encoder.write_num(self.into_primitive(), offset);
431            Ok(())
432        }
433    }
434
435    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for HardwareType {
436        #[inline(always)]
437        fn new_empty() -> Self {
438            Self::NetworkOnly
439        }
440
441        #[inline]
442        unsafe fn decode(
443            &mut self,
444            decoder: &mut fidl::encoding::Decoder<'_, D>,
445            offset: usize,
446            _depth: fidl::encoding::Depth,
447        ) -> fidl::Result<()> {
448            decoder.debug_check_bounds::<Self>(offset);
449            let prim = decoder.read_num::<u32>(offset);
450
451            *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
452            Ok(())
453        }
454    }
455    unsafe impl fidl::encoding::TypeMarker for Kind {
456        type Owned = Self;
457
458        #[inline(always)]
459        fn inline_align(_context: fidl::encoding::Context) -> usize {
460            std::mem::align_of::<u32>()
461        }
462
463        #[inline(always)]
464        fn inline_size(_context: fidl::encoding::Context) -> usize {
465            std::mem::size_of::<u32>()
466        }
467
468        #[inline(always)]
469        fn encode_is_copy() -> bool {
470            true
471        }
472
473        #[inline(always)]
474        fn decode_is_copy() -> bool {
475            false
476        }
477    }
478
479    impl fidl::encoding::ValueTypeMarker for Kind {
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 Kind {
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.into_primitive(), offset);
497            Ok(())
498        }
499    }
500
501    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Kind {
502        #[inline(always)]
503        fn new_empty() -> Self {
504            Self::Network
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
517            *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
518            Ok(())
519        }
520    }
521    unsafe impl fidl::encoding::TypeMarker for PacketType {
522        type Owned = Self;
523
524        #[inline(always)]
525        fn inline_align(_context: fidl::encoding::Context) -> usize {
526            std::mem::align_of::<u32>()
527        }
528
529        #[inline(always)]
530        fn inline_size(_context: fidl::encoding::Context) -> usize {
531            std::mem::size_of::<u32>()
532        }
533
534        #[inline(always)]
535        fn encode_is_copy() -> bool {
536            true
537        }
538
539        #[inline(always)]
540        fn decode_is_copy() -> bool {
541            false
542        }
543    }
544
545    impl fidl::encoding::ValueTypeMarker for PacketType {
546        type Borrowed<'a> = Self;
547        #[inline(always)]
548        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
549            *value
550        }
551    }
552
553    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for PacketType {
554        #[inline]
555        unsafe fn encode(
556            self,
557            encoder: &mut fidl::encoding::Encoder<'_, D>,
558            offset: usize,
559            _depth: fidl::encoding::Depth,
560        ) -> fidl::Result<()> {
561            encoder.debug_check_bounds::<Self>(offset);
562            encoder.write_num(self.into_primitive(), offset);
563            Ok(())
564        }
565    }
566
567    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for PacketType {
568        #[inline(always)]
569        fn new_empty() -> Self {
570            Self::Host
571        }
572
573        #[inline]
574        unsafe fn decode(
575            &mut self,
576            decoder: &mut fidl::encoding::Decoder<'_, D>,
577            offset: usize,
578            _depth: fidl::encoding::Depth,
579        ) -> fidl::Result<()> {
580            decoder.debug_check_bounds::<Self>(offset);
581            let prim = decoder.read_num::<u32>(offset);
582
583            *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
584            Ok(())
585        }
586    }
587
588    impl fidl::encoding::ValueTypeMarker for Empty {
589        type Borrowed<'a> = &'a Self;
590        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
591            value
592        }
593    }
594
595    unsafe impl fidl::encoding::TypeMarker for Empty {
596        type Owned = Self;
597
598        #[inline(always)]
599        fn inline_align(_context: fidl::encoding::Context) -> usize {
600            1
601        }
602
603        #[inline(always)]
604        fn inline_size(_context: fidl::encoding::Context) -> usize {
605            1
606        }
607    }
608
609    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Empty, D> for &Empty {
610        #[inline]
611        unsafe fn encode(
612            self,
613            encoder: &mut fidl::encoding::Encoder<'_, D>,
614            offset: usize,
615            _depth: fidl::encoding::Depth,
616        ) -> fidl::Result<()> {
617            encoder.debug_check_bounds::<Empty>(offset);
618            encoder.write_num(0u8, offset);
619            Ok(())
620        }
621    }
622
623    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Empty {
624        #[inline(always)]
625        fn new_empty() -> Self {
626            Self
627        }
628
629        #[inline]
630        unsafe fn decode(
631            &mut self,
632            decoder: &mut fidl::encoding::Decoder<'_, D>,
633            offset: usize,
634            _depth: fidl::encoding::Depth,
635        ) -> fidl::Result<()> {
636            decoder.debug_check_bounds::<Self>(offset);
637            match decoder.read_num::<u8>(offset) {
638                0 => Ok(()),
639                _ => Err(fidl::Error::Invalid),
640            }
641        }
642    }
643
644    impl fidl::encoding::ValueTypeMarker for InterfaceProperties {
645        type Borrowed<'a> = &'a Self;
646        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
647            value
648        }
649    }
650
651    unsafe impl fidl::encoding::TypeMarker for InterfaceProperties {
652        type Owned = Self;
653
654        #[inline(always)]
655        fn inline_align(_context: fidl::encoding::Context) -> usize {
656            8
657        }
658
659        #[inline(always)]
660        fn inline_size(_context: fidl::encoding::Context) -> usize {
661            32
662        }
663    }
664
665    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<InterfaceProperties, D>
666        for &InterfaceProperties
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::<InterfaceProperties>(offset);
676            // Delegate to tuple encoding.
677            fidl::encoding::Encode::<InterfaceProperties, D>::encode(
678                (
679                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.id),
680                    <HardwareAddress as fidl::encoding::ValueTypeMarker>::borrow(&self.addr),
681                    <HardwareType as fidl::encoding::ValueTypeMarker>::borrow(&self.type_),
682                ),
683                encoder,
684                offset,
685                _depth,
686            )
687        }
688    }
689    unsafe impl<
690        D: fidl::encoding::ResourceDialect,
691        T0: fidl::encoding::Encode<u64, D>,
692        T1: fidl::encoding::Encode<HardwareAddress, D>,
693        T2: fidl::encoding::Encode<HardwareType, D>,
694    > fidl::encoding::Encode<InterfaceProperties, D> for (T0, T1, T2)
695    {
696        #[inline]
697        unsafe fn encode(
698            self,
699            encoder: &mut fidl::encoding::Encoder<'_, D>,
700            offset: usize,
701            depth: fidl::encoding::Depth,
702        ) -> fidl::Result<()> {
703            encoder.debug_check_bounds::<InterfaceProperties>(offset);
704            // Zero out padding regions. There's no need to apply masks
705            // because the unmasked parts will be overwritten by fields.
706            unsafe {
707                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(24);
708                (ptr as *mut u64).write_unaligned(0);
709            }
710            // Write the fields.
711            self.0.encode(encoder, offset + 0, depth)?;
712            self.1.encode(encoder, offset + 8, depth)?;
713            self.2.encode(encoder, offset + 24, depth)?;
714            Ok(())
715        }
716    }
717
718    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for InterfaceProperties {
719        #[inline(always)]
720        fn new_empty() -> Self {
721            Self {
722                id: fidl::new_empty!(u64, D),
723                addr: fidl::new_empty!(HardwareAddress, D),
724                type_: fidl::new_empty!(HardwareType, D),
725            }
726        }
727
728        #[inline]
729        unsafe fn decode(
730            &mut self,
731            decoder: &mut fidl::encoding::Decoder<'_, D>,
732            offset: usize,
733            _depth: fidl::encoding::Depth,
734        ) -> fidl::Result<()> {
735            decoder.debug_check_bounds::<Self>(offset);
736            // Verify that padding bytes are zero.
737            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(24) };
738            let padval = unsafe { (ptr as *const u64).read_unaligned() };
739            let mask = 0xffffffff00000000u64;
740            let maskedval = padval & mask;
741            if maskedval != 0 {
742                return Err(fidl::Error::NonZeroPadding {
743                    padding_start: offset + 24 + ((mask as u64).trailing_zeros() / 8) as usize,
744                });
745            }
746            fidl::decode!(u64, D, &mut self.id, decoder, offset + 0, _depth)?;
747            fidl::decode!(HardwareAddress, D, &mut self.addr, decoder, offset + 8, _depth)?;
748            fidl::decode!(HardwareType, D, &mut self.type_, decoder, offset + 24, _depth)?;
749            Ok(())
750        }
751    }
752
753    impl fidl::encoding::ValueTypeMarker for PacketInfo {
754        type Borrowed<'a> = &'a Self;
755        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
756            value
757        }
758    }
759
760    unsafe impl fidl::encoding::TypeMarker for PacketInfo {
761        type Owned = Self;
762
763        #[inline(always)]
764        fn inline_align(_context: fidl::encoding::Context) -> usize {
765            8
766        }
767
768        #[inline(always)]
769        fn inline_size(_context: fidl::encoding::Context) -> usize {
770            32
771        }
772    }
773
774    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<PacketInfo, D>
775        for &PacketInfo
776    {
777        #[inline]
778        unsafe fn encode(
779            self,
780            encoder: &mut fidl::encoding::Encoder<'_, D>,
781            offset: usize,
782            _depth: fidl::encoding::Depth,
783        ) -> fidl::Result<()> {
784            encoder.debug_check_bounds::<PacketInfo>(offset);
785            // Delegate to tuple encoding.
786            fidl::encoding::Encode::<PacketInfo, D>::encode(
787                (
788                    <u16 as fidl::encoding::ValueTypeMarker>::borrow(&self.protocol),
789                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.interface_id),
790                    <HardwareAddress as fidl::encoding::ValueTypeMarker>::borrow(&self.addr),
791                ),
792                encoder,
793                offset,
794                _depth,
795            )
796        }
797    }
798    unsafe impl<
799        D: fidl::encoding::ResourceDialect,
800        T0: fidl::encoding::Encode<u16, D>,
801        T1: fidl::encoding::Encode<u64, D>,
802        T2: fidl::encoding::Encode<HardwareAddress, D>,
803    > fidl::encoding::Encode<PacketInfo, D> for (T0, T1, T2)
804    {
805        #[inline]
806        unsafe fn encode(
807            self,
808            encoder: &mut fidl::encoding::Encoder<'_, D>,
809            offset: usize,
810            depth: fidl::encoding::Depth,
811        ) -> fidl::Result<()> {
812            encoder.debug_check_bounds::<PacketInfo>(offset);
813            // Zero out padding regions. There's no need to apply masks
814            // because the unmasked parts will be overwritten by fields.
815            unsafe {
816                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
817                (ptr as *mut u64).write_unaligned(0);
818            }
819            // Write the fields.
820            self.0.encode(encoder, offset + 0, depth)?;
821            self.1.encode(encoder, offset + 8, depth)?;
822            self.2.encode(encoder, offset + 16, depth)?;
823            Ok(())
824        }
825    }
826
827    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for PacketInfo {
828        #[inline(always)]
829        fn new_empty() -> Self {
830            Self {
831                protocol: fidl::new_empty!(u16, D),
832                interface_id: fidl::new_empty!(u64, D),
833                addr: fidl::new_empty!(HardwareAddress, D),
834            }
835        }
836
837        #[inline]
838        unsafe fn decode(
839            &mut self,
840            decoder: &mut fidl::encoding::Decoder<'_, D>,
841            offset: usize,
842            _depth: fidl::encoding::Depth,
843        ) -> fidl::Result<()> {
844            decoder.debug_check_bounds::<Self>(offset);
845            // Verify that padding bytes are zero.
846            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
847            let padval = unsafe { (ptr as *const u64).read_unaligned() };
848            let mask = 0xffffffffffff0000u64;
849            let maskedval = padval & mask;
850            if maskedval != 0 {
851                return Err(fidl::Error::NonZeroPadding {
852                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
853                });
854            }
855            fidl::decode!(u16, D, &mut self.protocol, decoder, offset + 0, _depth)?;
856            fidl::decode!(u64, D, &mut self.interface_id, decoder, offset + 8, _depth)?;
857            fidl::decode!(HardwareAddress, D, &mut self.addr, decoder, offset + 16, _depth)?;
858            Ok(())
859        }
860    }
861
862    impl fidl::encoding::ValueTypeMarker for ProviderSocketRequest {
863        type Borrowed<'a> = &'a Self;
864        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
865            value
866        }
867    }
868
869    unsafe impl fidl::encoding::TypeMarker for ProviderSocketRequest {
870        type Owned = Self;
871
872        #[inline(always)]
873        fn inline_align(_context: fidl::encoding::Context) -> usize {
874            4
875        }
876
877        #[inline(always)]
878        fn inline_size(_context: fidl::encoding::Context) -> usize {
879            4
880        }
881    }
882
883    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<ProviderSocketRequest, D>
884        for &ProviderSocketRequest
885    {
886        #[inline]
887        unsafe fn encode(
888            self,
889            encoder: &mut fidl::encoding::Encoder<'_, D>,
890            offset: usize,
891            _depth: fidl::encoding::Depth,
892        ) -> fidl::Result<()> {
893            encoder.debug_check_bounds::<ProviderSocketRequest>(offset);
894            // Delegate to tuple encoding.
895            fidl::encoding::Encode::<ProviderSocketRequest, D>::encode(
896                (<Kind as fidl::encoding::ValueTypeMarker>::borrow(&self.kind),),
897                encoder,
898                offset,
899                _depth,
900            )
901        }
902    }
903    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<Kind, D>>
904        fidl::encoding::Encode<ProviderSocketRequest, D> for (T0,)
905    {
906        #[inline]
907        unsafe fn encode(
908            self,
909            encoder: &mut fidl::encoding::Encoder<'_, D>,
910            offset: usize,
911            depth: fidl::encoding::Depth,
912        ) -> fidl::Result<()> {
913            encoder.debug_check_bounds::<ProviderSocketRequest>(offset);
914            // Zero out padding regions. There's no need to apply masks
915            // because the unmasked parts will be overwritten by fields.
916            // Write the fields.
917            self.0.encode(encoder, offset + 0, depth)?;
918            Ok(())
919        }
920    }
921
922    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ProviderSocketRequest {
923        #[inline(always)]
924        fn new_empty() -> Self {
925            Self { kind: fidl::new_empty!(Kind, D) }
926        }
927
928        #[inline]
929        unsafe fn decode(
930            &mut self,
931            decoder: &mut fidl::encoding::Decoder<'_, D>,
932            offset: usize,
933            _depth: fidl::encoding::Depth,
934        ) -> fidl::Result<()> {
935            decoder.debug_check_bounds::<Self>(offset);
936            // Verify that padding bytes are zero.
937            fidl::decode!(Kind, D, &mut self.kind, decoder, offset + 0, _depth)?;
938            Ok(())
939        }
940    }
941
942    impl fidl::encoding::ValueTypeMarker for RecvPacketInfo {
943        type Borrowed<'a> = &'a Self;
944        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
945            value
946        }
947    }
948
949    unsafe impl fidl::encoding::TypeMarker for RecvPacketInfo {
950        type Owned = Self;
951
952        #[inline(always)]
953        fn inline_align(_context: fidl::encoding::Context) -> usize {
954            8
955        }
956
957        #[inline(always)]
958        fn inline_size(_context: fidl::encoding::Context) -> usize {
959            40
960        }
961    }
962
963    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<RecvPacketInfo, D>
964        for &RecvPacketInfo
965    {
966        #[inline]
967        unsafe fn encode(
968            self,
969            encoder: &mut fidl::encoding::Encoder<'_, D>,
970            offset: usize,
971            _depth: fidl::encoding::Depth,
972        ) -> fidl::Result<()> {
973            encoder.debug_check_bounds::<RecvPacketInfo>(offset);
974            // Delegate to tuple encoding.
975            fidl::encoding::Encode::<RecvPacketInfo, D>::encode(
976                (
977                    <PacketInfo as fidl::encoding::ValueTypeMarker>::borrow(&self.packet_info),
978                    <PacketType as fidl::encoding::ValueTypeMarker>::borrow(&self.packet_type),
979                    <HardwareType as fidl::encoding::ValueTypeMarker>::borrow(&self.interface_type),
980                ),
981                encoder,
982                offset,
983                _depth,
984            )
985        }
986    }
987    unsafe impl<
988        D: fidl::encoding::ResourceDialect,
989        T0: fidl::encoding::Encode<PacketInfo, D>,
990        T1: fidl::encoding::Encode<PacketType, D>,
991        T2: fidl::encoding::Encode<HardwareType, D>,
992    > fidl::encoding::Encode<RecvPacketInfo, D> for (T0, T1, T2)
993    {
994        #[inline]
995        unsafe fn encode(
996            self,
997            encoder: &mut fidl::encoding::Encoder<'_, D>,
998            offset: usize,
999            depth: fidl::encoding::Depth,
1000        ) -> fidl::Result<()> {
1001            encoder.debug_check_bounds::<RecvPacketInfo>(offset);
1002            // Zero out padding regions. There's no need to apply masks
1003            // because the unmasked parts will be overwritten by fields.
1004            // Write the fields.
1005            self.0.encode(encoder, offset + 0, depth)?;
1006            self.1.encode(encoder, offset + 32, depth)?;
1007            self.2.encode(encoder, offset + 36, depth)?;
1008            Ok(())
1009        }
1010    }
1011
1012    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for RecvPacketInfo {
1013        #[inline(always)]
1014        fn new_empty() -> Self {
1015            Self {
1016                packet_info: fidl::new_empty!(PacketInfo, D),
1017                packet_type: fidl::new_empty!(PacketType, D),
1018                interface_type: fidl::new_empty!(HardwareType, D),
1019            }
1020        }
1021
1022        #[inline]
1023        unsafe fn decode(
1024            &mut self,
1025            decoder: &mut fidl::encoding::Decoder<'_, D>,
1026            offset: usize,
1027            _depth: fidl::encoding::Depth,
1028        ) -> fidl::Result<()> {
1029            decoder.debug_check_bounds::<Self>(offset);
1030            // Verify that padding bytes are zero.
1031            fidl::decode!(PacketInfo, D, &mut self.packet_info, decoder, offset + 0, _depth)?;
1032            fidl::decode!(PacketType, D, &mut self.packet_type, decoder, offset + 32, _depth)?;
1033            fidl::decode!(HardwareType, D, &mut self.interface_type, decoder, offset + 36, _depth)?;
1034            Ok(())
1035        }
1036    }
1037
1038    impl fidl::encoding::ValueTypeMarker for SocketBindRequest {
1039        type Borrowed<'a> = &'a Self;
1040        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1041            value
1042        }
1043    }
1044
1045    unsafe impl fidl::encoding::TypeMarker for SocketBindRequest {
1046        type Owned = Self;
1047
1048        #[inline(always)]
1049        fn inline_align(_context: fidl::encoding::Context) -> usize {
1050            8
1051        }
1052
1053        #[inline(always)]
1054        fn inline_size(_context: fidl::encoding::Context) -> usize {
1055            32
1056        }
1057    }
1058
1059    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<SocketBindRequest, D>
1060        for &SocketBindRequest
1061    {
1062        #[inline]
1063        unsafe fn encode(
1064            self,
1065            encoder: &mut fidl::encoding::Encoder<'_, D>,
1066            offset: usize,
1067            _depth: fidl::encoding::Depth,
1068        ) -> fidl::Result<()> {
1069            encoder.debug_check_bounds::<SocketBindRequest>(offset);
1070            // Delegate to tuple encoding.
1071            fidl::encoding::Encode::<SocketBindRequest, D>::encode(
1072                (
1073                    <fidl::encoding::OptionalUnion<ProtocolAssociation> as fidl::encoding::ValueTypeMarker>::borrow(&self.protocol),
1074                    <BoundInterfaceId as fidl::encoding::ValueTypeMarker>::borrow(&self.bound_interface_id),
1075                ),
1076                encoder, offset, _depth
1077            )
1078        }
1079    }
1080    unsafe impl<
1081        D: fidl::encoding::ResourceDialect,
1082        T0: fidl::encoding::Encode<fidl::encoding::OptionalUnion<ProtocolAssociation>, D>,
1083        T1: fidl::encoding::Encode<BoundInterfaceId, D>,
1084    > fidl::encoding::Encode<SocketBindRequest, D> for (T0, T1)
1085    {
1086        #[inline]
1087        unsafe fn encode(
1088            self,
1089            encoder: &mut fidl::encoding::Encoder<'_, D>,
1090            offset: usize,
1091            depth: fidl::encoding::Depth,
1092        ) -> fidl::Result<()> {
1093            encoder.debug_check_bounds::<SocketBindRequest>(offset);
1094            // Zero out padding regions. There's no need to apply masks
1095            // because the unmasked parts will be overwritten by fields.
1096            // Write the fields.
1097            self.0.encode(encoder, offset + 0, depth)?;
1098            self.1.encode(encoder, offset + 16, depth)?;
1099            Ok(())
1100        }
1101    }
1102
1103    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SocketBindRequest {
1104        #[inline(always)]
1105        fn new_empty() -> Self {
1106            Self {
1107                protocol: fidl::new_empty!(fidl::encoding::OptionalUnion<ProtocolAssociation>, D),
1108                bound_interface_id: fidl::new_empty!(BoundInterfaceId, D),
1109            }
1110        }
1111
1112        #[inline]
1113        unsafe fn decode(
1114            &mut self,
1115            decoder: &mut fidl::encoding::Decoder<'_, D>,
1116            offset: usize,
1117            _depth: fidl::encoding::Depth,
1118        ) -> fidl::Result<()> {
1119            decoder.debug_check_bounds::<Self>(offset);
1120            // Verify that padding bytes are zero.
1121            fidl::decode!(
1122                fidl::encoding::OptionalUnion<ProtocolAssociation>,
1123                D,
1124                &mut self.protocol,
1125                decoder,
1126                offset + 0,
1127                _depth
1128            )?;
1129            fidl::decode!(
1130                BoundInterfaceId,
1131                D,
1132                &mut self.bound_interface_id,
1133                decoder,
1134                offset + 16,
1135                _depth
1136            )?;
1137            Ok(())
1138        }
1139    }
1140
1141    impl fidl::encoding::ValueTypeMarker for SocketRecvMsgRequest {
1142        type Borrowed<'a> = &'a Self;
1143        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1144            value
1145        }
1146    }
1147
1148    unsafe impl fidl::encoding::TypeMarker for SocketRecvMsgRequest {
1149        type Owned = Self;
1150
1151        #[inline(always)]
1152        fn inline_align(_context: fidl::encoding::Context) -> usize {
1153            4
1154        }
1155
1156        #[inline(always)]
1157        fn inline_size(_context: fidl::encoding::Context) -> usize {
1158            12
1159        }
1160    }
1161
1162    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<SocketRecvMsgRequest, D>
1163        for &SocketRecvMsgRequest
1164    {
1165        #[inline]
1166        unsafe fn encode(
1167            self,
1168            encoder: &mut fidl::encoding::Encoder<'_, D>,
1169            offset: usize,
1170            _depth: fidl::encoding::Depth,
1171        ) -> fidl::Result<()> {
1172            encoder.debug_check_bounds::<SocketRecvMsgRequest>(offset);
1173            // Delegate to tuple encoding.
1174            fidl::encoding::Encode::<SocketRecvMsgRequest, D>::encode(
1175                (
1176                    <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.want_packet_info),
1177                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.data_len),
1178                    <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.want_control),
1179                    <fidl_fuchsia_posix_socket_common::RecvMsgFlags as fidl::encoding::ValueTypeMarker>::borrow(&self.flags),
1180                ),
1181                encoder, offset, _depth
1182            )
1183        }
1184    }
1185    unsafe impl<
1186        D: fidl::encoding::ResourceDialect,
1187        T0: fidl::encoding::Encode<bool, D>,
1188        T1: fidl::encoding::Encode<u32, D>,
1189        T2: fidl::encoding::Encode<bool, D>,
1190        T3: fidl::encoding::Encode<fidl_fuchsia_posix_socket_common::RecvMsgFlags, D>,
1191    > fidl::encoding::Encode<SocketRecvMsgRequest, D> for (T0, T1, T2, T3)
1192    {
1193        #[inline]
1194        unsafe fn encode(
1195            self,
1196            encoder: &mut fidl::encoding::Encoder<'_, D>,
1197            offset: usize,
1198            depth: fidl::encoding::Depth,
1199        ) -> fidl::Result<()> {
1200            encoder.debug_check_bounds::<SocketRecvMsgRequest>(offset);
1201            // Zero out padding regions. There's no need to apply masks
1202            // because the unmasked parts will be overwritten by fields.
1203            unsafe {
1204                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
1205                (ptr as *mut u32).write_unaligned(0);
1206            }
1207            unsafe {
1208                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
1209                (ptr as *mut u32).write_unaligned(0);
1210            }
1211            // Write the fields.
1212            self.0.encode(encoder, offset + 0, depth)?;
1213            self.1.encode(encoder, offset + 4, depth)?;
1214            self.2.encode(encoder, offset + 8, depth)?;
1215            self.3.encode(encoder, offset + 10, depth)?;
1216            Ok(())
1217        }
1218    }
1219
1220    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SocketRecvMsgRequest {
1221        #[inline(always)]
1222        fn new_empty() -> Self {
1223            Self {
1224                want_packet_info: fidl::new_empty!(bool, D),
1225                data_len: fidl::new_empty!(u32, D),
1226                want_control: fidl::new_empty!(bool, D),
1227                flags: fidl::new_empty!(fidl_fuchsia_posix_socket_common::RecvMsgFlags, D),
1228            }
1229        }
1230
1231        #[inline]
1232        unsafe fn decode(
1233            &mut self,
1234            decoder: &mut fidl::encoding::Decoder<'_, D>,
1235            offset: usize,
1236            _depth: fidl::encoding::Depth,
1237        ) -> fidl::Result<()> {
1238            decoder.debug_check_bounds::<Self>(offset);
1239            // Verify that padding bytes are zero.
1240            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
1241            let padval = unsafe { (ptr as *const u32).read_unaligned() };
1242            let mask = 0xffffff00u32;
1243            let maskedval = padval & mask;
1244            if maskedval != 0 {
1245                return Err(fidl::Error::NonZeroPadding {
1246                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
1247                });
1248            }
1249            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(8) };
1250            let padval = unsafe { (ptr as *const u32).read_unaligned() };
1251            let mask = 0xff00u32;
1252            let maskedval = padval & mask;
1253            if maskedval != 0 {
1254                return Err(fidl::Error::NonZeroPadding {
1255                    padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
1256                });
1257            }
1258            fidl::decode!(bool, D, &mut self.want_packet_info, decoder, offset + 0, _depth)?;
1259            fidl::decode!(u32, D, &mut self.data_len, decoder, offset + 4, _depth)?;
1260            fidl::decode!(bool, D, &mut self.want_control, decoder, offset + 8, _depth)?;
1261            fidl::decode!(
1262                fidl_fuchsia_posix_socket_common::RecvMsgFlags,
1263                D,
1264                &mut self.flags,
1265                decoder,
1266                offset + 10,
1267                _depth
1268            )?;
1269            Ok(())
1270        }
1271    }
1272
1273    impl fidl::encoding::ValueTypeMarker for SocketSendMsgRequest {
1274        type Borrowed<'a> = &'a Self;
1275        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1276            value
1277        }
1278    }
1279
1280    unsafe impl fidl::encoding::TypeMarker for SocketSendMsgRequest {
1281        type Owned = Self;
1282
1283        #[inline(always)]
1284        fn inline_align(_context: fidl::encoding::Context) -> usize {
1285            8
1286        }
1287
1288        #[inline(always)]
1289        fn inline_size(_context: fidl::encoding::Context) -> usize {
1290            48
1291        }
1292    }
1293
1294    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<SocketSendMsgRequest, D>
1295        for &SocketSendMsgRequest
1296    {
1297        #[inline]
1298        unsafe fn encode(
1299            self,
1300            encoder: &mut fidl::encoding::Encoder<'_, D>,
1301            offset: usize,
1302            _depth: fidl::encoding::Depth,
1303        ) -> fidl::Result<()> {
1304            encoder.debug_check_bounds::<SocketSendMsgRequest>(offset);
1305            // Delegate to tuple encoding.
1306            fidl::encoding::Encode::<SocketSendMsgRequest, D>::encode(
1307                (
1308                    <fidl::encoding::Boxed<PacketInfo> as fidl::encoding::ValueTypeMarker>::borrow(&self.packet_info),
1309                    <fidl::encoding::UnboundedVector<u8> as fidl::encoding::ValueTypeMarker>::borrow(&self.data),
1310                    <SendControlData as fidl::encoding::ValueTypeMarker>::borrow(&self.control),
1311                    <fidl_fuchsia_posix_socket_common::SendMsgFlags as fidl::encoding::ValueTypeMarker>::borrow(&self.flags),
1312                ),
1313                encoder, offset, _depth
1314            )
1315        }
1316    }
1317    unsafe impl<
1318        D: fidl::encoding::ResourceDialect,
1319        T0: fidl::encoding::Encode<fidl::encoding::Boxed<PacketInfo>, D>,
1320        T1: fidl::encoding::Encode<fidl::encoding::UnboundedVector<u8>, D>,
1321        T2: fidl::encoding::Encode<SendControlData, D>,
1322        T3: fidl::encoding::Encode<fidl_fuchsia_posix_socket_common::SendMsgFlags, D>,
1323    > fidl::encoding::Encode<SocketSendMsgRequest, D> for (T0, T1, T2, T3)
1324    {
1325        #[inline]
1326        unsafe fn encode(
1327            self,
1328            encoder: &mut fidl::encoding::Encoder<'_, D>,
1329            offset: usize,
1330            depth: fidl::encoding::Depth,
1331        ) -> fidl::Result<()> {
1332            encoder.debug_check_bounds::<SocketSendMsgRequest>(offset);
1333            // Zero out padding regions. There's no need to apply masks
1334            // because the unmasked parts will be overwritten by fields.
1335            unsafe {
1336                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(40);
1337                (ptr as *mut u64).write_unaligned(0);
1338            }
1339            // Write the fields.
1340            self.0.encode(encoder, offset + 0, depth)?;
1341            self.1.encode(encoder, offset + 8, depth)?;
1342            self.2.encode(encoder, offset + 24, depth)?;
1343            self.3.encode(encoder, offset + 40, depth)?;
1344            Ok(())
1345        }
1346    }
1347
1348    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SocketSendMsgRequest {
1349        #[inline(always)]
1350        fn new_empty() -> Self {
1351            Self {
1352                packet_info: fidl::new_empty!(fidl::encoding::Boxed<PacketInfo>, D),
1353                data: fidl::new_empty!(fidl::encoding::UnboundedVector<u8>, D),
1354                control: fidl::new_empty!(SendControlData, D),
1355                flags: fidl::new_empty!(fidl_fuchsia_posix_socket_common::SendMsgFlags, D),
1356            }
1357        }
1358
1359        #[inline]
1360        unsafe fn decode(
1361            &mut self,
1362            decoder: &mut fidl::encoding::Decoder<'_, D>,
1363            offset: usize,
1364            _depth: fidl::encoding::Depth,
1365        ) -> fidl::Result<()> {
1366            decoder.debug_check_bounds::<Self>(offset);
1367            // Verify that padding bytes are zero.
1368            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(40) };
1369            let padval = unsafe { (ptr as *const u64).read_unaligned() };
1370            let mask = 0xffffffffffff0000u64;
1371            let maskedval = padval & mask;
1372            if maskedval != 0 {
1373                return Err(fidl::Error::NonZeroPadding {
1374                    padding_start: offset + 40 + ((mask as u64).trailing_zeros() / 8) as usize,
1375                });
1376            }
1377            fidl::decode!(
1378                fidl::encoding::Boxed<PacketInfo>,
1379                D,
1380                &mut self.packet_info,
1381                decoder,
1382                offset + 0,
1383                _depth
1384            )?;
1385            fidl::decode!(
1386                fidl::encoding::UnboundedVector<u8>,
1387                D,
1388                &mut self.data,
1389                decoder,
1390                offset + 8,
1391                _depth
1392            )?;
1393            fidl::decode!(SendControlData, D, &mut self.control, decoder, offset + 24, _depth)?;
1394            fidl::decode!(
1395                fidl_fuchsia_posix_socket_common::SendMsgFlags,
1396                D,
1397                &mut self.flags,
1398                decoder,
1399                offset + 40,
1400                _depth
1401            )?;
1402            Ok(())
1403        }
1404    }
1405
1406    impl fidl::encoding::ValueTypeMarker for SocketGetInfoResponse {
1407        type Borrowed<'a> = &'a Self;
1408        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1409            value
1410        }
1411    }
1412
1413    unsafe impl fidl::encoding::TypeMarker for SocketGetInfoResponse {
1414        type Owned = Self;
1415
1416        #[inline(always)]
1417        fn inline_align(_context: fidl::encoding::Context) -> usize {
1418            8
1419        }
1420
1421        #[inline(always)]
1422        fn inline_size(_context: fidl::encoding::Context) -> usize {
1423            40
1424        }
1425    }
1426
1427    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<SocketGetInfoResponse, D>
1428        for &SocketGetInfoResponse
1429    {
1430        #[inline]
1431        unsafe fn encode(
1432            self,
1433            encoder: &mut fidl::encoding::Encoder<'_, D>,
1434            offset: usize,
1435            _depth: fidl::encoding::Depth,
1436        ) -> fidl::Result<()> {
1437            encoder.debug_check_bounds::<SocketGetInfoResponse>(offset);
1438            // Delegate to tuple encoding.
1439            fidl::encoding::Encode::<SocketGetInfoResponse, D>::encode(
1440                (
1441                    <Kind as fidl::encoding::ValueTypeMarker>::borrow(&self.kind),
1442                    <fidl::encoding::OptionalUnion<ProtocolAssociation> as fidl::encoding::ValueTypeMarker>::borrow(&self.protocol),
1443                    <BoundInterface as fidl::encoding::ValueTypeMarker>::borrow(&self.bound_interface),
1444                ),
1445                encoder, offset, _depth
1446            )
1447        }
1448    }
1449    unsafe impl<
1450        D: fidl::encoding::ResourceDialect,
1451        T0: fidl::encoding::Encode<Kind, D>,
1452        T1: fidl::encoding::Encode<fidl::encoding::OptionalUnion<ProtocolAssociation>, D>,
1453        T2: fidl::encoding::Encode<BoundInterface, D>,
1454    > fidl::encoding::Encode<SocketGetInfoResponse, D> for (T0, T1, T2)
1455    {
1456        #[inline]
1457        unsafe fn encode(
1458            self,
1459            encoder: &mut fidl::encoding::Encoder<'_, D>,
1460            offset: usize,
1461            depth: fidl::encoding::Depth,
1462        ) -> fidl::Result<()> {
1463            encoder.debug_check_bounds::<SocketGetInfoResponse>(offset);
1464            // Zero out padding regions. There's no need to apply masks
1465            // because the unmasked parts will be overwritten by fields.
1466            unsafe {
1467                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
1468                (ptr as *mut u64).write_unaligned(0);
1469            }
1470            // Write the fields.
1471            self.0.encode(encoder, offset + 0, depth)?;
1472            self.1.encode(encoder, offset + 8, depth)?;
1473            self.2.encode(encoder, offset + 24, depth)?;
1474            Ok(())
1475        }
1476    }
1477
1478    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SocketGetInfoResponse {
1479        #[inline(always)]
1480        fn new_empty() -> Self {
1481            Self {
1482                kind: fidl::new_empty!(Kind, D),
1483                protocol: fidl::new_empty!(fidl::encoding::OptionalUnion<ProtocolAssociation>, D),
1484                bound_interface: fidl::new_empty!(BoundInterface, D),
1485            }
1486        }
1487
1488        #[inline]
1489        unsafe fn decode(
1490            &mut self,
1491            decoder: &mut fidl::encoding::Decoder<'_, D>,
1492            offset: usize,
1493            _depth: fidl::encoding::Depth,
1494        ) -> fidl::Result<()> {
1495            decoder.debug_check_bounds::<Self>(offset);
1496            // Verify that padding bytes are zero.
1497            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
1498            let padval = unsafe { (ptr as *const u64).read_unaligned() };
1499            let mask = 0xffffffff00000000u64;
1500            let maskedval = padval & mask;
1501            if maskedval != 0 {
1502                return Err(fidl::Error::NonZeroPadding {
1503                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
1504                });
1505            }
1506            fidl::decode!(Kind, D, &mut self.kind, decoder, offset + 0, _depth)?;
1507            fidl::decode!(
1508                fidl::encoding::OptionalUnion<ProtocolAssociation>,
1509                D,
1510                &mut self.protocol,
1511                decoder,
1512                offset + 8,
1513                _depth
1514            )?;
1515            fidl::decode!(
1516                BoundInterface,
1517                D,
1518                &mut self.bound_interface,
1519                decoder,
1520                offset + 24,
1521                _depth
1522            )?;
1523            Ok(())
1524        }
1525    }
1526
1527    impl fidl::encoding::ValueTypeMarker for SocketRecvMsgResponse {
1528        type Borrowed<'a> = &'a Self;
1529        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1530            value
1531        }
1532    }
1533
1534    unsafe impl fidl::encoding::TypeMarker for SocketRecvMsgResponse {
1535        type Owned = Self;
1536
1537        #[inline(always)]
1538        fn inline_align(_context: fidl::encoding::Context) -> usize {
1539            8
1540        }
1541
1542        #[inline(always)]
1543        fn inline_size(_context: fidl::encoding::Context) -> usize {
1544            48
1545        }
1546    }
1547
1548    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<SocketRecvMsgResponse, D>
1549        for &SocketRecvMsgResponse
1550    {
1551        #[inline]
1552        unsafe fn encode(
1553            self,
1554            encoder: &mut fidl::encoding::Encoder<'_, D>,
1555            offset: usize,
1556            _depth: fidl::encoding::Depth,
1557        ) -> fidl::Result<()> {
1558            encoder.debug_check_bounds::<SocketRecvMsgResponse>(offset);
1559            // Delegate to tuple encoding.
1560            fidl::encoding::Encode::<SocketRecvMsgResponse, D>::encode(
1561                (
1562                    <fidl::encoding::Boxed<RecvPacketInfo> as fidl::encoding::ValueTypeMarker>::borrow(&self.packet_info),
1563                    <fidl::encoding::UnboundedVector<u8> as fidl::encoding::ValueTypeMarker>::borrow(&self.data),
1564                    <RecvControlData as fidl::encoding::ValueTypeMarker>::borrow(&self.control),
1565                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.truncated),
1566                ),
1567                encoder, offset, _depth
1568            )
1569        }
1570    }
1571    unsafe impl<
1572        D: fidl::encoding::ResourceDialect,
1573        T0: fidl::encoding::Encode<fidl::encoding::Boxed<RecvPacketInfo>, D>,
1574        T1: fidl::encoding::Encode<fidl::encoding::UnboundedVector<u8>, D>,
1575        T2: fidl::encoding::Encode<RecvControlData, D>,
1576        T3: fidl::encoding::Encode<u32, D>,
1577    > fidl::encoding::Encode<SocketRecvMsgResponse, D> for (T0, T1, T2, T3)
1578    {
1579        #[inline]
1580        unsafe fn encode(
1581            self,
1582            encoder: &mut fidl::encoding::Encoder<'_, D>,
1583            offset: usize,
1584            depth: fidl::encoding::Depth,
1585        ) -> fidl::Result<()> {
1586            encoder.debug_check_bounds::<SocketRecvMsgResponse>(offset);
1587            // Zero out padding regions. There's no need to apply masks
1588            // because the unmasked parts will be overwritten by fields.
1589            unsafe {
1590                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(40);
1591                (ptr as *mut u64).write_unaligned(0);
1592            }
1593            // Write the fields.
1594            self.0.encode(encoder, offset + 0, depth)?;
1595            self.1.encode(encoder, offset + 8, depth)?;
1596            self.2.encode(encoder, offset + 24, depth)?;
1597            self.3.encode(encoder, offset + 40, depth)?;
1598            Ok(())
1599        }
1600    }
1601
1602    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SocketRecvMsgResponse {
1603        #[inline(always)]
1604        fn new_empty() -> Self {
1605            Self {
1606                packet_info: fidl::new_empty!(fidl::encoding::Boxed<RecvPacketInfo>, D),
1607                data: fidl::new_empty!(fidl::encoding::UnboundedVector<u8>, D),
1608                control: fidl::new_empty!(RecvControlData, D),
1609                truncated: fidl::new_empty!(u32, D),
1610            }
1611        }
1612
1613        #[inline]
1614        unsafe fn decode(
1615            &mut self,
1616            decoder: &mut fidl::encoding::Decoder<'_, D>,
1617            offset: usize,
1618            _depth: fidl::encoding::Depth,
1619        ) -> fidl::Result<()> {
1620            decoder.debug_check_bounds::<Self>(offset);
1621            // Verify that padding bytes are zero.
1622            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(40) };
1623            let padval = unsafe { (ptr as *const u64).read_unaligned() };
1624            let mask = 0xffffffff00000000u64;
1625            let maskedval = padval & mask;
1626            if maskedval != 0 {
1627                return Err(fidl::Error::NonZeroPadding {
1628                    padding_start: offset + 40 + ((mask as u64).trailing_zeros() / 8) as usize,
1629                });
1630            }
1631            fidl::decode!(
1632                fidl::encoding::Boxed<RecvPacketInfo>,
1633                D,
1634                &mut self.packet_info,
1635                decoder,
1636                offset + 0,
1637                _depth
1638            )?;
1639            fidl::decode!(
1640                fidl::encoding::UnboundedVector<u8>,
1641                D,
1642                &mut self.data,
1643                decoder,
1644                offset + 8,
1645                _depth
1646            )?;
1647            fidl::decode!(RecvControlData, D, &mut self.control, decoder, offset + 24, _depth)?;
1648            fidl::decode!(u32, D, &mut self.truncated, decoder, offset + 40, _depth)?;
1649            Ok(())
1650        }
1651    }
1652
1653    impl RecvControlData {
1654        #[inline(always)]
1655        fn max_ordinal_present(&self) -> u64 {
1656            if let Some(_) = self.socket {
1657                return 1;
1658            }
1659            0
1660        }
1661    }
1662
1663    impl fidl::encoding::ValueTypeMarker for RecvControlData {
1664        type Borrowed<'a> = &'a Self;
1665        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1666            value
1667        }
1668    }
1669
1670    unsafe impl fidl::encoding::TypeMarker for RecvControlData {
1671        type Owned = Self;
1672
1673        #[inline(always)]
1674        fn inline_align(_context: fidl::encoding::Context) -> usize {
1675            8
1676        }
1677
1678        #[inline(always)]
1679        fn inline_size(_context: fidl::encoding::Context) -> usize {
1680            16
1681        }
1682    }
1683
1684    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<RecvControlData, D>
1685        for &RecvControlData
1686    {
1687        unsafe fn encode(
1688            self,
1689            encoder: &mut fidl::encoding::Encoder<'_, D>,
1690            offset: usize,
1691            mut depth: fidl::encoding::Depth,
1692        ) -> fidl::Result<()> {
1693            encoder.debug_check_bounds::<RecvControlData>(offset);
1694            // Vector header
1695            let max_ordinal: u64 = self.max_ordinal_present();
1696            encoder.write_num(max_ordinal, offset);
1697            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
1698            // Calling encoder.out_of_line_offset(0) is not allowed.
1699            if max_ordinal == 0 {
1700                return Ok(());
1701            }
1702            depth.increment()?;
1703            let envelope_size = 8;
1704            let bytes_len = max_ordinal as usize * envelope_size;
1705            #[allow(unused_variables)]
1706            let offset = encoder.out_of_line_offset(bytes_len);
1707            let mut _prev_end_offset: usize = 0;
1708            if 1 > max_ordinal {
1709                return Ok(());
1710            }
1711
1712            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1713            // are envelope_size bytes.
1714            let cur_offset: usize = (1 - 1) * envelope_size;
1715
1716            // Zero reserved fields.
1717            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1718
1719            // Safety:
1720            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1721            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1722            //   envelope_size bytes, there is always sufficient room.
1723            fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_posix_socket_common::SocketRecvControlData, D>(
1724            self.socket.as_ref().map(<fidl_fuchsia_posix_socket_common::SocketRecvControlData as fidl::encoding::ValueTypeMarker>::borrow),
1725            encoder, offset + cur_offset, depth
1726        )?;
1727
1728            _prev_end_offset = cur_offset + envelope_size;
1729
1730            Ok(())
1731        }
1732    }
1733
1734    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for RecvControlData {
1735        #[inline(always)]
1736        fn new_empty() -> Self {
1737            Self::default()
1738        }
1739
1740        unsafe fn decode(
1741            &mut self,
1742            decoder: &mut fidl::encoding::Decoder<'_, D>,
1743            offset: usize,
1744            mut depth: fidl::encoding::Depth,
1745        ) -> fidl::Result<()> {
1746            decoder.debug_check_bounds::<Self>(offset);
1747            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
1748                None => return Err(fidl::Error::NotNullable),
1749                Some(len) => len,
1750            };
1751            // Calling decoder.out_of_line_offset(0) is not allowed.
1752            if len == 0 {
1753                return Ok(());
1754            };
1755            depth.increment()?;
1756            let envelope_size = 8;
1757            let bytes_len = len * envelope_size;
1758            let offset = decoder.out_of_line_offset(bytes_len)?;
1759            // Decode the envelope for each type.
1760            let mut _next_ordinal_to_read = 0;
1761            let mut next_offset = offset;
1762            let end_offset = offset + bytes_len;
1763            _next_ordinal_to_read += 1;
1764            if next_offset >= end_offset {
1765                return Ok(());
1766            }
1767
1768            // Decode unknown envelopes for gaps in ordinals.
1769            while _next_ordinal_to_read < 1 {
1770                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1771                _next_ordinal_to_read += 1;
1772                next_offset += envelope_size;
1773            }
1774
1775            let next_out_of_line = decoder.next_out_of_line();
1776            let handles_before = decoder.remaining_handles();
1777            if let Some((inlined, num_bytes, num_handles)) =
1778                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1779            {
1780                let member_inline_size = <fidl_fuchsia_posix_socket_common::SocketRecvControlData as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1781                if inlined != (member_inline_size <= 4) {
1782                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1783                }
1784                let inner_offset;
1785                let mut inner_depth = depth.clone();
1786                if inlined {
1787                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1788                    inner_offset = next_offset;
1789                } else {
1790                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1791                    inner_depth.increment()?;
1792                }
1793                let val_ref = self.socket.get_or_insert_with(|| {
1794                    fidl::new_empty!(fidl_fuchsia_posix_socket_common::SocketRecvControlData, D)
1795                });
1796                fidl::decode!(
1797                    fidl_fuchsia_posix_socket_common::SocketRecvControlData,
1798                    D,
1799                    val_ref,
1800                    decoder,
1801                    inner_offset,
1802                    inner_depth
1803                )?;
1804                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1805                {
1806                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
1807                }
1808                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1809                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1810                }
1811            }
1812
1813            next_offset += envelope_size;
1814
1815            // Decode the remaining unknown envelopes.
1816            while next_offset < end_offset {
1817                _next_ordinal_to_read += 1;
1818                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1819                next_offset += envelope_size;
1820            }
1821
1822            Ok(())
1823        }
1824    }
1825
1826    impl SendControlData {
1827        #[inline(always)]
1828        fn max_ordinal_present(&self) -> u64 {
1829            if let Some(_) = self.socket {
1830                return 1;
1831            }
1832            0
1833        }
1834    }
1835
1836    impl fidl::encoding::ValueTypeMarker for SendControlData {
1837        type Borrowed<'a> = &'a Self;
1838        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1839            value
1840        }
1841    }
1842
1843    unsafe impl fidl::encoding::TypeMarker for SendControlData {
1844        type Owned = Self;
1845
1846        #[inline(always)]
1847        fn inline_align(_context: fidl::encoding::Context) -> usize {
1848            8
1849        }
1850
1851        #[inline(always)]
1852        fn inline_size(_context: fidl::encoding::Context) -> usize {
1853            16
1854        }
1855    }
1856
1857    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<SendControlData, D>
1858        for &SendControlData
1859    {
1860        unsafe fn encode(
1861            self,
1862            encoder: &mut fidl::encoding::Encoder<'_, D>,
1863            offset: usize,
1864            mut depth: fidl::encoding::Depth,
1865        ) -> fidl::Result<()> {
1866            encoder.debug_check_bounds::<SendControlData>(offset);
1867            // Vector header
1868            let max_ordinal: u64 = self.max_ordinal_present();
1869            encoder.write_num(max_ordinal, offset);
1870            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
1871            // Calling encoder.out_of_line_offset(0) is not allowed.
1872            if max_ordinal == 0 {
1873                return Ok(());
1874            }
1875            depth.increment()?;
1876            let envelope_size = 8;
1877            let bytes_len = max_ordinal as usize * envelope_size;
1878            #[allow(unused_variables)]
1879            let offset = encoder.out_of_line_offset(bytes_len);
1880            let mut _prev_end_offset: usize = 0;
1881            if 1 > max_ordinal {
1882                return Ok(());
1883            }
1884
1885            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1886            // are envelope_size bytes.
1887            let cur_offset: usize = (1 - 1) * envelope_size;
1888
1889            // Zero reserved fields.
1890            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1891
1892            // Safety:
1893            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1894            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1895            //   envelope_size bytes, there is always sufficient room.
1896            fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_posix_socket_common::SocketSendControlData, D>(
1897            self.socket.as_ref().map(<fidl_fuchsia_posix_socket_common::SocketSendControlData as fidl::encoding::ValueTypeMarker>::borrow),
1898            encoder, offset + cur_offset, depth
1899        )?;
1900
1901            _prev_end_offset = cur_offset + envelope_size;
1902
1903            Ok(())
1904        }
1905    }
1906
1907    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SendControlData {
1908        #[inline(always)]
1909        fn new_empty() -> Self {
1910            Self::default()
1911        }
1912
1913        unsafe fn decode(
1914            &mut self,
1915            decoder: &mut fidl::encoding::Decoder<'_, D>,
1916            offset: usize,
1917            mut depth: fidl::encoding::Depth,
1918        ) -> fidl::Result<()> {
1919            decoder.debug_check_bounds::<Self>(offset);
1920            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
1921                None => return Err(fidl::Error::NotNullable),
1922                Some(len) => len,
1923            };
1924            // Calling decoder.out_of_line_offset(0) is not allowed.
1925            if len == 0 {
1926                return Ok(());
1927            };
1928            depth.increment()?;
1929            let envelope_size = 8;
1930            let bytes_len = len * envelope_size;
1931            let offset = decoder.out_of_line_offset(bytes_len)?;
1932            // Decode the envelope for each type.
1933            let mut _next_ordinal_to_read = 0;
1934            let mut next_offset = offset;
1935            let end_offset = offset + bytes_len;
1936            _next_ordinal_to_read += 1;
1937            if next_offset >= end_offset {
1938                return Ok(());
1939            }
1940
1941            // Decode unknown envelopes for gaps in ordinals.
1942            while _next_ordinal_to_read < 1 {
1943                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1944                _next_ordinal_to_read += 1;
1945                next_offset += envelope_size;
1946            }
1947
1948            let next_out_of_line = decoder.next_out_of_line();
1949            let handles_before = decoder.remaining_handles();
1950            if let Some((inlined, num_bytes, num_handles)) =
1951                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1952            {
1953                let member_inline_size = <fidl_fuchsia_posix_socket_common::SocketSendControlData as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1954                if inlined != (member_inline_size <= 4) {
1955                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1956                }
1957                let inner_offset;
1958                let mut inner_depth = depth.clone();
1959                if inlined {
1960                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1961                    inner_offset = next_offset;
1962                } else {
1963                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1964                    inner_depth.increment()?;
1965                }
1966                let val_ref = self.socket.get_or_insert_with(|| {
1967                    fidl::new_empty!(fidl_fuchsia_posix_socket_common::SocketSendControlData, D)
1968                });
1969                fidl::decode!(
1970                    fidl_fuchsia_posix_socket_common::SocketSendControlData,
1971                    D,
1972                    val_ref,
1973                    decoder,
1974                    inner_offset,
1975                    inner_depth
1976                )?;
1977                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1978                {
1979                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
1980                }
1981                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1982                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1983                }
1984            }
1985
1986            next_offset += envelope_size;
1987
1988            // Decode the remaining unknown envelopes.
1989            while next_offset < end_offset {
1990                _next_ordinal_to_read += 1;
1991                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1992                next_offset += envelope_size;
1993            }
1994
1995            Ok(())
1996        }
1997    }
1998
1999    impl fidl::encoding::ValueTypeMarker for BoundInterface {
2000        type Borrowed<'a> = &'a Self;
2001        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2002            value
2003        }
2004    }
2005
2006    unsafe impl fidl::encoding::TypeMarker for BoundInterface {
2007        type Owned = Self;
2008
2009        #[inline(always)]
2010        fn inline_align(_context: fidl::encoding::Context) -> usize {
2011            8
2012        }
2013
2014        #[inline(always)]
2015        fn inline_size(_context: fidl::encoding::Context) -> usize {
2016            16
2017        }
2018    }
2019
2020    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<BoundInterface, D>
2021        for &BoundInterface
2022    {
2023        #[inline]
2024        unsafe fn encode(
2025            self,
2026            encoder: &mut fidl::encoding::Encoder<'_, D>,
2027            offset: usize,
2028            _depth: fidl::encoding::Depth,
2029        ) -> fidl::Result<()> {
2030            encoder.debug_check_bounds::<BoundInterface>(offset);
2031            encoder.write_num::<u64>(self.ordinal(), offset);
2032            match self {
2033                BoundInterface::All(ref val) => fidl::encoding::encode_in_envelope::<Empty, D>(
2034                    <Empty as fidl::encoding::ValueTypeMarker>::borrow(val),
2035                    encoder,
2036                    offset + 8,
2037                    _depth,
2038                ),
2039                BoundInterface::Specified(ref val) => {
2040                    fidl::encoding::encode_in_envelope::<InterfaceProperties, D>(
2041                        <InterfaceProperties as fidl::encoding::ValueTypeMarker>::borrow(val),
2042                        encoder,
2043                        offset + 8,
2044                        _depth,
2045                    )
2046                }
2047            }
2048        }
2049    }
2050
2051    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for BoundInterface {
2052        #[inline(always)]
2053        fn new_empty() -> Self {
2054            Self::All(fidl::new_empty!(Empty, D))
2055        }
2056
2057        #[inline]
2058        unsafe fn decode(
2059            &mut self,
2060            decoder: &mut fidl::encoding::Decoder<'_, D>,
2061            offset: usize,
2062            mut depth: fidl::encoding::Depth,
2063        ) -> fidl::Result<()> {
2064            decoder.debug_check_bounds::<Self>(offset);
2065            #[allow(unused_variables)]
2066            let next_out_of_line = decoder.next_out_of_line();
2067            let handles_before = decoder.remaining_handles();
2068            let (ordinal, inlined, num_bytes, num_handles) =
2069                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
2070
2071            let member_inline_size = match ordinal {
2072                1 => <Empty as fidl::encoding::TypeMarker>::inline_size(decoder.context),
2073                2 => <InterfaceProperties as fidl::encoding::TypeMarker>::inline_size(
2074                    decoder.context,
2075                ),
2076                _ => return Err(fidl::Error::UnknownUnionTag),
2077            };
2078
2079            if inlined != (member_inline_size <= 4) {
2080                return Err(fidl::Error::InvalidInlineBitInEnvelope);
2081            }
2082            let _inner_offset;
2083            if inlined {
2084                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
2085                _inner_offset = offset + 8;
2086            } else {
2087                depth.increment()?;
2088                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2089            }
2090            match ordinal {
2091                1 => {
2092                    #[allow(irrefutable_let_patterns)]
2093                    if let BoundInterface::All(_) = self {
2094                        // Do nothing, read the value into the object
2095                    } else {
2096                        // Initialize `self` to the right variant
2097                        *self = BoundInterface::All(fidl::new_empty!(Empty, D));
2098                    }
2099                    #[allow(irrefutable_let_patterns)]
2100                    if let BoundInterface::All(ref mut val) = self {
2101                        fidl::decode!(Empty, D, val, decoder, _inner_offset, depth)?;
2102                    } else {
2103                        unreachable!()
2104                    }
2105                }
2106                2 => {
2107                    #[allow(irrefutable_let_patterns)]
2108                    if let BoundInterface::Specified(_) = self {
2109                        // Do nothing, read the value into the object
2110                    } else {
2111                        // Initialize `self` to the right variant
2112                        *self = BoundInterface::Specified(fidl::new_empty!(InterfaceProperties, D));
2113                    }
2114                    #[allow(irrefutable_let_patterns)]
2115                    if let BoundInterface::Specified(ref mut val) = self {
2116                        fidl::decode!(InterfaceProperties, D, val, decoder, _inner_offset, depth)?;
2117                    } else {
2118                        unreachable!()
2119                    }
2120                }
2121                ordinal => panic!("unexpected ordinal {:?}", ordinal),
2122            }
2123            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
2124                return Err(fidl::Error::InvalidNumBytesInEnvelope);
2125            }
2126            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2127                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2128            }
2129            Ok(())
2130        }
2131    }
2132
2133    impl fidl::encoding::ValueTypeMarker for BoundInterfaceId {
2134        type Borrowed<'a> = &'a Self;
2135        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2136            value
2137        }
2138    }
2139
2140    unsafe impl fidl::encoding::TypeMarker for BoundInterfaceId {
2141        type Owned = Self;
2142
2143        #[inline(always)]
2144        fn inline_align(_context: fidl::encoding::Context) -> usize {
2145            8
2146        }
2147
2148        #[inline(always)]
2149        fn inline_size(_context: fidl::encoding::Context) -> usize {
2150            16
2151        }
2152    }
2153
2154    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<BoundInterfaceId, D>
2155        for &BoundInterfaceId
2156    {
2157        #[inline]
2158        unsafe fn encode(
2159            self,
2160            encoder: &mut fidl::encoding::Encoder<'_, D>,
2161            offset: usize,
2162            _depth: fidl::encoding::Depth,
2163        ) -> fidl::Result<()> {
2164            encoder.debug_check_bounds::<BoundInterfaceId>(offset);
2165            encoder.write_num::<u64>(self.ordinal(), offset);
2166            match self {
2167                BoundInterfaceId::All(ref val) => fidl::encoding::encode_in_envelope::<Empty, D>(
2168                    <Empty as fidl::encoding::ValueTypeMarker>::borrow(val),
2169                    encoder,
2170                    offset + 8,
2171                    _depth,
2172                ),
2173                BoundInterfaceId::Specified(ref val) => {
2174                    fidl::encoding::encode_in_envelope::<u64, D>(
2175                        <u64 as fidl::encoding::ValueTypeMarker>::borrow(val),
2176                        encoder,
2177                        offset + 8,
2178                        _depth,
2179                    )
2180                }
2181            }
2182        }
2183    }
2184
2185    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for BoundInterfaceId {
2186        #[inline(always)]
2187        fn new_empty() -> Self {
2188            Self::All(fidl::new_empty!(Empty, D))
2189        }
2190
2191        #[inline]
2192        unsafe fn decode(
2193            &mut self,
2194            decoder: &mut fidl::encoding::Decoder<'_, D>,
2195            offset: usize,
2196            mut depth: fidl::encoding::Depth,
2197        ) -> fidl::Result<()> {
2198            decoder.debug_check_bounds::<Self>(offset);
2199            #[allow(unused_variables)]
2200            let next_out_of_line = decoder.next_out_of_line();
2201            let handles_before = decoder.remaining_handles();
2202            let (ordinal, inlined, num_bytes, num_handles) =
2203                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
2204
2205            let member_inline_size = match ordinal {
2206                1 => <Empty as fidl::encoding::TypeMarker>::inline_size(decoder.context),
2207                2 => <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context),
2208                _ => return Err(fidl::Error::UnknownUnionTag),
2209            };
2210
2211            if inlined != (member_inline_size <= 4) {
2212                return Err(fidl::Error::InvalidInlineBitInEnvelope);
2213            }
2214            let _inner_offset;
2215            if inlined {
2216                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
2217                _inner_offset = offset + 8;
2218            } else {
2219                depth.increment()?;
2220                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2221            }
2222            match ordinal {
2223                1 => {
2224                    #[allow(irrefutable_let_patterns)]
2225                    if let BoundInterfaceId::All(_) = self {
2226                        // Do nothing, read the value into the object
2227                    } else {
2228                        // Initialize `self` to the right variant
2229                        *self = BoundInterfaceId::All(fidl::new_empty!(Empty, D));
2230                    }
2231                    #[allow(irrefutable_let_patterns)]
2232                    if let BoundInterfaceId::All(ref mut val) = self {
2233                        fidl::decode!(Empty, D, val, decoder, _inner_offset, depth)?;
2234                    } else {
2235                        unreachable!()
2236                    }
2237                }
2238                2 => {
2239                    #[allow(irrefutable_let_patterns)]
2240                    if let BoundInterfaceId::Specified(_) = self {
2241                        // Do nothing, read the value into the object
2242                    } else {
2243                        // Initialize `self` to the right variant
2244                        *self = BoundInterfaceId::Specified(fidl::new_empty!(u64, D));
2245                    }
2246                    #[allow(irrefutable_let_patterns)]
2247                    if let BoundInterfaceId::Specified(ref mut val) = self {
2248                        fidl::decode!(u64, D, val, decoder, _inner_offset, depth)?;
2249                    } else {
2250                        unreachable!()
2251                    }
2252                }
2253                ordinal => panic!("unexpected ordinal {:?}", ordinal),
2254            }
2255            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
2256                return Err(fidl::Error::InvalidNumBytesInEnvelope);
2257            }
2258            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2259                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2260            }
2261            Ok(())
2262        }
2263    }
2264
2265    impl fidl::encoding::ValueTypeMarker for HardwareAddress {
2266        type Borrowed<'a> = &'a Self;
2267        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2268            value
2269        }
2270    }
2271
2272    unsafe impl fidl::encoding::TypeMarker for HardwareAddress {
2273        type Owned = Self;
2274
2275        #[inline(always)]
2276        fn inline_align(_context: fidl::encoding::Context) -> usize {
2277            8
2278        }
2279
2280        #[inline(always)]
2281        fn inline_size(_context: fidl::encoding::Context) -> usize {
2282            16
2283        }
2284    }
2285
2286    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<HardwareAddress, D>
2287        for &HardwareAddress
2288    {
2289        #[inline]
2290        unsafe fn encode(
2291            self,
2292            encoder: &mut fidl::encoding::Encoder<'_, D>,
2293            offset: usize,
2294            _depth: fidl::encoding::Depth,
2295        ) -> fidl::Result<()> {
2296            encoder.debug_check_bounds::<HardwareAddress>(offset);
2297            encoder.write_num::<u64>(self.ordinal(), offset);
2298            match self {
2299            HardwareAddress::None(ref val) => {
2300                fidl::encoding::encode_in_envelope::<Empty, D>(
2301                    <Empty as fidl::encoding::ValueTypeMarker>::borrow(val),
2302                    encoder, offset + 8, _depth
2303                )
2304            }
2305            HardwareAddress::Eui48(ref val) => {
2306                fidl::encoding::encode_in_envelope::<fidl_fuchsia_net_common::MacAddress, D>(
2307                    <fidl_fuchsia_net_common::MacAddress as fidl::encoding::ValueTypeMarker>::borrow(val),
2308                    encoder, offset + 8, _depth
2309                )
2310            }
2311            HardwareAddress::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
2312        }
2313        }
2314    }
2315
2316    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for HardwareAddress {
2317        #[inline(always)]
2318        fn new_empty() -> Self {
2319            Self::__SourceBreaking { unknown_ordinal: 0 }
2320        }
2321
2322        #[inline]
2323        unsafe fn decode(
2324            &mut self,
2325            decoder: &mut fidl::encoding::Decoder<'_, D>,
2326            offset: usize,
2327            mut depth: fidl::encoding::Depth,
2328        ) -> fidl::Result<()> {
2329            decoder.debug_check_bounds::<Self>(offset);
2330            #[allow(unused_variables)]
2331            let next_out_of_line = decoder.next_out_of_line();
2332            let handles_before = decoder.remaining_handles();
2333            let (ordinal, inlined, num_bytes, num_handles) =
2334                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
2335
2336            let member_inline_size = match ordinal {
2337                1 => <Empty as fidl::encoding::TypeMarker>::inline_size(decoder.context),
2338                2 => {
2339                    <fidl_fuchsia_net_common::MacAddress as fidl::encoding::TypeMarker>::inline_size(
2340                        decoder.context,
2341                    )
2342                }
2343                0 => return Err(fidl::Error::UnknownUnionTag),
2344                _ => num_bytes as usize,
2345            };
2346
2347            if inlined != (member_inline_size <= 4) {
2348                return Err(fidl::Error::InvalidInlineBitInEnvelope);
2349            }
2350            let _inner_offset;
2351            if inlined {
2352                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
2353                _inner_offset = offset + 8;
2354            } else {
2355                depth.increment()?;
2356                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2357            }
2358            match ordinal {
2359                1 => {
2360                    #[allow(irrefutable_let_patterns)]
2361                    if let HardwareAddress::None(_) = self {
2362                        // Do nothing, read the value into the object
2363                    } else {
2364                        // Initialize `self` to the right variant
2365                        *self = HardwareAddress::None(fidl::new_empty!(Empty, D));
2366                    }
2367                    #[allow(irrefutable_let_patterns)]
2368                    if let HardwareAddress::None(ref mut val) = self {
2369                        fidl::decode!(Empty, D, val, decoder, _inner_offset, depth)?;
2370                    } else {
2371                        unreachable!()
2372                    }
2373                }
2374                2 => {
2375                    #[allow(irrefutable_let_patterns)]
2376                    if let HardwareAddress::Eui48(_) = self {
2377                        // Do nothing, read the value into the object
2378                    } else {
2379                        // Initialize `self` to the right variant
2380                        *self = HardwareAddress::Eui48(fidl::new_empty!(
2381                            fidl_fuchsia_net_common::MacAddress,
2382                            D
2383                        ));
2384                    }
2385                    #[allow(irrefutable_let_patterns)]
2386                    if let HardwareAddress::Eui48(ref mut val) = self {
2387                        fidl::decode!(
2388                            fidl_fuchsia_net_common::MacAddress,
2389                            D,
2390                            val,
2391                            decoder,
2392                            _inner_offset,
2393                            depth
2394                        )?;
2395                    } else {
2396                        unreachable!()
2397                    }
2398                }
2399                #[allow(deprecated)]
2400                ordinal => {
2401                    for _ in 0..num_handles {
2402                        decoder.drop_next_handle()?;
2403                    }
2404                    *self = HardwareAddress::__SourceBreaking { unknown_ordinal: ordinal };
2405                }
2406            }
2407            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
2408                return Err(fidl::Error::InvalidNumBytesInEnvelope);
2409            }
2410            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2411                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2412            }
2413            Ok(())
2414        }
2415    }
2416
2417    impl fidl::encoding::ValueTypeMarker for ProtocolAssociation {
2418        type Borrowed<'a> = &'a Self;
2419        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2420            value
2421        }
2422    }
2423
2424    unsafe impl fidl::encoding::TypeMarker for ProtocolAssociation {
2425        type Owned = Self;
2426
2427        #[inline(always)]
2428        fn inline_align(_context: fidl::encoding::Context) -> usize {
2429            8
2430        }
2431
2432        #[inline(always)]
2433        fn inline_size(_context: fidl::encoding::Context) -> usize {
2434            16
2435        }
2436    }
2437
2438    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<ProtocolAssociation, D>
2439        for &ProtocolAssociation
2440    {
2441        #[inline]
2442        unsafe fn encode(
2443            self,
2444            encoder: &mut fidl::encoding::Encoder<'_, D>,
2445            offset: usize,
2446            _depth: fidl::encoding::Depth,
2447        ) -> fidl::Result<()> {
2448            encoder.debug_check_bounds::<ProtocolAssociation>(offset);
2449            encoder.write_num::<u64>(self.ordinal(), offset);
2450            match self {
2451                ProtocolAssociation::All(ref val) => {
2452                    fidl::encoding::encode_in_envelope::<Empty, D>(
2453                        <Empty as fidl::encoding::ValueTypeMarker>::borrow(val),
2454                        encoder,
2455                        offset + 8,
2456                        _depth,
2457                    )
2458                }
2459                ProtocolAssociation::Specified(ref val) => {
2460                    fidl::encoding::encode_in_envelope::<u16, D>(
2461                        <u16 as fidl::encoding::ValueTypeMarker>::borrow(val),
2462                        encoder,
2463                        offset + 8,
2464                        _depth,
2465                    )
2466                }
2467            }
2468        }
2469    }
2470
2471    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ProtocolAssociation {
2472        #[inline(always)]
2473        fn new_empty() -> Self {
2474            Self::All(fidl::new_empty!(Empty, D))
2475        }
2476
2477        #[inline]
2478        unsafe fn decode(
2479            &mut self,
2480            decoder: &mut fidl::encoding::Decoder<'_, D>,
2481            offset: usize,
2482            mut depth: fidl::encoding::Depth,
2483        ) -> fidl::Result<()> {
2484            decoder.debug_check_bounds::<Self>(offset);
2485            #[allow(unused_variables)]
2486            let next_out_of_line = decoder.next_out_of_line();
2487            let handles_before = decoder.remaining_handles();
2488            let (ordinal, inlined, num_bytes, num_handles) =
2489                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
2490
2491            let member_inline_size = match ordinal {
2492                1 => <Empty as fidl::encoding::TypeMarker>::inline_size(decoder.context),
2493                2 => <u16 as fidl::encoding::TypeMarker>::inline_size(decoder.context),
2494                _ => return Err(fidl::Error::UnknownUnionTag),
2495            };
2496
2497            if inlined != (member_inline_size <= 4) {
2498                return Err(fidl::Error::InvalidInlineBitInEnvelope);
2499            }
2500            let _inner_offset;
2501            if inlined {
2502                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
2503                _inner_offset = offset + 8;
2504            } else {
2505                depth.increment()?;
2506                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2507            }
2508            match ordinal {
2509                1 => {
2510                    #[allow(irrefutable_let_patterns)]
2511                    if let ProtocolAssociation::All(_) = self {
2512                        // Do nothing, read the value into the object
2513                    } else {
2514                        // Initialize `self` to the right variant
2515                        *self = ProtocolAssociation::All(fidl::new_empty!(Empty, D));
2516                    }
2517                    #[allow(irrefutable_let_patterns)]
2518                    if let ProtocolAssociation::All(ref mut val) = self {
2519                        fidl::decode!(Empty, D, val, decoder, _inner_offset, depth)?;
2520                    } else {
2521                        unreachable!()
2522                    }
2523                }
2524                2 => {
2525                    #[allow(irrefutable_let_patterns)]
2526                    if let ProtocolAssociation::Specified(_) = self {
2527                        // Do nothing, read the value into the object
2528                    } else {
2529                        // Initialize `self` to the right variant
2530                        *self = ProtocolAssociation::Specified(fidl::new_empty!(u16, D));
2531                    }
2532                    #[allow(irrefutable_let_patterns)]
2533                    if let ProtocolAssociation::Specified(ref mut val) = self {
2534                        fidl::decode!(u16, D, val, decoder, _inner_offset, depth)?;
2535                    } else {
2536                        unreachable!()
2537                    }
2538                }
2539                ordinal => panic!("unexpected ordinal {:?}", ordinal),
2540            }
2541            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
2542                return Err(fidl::Error::InvalidNumBytesInEnvelope);
2543            }
2544            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2545                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2546            }
2547            Ok(())
2548        }
2549    }
2550}