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