Skip to main content

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