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