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