fidl_fuchsia_posix_socket_raw__common/
fidl_fuchsia_posix_socket_raw__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/// The protocol a raw socket may be associated with.
12pub type Protocol = u8;
13
14pub const SOCKET_PROTOCOL_NAME: &str = "fuchsia.posix.socket.raw/Socket";
15
16#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
17pub struct Empty;
18
19impl fidl::Persistable for Empty {}
20
21/// A filter for ICMPv6 types.
22#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
23#[repr(C)]
24pub struct Icmpv6Filter {
25    /// Indicates whether or not an ICMPv6 type should be blocked.
26    ///
27    /// Each bit index encodes an ICMPv6 type; bit 0 in `blocked_types[0]` holds
28    /// the flag for ICMPv6 type 0 and bit 31 in `blocked_types[7]` holds the
29    /// flag for ICMPv6 type 255.
30    ///
31    /// Equivalent to Linux's `icmp6_filter.icmp6_filt`.
32    pub blocked_types: [u32; 8],
33}
34
35impl fidl::Persistable for Icmpv6Filter {}
36
37#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
38pub struct ProviderSocketRequest {
39    pub domain: fidl_fuchsia_posix_socket__common::Domain,
40    pub proto: ProtocolAssociation,
41}
42
43impl fidl::Persistable for ProviderSocketRequest {}
44
45#[derive(Clone, Debug, PartialEq)]
46pub struct ProviderSocketWithOptionsRequest {
47    pub domain: fidl_fuchsia_posix_socket__common::Domain,
48    pub proto: ProtocolAssociation,
49    pub opts: fidl_fuchsia_posix_socket__common::SocketCreationOptions,
50}
51
52impl fidl::Persistable for ProviderSocketWithOptionsRequest {}
53
54#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
55pub struct SocketRecvMsgRequest {
56    pub want_addr: bool,
57    pub data_len: u32,
58    pub want_control: bool,
59    pub flags: fidl_fuchsia_posix_socket__common::RecvMsgFlags,
60}
61
62impl fidl::Persistable for SocketRecvMsgRequest {}
63
64#[derive(Clone, Debug, PartialEq)]
65pub struct SocketSendMsgRequest {
66    pub addr: Option<Box<fidl_fuchsia_net__common::SocketAddress>>,
67    pub data: Vec<u8>,
68    pub control: fidl_fuchsia_posix_socket__common::NetworkSocketSendControlData,
69    pub flags: fidl_fuchsia_posix_socket__common::SendMsgFlags,
70}
71
72impl fidl::Persistable for SocketSendMsgRequest {}
73
74#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
75#[repr(C)]
76pub struct SocketSetIcmpv6FilterRequest {
77    pub filter: Icmpv6Filter,
78}
79
80impl fidl::Persistable for SocketSetIcmpv6FilterRequest {}
81
82#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
83pub struct SocketSetIpHeaderIncludedRequest {
84    pub value: bool,
85}
86
87impl fidl::Persistable for SocketSetIpHeaderIncludedRequest {}
88
89#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
90pub struct SocketSetIpv6ChecksumRequest {
91    pub config: Ipv6ChecksumConfiguration,
92}
93
94impl fidl::Persistable for SocketSetIpv6ChecksumRequest {}
95
96#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
97#[repr(C)]
98pub struct SocketGetIcmpv6FilterResponse {
99    pub filter: Icmpv6Filter,
100}
101
102impl fidl::Persistable for SocketGetIcmpv6FilterResponse {}
103
104#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
105pub struct SocketGetInfoResponse {
106    pub domain: fidl_fuchsia_posix_socket__common::Domain,
107    pub proto: ProtocolAssociation,
108}
109
110impl fidl::Persistable for SocketGetInfoResponse {}
111
112#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
113pub struct SocketGetIpHeaderIncludedResponse {
114    pub value: bool,
115}
116
117impl fidl::Persistable for SocketGetIpHeaderIncludedResponse {}
118
119#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
120pub struct SocketGetIpv6ChecksumResponse {
121    pub config: Ipv6ChecksumConfiguration,
122}
123
124impl fidl::Persistable for SocketGetIpv6ChecksumResponse {}
125
126#[derive(Clone, Debug, PartialEq)]
127pub struct SocketRecvMsgResponse {
128    pub addr: Option<Box<fidl_fuchsia_net__common::SocketAddress>>,
129    pub data: Vec<u8>,
130    pub control: fidl_fuchsia_posix_socket__common::NetworkSocketRecvControlData,
131    pub truncated: u32,
132}
133
134impl fidl::Persistable for SocketRecvMsgResponse {}
135
136/// IPv6 socket checksum configuration.
137#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
138pub enum Ipv6ChecksumConfiguration {
139    /// Indicates that the stack should not calculate checksums for outgoing
140    /// packets and valiate checksums for incoming packets.
141    Disabled(Empty),
142    /// Indicates that the stack should calculate checksums for outgoing packets
143    /// and validate checksums for incoming packets.
144    ///
145    /// `offset` indicates where the checksum is found in the IPv6 packet's
146    /// payload.
147    ///
148    /// The offset must be aligned to the size of an internet checksum as
149    /// specified in RFC 1071. That is, the offset must be 2-byte aligned.
150    Offset(i32),
151}
152
153impl Ipv6ChecksumConfiguration {
154    #[inline]
155    pub fn ordinal(&self) -> u64 {
156        match *self {
157            Self::Disabled(_) => 1,
158            Self::Offset(_) => 2,
159        }
160    }
161}
162
163impl fidl::Persistable for Ipv6ChecksumConfiguration {}
164
165/// The protocol a raw socket is associated with.
166#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
167pub enum ProtocolAssociation {
168    /// Indicates no association with any protocol.
169    ///
170    /// The socket will not receive packets. Sent packets must include the
171    /// network header.
172    Unassociated(Empty),
173    /// The associated protocol.
174    ///
175    /// The socket may only send and receive network packets for the associated
176    /// protocol.
177    Associated(u8),
178}
179
180impl ProtocolAssociation {
181    #[inline]
182    pub fn ordinal(&self) -> u64 {
183        match *self {
184            Self::Unassociated(_) => 1,
185            Self::Associated(_) => 2,
186        }
187    }
188}
189
190impl fidl::Persistable for ProtocolAssociation {}
191
192mod internal {
193    use super::*;
194
195    impl fidl::encoding::ValueTypeMarker for Empty {
196        type Borrowed<'a> = &'a Self;
197        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
198            value
199        }
200    }
201
202    unsafe impl fidl::encoding::TypeMarker for Empty {
203        type Owned = Self;
204
205        #[inline(always)]
206        fn inline_align(_context: fidl::encoding::Context) -> usize {
207            1
208        }
209
210        #[inline(always)]
211        fn inline_size(_context: fidl::encoding::Context) -> usize {
212            1
213        }
214    }
215
216    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Empty, D> for &Empty {
217        #[inline]
218        unsafe fn encode(
219            self,
220            encoder: &mut fidl::encoding::Encoder<'_, D>,
221            offset: usize,
222            _depth: fidl::encoding::Depth,
223        ) -> fidl::Result<()> {
224            encoder.debug_check_bounds::<Empty>(offset);
225            encoder.write_num(0u8, offset);
226            Ok(())
227        }
228    }
229
230    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Empty {
231        #[inline(always)]
232        fn new_empty() -> Self {
233            Self
234        }
235
236        #[inline]
237        unsafe fn decode(
238            &mut self,
239            decoder: &mut fidl::encoding::Decoder<'_, D>,
240            offset: usize,
241            _depth: fidl::encoding::Depth,
242        ) -> fidl::Result<()> {
243            decoder.debug_check_bounds::<Self>(offset);
244            match decoder.read_num::<u8>(offset) {
245                0 => Ok(()),
246                _ => Err(fidl::Error::Invalid),
247            }
248        }
249    }
250
251    impl fidl::encoding::ValueTypeMarker for Icmpv6Filter {
252        type Borrowed<'a> = &'a Self;
253        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
254            value
255        }
256    }
257
258    unsafe impl fidl::encoding::TypeMarker for Icmpv6Filter {
259        type Owned = Self;
260
261        #[inline(always)]
262        fn inline_align(_context: fidl::encoding::Context) -> usize {
263            4
264        }
265
266        #[inline(always)]
267        fn inline_size(_context: fidl::encoding::Context) -> usize {
268            32
269        }
270        #[inline(always)]
271        fn encode_is_copy() -> bool {
272            true
273        }
274
275        #[inline(always)]
276        fn decode_is_copy() -> bool {
277            true
278        }
279    }
280
281    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Icmpv6Filter, D>
282        for &Icmpv6Filter
283    {
284        #[inline]
285        unsafe fn encode(
286            self,
287            encoder: &mut fidl::encoding::Encoder<'_, D>,
288            offset: usize,
289            _depth: fidl::encoding::Depth,
290        ) -> fidl::Result<()> {
291            encoder.debug_check_bounds::<Icmpv6Filter>(offset);
292            unsafe {
293                // Copy the object into the buffer.
294                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
295                (buf_ptr as *mut Icmpv6Filter)
296                    .write_unaligned((self as *const Icmpv6Filter).read());
297                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
298                // done second because the memcpy will write garbage to these bytes.
299            }
300            Ok(())
301        }
302    }
303    unsafe impl<
304            D: fidl::encoding::ResourceDialect,
305            T0: fidl::encoding::Encode<fidl::encoding::Array<u32, 8>, D>,
306        > fidl::encoding::Encode<Icmpv6Filter, D> for (T0,)
307    {
308        #[inline]
309        unsafe fn encode(
310            self,
311            encoder: &mut fidl::encoding::Encoder<'_, D>,
312            offset: usize,
313            depth: fidl::encoding::Depth,
314        ) -> fidl::Result<()> {
315            encoder.debug_check_bounds::<Icmpv6Filter>(offset);
316            // Zero out padding regions. There's no need to apply masks
317            // because the unmasked parts will be overwritten by fields.
318            // Write the fields.
319            self.0.encode(encoder, offset + 0, depth)?;
320            Ok(())
321        }
322    }
323
324    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Icmpv6Filter {
325        #[inline(always)]
326        fn new_empty() -> Self {
327            Self { blocked_types: fidl::new_empty!(fidl::encoding::Array<u32, 8>, D) }
328        }
329
330        #[inline]
331        unsafe fn decode(
332            &mut self,
333            decoder: &mut fidl::encoding::Decoder<'_, D>,
334            offset: usize,
335            _depth: fidl::encoding::Depth,
336        ) -> fidl::Result<()> {
337            decoder.debug_check_bounds::<Self>(offset);
338            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
339            // Verify that padding bytes are zero.
340            // Copy from the buffer into the object.
341            unsafe {
342                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 32);
343            }
344            Ok(())
345        }
346    }
347
348    impl fidl::encoding::ValueTypeMarker for ProviderSocketRequest {
349        type Borrowed<'a> = &'a Self;
350        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
351            value
352        }
353    }
354
355    unsafe impl fidl::encoding::TypeMarker for ProviderSocketRequest {
356        type Owned = Self;
357
358        #[inline(always)]
359        fn inline_align(_context: fidl::encoding::Context) -> usize {
360            8
361        }
362
363        #[inline(always)]
364        fn inline_size(_context: fidl::encoding::Context) -> usize {
365            24
366        }
367    }
368
369    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<ProviderSocketRequest, D>
370        for &ProviderSocketRequest
371    {
372        #[inline]
373        unsafe fn encode(
374            self,
375            encoder: &mut fidl::encoding::Encoder<'_, D>,
376            offset: usize,
377            _depth: fidl::encoding::Depth,
378        ) -> fidl::Result<()> {
379            encoder.debug_check_bounds::<ProviderSocketRequest>(offset);
380            // Delegate to tuple encoding.
381            fidl::encoding::Encode::<ProviderSocketRequest, D>::encode(
382                (
383                    <fidl_fuchsia_posix_socket__common::Domain as fidl::encoding::ValueTypeMarker>::borrow(&self.domain),
384                    <ProtocolAssociation as fidl::encoding::ValueTypeMarker>::borrow(&self.proto),
385                ),
386                encoder, offset, _depth
387            )
388        }
389    }
390    unsafe impl<
391            D: fidl::encoding::ResourceDialect,
392            T0: fidl::encoding::Encode<fidl_fuchsia_posix_socket__common::Domain, D>,
393            T1: fidl::encoding::Encode<ProtocolAssociation, D>,
394        > fidl::encoding::Encode<ProviderSocketRequest, D> for (T0, T1)
395    {
396        #[inline]
397        unsafe fn encode(
398            self,
399            encoder: &mut fidl::encoding::Encoder<'_, D>,
400            offset: usize,
401            depth: fidl::encoding::Depth,
402        ) -> fidl::Result<()> {
403            encoder.debug_check_bounds::<ProviderSocketRequest>(offset);
404            // Zero out padding regions. There's no need to apply masks
405            // because the unmasked parts will be overwritten by fields.
406            unsafe {
407                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
408                (ptr as *mut u64).write_unaligned(0);
409            }
410            // Write the fields.
411            self.0.encode(encoder, offset + 0, depth)?;
412            self.1.encode(encoder, offset + 8, depth)?;
413            Ok(())
414        }
415    }
416
417    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ProviderSocketRequest {
418        #[inline(always)]
419        fn new_empty() -> Self {
420            Self {
421                domain: fidl::new_empty!(fidl_fuchsia_posix_socket__common::Domain, D),
422                proto: fidl::new_empty!(ProtocolAssociation, D),
423            }
424        }
425
426        #[inline]
427        unsafe fn decode(
428            &mut self,
429            decoder: &mut fidl::encoding::Decoder<'_, D>,
430            offset: usize,
431            _depth: fidl::encoding::Depth,
432        ) -> fidl::Result<()> {
433            decoder.debug_check_bounds::<Self>(offset);
434            // Verify that padding bytes are zero.
435            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
436            let padval = unsafe { (ptr as *const u64).read_unaligned() };
437            let mask = 0xffffffffffff0000u64;
438            let maskedval = padval & mask;
439            if maskedval != 0 {
440                return Err(fidl::Error::NonZeroPadding {
441                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
442                });
443            }
444            fidl::decode!(
445                fidl_fuchsia_posix_socket__common::Domain,
446                D,
447                &mut self.domain,
448                decoder,
449                offset + 0,
450                _depth
451            )?;
452            fidl::decode!(ProtocolAssociation, D, &mut self.proto, decoder, offset + 8, _depth)?;
453            Ok(())
454        }
455    }
456
457    impl fidl::encoding::ValueTypeMarker for ProviderSocketWithOptionsRequest {
458        type Borrowed<'a> = &'a Self;
459        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
460            value
461        }
462    }
463
464    unsafe impl fidl::encoding::TypeMarker for ProviderSocketWithOptionsRequest {
465        type Owned = Self;
466
467        #[inline(always)]
468        fn inline_align(_context: fidl::encoding::Context) -> usize {
469            8
470        }
471
472        #[inline(always)]
473        fn inline_size(_context: fidl::encoding::Context) -> usize {
474            40
475        }
476    }
477
478    unsafe impl<D: fidl::encoding::ResourceDialect>
479        fidl::encoding::Encode<ProviderSocketWithOptionsRequest, D>
480        for &ProviderSocketWithOptionsRequest
481    {
482        #[inline]
483        unsafe fn encode(
484            self,
485            encoder: &mut fidl::encoding::Encoder<'_, D>,
486            offset: usize,
487            _depth: fidl::encoding::Depth,
488        ) -> fidl::Result<()> {
489            encoder.debug_check_bounds::<ProviderSocketWithOptionsRequest>(offset);
490            // Delegate to tuple encoding.
491            fidl::encoding::Encode::<ProviderSocketWithOptionsRequest, D>::encode(
492                (
493                    <fidl_fuchsia_posix_socket__common::Domain as fidl::encoding::ValueTypeMarker>::borrow(&self.domain),
494                    <ProtocolAssociation as fidl::encoding::ValueTypeMarker>::borrow(&self.proto),
495                    <fidl_fuchsia_posix_socket__common::SocketCreationOptions as fidl::encoding::ValueTypeMarker>::borrow(&self.opts),
496                ),
497                encoder, offset, _depth
498            )
499        }
500    }
501    unsafe impl<
502            D: fidl::encoding::ResourceDialect,
503            T0: fidl::encoding::Encode<fidl_fuchsia_posix_socket__common::Domain, D>,
504            T1: fidl::encoding::Encode<ProtocolAssociation, D>,
505            T2: fidl::encoding::Encode<fidl_fuchsia_posix_socket__common::SocketCreationOptions, D>,
506        > fidl::encoding::Encode<ProviderSocketWithOptionsRequest, D> for (T0, T1, T2)
507    {
508        #[inline]
509        unsafe fn encode(
510            self,
511            encoder: &mut fidl::encoding::Encoder<'_, D>,
512            offset: usize,
513            depth: fidl::encoding::Depth,
514        ) -> fidl::Result<()> {
515            encoder.debug_check_bounds::<ProviderSocketWithOptionsRequest>(offset);
516            // Zero out padding regions. There's no need to apply masks
517            // because the unmasked parts will be overwritten by fields.
518            unsafe {
519                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
520                (ptr as *mut u64).write_unaligned(0);
521            }
522            // Write the fields.
523            self.0.encode(encoder, offset + 0, depth)?;
524            self.1.encode(encoder, offset + 8, depth)?;
525            self.2.encode(encoder, offset + 24, depth)?;
526            Ok(())
527        }
528    }
529
530    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
531        for ProviderSocketWithOptionsRequest
532    {
533        #[inline(always)]
534        fn new_empty() -> Self {
535            Self {
536                domain: fidl::new_empty!(fidl_fuchsia_posix_socket__common::Domain, D),
537                proto: fidl::new_empty!(ProtocolAssociation, D),
538                opts: fidl::new_empty!(fidl_fuchsia_posix_socket__common::SocketCreationOptions, D),
539            }
540        }
541
542        #[inline]
543        unsafe fn decode(
544            &mut self,
545            decoder: &mut fidl::encoding::Decoder<'_, D>,
546            offset: usize,
547            _depth: fidl::encoding::Depth,
548        ) -> fidl::Result<()> {
549            decoder.debug_check_bounds::<Self>(offset);
550            // Verify that padding bytes are zero.
551            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
552            let padval = unsafe { (ptr as *const u64).read_unaligned() };
553            let mask = 0xffffffffffff0000u64;
554            let maskedval = padval & mask;
555            if maskedval != 0 {
556                return Err(fidl::Error::NonZeroPadding {
557                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
558                });
559            }
560            fidl::decode!(
561                fidl_fuchsia_posix_socket__common::Domain,
562                D,
563                &mut self.domain,
564                decoder,
565                offset + 0,
566                _depth
567            )?;
568            fidl::decode!(ProtocolAssociation, D, &mut self.proto, decoder, offset + 8, _depth)?;
569            fidl::decode!(
570                fidl_fuchsia_posix_socket__common::SocketCreationOptions,
571                D,
572                &mut self.opts,
573                decoder,
574                offset + 24,
575                _depth
576            )?;
577            Ok(())
578        }
579    }
580
581    impl fidl::encoding::ValueTypeMarker for SocketRecvMsgRequest {
582        type Borrowed<'a> = &'a Self;
583        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
584            value
585        }
586    }
587
588    unsafe impl fidl::encoding::TypeMarker for SocketRecvMsgRequest {
589        type Owned = Self;
590
591        #[inline(always)]
592        fn inline_align(_context: fidl::encoding::Context) -> usize {
593            4
594        }
595
596        #[inline(always)]
597        fn inline_size(_context: fidl::encoding::Context) -> usize {
598            12
599        }
600    }
601
602    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<SocketRecvMsgRequest, D>
603        for &SocketRecvMsgRequest
604    {
605        #[inline]
606        unsafe fn encode(
607            self,
608            encoder: &mut fidl::encoding::Encoder<'_, D>,
609            offset: usize,
610            _depth: fidl::encoding::Depth,
611        ) -> fidl::Result<()> {
612            encoder.debug_check_bounds::<SocketRecvMsgRequest>(offset);
613            // Delegate to tuple encoding.
614            fidl::encoding::Encode::<SocketRecvMsgRequest, D>::encode(
615                (
616                    <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.want_addr),
617                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.data_len),
618                    <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.want_control),
619                    <fidl_fuchsia_posix_socket__common::RecvMsgFlags as fidl::encoding::ValueTypeMarker>::borrow(&self.flags),
620                ),
621                encoder, offset, _depth
622            )
623        }
624    }
625    unsafe impl<
626            D: fidl::encoding::ResourceDialect,
627            T0: fidl::encoding::Encode<bool, D>,
628            T1: fidl::encoding::Encode<u32, D>,
629            T2: fidl::encoding::Encode<bool, D>,
630            T3: fidl::encoding::Encode<fidl_fuchsia_posix_socket__common::RecvMsgFlags, D>,
631        > fidl::encoding::Encode<SocketRecvMsgRequest, D> for (T0, T1, T2, T3)
632    {
633        #[inline]
634        unsafe fn encode(
635            self,
636            encoder: &mut fidl::encoding::Encoder<'_, D>,
637            offset: usize,
638            depth: fidl::encoding::Depth,
639        ) -> fidl::Result<()> {
640            encoder.debug_check_bounds::<SocketRecvMsgRequest>(offset);
641            // Zero out padding regions. There's no need to apply masks
642            // because the unmasked parts will be overwritten by fields.
643            unsafe {
644                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
645                (ptr as *mut u32).write_unaligned(0);
646            }
647            unsafe {
648                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
649                (ptr as *mut u32).write_unaligned(0);
650            }
651            // Write the fields.
652            self.0.encode(encoder, offset + 0, depth)?;
653            self.1.encode(encoder, offset + 4, depth)?;
654            self.2.encode(encoder, offset + 8, depth)?;
655            self.3.encode(encoder, offset + 10, depth)?;
656            Ok(())
657        }
658    }
659
660    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SocketRecvMsgRequest {
661        #[inline(always)]
662        fn new_empty() -> Self {
663            Self {
664                want_addr: fidl::new_empty!(bool, D),
665                data_len: fidl::new_empty!(u32, D),
666                want_control: fidl::new_empty!(bool, D),
667                flags: fidl::new_empty!(fidl_fuchsia_posix_socket__common::RecvMsgFlags, D),
668            }
669        }
670
671        #[inline]
672        unsafe fn decode(
673            &mut self,
674            decoder: &mut fidl::encoding::Decoder<'_, D>,
675            offset: usize,
676            _depth: fidl::encoding::Depth,
677        ) -> fidl::Result<()> {
678            decoder.debug_check_bounds::<Self>(offset);
679            // Verify that padding bytes are zero.
680            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
681            let padval = unsafe { (ptr as *const u32).read_unaligned() };
682            let mask = 0xffffff00u32;
683            let maskedval = padval & mask;
684            if maskedval != 0 {
685                return Err(fidl::Error::NonZeroPadding {
686                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
687                });
688            }
689            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(8) };
690            let padval = unsafe { (ptr as *const u32).read_unaligned() };
691            let mask = 0xff00u32;
692            let maskedval = padval & mask;
693            if maskedval != 0 {
694                return Err(fidl::Error::NonZeroPadding {
695                    padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
696                });
697            }
698            fidl::decode!(bool, D, &mut self.want_addr, decoder, offset + 0, _depth)?;
699            fidl::decode!(u32, D, &mut self.data_len, decoder, offset + 4, _depth)?;
700            fidl::decode!(bool, D, &mut self.want_control, decoder, offset + 8, _depth)?;
701            fidl::decode!(
702                fidl_fuchsia_posix_socket__common::RecvMsgFlags,
703                D,
704                &mut self.flags,
705                decoder,
706                offset + 10,
707                _depth
708            )?;
709            Ok(())
710        }
711    }
712
713    impl fidl::encoding::ValueTypeMarker for SocketSendMsgRequest {
714        type Borrowed<'a> = &'a Self;
715        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
716            value
717        }
718    }
719
720    unsafe impl fidl::encoding::TypeMarker for SocketSendMsgRequest {
721        type Owned = Self;
722
723        #[inline(always)]
724        fn inline_align(_context: fidl::encoding::Context) -> usize {
725            8
726        }
727
728        #[inline(always)]
729        fn inline_size(_context: fidl::encoding::Context) -> usize {
730            56
731        }
732    }
733
734    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<SocketSendMsgRequest, D>
735        for &SocketSendMsgRequest
736    {
737        #[inline]
738        unsafe fn encode(
739            self,
740            encoder: &mut fidl::encoding::Encoder<'_, D>,
741            offset: usize,
742            _depth: fidl::encoding::Depth,
743        ) -> fidl::Result<()> {
744            encoder.debug_check_bounds::<SocketSendMsgRequest>(offset);
745            // Delegate to tuple encoding.
746            fidl::encoding::Encode::<SocketSendMsgRequest, D>::encode(
747                (
748                    <fidl::encoding::OptionalUnion<fidl_fuchsia_net__common::SocketAddress> as fidl::encoding::ValueTypeMarker>::borrow(&self.addr),
749                    <fidl::encoding::UnboundedVector<u8> as fidl::encoding::ValueTypeMarker>::borrow(&self.data),
750                    <fidl_fuchsia_posix_socket__common::NetworkSocketSendControlData as fidl::encoding::ValueTypeMarker>::borrow(&self.control),
751                    <fidl_fuchsia_posix_socket__common::SendMsgFlags as fidl::encoding::ValueTypeMarker>::borrow(&self.flags),
752                ),
753                encoder, offset, _depth
754            )
755        }
756    }
757    unsafe impl<
758            D: fidl::encoding::ResourceDialect,
759            T0: fidl::encoding::Encode<
760                fidl::encoding::OptionalUnion<fidl_fuchsia_net__common::SocketAddress>,
761                D,
762            >,
763            T1: fidl::encoding::Encode<fidl::encoding::UnboundedVector<u8>, D>,
764            T2: fidl::encoding::Encode<
765                fidl_fuchsia_posix_socket__common::NetworkSocketSendControlData,
766                D,
767            >,
768            T3: fidl::encoding::Encode<fidl_fuchsia_posix_socket__common::SendMsgFlags, D>,
769        > fidl::encoding::Encode<SocketSendMsgRequest, D> for (T0, T1, T2, T3)
770    {
771        #[inline]
772        unsafe fn encode(
773            self,
774            encoder: &mut fidl::encoding::Encoder<'_, D>,
775            offset: usize,
776            depth: fidl::encoding::Depth,
777        ) -> fidl::Result<()> {
778            encoder.debug_check_bounds::<SocketSendMsgRequest>(offset);
779            // Zero out padding regions. There's no need to apply masks
780            // because the unmasked parts will be overwritten by fields.
781            unsafe {
782                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(48);
783                (ptr as *mut u64).write_unaligned(0);
784            }
785            // Write the fields.
786            self.0.encode(encoder, offset + 0, depth)?;
787            self.1.encode(encoder, offset + 16, depth)?;
788            self.2.encode(encoder, offset + 32, depth)?;
789            self.3.encode(encoder, offset + 48, depth)?;
790            Ok(())
791        }
792    }
793
794    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SocketSendMsgRequest {
795        #[inline(always)]
796        fn new_empty() -> Self {
797            Self {
798                addr: fidl::new_empty!(
799                    fidl::encoding::OptionalUnion<fidl_fuchsia_net__common::SocketAddress>,
800                    D
801                ),
802                data: fidl::new_empty!(fidl::encoding::UnboundedVector<u8>, D),
803                control: fidl::new_empty!(
804                    fidl_fuchsia_posix_socket__common::NetworkSocketSendControlData,
805                    D
806                ),
807                flags: fidl::new_empty!(fidl_fuchsia_posix_socket__common::SendMsgFlags, D),
808            }
809        }
810
811        #[inline]
812        unsafe fn decode(
813            &mut self,
814            decoder: &mut fidl::encoding::Decoder<'_, D>,
815            offset: usize,
816            _depth: fidl::encoding::Depth,
817        ) -> fidl::Result<()> {
818            decoder.debug_check_bounds::<Self>(offset);
819            // Verify that padding bytes are zero.
820            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(48) };
821            let padval = unsafe { (ptr as *const u64).read_unaligned() };
822            let mask = 0xffffffffffff0000u64;
823            let maskedval = padval & mask;
824            if maskedval != 0 {
825                return Err(fidl::Error::NonZeroPadding {
826                    padding_start: offset + 48 + ((mask as u64).trailing_zeros() / 8) as usize,
827                });
828            }
829            fidl::decode!(
830                fidl::encoding::OptionalUnion<fidl_fuchsia_net__common::SocketAddress>,
831                D,
832                &mut self.addr,
833                decoder,
834                offset + 0,
835                _depth
836            )?;
837            fidl::decode!(
838                fidl::encoding::UnboundedVector<u8>,
839                D,
840                &mut self.data,
841                decoder,
842                offset + 16,
843                _depth
844            )?;
845            fidl::decode!(
846                fidl_fuchsia_posix_socket__common::NetworkSocketSendControlData,
847                D,
848                &mut self.control,
849                decoder,
850                offset + 32,
851                _depth
852            )?;
853            fidl::decode!(
854                fidl_fuchsia_posix_socket__common::SendMsgFlags,
855                D,
856                &mut self.flags,
857                decoder,
858                offset + 48,
859                _depth
860            )?;
861            Ok(())
862        }
863    }
864
865    impl fidl::encoding::ValueTypeMarker for SocketSetIcmpv6FilterRequest {
866        type Borrowed<'a> = &'a Self;
867        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
868            value
869        }
870    }
871
872    unsafe impl fidl::encoding::TypeMarker for SocketSetIcmpv6FilterRequest {
873        type Owned = Self;
874
875        #[inline(always)]
876        fn inline_align(_context: fidl::encoding::Context) -> usize {
877            4
878        }
879
880        #[inline(always)]
881        fn inline_size(_context: fidl::encoding::Context) -> usize {
882            32
883        }
884        #[inline(always)]
885        fn encode_is_copy() -> bool {
886            true
887        }
888
889        #[inline(always)]
890        fn decode_is_copy() -> bool {
891            true
892        }
893    }
894
895    unsafe impl<D: fidl::encoding::ResourceDialect>
896        fidl::encoding::Encode<SocketSetIcmpv6FilterRequest, D> for &SocketSetIcmpv6FilterRequest
897    {
898        #[inline]
899        unsafe fn encode(
900            self,
901            encoder: &mut fidl::encoding::Encoder<'_, D>,
902            offset: usize,
903            _depth: fidl::encoding::Depth,
904        ) -> fidl::Result<()> {
905            encoder.debug_check_bounds::<SocketSetIcmpv6FilterRequest>(offset);
906            unsafe {
907                // Copy the object into the buffer.
908                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
909                (buf_ptr as *mut SocketSetIcmpv6FilterRequest)
910                    .write_unaligned((self as *const SocketSetIcmpv6FilterRequest).read());
911                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
912                // done second because the memcpy will write garbage to these bytes.
913            }
914            Ok(())
915        }
916    }
917    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<Icmpv6Filter, D>>
918        fidl::encoding::Encode<SocketSetIcmpv6FilterRequest, D> for (T0,)
919    {
920        #[inline]
921        unsafe fn encode(
922            self,
923            encoder: &mut fidl::encoding::Encoder<'_, D>,
924            offset: usize,
925            depth: fidl::encoding::Depth,
926        ) -> fidl::Result<()> {
927            encoder.debug_check_bounds::<SocketSetIcmpv6FilterRequest>(offset);
928            // Zero out padding regions. There's no need to apply masks
929            // because the unmasked parts will be overwritten by fields.
930            // Write the fields.
931            self.0.encode(encoder, offset + 0, depth)?;
932            Ok(())
933        }
934    }
935
936    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
937        for SocketSetIcmpv6FilterRequest
938    {
939        #[inline(always)]
940        fn new_empty() -> Self {
941            Self { filter: fidl::new_empty!(Icmpv6Filter, D) }
942        }
943
944        #[inline]
945        unsafe fn decode(
946            &mut self,
947            decoder: &mut fidl::encoding::Decoder<'_, D>,
948            offset: usize,
949            _depth: fidl::encoding::Depth,
950        ) -> fidl::Result<()> {
951            decoder.debug_check_bounds::<Self>(offset);
952            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
953            // Verify that padding bytes are zero.
954            // Copy from the buffer into the object.
955            unsafe {
956                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 32);
957            }
958            Ok(())
959        }
960    }
961
962    impl fidl::encoding::ValueTypeMarker for SocketSetIpHeaderIncludedRequest {
963        type Borrowed<'a> = &'a Self;
964        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
965            value
966        }
967    }
968
969    unsafe impl fidl::encoding::TypeMarker for SocketSetIpHeaderIncludedRequest {
970        type Owned = Self;
971
972        #[inline(always)]
973        fn inline_align(_context: fidl::encoding::Context) -> usize {
974            1
975        }
976
977        #[inline(always)]
978        fn inline_size(_context: fidl::encoding::Context) -> usize {
979            1
980        }
981    }
982
983    unsafe impl<D: fidl::encoding::ResourceDialect>
984        fidl::encoding::Encode<SocketSetIpHeaderIncludedRequest, D>
985        for &SocketSetIpHeaderIncludedRequest
986    {
987        #[inline]
988        unsafe fn encode(
989            self,
990            encoder: &mut fidl::encoding::Encoder<'_, D>,
991            offset: usize,
992            _depth: fidl::encoding::Depth,
993        ) -> fidl::Result<()> {
994            encoder.debug_check_bounds::<SocketSetIpHeaderIncludedRequest>(offset);
995            // Delegate to tuple encoding.
996            fidl::encoding::Encode::<SocketSetIpHeaderIncludedRequest, D>::encode(
997                (<bool as fidl::encoding::ValueTypeMarker>::borrow(&self.value),),
998                encoder,
999                offset,
1000                _depth,
1001            )
1002        }
1003    }
1004    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<bool, D>>
1005        fidl::encoding::Encode<SocketSetIpHeaderIncludedRequest, D> for (T0,)
1006    {
1007        #[inline]
1008        unsafe fn encode(
1009            self,
1010            encoder: &mut fidl::encoding::Encoder<'_, D>,
1011            offset: usize,
1012            depth: fidl::encoding::Depth,
1013        ) -> fidl::Result<()> {
1014            encoder.debug_check_bounds::<SocketSetIpHeaderIncludedRequest>(offset);
1015            // Zero out padding regions. There's no need to apply masks
1016            // because the unmasked parts will be overwritten by fields.
1017            // Write the fields.
1018            self.0.encode(encoder, offset + 0, depth)?;
1019            Ok(())
1020        }
1021    }
1022
1023    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1024        for SocketSetIpHeaderIncludedRequest
1025    {
1026        #[inline(always)]
1027        fn new_empty() -> Self {
1028            Self { value: fidl::new_empty!(bool, D) }
1029        }
1030
1031        #[inline]
1032        unsafe fn decode(
1033            &mut self,
1034            decoder: &mut fidl::encoding::Decoder<'_, D>,
1035            offset: usize,
1036            _depth: fidl::encoding::Depth,
1037        ) -> fidl::Result<()> {
1038            decoder.debug_check_bounds::<Self>(offset);
1039            // Verify that padding bytes are zero.
1040            fidl::decode!(bool, D, &mut self.value, decoder, offset + 0, _depth)?;
1041            Ok(())
1042        }
1043    }
1044
1045    impl fidl::encoding::ValueTypeMarker for SocketSetIpv6ChecksumRequest {
1046        type Borrowed<'a> = &'a Self;
1047        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1048            value
1049        }
1050    }
1051
1052    unsafe impl fidl::encoding::TypeMarker for SocketSetIpv6ChecksumRequest {
1053        type Owned = Self;
1054
1055        #[inline(always)]
1056        fn inline_align(_context: fidl::encoding::Context) -> usize {
1057            8
1058        }
1059
1060        #[inline(always)]
1061        fn inline_size(_context: fidl::encoding::Context) -> usize {
1062            16
1063        }
1064    }
1065
1066    unsafe impl<D: fidl::encoding::ResourceDialect>
1067        fidl::encoding::Encode<SocketSetIpv6ChecksumRequest, D> for &SocketSetIpv6ChecksumRequest
1068    {
1069        #[inline]
1070        unsafe fn encode(
1071            self,
1072            encoder: &mut fidl::encoding::Encoder<'_, D>,
1073            offset: usize,
1074            _depth: fidl::encoding::Depth,
1075        ) -> fidl::Result<()> {
1076            encoder.debug_check_bounds::<SocketSetIpv6ChecksumRequest>(offset);
1077            // Delegate to tuple encoding.
1078            fidl::encoding::Encode::<SocketSetIpv6ChecksumRequest, D>::encode(
1079                (<Ipv6ChecksumConfiguration as fidl::encoding::ValueTypeMarker>::borrow(
1080                    &self.config,
1081                ),),
1082                encoder,
1083                offset,
1084                _depth,
1085            )
1086        }
1087    }
1088    unsafe impl<
1089            D: fidl::encoding::ResourceDialect,
1090            T0: fidl::encoding::Encode<Ipv6ChecksumConfiguration, D>,
1091        > fidl::encoding::Encode<SocketSetIpv6ChecksumRequest, D> for (T0,)
1092    {
1093        #[inline]
1094        unsafe fn encode(
1095            self,
1096            encoder: &mut fidl::encoding::Encoder<'_, D>,
1097            offset: usize,
1098            depth: fidl::encoding::Depth,
1099        ) -> fidl::Result<()> {
1100            encoder.debug_check_bounds::<SocketSetIpv6ChecksumRequest>(offset);
1101            // Zero out padding regions. There's no need to apply masks
1102            // because the unmasked parts will be overwritten by fields.
1103            // Write the fields.
1104            self.0.encode(encoder, offset + 0, depth)?;
1105            Ok(())
1106        }
1107    }
1108
1109    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1110        for SocketSetIpv6ChecksumRequest
1111    {
1112        #[inline(always)]
1113        fn new_empty() -> Self {
1114            Self { config: fidl::new_empty!(Ipv6ChecksumConfiguration, D) }
1115        }
1116
1117        #[inline]
1118        unsafe fn decode(
1119            &mut self,
1120            decoder: &mut fidl::encoding::Decoder<'_, D>,
1121            offset: usize,
1122            _depth: fidl::encoding::Depth,
1123        ) -> fidl::Result<()> {
1124            decoder.debug_check_bounds::<Self>(offset);
1125            // Verify that padding bytes are zero.
1126            fidl::decode!(
1127                Ipv6ChecksumConfiguration,
1128                D,
1129                &mut self.config,
1130                decoder,
1131                offset + 0,
1132                _depth
1133            )?;
1134            Ok(())
1135        }
1136    }
1137
1138    impl fidl::encoding::ValueTypeMarker for SocketGetIcmpv6FilterResponse {
1139        type Borrowed<'a> = &'a Self;
1140        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1141            value
1142        }
1143    }
1144
1145    unsafe impl fidl::encoding::TypeMarker for SocketGetIcmpv6FilterResponse {
1146        type Owned = Self;
1147
1148        #[inline(always)]
1149        fn inline_align(_context: fidl::encoding::Context) -> usize {
1150            4
1151        }
1152
1153        #[inline(always)]
1154        fn inline_size(_context: fidl::encoding::Context) -> usize {
1155            32
1156        }
1157        #[inline(always)]
1158        fn encode_is_copy() -> bool {
1159            true
1160        }
1161
1162        #[inline(always)]
1163        fn decode_is_copy() -> bool {
1164            true
1165        }
1166    }
1167
1168    unsafe impl<D: fidl::encoding::ResourceDialect>
1169        fidl::encoding::Encode<SocketGetIcmpv6FilterResponse, D>
1170        for &SocketGetIcmpv6FilterResponse
1171    {
1172        #[inline]
1173        unsafe fn encode(
1174            self,
1175            encoder: &mut fidl::encoding::Encoder<'_, D>,
1176            offset: usize,
1177            _depth: fidl::encoding::Depth,
1178        ) -> fidl::Result<()> {
1179            encoder.debug_check_bounds::<SocketGetIcmpv6FilterResponse>(offset);
1180            unsafe {
1181                // Copy the object into the buffer.
1182                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
1183                (buf_ptr as *mut SocketGetIcmpv6FilterResponse)
1184                    .write_unaligned((self as *const SocketGetIcmpv6FilterResponse).read());
1185                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
1186                // done second because the memcpy will write garbage to these bytes.
1187            }
1188            Ok(())
1189        }
1190    }
1191    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<Icmpv6Filter, D>>
1192        fidl::encoding::Encode<SocketGetIcmpv6FilterResponse, D> for (T0,)
1193    {
1194        #[inline]
1195        unsafe fn encode(
1196            self,
1197            encoder: &mut fidl::encoding::Encoder<'_, D>,
1198            offset: usize,
1199            depth: fidl::encoding::Depth,
1200        ) -> fidl::Result<()> {
1201            encoder.debug_check_bounds::<SocketGetIcmpv6FilterResponse>(offset);
1202            // Zero out padding regions. There's no need to apply masks
1203            // because the unmasked parts will be overwritten by fields.
1204            // Write the fields.
1205            self.0.encode(encoder, offset + 0, depth)?;
1206            Ok(())
1207        }
1208    }
1209
1210    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1211        for SocketGetIcmpv6FilterResponse
1212    {
1213        #[inline(always)]
1214        fn new_empty() -> Self {
1215            Self { filter: fidl::new_empty!(Icmpv6Filter, D) }
1216        }
1217
1218        #[inline]
1219        unsafe fn decode(
1220            &mut self,
1221            decoder: &mut fidl::encoding::Decoder<'_, D>,
1222            offset: usize,
1223            _depth: fidl::encoding::Depth,
1224        ) -> fidl::Result<()> {
1225            decoder.debug_check_bounds::<Self>(offset);
1226            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
1227            // Verify that padding bytes are zero.
1228            // Copy from the buffer into the object.
1229            unsafe {
1230                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 32);
1231            }
1232            Ok(())
1233        }
1234    }
1235
1236    impl fidl::encoding::ValueTypeMarker for SocketGetInfoResponse {
1237        type Borrowed<'a> = &'a Self;
1238        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1239            value
1240        }
1241    }
1242
1243    unsafe impl fidl::encoding::TypeMarker for SocketGetInfoResponse {
1244        type Owned = Self;
1245
1246        #[inline(always)]
1247        fn inline_align(_context: fidl::encoding::Context) -> usize {
1248            8
1249        }
1250
1251        #[inline(always)]
1252        fn inline_size(_context: fidl::encoding::Context) -> usize {
1253            24
1254        }
1255    }
1256
1257    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<SocketGetInfoResponse, D>
1258        for &SocketGetInfoResponse
1259    {
1260        #[inline]
1261        unsafe fn encode(
1262            self,
1263            encoder: &mut fidl::encoding::Encoder<'_, D>,
1264            offset: usize,
1265            _depth: fidl::encoding::Depth,
1266        ) -> fidl::Result<()> {
1267            encoder.debug_check_bounds::<SocketGetInfoResponse>(offset);
1268            // Delegate to tuple encoding.
1269            fidl::encoding::Encode::<SocketGetInfoResponse, D>::encode(
1270                (
1271                    <fidl_fuchsia_posix_socket__common::Domain as fidl::encoding::ValueTypeMarker>::borrow(&self.domain),
1272                    <ProtocolAssociation as fidl::encoding::ValueTypeMarker>::borrow(&self.proto),
1273                ),
1274                encoder, offset, _depth
1275            )
1276        }
1277    }
1278    unsafe impl<
1279            D: fidl::encoding::ResourceDialect,
1280            T0: fidl::encoding::Encode<fidl_fuchsia_posix_socket__common::Domain, D>,
1281            T1: fidl::encoding::Encode<ProtocolAssociation, D>,
1282        > fidl::encoding::Encode<SocketGetInfoResponse, D> for (T0, T1)
1283    {
1284        #[inline]
1285        unsafe fn encode(
1286            self,
1287            encoder: &mut fidl::encoding::Encoder<'_, D>,
1288            offset: usize,
1289            depth: fidl::encoding::Depth,
1290        ) -> fidl::Result<()> {
1291            encoder.debug_check_bounds::<SocketGetInfoResponse>(offset);
1292            // Zero out padding regions. There's no need to apply masks
1293            // because the unmasked parts will be overwritten by fields.
1294            unsafe {
1295                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
1296                (ptr as *mut u64).write_unaligned(0);
1297            }
1298            // Write the fields.
1299            self.0.encode(encoder, offset + 0, depth)?;
1300            self.1.encode(encoder, offset + 8, depth)?;
1301            Ok(())
1302        }
1303    }
1304
1305    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SocketGetInfoResponse {
1306        #[inline(always)]
1307        fn new_empty() -> Self {
1308            Self {
1309                domain: fidl::new_empty!(fidl_fuchsia_posix_socket__common::Domain, D),
1310                proto: fidl::new_empty!(ProtocolAssociation, D),
1311            }
1312        }
1313
1314        #[inline]
1315        unsafe fn decode(
1316            &mut self,
1317            decoder: &mut fidl::encoding::Decoder<'_, D>,
1318            offset: usize,
1319            _depth: fidl::encoding::Depth,
1320        ) -> fidl::Result<()> {
1321            decoder.debug_check_bounds::<Self>(offset);
1322            // Verify that padding bytes are zero.
1323            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
1324            let padval = unsafe { (ptr as *const u64).read_unaligned() };
1325            let mask = 0xffffffffffff0000u64;
1326            let maskedval = padval & mask;
1327            if maskedval != 0 {
1328                return Err(fidl::Error::NonZeroPadding {
1329                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
1330                });
1331            }
1332            fidl::decode!(
1333                fidl_fuchsia_posix_socket__common::Domain,
1334                D,
1335                &mut self.domain,
1336                decoder,
1337                offset + 0,
1338                _depth
1339            )?;
1340            fidl::decode!(ProtocolAssociation, D, &mut self.proto, decoder, offset + 8, _depth)?;
1341            Ok(())
1342        }
1343    }
1344
1345    impl fidl::encoding::ValueTypeMarker for SocketGetIpHeaderIncludedResponse {
1346        type Borrowed<'a> = &'a Self;
1347        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1348            value
1349        }
1350    }
1351
1352    unsafe impl fidl::encoding::TypeMarker for SocketGetIpHeaderIncludedResponse {
1353        type Owned = Self;
1354
1355        #[inline(always)]
1356        fn inline_align(_context: fidl::encoding::Context) -> usize {
1357            1
1358        }
1359
1360        #[inline(always)]
1361        fn inline_size(_context: fidl::encoding::Context) -> usize {
1362            1
1363        }
1364    }
1365
1366    unsafe impl<D: fidl::encoding::ResourceDialect>
1367        fidl::encoding::Encode<SocketGetIpHeaderIncludedResponse, D>
1368        for &SocketGetIpHeaderIncludedResponse
1369    {
1370        #[inline]
1371        unsafe fn encode(
1372            self,
1373            encoder: &mut fidl::encoding::Encoder<'_, D>,
1374            offset: usize,
1375            _depth: fidl::encoding::Depth,
1376        ) -> fidl::Result<()> {
1377            encoder.debug_check_bounds::<SocketGetIpHeaderIncludedResponse>(offset);
1378            // Delegate to tuple encoding.
1379            fidl::encoding::Encode::<SocketGetIpHeaderIncludedResponse, D>::encode(
1380                (<bool as fidl::encoding::ValueTypeMarker>::borrow(&self.value),),
1381                encoder,
1382                offset,
1383                _depth,
1384            )
1385        }
1386    }
1387    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<bool, D>>
1388        fidl::encoding::Encode<SocketGetIpHeaderIncludedResponse, D> for (T0,)
1389    {
1390        #[inline]
1391        unsafe fn encode(
1392            self,
1393            encoder: &mut fidl::encoding::Encoder<'_, D>,
1394            offset: usize,
1395            depth: fidl::encoding::Depth,
1396        ) -> fidl::Result<()> {
1397            encoder.debug_check_bounds::<SocketGetIpHeaderIncludedResponse>(offset);
1398            // Zero out padding regions. There's no need to apply masks
1399            // because the unmasked parts will be overwritten by fields.
1400            // Write the fields.
1401            self.0.encode(encoder, offset + 0, depth)?;
1402            Ok(())
1403        }
1404    }
1405
1406    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1407        for SocketGetIpHeaderIncludedResponse
1408    {
1409        #[inline(always)]
1410        fn new_empty() -> Self {
1411            Self { value: fidl::new_empty!(bool, D) }
1412        }
1413
1414        #[inline]
1415        unsafe fn decode(
1416            &mut self,
1417            decoder: &mut fidl::encoding::Decoder<'_, D>,
1418            offset: usize,
1419            _depth: fidl::encoding::Depth,
1420        ) -> fidl::Result<()> {
1421            decoder.debug_check_bounds::<Self>(offset);
1422            // Verify that padding bytes are zero.
1423            fidl::decode!(bool, D, &mut self.value, decoder, offset + 0, _depth)?;
1424            Ok(())
1425        }
1426    }
1427
1428    impl fidl::encoding::ValueTypeMarker for SocketGetIpv6ChecksumResponse {
1429        type Borrowed<'a> = &'a Self;
1430        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1431            value
1432        }
1433    }
1434
1435    unsafe impl fidl::encoding::TypeMarker for SocketGetIpv6ChecksumResponse {
1436        type Owned = Self;
1437
1438        #[inline(always)]
1439        fn inline_align(_context: fidl::encoding::Context) -> usize {
1440            8
1441        }
1442
1443        #[inline(always)]
1444        fn inline_size(_context: fidl::encoding::Context) -> usize {
1445            16
1446        }
1447    }
1448
1449    unsafe impl<D: fidl::encoding::ResourceDialect>
1450        fidl::encoding::Encode<SocketGetIpv6ChecksumResponse, D>
1451        for &SocketGetIpv6ChecksumResponse
1452    {
1453        #[inline]
1454        unsafe fn encode(
1455            self,
1456            encoder: &mut fidl::encoding::Encoder<'_, D>,
1457            offset: usize,
1458            _depth: fidl::encoding::Depth,
1459        ) -> fidl::Result<()> {
1460            encoder.debug_check_bounds::<SocketGetIpv6ChecksumResponse>(offset);
1461            // Delegate to tuple encoding.
1462            fidl::encoding::Encode::<SocketGetIpv6ChecksumResponse, D>::encode(
1463                (<Ipv6ChecksumConfiguration as fidl::encoding::ValueTypeMarker>::borrow(
1464                    &self.config,
1465                ),),
1466                encoder,
1467                offset,
1468                _depth,
1469            )
1470        }
1471    }
1472    unsafe impl<
1473            D: fidl::encoding::ResourceDialect,
1474            T0: fidl::encoding::Encode<Ipv6ChecksumConfiguration, D>,
1475        > fidl::encoding::Encode<SocketGetIpv6ChecksumResponse, D> for (T0,)
1476    {
1477        #[inline]
1478        unsafe fn encode(
1479            self,
1480            encoder: &mut fidl::encoding::Encoder<'_, D>,
1481            offset: usize,
1482            depth: fidl::encoding::Depth,
1483        ) -> fidl::Result<()> {
1484            encoder.debug_check_bounds::<SocketGetIpv6ChecksumResponse>(offset);
1485            // Zero out padding regions. There's no need to apply masks
1486            // because the unmasked parts will be overwritten by fields.
1487            // Write the fields.
1488            self.0.encode(encoder, offset + 0, depth)?;
1489            Ok(())
1490        }
1491    }
1492
1493    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1494        for SocketGetIpv6ChecksumResponse
1495    {
1496        #[inline(always)]
1497        fn new_empty() -> Self {
1498            Self { config: fidl::new_empty!(Ipv6ChecksumConfiguration, D) }
1499        }
1500
1501        #[inline]
1502        unsafe fn decode(
1503            &mut self,
1504            decoder: &mut fidl::encoding::Decoder<'_, D>,
1505            offset: usize,
1506            _depth: fidl::encoding::Depth,
1507        ) -> fidl::Result<()> {
1508            decoder.debug_check_bounds::<Self>(offset);
1509            // Verify that padding bytes are zero.
1510            fidl::decode!(
1511                Ipv6ChecksumConfiguration,
1512                D,
1513                &mut self.config,
1514                decoder,
1515                offset + 0,
1516                _depth
1517            )?;
1518            Ok(())
1519        }
1520    }
1521
1522    impl fidl::encoding::ValueTypeMarker for SocketRecvMsgResponse {
1523        type Borrowed<'a> = &'a Self;
1524        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1525            value
1526        }
1527    }
1528
1529    unsafe impl fidl::encoding::TypeMarker for SocketRecvMsgResponse {
1530        type Owned = Self;
1531
1532        #[inline(always)]
1533        fn inline_align(_context: fidl::encoding::Context) -> usize {
1534            8
1535        }
1536
1537        #[inline(always)]
1538        fn inline_size(_context: fidl::encoding::Context) -> usize {
1539            56
1540        }
1541    }
1542
1543    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<SocketRecvMsgResponse, D>
1544        for &SocketRecvMsgResponse
1545    {
1546        #[inline]
1547        unsafe fn encode(
1548            self,
1549            encoder: &mut fidl::encoding::Encoder<'_, D>,
1550            offset: usize,
1551            _depth: fidl::encoding::Depth,
1552        ) -> fidl::Result<()> {
1553            encoder.debug_check_bounds::<SocketRecvMsgResponse>(offset);
1554            // Delegate to tuple encoding.
1555            fidl::encoding::Encode::<SocketRecvMsgResponse, D>::encode(
1556                (
1557                    <fidl::encoding::OptionalUnion<fidl_fuchsia_net__common::SocketAddress> as fidl::encoding::ValueTypeMarker>::borrow(&self.addr),
1558                    <fidl::encoding::UnboundedVector<u8> as fidl::encoding::ValueTypeMarker>::borrow(&self.data),
1559                    <fidl_fuchsia_posix_socket__common::NetworkSocketRecvControlData as fidl::encoding::ValueTypeMarker>::borrow(&self.control),
1560                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.truncated),
1561                ),
1562                encoder, offset, _depth
1563            )
1564        }
1565    }
1566    unsafe impl<
1567            D: fidl::encoding::ResourceDialect,
1568            T0: fidl::encoding::Encode<
1569                fidl::encoding::OptionalUnion<fidl_fuchsia_net__common::SocketAddress>,
1570                D,
1571            >,
1572            T1: fidl::encoding::Encode<fidl::encoding::UnboundedVector<u8>, D>,
1573            T2: fidl::encoding::Encode<
1574                fidl_fuchsia_posix_socket__common::NetworkSocketRecvControlData,
1575                D,
1576            >,
1577            T3: fidl::encoding::Encode<u32, D>,
1578        > fidl::encoding::Encode<SocketRecvMsgResponse, D> for (T0, T1, T2, T3)
1579    {
1580        #[inline]
1581        unsafe fn encode(
1582            self,
1583            encoder: &mut fidl::encoding::Encoder<'_, D>,
1584            offset: usize,
1585            depth: fidl::encoding::Depth,
1586        ) -> fidl::Result<()> {
1587            encoder.debug_check_bounds::<SocketRecvMsgResponse>(offset);
1588            // Zero out padding regions. There's no need to apply masks
1589            // because the unmasked parts will be overwritten by fields.
1590            unsafe {
1591                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(48);
1592                (ptr as *mut u64).write_unaligned(0);
1593            }
1594            // Write the fields.
1595            self.0.encode(encoder, offset + 0, depth)?;
1596            self.1.encode(encoder, offset + 16, depth)?;
1597            self.2.encode(encoder, offset + 32, depth)?;
1598            self.3.encode(encoder, offset + 48, depth)?;
1599            Ok(())
1600        }
1601    }
1602
1603    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SocketRecvMsgResponse {
1604        #[inline(always)]
1605        fn new_empty() -> Self {
1606            Self {
1607                addr: fidl::new_empty!(
1608                    fidl::encoding::OptionalUnion<fidl_fuchsia_net__common::SocketAddress>,
1609                    D
1610                ),
1611                data: fidl::new_empty!(fidl::encoding::UnboundedVector<u8>, D),
1612                control: fidl::new_empty!(
1613                    fidl_fuchsia_posix_socket__common::NetworkSocketRecvControlData,
1614                    D
1615                ),
1616                truncated: fidl::new_empty!(u32, D),
1617            }
1618        }
1619
1620        #[inline]
1621        unsafe fn decode(
1622            &mut self,
1623            decoder: &mut fidl::encoding::Decoder<'_, D>,
1624            offset: usize,
1625            _depth: fidl::encoding::Depth,
1626        ) -> fidl::Result<()> {
1627            decoder.debug_check_bounds::<Self>(offset);
1628            // Verify that padding bytes are zero.
1629            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(48) };
1630            let padval = unsafe { (ptr as *const u64).read_unaligned() };
1631            let mask = 0xffffffff00000000u64;
1632            let maskedval = padval & mask;
1633            if maskedval != 0 {
1634                return Err(fidl::Error::NonZeroPadding {
1635                    padding_start: offset + 48 + ((mask as u64).trailing_zeros() / 8) as usize,
1636                });
1637            }
1638            fidl::decode!(
1639                fidl::encoding::OptionalUnion<fidl_fuchsia_net__common::SocketAddress>,
1640                D,
1641                &mut self.addr,
1642                decoder,
1643                offset + 0,
1644                _depth
1645            )?;
1646            fidl::decode!(
1647                fidl::encoding::UnboundedVector<u8>,
1648                D,
1649                &mut self.data,
1650                decoder,
1651                offset + 16,
1652                _depth
1653            )?;
1654            fidl::decode!(
1655                fidl_fuchsia_posix_socket__common::NetworkSocketRecvControlData,
1656                D,
1657                &mut self.control,
1658                decoder,
1659                offset + 32,
1660                _depth
1661            )?;
1662            fidl::decode!(u32, D, &mut self.truncated, decoder, offset + 48, _depth)?;
1663            Ok(())
1664        }
1665    }
1666
1667    impl fidl::encoding::ValueTypeMarker for Ipv6ChecksumConfiguration {
1668        type Borrowed<'a> = &'a Self;
1669        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1670            value
1671        }
1672    }
1673
1674    unsafe impl fidl::encoding::TypeMarker for Ipv6ChecksumConfiguration {
1675        type Owned = Self;
1676
1677        #[inline(always)]
1678        fn inline_align(_context: fidl::encoding::Context) -> usize {
1679            8
1680        }
1681
1682        #[inline(always)]
1683        fn inline_size(_context: fidl::encoding::Context) -> usize {
1684            16
1685        }
1686    }
1687
1688    unsafe impl<D: fidl::encoding::ResourceDialect>
1689        fidl::encoding::Encode<Ipv6ChecksumConfiguration, D> for &Ipv6ChecksumConfiguration
1690    {
1691        #[inline]
1692        unsafe fn encode(
1693            self,
1694            encoder: &mut fidl::encoding::Encoder<'_, D>,
1695            offset: usize,
1696            _depth: fidl::encoding::Depth,
1697        ) -> fidl::Result<()> {
1698            encoder.debug_check_bounds::<Ipv6ChecksumConfiguration>(offset);
1699            encoder.write_num::<u64>(self.ordinal(), offset);
1700            match self {
1701                Ipv6ChecksumConfiguration::Disabled(ref val) => {
1702                    fidl::encoding::encode_in_envelope::<Empty, D>(
1703                        <Empty as fidl::encoding::ValueTypeMarker>::borrow(val),
1704                        encoder,
1705                        offset + 8,
1706                        _depth,
1707                    )
1708                }
1709                Ipv6ChecksumConfiguration::Offset(ref val) => {
1710                    fidl::encoding::encode_in_envelope::<i32, D>(
1711                        <i32 as fidl::encoding::ValueTypeMarker>::borrow(val),
1712                        encoder,
1713                        offset + 8,
1714                        _depth,
1715                    )
1716                }
1717            }
1718        }
1719    }
1720
1721    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1722        for Ipv6ChecksumConfiguration
1723    {
1724        #[inline(always)]
1725        fn new_empty() -> Self {
1726            Self::Disabled(fidl::new_empty!(Empty, D))
1727        }
1728
1729        #[inline]
1730        unsafe fn decode(
1731            &mut self,
1732            decoder: &mut fidl::encoding::Decoder<'_, D>,
1733            offset: usize,
1734            mut depth: fidl::encoding::Depth,
1735        ) -> fidl::Result<()> {
1736            decoder.debug_check_bounds::<Self>(offset);
1737            #[allow(unused_variables)]
1738            let next_out_of_line = decoder.next_out_of_line();
1739            let handles_before = decoder.remaining_handles();
1740            let (ordinal, inlined, num_bytes, num_handles) =
1741                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
1742
1743            let member_inline_size = match ordinal {
1744                1 => <Empty as fidl::encoding::TypeMarker>::inline_size(decoder.context),
1745                2 => <i32 as fidl::encoding::TypeMarker>::inline_size(decoder.context),
1746                _ => return Err(fidl::Error::UnknownUnionTag),
1747            };
1748
1749            if inlined != (member_inline_size <= 4) {
1750                return Err(fidl::Error::InvalidInlineBitInEnvelope);
1751            }
1752            let _inner_offset;
1753            if inlined {
1754                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
1755                _inner_offset = offset + 8;
1756            } else {
1757                depth.increment()?;
1758                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1759            }
1760            match ordinal {
1761                1 => {
1762                    #[allow(irrefutable_let_patterns)]
1763                    if let Ipv6ChecksumConfiguration::Disabled(_) = self {
1764                        // Do nothing, read the value into the object
1765                    } else {
1766                        // Initialize `self` to the right variant
1767                        *self = Ipv6ChecksumConfiguration::Disabled(fidl::new_empty!(Empty, D));
1768                    }
1769                    #[allow(irrefutable_let_patterns)]
1770                    if let Ipv6ChecksumConfiguration::Disabled(ref mut val) = self {
1771                        fidl::decode!(Empty, D, val, decoder, _inner_offset, depth)?;
1772                    } else {
1773                        unreachable!()
1774                    }
1775                }
1776                2 => {
1777                    #[allow(irrefutable_let_patterns)]
1778                    if let Ipv6ChecksumConfiguration::Offset(_) = self {
1779                        // Do nothing, read the value into the object
1780                    } else {
1781                        // Initialize `self` to the right variant
1782                        *self = Ipv6ChecksumConfiguration::Offset(fidl::new_empty!(i32, D));
1783                    }
1784                    #[allow(irrefutable_let_patterns)]
1785                    if let Ipv6ChecksumConfiguration::Offset(ref mut val) = self {
1786                        fidl::decode!(i32, D, val, decoder, _inner_offset, depth)?;
1787                    } else {
1788                        unreachable!()
1789                    }
1790                }
1791                ordinal => panic!("unexpected ordinal {:?}", ordinal),
1792            }
1793            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
1794                return Err(fidl::Error::InvalidNumBytesInEnvelope);
1795            }
1796            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1797                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1798            }
1799            Ok(())
1800        }
1801    }
1802
1803    impl fidl::encoding::ValueTypeMarker for ProtocolAssociation {
1804        type Borrowed<'a> = &'a Self;
1805        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1806            value
1807        }
1808    }
1809
1810    unsafe impl fidl::encoding::TypeMarker for ProtocolAssociation {
1811        type Owned = Self;
1812
1813        #[inline(always)]
1814        fn inline_align(_context: fidl::encoding::Context) -> usize {
1815            8
1816        }
1817
1818        #[inline(always)]
1819        fn inline_size(_context: fidl::encoding::Context) -> usize {
1820            16
1821        }
1822    }
1823
1824    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<ProtocolAssociation, D>
1825        for &ProtocolAssociation
1826    {
1827        #[inline]
1828        unsafe fn encode(
1829            self,
1830            encoder: &mut fidl::encoding::Encoder<'_, D>,
1831            offset: usize,
1832            _depth: fidl::encoding::Depth,
1833        ) -> fidl::Result<()> {
1834            encoder.debug_check_bounds::<ProtocolAssociation>(offset);
1835            encoder.write_num::<u64>(self.ordinal(), offset);
1836            match self {
1837                ProtocolAssociation::Unassociated(ref val) => {
1838                    fidl::encoding::encode_in_envelope::<Empty, D>(
1839                        <Empty as fidl::encoding::ValueTypeMarker>::borrow(val),
1840                        encoder,
1841                        offset + 8,
1842                        _depth,
1843                    )
1844                }
1845                ProtocolAssociation::Associated(ref val) => {
1846                    fidl::encoding::encode_in_envelope::<u8, D>(
1847                        <u8 as fidl::encoding::ValueTypeMarker>::borrow(val),
1848                        encoder,
1849                        offset + 8,
1850                        _depth,
1851                    )
1852                }
1853            }
1854        }
1855    }
1856
1857    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ProtocolAssociation {
1858        #[inline(always)]
1859        fn new_empty() -> Self {
1860            Self::Unassociated(fidl::new_empty!(Empty, D))
1861        }
1862
1863        #[inline]
1864        unsafe fn decode(
1865            &mut self,
1866            decoder: &mut fidl::encoding::Decoder<'_, D>,
1867            offset: usize,
1868            mut depth: fidl::encoding::Depth,
1869        ) -> fidl::Result<()> {
1870            decoder.debug_check_bounds::<Self>(offset);
1871            #[allow(unused_variables)]
1872            let next_out_of_line = decoder.next_out_of_line();
1873            let handles_before = decoder.remaining_handles();
1874            let (ordinal, inlined, num_bytes, num_handles) =
1875                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
1876
1877            let member_inline_size = match ordinal {
1878                1 => <Empty as fidl::encoding::TypeMarker>::inline_size(decoder.context),
1879                2 => <u8 as fidl::encoding::TypeMarker>::inline_size(decoder.context),
1880                _ => return Err(fidl::Error::UnknownUnionTag),
1881            };
1882
1883            if inlined != (member_inline_size <= 4) {
1884                return Err(fidl::Error::InvalidInlineBitInEnvelope);
1885            }
1886            let _inner_offset;
1887            if inlined {
1888                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
1889                _inner_offset = offset + 8;
1890            } else {
1891                depth.increment()?;
1892                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1893            }
1894            match ordinal {
1895                1 => {
1896                    #[allow(irrefutable_let_patterns)]
1897                    if let ProtocolAssociation::Unassociated(_) = self {
1898                        // Do nothing, read the value into the object
1899                    } else {
1900                        // Initialize `self` to the right variant
1901                        *self = ProtocolAssociation::Unassociated(fidl::new_empty!(Empty, D));
1902                    }
1903                    #[allow(irrefutable_let_patterns)]
1904                    if let ProtocolAssociation::Unassociated(ref mut val) = self {
1905                        fidl::decode!(Empty, D, val, decoder, _inner_offset, depth)?;
1906                    } else {
1907                        unreachable!()
1908                    }
1909                }
1910                2 => {
1911                    #[allow(irrefutable_let_patterns)]
1912                    if let ProtocolAssociation::Associated(_) = self {
1913                        // Do nothing, read the value into the object
1914                    } else {
1915                        // Initialize `self` to the right variant
1916                        *self = ProtocolAssociation::Associated(fidl::new_empty!(u8, D));
1917                    }
1918                    #[allow(irrefutable_let_patterns)]
1919                    if let ProtocolAssociation::Associated(ref mut val) = self {
1920                        fidl::decode!(u8, D, val, decoder, _inner_offset, depth)?;
1921                    } else {
1922                        unreachable!()
1923                    }
1924                }
1925                ordinal => panic!("unexpected ordinal {:?}", ordinal),
1926            }
1927            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
1928                return Err(fidl::Error::InvalidNumBytesInEnvelope);
1929            }
1930            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1931                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1932            }
1933            Ok(())
1934        }
1935    }
1936}