fidl_fuchsia_posix_socket_packet__common/
fidl_fuchsia_posix_socket_packet__common.rs

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