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