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