Skip to main content

fidl_fuchsia_net_dhcpv6_common/
fidl_fuchsia_net_dhcpv6_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/// Default port a DHCPv6 client should listen to according to
12/// [RFC 8415, Section 7.2](https://tools.ietf.org/html/rfc8415#section-7.2).
13pub const DEFAULT_CLIENT_PORT: u16 = 546;
14
15/// The link-local multicast address used by a client to communicate with
16/// neighboring (i.e. on-link) DHCPv6 relay agents and servers, as per
17/// [RFC 8415, section 7.1](https://tools.ietf.org/html/rfc8415#section-7.1).
18/// All servers and relay agents are members of this multicast group.
19pub const RELAY_AGENT_AND_SERVER_LINK_LOCAL_MULTICAST_ADDRESS: &str = "ff02::1:2";
20
21/// The port a DHCPv6 server or relay agent listens to according to [RFC 8415,
22/// Section 7.2](https://tools.ietf.org/html/rfc8415#section-7.2).
23pub const RELAY_AGENT_AND_SERVER_PORT: u16 = 547;
24
25#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
26pub enum PrefixControlExitReason {
27    /// The interface identified is invalid for acquiring a prefix on.
28    InvalidInterface,
29    /// The preferred prefix length is invalid.
30    InvalidPrefixLength,
31    /// An existing [`PrefixControl`] channel has already been
32    /// established to acquire a prefix.
33    AlreadyAcquiring,
34    /// The interface to acquire the prefix on was removed. Can only
35    /// be returned if a specific interface ID was named when
36    /// initializing the protocol.
37    InterfaceRemoved,
38    /// More than one concurrent call to a watch method was made.
39    DoubleWatch,
40    /// Acquiring prefixes is not supported.
41    NotSupported,
42    /// Prefix acquisition was stopped by client request.
43    Stopped,
44    #[doc(hidden)]
45    __SourceBreaking { unknown_ordinal: u32 },
46}
47
48/// Pattern that matches an unknown `PrefixControlExitReason` member.
49#[macro_export]
50macro_rules! PrefixControlExitReasonUnknown {
51    () => {
52        _
53    };
54}
55
56impl PrefixControlExitReason {
57    #[inline]
58    pub fn from_primitive(prim: u32) -> Option<Self> {
59        match prim {
60            1 => Some(Self::InvalidInterface),
61            2 => Some(Self::InvalidPrefixLength),
62            3 => Some(Self::AlreadyAcquiring),
63            4 => Some(Self::InterfaceRemoved),
64            5 => Some(Self::DoubleWatch),
65            6 => Some(Self::NotSupported),
66            7 => Some(Self::Stopped),
67            _ => None,
68        }
69    }
70
71    #[inline]
72    pub fn from_primitive_allow_unknown(prim: u32) -> Self {
73        match prim {
74            1 => Self::InvalidInterface,
75            2 => Self::InvalidPrefixLength,
76            3 => Self::AlreadyAcquiring,
77            4 => Self::InterfaceRemoved,
78            5 => Self::DoubleWatch,
79            6 => Self::NotSupported,
80            7 => Self::Stopped,
81            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
82        }
83    }
84
85    #[inline]
86    pub fn unknown() -> Self {
87        Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
88    }
89
90    #[inline]
91    pub const fn into_primitive(self) -> u32 {
92        match self {
93            Self::InvalidInterface => 1,
94            Self::InvalidPrefixLength => 2,
95            Self::AlreadyAcquiring => 3,
96            Self::InterfaceRemoved => 4,
97            Self::DoubleWatch => 5,
98            Self::NotSupported => 6,
99            Self::Stopped => 7,
100            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
101        }
102    }
103
104    #[inline]
105    pub fn is_unknown(&self) -> bool {
106        match self {
107            Self::__SourceBreaking { unknown_ordinal: _ } => true,
108            _ => false,
109        }
110    }
111}
112
113#[derive(Clone, Debug, PartialEq)]
114pub struct ClientWatchPrefixesResponse {
115    /// Prefixes must be unique on [`Prefix.prefix`].
116    ///
117    /// Prefixes with a `Prefix.prefix` value that did not appear in
118    /// a previous value returned via this method are new; conversely
119    /// prefixes previously present may have been removed, and usage
120    /// should stop immediately. The same prefix may appear with updated
121    /// lifetime values.
122    ///
123    /// Note that any prefix's valid lifetime expiring will cause the
124    /// method to return with said prefix removed; but preferred lifetime
125    /// elapsing does not cause this method to return.
126    pub prefixes: Vec<Prefix>,
127}
128
129impl fidl::Persistable for ClientWatchPrefixesResponse {}
130
131#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
132pub struct Empty;
133
134impl fidl::Persistable for Empty {}
135
136#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
137#[repr(C)]
138pub struct Lifetimes {
139    /// The time after which the prefix will no longer be valid.
140    ///
141    /// Its value must be greater than 0. A value of
142    /// `ZX_TIME_INFINITE` indicates that the prefix will always
143    /// be valid. If the value indicates a time in the past,
144    /// the prefix is invalid and should not be used.
145    ///
146    /// As a `zx.Time`, the value has
147    /// [monotonic clock semantics][monotonic], which implies
148    /// that it has no meaning outside of the host on which it
149    /// was generated and no meaning across host restarts.
150    ///
151    /// [monotonic]: https://fuchsia.dev/fuchsia-src/concepts/time/monotonic
152    pub valid_until: i64,
153    /// The time after which the prefix will no longer be preferred.
154    ///
155    /// Its value must be greater than 0. A value of
156    /// `ZX_TIME_INFINITE` indicates that the prefix will always
157    /// be preferred. If the value indicates a time in the past,
158    /// the prefix should be considered deprecated. The value must not
159    /// refer to a time after [`valid_until`].
160    ///
161    /// As a `zx.Time`, the value has
162    /// [monotonic clock semantics][monotonic],
163    /// which implies that it has no meaning outside of the host on
164    /// which it was generated and no meaning across host restarts.
165    ///
166    /// [monotonic]: https://fuchsia.dev/fuchsia-src/concepts/time/monotonic
167    pub preferred_until: i64,
168}
169
170impl fidl::Persistable for Lifetimes {}
171
172#[derive(Clone, Debug, PartialEq)]
173pub struct LinkLayerAddressPlusTime {
174    /// Timestamp when the DUID is generated. According to
175    /// [RFC 8415, section 11.2]:
176    ///
177    ///   The time value is the time that the DUID is generated,
178    ///   represented in seconds since midnight (UTC), January 1,
179    ///   2000, modulo 2^32.
180    ///
181    /// [RFC 8415, section 11.2]: https://datatracker.ietf.org/doc/html/rfc8415#section-11.2
182    pub time: u32,
183    /// The link layer address.
184    pub link_layer_address: LinkLayerAddress,
185}
186
187impl fidl::Persistable for LinkLayerAddressPlusTime {}
188
189/// An IPv6 prefix and its lifetimes.
190#[derive(Clone, Debug, PartialEq)]
191pub struct Prefix {
192    /// The IPv6 prefix.
193    ///
194    /// The host bits of the address must be all zeroes.
195    pub prefix: fidl_fuchsia_net_common::Ipv6AddressWithPrefix,
196    /// The prefix lifetimes.
197    pub lifetimes: Lifetimes,
198}
199
200impl fidl::Persistable for Prefix {}
201
202#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
203pub struct PrefixControlOnExitRequest {
204    pub reason: PrefixControlExitReason,
205}
206
207impl fidl::Persistable for PrefixControlOnExitRequest {}
208
209#[derive(Clone, Debug, PartialEq)]
210pub struct PrefixControlWatchPrefixResponse {
211    pub event: PrefixEvent,
212}
213
214impl fidl::Persistable for PrefixControlWatchPrefixResponse {}
215
216#[derive(Clone, Debug, Default, PartialEq)]
217pub struct AcquirePrefixConfig {
218    /// Optional. If specified, PD will only be performed on the
219    /// interface identified. If absent, the interface(s) to perform PD
220    /// on will be chosen by the server.
221    pub interface_id: Option<u64>,
222    /// The preferred prefix length.
223    ///
224    /// Note that the server will make a best effort to return a prefix
225    /// of the preferred length, but may return a shorter one.
226    ///
227    /// Optional; if absent, interpreted as no preference for prefix
228    /// length.
229    ///
230    /// Must be in the range [0, 128].
231    pub preferred_prefix_len: Option<u8>,
232    #[doc(hidden)]
233    pub __source_breaking: fidl::marker::SourceBreaking,
234}
235
236impl fidl::Persistable for AcquirePrefixConfig {}
237
238#[derive(Clone, Debug, Default, PartialEq)]
239pub struct AddressConfig {
240    /// Number of addresses.
241    ///
242    /// If the value is 0, the client will not negotiate
243    /// non-temporary addresses, i.e. its messages to the
244    /// server will not contain the IA_NA option.
245    ///
246    /// Required.
247    pub address_count: Option<u8>,
248    /// Preferred addresses.
249    ///
250    /// The addresses are used as hints by DHCPv6 servers,
251    /// but may be ignored.
252    ///
253    /// The size of `preferred_addresses` must be less than
254    /// or equal to `address_count`, otherwise the
255    /// `AddressConfig` is invalid.
256    ///
257    /// Optional field. If not set, or if
258    /// `preferred_addresses` is empty, no address hints are
259    /// provided.
260    pub preferred_addresses: Option<Vec<fidl_fuchsia_net_common::Ipv6Address>>,
261    #[doc(hidden)]
262    pub __source_breaking: fidl::marker::SourceBreaking,
263}
264
265impl fidl::Persistable for AddressConfig {}
266
267#[derive(Clone, Debug, Default, PartialEq)]
268pub struct ClientConfig {
269    /// Configuration for requesting configuration information.
270    ///
271    /// If not set, interpreted as empty (no configuration
272    /// information will be requested).
273    pub information_config: Option<InformationConfig>,
274    /// Non-temporary address configuration.
275    ///
276    /// Configures the client to negotiate non-temporary
277    /// addresses (IA_NA), as defined in
278    /// [RFC 8415, section 6.2](https://tools.ietf.org/html/rfc8415#section-6.2).
279    ///
280    /// If not set, interpreted as a configuration with an address count
281    /// of 0 (non-temporary addresses will not be negotiated). If invalid,
282    /// client creation will fail and the pipelined channel will be closed.
283    pub non_temporary_address_config: Option<AddressConfig>,
284    /// Prefix delegation configuration.
285    ///
286    /// Configures the client to negotiate a delegated prefix
287    /// (IA_PD), as defined in [RFC 8415, section 6.3][RFC 8415 6.3].
288    ///
289    /// Optional. If not set, delegated prefixes will not be
290    /// requested. If invalid, client creation will fail and
291    /// the pipelined channel will be closed.
292    ///
293    /// [RFC 8415 6.3]: https://datatracker.ietf.org/doc/html/rfc8415#section-6.3
294    pub prefix_delegation_config: Option<PrefixDelegationConfig>,
295    #[doc(hidden)]
296    pub __source_breaking: fidl::marker::SourceBreaking,
297}
298
299impl fidl::Persistable for ClientConfig {}
300
301#[derive(Clone, Debug, Default, PartialEq)]
302pub struct InformationConfig {
303    /// Request a list of available DNS servers
304    /// [RFC 3646](https://tools.ietf.org/html/rfc3646).
305    ///
306    /// If not set, interpreted as false;
307    pub dns_servers: Option<bool>,
308    #[doc(hidden)]
309    pub __source_breaking: fidl::marker::SourceBreaking,
310}
311
312impl fidl::Persistable for InformationConfig {}
313
314/// Parameters to start a new DHCPv6 client with.
315#[derive(Clone, Debug, Default, PartialEq)]
316pub struct NewClientParams {
317    /// The ID of the interface the client will run on.
318    ///
319    /// Required.
320    pub interface_id: Option<u64>,
321    /// The socket address to use when communicating with servers.
322    ///
323    /// DHCPv6 servers listen for link-local multicasts, so not using a
324    /// link-local address here may cause interoperability issues.
325    ///
326    /// Client creation will fail with `INVALID_ARGS` if:
327    ///
328    /// * a multicast address is provided;
329    /// * or a link-local address is provided, and its zone index
330    ///     doesn't match `interface_id` (Fuchsia has a 1:1 mapping from
331    ///     zone index to interface ID).
332    ///
333    /// Client creation will fail if it fails to bind a socket to this
334    /// address.
335    ///
336    /// Required.
337    pub address: Option<fidl_fuchsia_net_common::Ipv6SocketAddress>,
338    /// Configuration for starting the DHCPv6 client.
339    ///
340    /// If the configuration requests both addresses and other
341    /// configuration parameters, all information is requested in the
342    /// same message exchange, running in stateful mode. If only
343    /// configuration parameters are requested (no addresses or prefixes), the
344    /// client runs in stateless mode, as described in
345    /// [RFC 8415, Section 6.1](https://tools.ietf.org/html/rfc8415#section-6.1).
346    ///
347    /// Client creation will fail if `config` is not requesting any
348    /// information (all fields are empty), or if it contains invalid
349    /// fields.
350    ///
351    /// Required.
352    pub config: Option<ClientConfig>,
353    /// DHCP Unique Identifier (DUID) configuration.
354    ///
355    /// The DUID is used by the client to identify itself to servers as
356    /// defined in [RFC 8415, section 11]. The field must be present if and
357    /// only if the client is started in stateful mode, otherwise client
358    /// creation will fail and the pipelined channel will be closed.
359    ///
360    /// [RFC 8415, section 11]: https://datatracker.ietf.org/doc/html/rfc8415#section-11
361    pub duid: Option<Duid>,
362    #[doc(hidden)]
363    pub __source_breaking: fidl::marker::SourceBreaking,
364}
365
366impl fidl::Persistable for NewClientParams {}
367
368#[derive(Clone, Debug)]
369pub enum Duid {
370    /// Configure DUID based on link-layer address plus time (DUID-LLT),
371    /// as defined in [RFC 8415, section 11.2].
372    ///
373    /// [RFC 8415, section 11.2]: https://datatracker.ietf.org/doc/html/rfc8415#section-11.2
374    LinkLayerAddressPlusTime(LinkLayerAddressPlusTime),
375    /// Configure DUID based on link-layer address (DUID-LL), as defined in
376    /// [RFC 8415, section 11.4].
377    ///
378    /// [RFC 8415, section 11.4]: https://datatracker.ietf.org/doc/html/rfc8415#section-11.4
379    LinkLayerAddress(LinkLayerAddress),
380    /// Configure DUID with a UUID, as defined in [RFC 8415, section 11.5].
381    ///
382    /// [RFC 8415, section 11.5]: https://datatracker.ietf.org/doc/html/rfc8415#section-11.5
383    Uuid([u8; 16]),
384    #[doc(hidden)]
385    __SourceBreaking { unknown_ordinal: u64 },
386}
387
388/// Pattern that matches an unknown `Duid` member.
389#[macro_export]
390macro_rules! DuidUnknown {
391    () => {
392        _
393    };
394}
395
396// Custom PartialEq so that unknown variants are not equal to themselves.
397impl PartialEq for Duid {
398    fn eq(&self, other: &Self) -> bool {
399        match (self, other) {
400            (Self::LinkLayerAddressPlusTime(x), Self::LinkLayerAddressPlusTime(y)) => *x == *y,
401            (Self::LinkLayerAddress(x), Self::LinkLayerAddress(y)) => *x == *y,
402            (Self::Uuid(x), Self::Uuid(y)) => *x == *y,
403            _ => false,
404        }
405    }
406}
407
408impl Duid {
409    #[inline]
410    pub fn ordinal(&self) -> u64 {
411        match *self {
412            Self::LinkLayerAddressPlusTime(_) => 1,
413            Self::LinkLayerAddress(_) => 2,
414            Self::Uuid(_) => 3,
415            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
416        }
417    }
418
419    #[inline]
420    pub fn unknown_variant_for_testing() -> Self {
421        Self::__SourceBreaking { unknown_ordinal: 0 }
422    }
423
424    #[inline]
425    pub fn is_unknown(&self) -> bool {
426        match self {
427            Self::__SourceBreaking { .. } => true,
428            _ => false,
429        }
430    }
431}
432
433impl fidl::Persistable for Duid {}
434
435/// Link layer address used to generate a DUID as defined in
436/// [RFC 8415, Section 11].
437///
438/// [RFC 8415, Section 11]: https://datatracker.ietf.org/doc/html/rfc8415#section-11
439#[derive(Clone, Debug)]
440pub enum LinkLayerAddress {
441    Ethernet(fidl_fuchsia_net_common::MacAddress),
442    #[doc(hidden)]
443    __SourceBreaking {
444        unknown_ordinal: u64,
445    },
446}
447
448/// Pattern that matches an unknown `LinkLayerAddress` member.
449#[macro_export]
450macro_rules! LinkLayerAddressUnknown {
451    () => {
452        _
453    };
454}
455
456// Custom PartialEq so that unknown variants are not equal to themselves.
457impl PartialEq for LinkLayerAddress {
458    fn eq(&self, other: &Self) -> bool {
459        match (self, other) {
460            (Self::Ethernet(x), Self::Ethernet(y)) => *x == *y,
461            _ => false,
462        }
463    }
464}
465
466impl LinkLayerAddress {
467    #[inline]
468    pub fn ordinal(&self) -> u64 {
469        match *self {
470            Self::Ethernet(_) => 1,
471            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
472        }
473    }
474
475    #[inline]
476    pub fn unknown_variant_for_testing() -> Self {
477        Self::__SourceBreaking { unknown_ordinal: 0 }
478    }
479
480    #[inline]
481    pub fn is_unknown(&self) -> bool {
482        match self {
483            Self::__SourceBreaking { .. } => true,
484            _ => false,
485        }
486    }
487}
488
489impl fidl::Persistable for LinkLayerAddress {}
490
491#[derive(Clone, Debug, PartialEq)]
492pub enum PrefixDelegationConfig {
493    /// Request a prefix of any length.
494    Empty(Empty),
495    /// Request a prefix of a specific length.
496    ///
497    /// Must be in the range [1, 128]; otherwise client creation will fail.
498    PrefixLength(u8),
499    /// Request a specific prefix.
500    ///
501    /// The prefix length must be in the range [1, 128], and the host bits of
502    /// the address must be all zeroes; otherwise client creation will fail.
503    Prefix(fidl_fuchsia_net_common::Ipv6AddressWithPrefix),
504}
505
506impl PrefixDelegationConfig {
507    #[inline]
508    pub fn ordinal(&self) -> u64 {
509        match *self {
510            Self::Empty(_) => 1,
511            Self::PrefixLength(_) => 2,
512            Self::Prefix(_) => 3,
513        }
514    }
515}
516
517impl fidl::Persistable for PrefixDelegationConfig {}
518
519#[derive(Clone, Debug, PartialEq)]
520pub enum PrefixEvent {
521    /// No prefix is assigned.
522    ///
523    /// If a previously-assigned prefix was received, usage must stop
524    /// immediately.
525    Unassigned(Empty),
526    /// The assigned prefix and lifetimes.
527    ///
528    /// May receive consecutive updates with an assigned prefix -
529    /// callers must use the latest prefix subnet and drop the
530    /// older prefix if the prefix is different. If the prefix is
531    /// the same, the lifetimes must be updated to what is held in
532    /// the latest update.
533    Assigned(Prefix),
534}
535
536impl PrefixEvent {
537    #[inline]
538    pub fn ordinal(&self) -> u64 {
539        match *self {
540            Self::Unassigned(_) => 1,
541            Self::Assigned(_) => 2,
542        }
543    }
544}
545
546impl fidl::Persistable for PrefixEvent {}
547
548pub mod client_ordinals {
549    pub const WATCH_SERVERS: u64 = 0x5748907e7f11b632;
550    pub const WATCH_ADDRESS: u64 = 0x942e6f66f63721c;
551    pub const WATCH_PREFIXES: u64 = 0x3b7908cc71ae2a5e;
552    pub const SHUTDOWN: u64 = 0x6da95f1bcd43fa11;
553}
554
555pub mod client_provider_ordinals {
556    pub const NEW_CLIENT: u64 = 0x269268c97d062419;
557}
558
559pub mod prefix_control_ordinals {
560    pub const WATCH_PREFIX: u64 = 0x1f5c40d4d1e84d84;
561    pub const STOP: u64 = 0x13acc61ec17d8dd6;
562    pub const ON_EXIT: u64 = 0x353b8c435cbe08f9;
563}
564
565pub mod prefix_provider_ordinals {
566    pub const ACQUIRE_PREFIX: u64 = 0x24eff9a5ce404cf8;
567}
568
569mod internal {
570    use super::*;
571    unsafe impl fidl::encoding::TypeMarker for PrefixControlExitReason {
572        type Owned = Self;
573
574        #[inline(always)]
575        fn inline_align(_context: fidl::encoding::Context) -> usize {
576            std::mem::align_of::<u32>()
577        }
578
579        #[inline(always)]
580        fn inline_size(_context: fidl::encoding::Context) -> usize {
581            std::mem::size_of::<u32>()
582        }
583
584        #[inline(always)]
585        fn encode_is_copy() -> bool {
586            false
587        }
588
589        #[inline(always)]
590        fn decode_is_copy() -> bool {
591            false
592        }
593    }
594
595    impl fidl::encoding::ValueTypeMarker for PrefixControlExitReason {
596        type Borrowed<'a> = Self;
597        #[inline(always)]
598        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
599            *value
600        }
601    }
602
603    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
604        for PrefixControlExitReason
605    {
606        #[inline]
607        unsafe fn encode(
608            self,
609            encoder: &mut fidl::encoding::Encoder<'_, D>,
610            offset: usize,
611            _depth: fidl::encoding::Depth,
612        ) -> fidl::Result<()> {
613            encoder.debug_check_bounds::<Self>(offset);
614            encoder.write_num(self.into_primitive(), offset);
615            Ok(())
616        }
617    }
618
619    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
620        for PrefixControlExitReason
621    {
622        #[inline(always)]
623        fn new_empty() -> Self {
624            Self::unknown()
625        }
626
627        #[inline]
628        unsafe fn decode(
629            &mut self,
630            decoder: &mut fidl::encoding::Decoder<'_, D>,
631            offset: usize,
632            _depth: fidl::encoding::Depth,
633        ) -> fidl::Result<()> {
634            decoder.debug_check_bounds::<Self>(offset);
635            let prim = decoder.read_num::<u32>(offset);
636
637            *self = Self::from_primitive_allow_unknown(prim);
638            Ok(())
639        }
640    }
641
642    impl fidl::encoding::ValueTypeMarker for ClientWatchPrefixesResponse {
643        type Borrowed<'a> = &'a Self;
644        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
645            value
646        }
647    }
648
649    unsafe impl fidl::encoding::TypeMarker for ClientWatchPrefixesResponse {
650        type Owned = Self;
651
652        #[inline(always)]
653        fn inline_align(_context: fidl::encoding::Context) -> usize {
654            8
655        }
656
657        #[inline(always)]
658        fn inline_size(_context: fidl::encoding::Context) -> usize {
659            16
660        }
661    }
662
663    unsafe impl<D: fidl::encoding::ResourceDialect>
664        fidl::encoding::Encode<ClientWatchPrefixesResponse, D> for &ClientWatchPrefixesResponse
665    {
666        #[inline]
667        unsafe fn encode(
668            self,
669            encoder: &mut fidl::encoding::Encoder<'_, D>,
670            offset: usize,
671            _depth: fidl::encoding::Depth,
672        ) -> fidl::Result<()> {
673            encoder.debug_check_bounds::<ClientWatchPrefixesResponse>(offset);
674            // Delegate to tuple encoding.
675            fidl::encoding::Encode::<ClientWatchPrefixesResponse, D>::encode(
676                (
677                    <fidl::encoding::UnboundedVector<Prefix> as fidl::encoding::ValueTypeMarker>::borrow(&self.prefixes),
678                ),
679                encoder, offset, _depth
680            )
681        }
682    }
683    unsafe impl<
684        D: fidl::encoding::ResourceDialect,
685        T0: fidl::encoding::Encode<fidl::encoding::UnboundedVector<Prefix>, D>,
686    > fidl::encoding::Encode<ClientWatchPrefixesResponse, D> for (T0,)
687    {
688        #[inline]
689        unsafe fn encode(
690            self,
691            encoder: &mut fidl::encoding::Encoder<'_, D>,
692            offset: usize,
693            depth: fidl::encoding::Depth,
694        ) -> fidl::Result<()> {
695            encoder.debug_check_bounds::<ClientWatchPrefixesResponse>(offset);
696            // Zero out padding regions. There's no need to apply masks
697            // because the unmasked parts will be overwritten by fields.
698            // Write the fields.
699            self.0.encode(encoder, offset + 0, depth)?;
700            Ok(())
701        }
702    }
703
704    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
705        for ClientWatchPrefixesResponse
706    {
707        #[inline(always)]
708        fn new_empty() -> Self {
709            Self { prefixes: fidl::new_empty!(fidl::encoding::UnboundedVector<Prefix>, D) }
710        }
711
712        #[inline]
713        unsafe fn decode(
714            &mut self,
715            decoder: &mut fidl::encoding::Decoder<'_, D>,
716            offset: usize,
717            _depth: fidl::encoding::Depth,
718        ) -> fidl::Result<()> {
719            decoder.debug_check_bounds::<Self>(offset);
720            // Verify that padding bytes are zero.
721            fidl::decode!(
722                fidl::encoding::UnboundedVector<Prefix>,
723                D,
724                &mut self.prefixes,
725                decoder,
726                offset + 0,
727                _depth
728            )?;
729            Ok(())
730        }
731    }
732
733    impl fidl::encoding::ValueTypeMarker for Empty {
734        type Borrowed<'a> = &'a Self;
735        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
736            value
737        }
738    }
739
740    unsafe impl fidl::encoding::TypeMarker for Empty {
741        type Owned = Self;
742
743        #[inline(always)]
744        fn inline_align(_context: fidl::encoding::Context) -> usize {
745            1
746        }
747
748        #[inline(always)]
749        fn inline_size(_context: fidl::encoding::Context) -> usize {
750            1
751        }
752    }
753
754    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Empty, D> for &Empty {
755        #[inline]
756        unsafe fn encode(
757            self,
758            encoder: &mut fidl::encoding::Encoder<'_, D>,
759            offset: usize,
760            _depth: fidl::encoding::Depth,
761        ) -> fidl::Result<()> {
762            encoder.debug_check_bounds::<Empty>(offset);
763            encoder.write_num(0u8, offset);
764            Ok(())
765        }
766    }
767
768    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Empty {
769        #[inline(always)]
770        fn new_empty() -> Self {
771            Self
772        }
773
774        #[inline]
775        unsafe fn decode(
776            &mut self,
777            decoder: &mut fidl::encoding::Decoder<'_, D>,
778            offset: usize,
779            _depth: fidl::encoding::Depth,
780        ) -> fidl::Result<()> {
781            decoder.debug_check_bounds::<Self>(offset);
782            match decoder.read_num::<u8>(offset) {
783                0 => Ok(()),
784                _ => Err(fidl::Error::Invalid),
785            }
786        }
787    }
788
789    impl fidl::encoding::ValueTypeMarker for Lifetimes {
790        type Borrowed<'a> = &'a Self;
791        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
792            value
793        }
794    }
795
796    unsafe impl fidl::encoding::TypeMarker for Lifetimes {
797        type Owned = Self;
798
799        #[inline(always)]
800        fn inline_align(_context: fidl::encoding::Context) -> usize {
801            8
802        }
803
804        #[inline(always)]
805        fn inline_size(_context: fidl::encoding::Context) -> usize {
806            16
807        }
808        #[inline(always)]
809        fn encode_is_copy() -> bool {
810            true
811        }
812
813        #[inline(always)]
814        fn decode_is_copy() -> bool {
815            true
816        }
817    }
818
819    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Lifetimes, D>
820        for &Lifetimes
821    {
822        #[inline]
823        unsafe fn encode(
824            self,
825            encoder: &mut fidl::encoding::Encoder<'_, D>,
826            offset: usize,
827            _depth: fidl::encoding::Depth,
828        ) -> fidl::Result<()> {
829            encoder.debug_check_bounds::<Lifetimes>(offset);
830            unsafe {
831                // Copy the object into the buffer.
832                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
833                (buf_ptr as *mut Lifetimes).write_unaligned((self as *const Lifetimes).read());
834                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
835                // done second because the memcpy will write garbage to these bytes.
836            }
837            Ok(())
838        }
839    }
840    unsafe impl<
841        D: fidl::encoding::ResourceDialect,
842        T0: fidl::encoding::Encode<i64, D>,
843        T1: fidl::encoding::Encode<i64, D>,
844    > fidl::encoding::Encode<Lifetimes, D> for (T0, T1)
845    {
846        #[inline]
847        unsafe fn encode(
848            self,
849            encoder: &mut fidl::encoding::Encoder<'_, D>,
850            offset: usize,
851            depth: fidl::encoding::Depth,
852        ) -> fidl::Result<()> {
853            encoder.debug_check_bounds::<Lifetimes>(offset);
854            // Zero out padding regions. There's no need to apply masks
855            // because the unmasked parts will be overwritten by fields.
856            // Write the fields.
857            self.0.encode(encoder, offset + 0, depth)?;
858            self.1.encode(encoder, offset + 8, depth)?;
859            Ok(())
860        }
861    }
862
863    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Lifetimes {
864        #[inline(always)]
865        fn new_empty() -> Self {
866            Self {
867                valid_until: fidl::new_empty!(i64, D),
868                preferred_until: fidl::new_empty!(i64, D),
869            }
870        }
871
872        #[inline]
873        unsafe fn decode(
874            &mut self,
875            decoder: &mut fidl::encoding::Decoder<'_, D>,
876            offset: usize,
877            _depth: fidl::encoding::Depth,
878        ) -> fidl::Result<()> {
879            decoder.debug_check_bounds::<Self>(offset);
880            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
881            // Verify that padding bytes are zero.
882            // Copy from the buffer into the object.
883            unsafe {
884                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 16);
885            }
886            Ok(())
887        }
888    }
889
890    impl fidl::encoding::ValueTypeMarker for LinkLayerAddressPlusTime {
891        type Borrowed<'a> = &'a Self;
892        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
893            value
894        }
895    }
896
897    unsafe impl fidl::encoding::TypeMarker for LinkLayerAddressPlusTime {
898        type Owned = Self;
899
900        #[inline(always)]
901        fn inline_align(_context: fidl::encoding::Context) -> usize {
902            8
903        }
904
905        #[inline(always)]
906        fn inline_size(_context: fidl::encoding::Context) -> usize {
907            24
908        }
909    }
910
911    unsafe impl<D: fidl::encoding::ResourceDialect>
912        fidl::encoding::Encode<LinkLayerAddressPlusTime, D> for &LinkLayerAddressPlusTime
913    {
914        #[inline]
915        unsafe fn encode(
916            self,
917            encoder: &mut fidl::encoding::Encoder<'_, D>,
918            offset: usize,
919            _depth: fidl::encoding::Depth,
920        ) -> fidl::Result<()> {
921            encoder.debug_check_bounds::<LinkLayerAddressPlusTime>(offset);
922            // Delegate to tuple encoding.
923            fidl::encoding::Encode::<LinkLayerAddressPlusTime, D>::encode(
924                (
925                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.time),
926                    <LinkLayerAddress as fidl::encoding::ValueTypeMarker>::borrow(
927                        &self.link_layer_address,
928                    ),
929                ),
930                encoder,
931                offset,
932                _depth,
933            )
934        }
935    }
936    unsafe impl<
937        D: fidl::encoding::ResourceDialect,
938        T0: fidl::encoding::Encode<u32, D>,
939        T1: fidl::encoding::Encode<LinkLayerAddress, D>,
940    > fidl::encoding::Encode<LinkLayerAddressPlusTime, D> for (T0, T1)
941    {
942        #[inline]
943        unsafe fn encode(
944            self,
945            encoder: &mut fidl::encoding::Encoder<'_, D>,
946            offset: usize,
947            depth: fidl::encoding::Depth,
948        ) -> fidl::Result<()> {
949            encoder.debug_check_bounds::<LinkLayerAddressPlusTime>(offset);
950            // Zero out padding regions. There's no need to apply masks
951            // because the unmasked parts will be overwritten by fields.
952            unsafe {
953                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
954                (ptr as *mut u64).write_unaligned(0);
955            }
956            // Write the fields.
957            self.0.encode(encoder, offset + 0, depth)?;
958            self.1.encode(encoder, offset + 8, depth)?;
959            Ok(())
960        }
961    }
962
963    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
964        for LinkLayerAddressPlusTime
965    {
966        #[inline(always)]
967        fn new_empty() -> Self {
968            Self {
969                time: fidl::new_empty!(u32, D),
970                link_layer_address: fidl::new_empty!(LinkLayerAddress, D),
971            }
972        }
973
974        #[inline]
975        unsafe fn decode(
976            &mut self,
977            decoder: &mut fidl::encoding::Decoder<'_, D>,
978            offset: usize,
979            _depth: fidl::encoding::Depth,
980        ) -> fidl::Result<()> {
981            decoder.debug_check_bounds::<Self>(offset);
982            // Verify that padding bytes are zero.
983            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
984            let padval = unsafe { (ptr as *const u64).read_unaligned() };
985            let mask = 0xffffffff00000000u64;
986            let maskedval = padval & mask;
987            if maskedval != 0 {
988                return Err(fidl::Error::NonZeroPadding {
989                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
990                });
991            }
992            fidl::decode!(u32, D, &mut self.time, decoder, offset + 0, _depth)?;
993            fidl::decode!(
994                LinkLayerAddress,
995                D,
996                &mut self.link_layer_address,
997                decoder,
998                offset + 8,
999                _depth
1000            )?;
1001            Ok(())
1002        }
1003    }
1004
1005    impl fidl::encoding::ValueTypeMarker for Prefix {
1006        type Borrowed<'a> = &'a Self;
1007        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1008            value
1009        }
1010    }
1011
1012    unsafe impl fidl::encoding::TypeMarker for Prefix {
1013        type Owned = Self;
1014
1015        #[inline(always)]
1016        fn inline_align(_context: fidl::encoding::Context) -> usize {
1017            8
1018        }
1019
1020        #[inline(always)]
1021        fn inline_size(_context: fidl::encoding::Context) -> usize {
1022            40
1023        }
1024    }
1025
1026    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Prefix, D> for &Prefix {
1027        #[inline]
1028        unsafe fn encode(
1029            self,
1030            encoder: &mut fidl::encoding::Encoder<'_, D>,
1031            offset: usize,
1032            _depth: fidl::encoding::Depth,
1033        ) -> fidl::Result<()> {
1034            encoder.debug_check_bounds::<Prefix>(offset);
1035            // Delegate to tuple encoding.
1036            fidl::encoding::Encode::<Prefix, D>::encode(
1037                (
1038                    <fidl_fuchsia_net_common::Ipv6AddressWithPrefix as fidl::encoding::ValueTypeMarker>::borrow(&self.prefix),
1039                    <Lifetimes as fidl::encoding::ValueTypeMarker>::borrow(&self.lifetimes),
1040                ),
1041                encoder, offset, _depth
1042            )
1043        }
1044    }
1045    unsafe impl<
1046        D: fidl::encoding::ResourceDialect,
1047        T0: fidl::encoding::Encode<fidl_fuchsia_net_common::Ipv6AddressWithPrefix, D>,
1048        T1: fidl::encoding::Encode<Lifetimes, D>,
1049    > fidl::encoding::Encode<Prefix, D> for (T0, T1)
1050    {
1051        #[inline]
1052        unsafe fn encode(
1053            self,
1054            encoder: &mut fidl::encoding::Encoder<'_, D>,
1055            offset: usize,
1056            depth: fidl::encoding::Depth,
1057        ) -> fidl::Result<()> {
1058            encoder.debug_check_bounds::<Prefix>(offset);
1059            // Zero out padding regions. There's no need to apply masks
1060            // because the unmasked parts will be overwritten by fields.
1061            unsafe {
1062                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
1063                (ptr as *mut u64).write_unaligned(0);
1064            }
1065            // Write the fields.
1066            self.0.encode(encoder, offset + 0, depth)?;
1067            self.1.encode(encoder, offset + 24, depth)?;
1068            Ok(())
1069        }
1070    }
1071
1072    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Prefix {
1073        #[inline(always)]
1074        fn new_empty() -> Self {
1075            Self {
1076                prefix: fidl::new_empty!(fidl_fuchsia_net_common::Ipv6AddressWithPrefix, D),
1077                lifetimes: fidl::new_empty!(Lifetimes, D),
1078            }
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            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
1091            let padval = unsafe { (ptr as *const u64).read_unaligned() };
1092            let mask = 0xffffffffffffff00u64;
1093            let maskedval = padval & mask;
1094            if maskedval != 0 {
1095                return Err(fidl::Error::NonZeroPadding {
1096                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
1097                });
1098            }
1099            fidl::decode!(
1100                fidl_fuchsia_net_common::Ipv6AddressWithPrefix,
1101                D,
1102                &mut self.prefix,
1103                decoder,
1104                offset + 0,
1105                _depth
1106            )?;
1107            fidl::decode!(Lifetimes, D, &mut self.lifetimes, decoder, offset + 24, _depth)?;
1108            Ok(())
1109        }
1110    }
1111
1112    impl fidl::encoding::ValueTypeMarker for PrefixControlOnExitRequest {
1113        type Borrowed<'a> = &'a Self;
1114        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1115            value
1116        }
1117    }
1118
1119    unsafe impl fidl::encoding::TypeMarker for PrefixControlOnExitRequest {
1120        type Owned = Self;
1121
1122        #[inline(always)]
1123        fn inline_align(_context: fidl::encoding::Context) -> usize {
1124            4
1125        }
1126
1127        #[inline(always)]
1128        fn inline_size(_context: fidl::encoding::Context) -> usize {
1129            4
1130        }
1131    }
1132
1133    unsafe impl<D: fidl::encoding::ResourceDialect>
1134        fidl::encoding::Encode<PrefixControlOnExitRequest, D> for &PrefixControlOnExitRequest
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::<PrefixControlOnExitRequest>(offset);
1144            // Delegate to tuple encoding.
1145            fidl::encoding::Encode::<PrefixControlOnExitRequest, D>::encode(
1146                (<PrefixControlExitReason as fidl::encoding::ValueTypeMarker>::borrow(
1147                    &self.reason,
1148                ),),
1149                encoder,
1150                offset,
1151                _depth,
1152            )
1153        }
1154    }
1155    unsafe impl<
1156        D: fidl::encoding::ResourceDialect,
1157        T0: fidl::encoding::Encode<PrefixControlExitReason, D>,
1158    > fidl::encoding::Encode<PrefixControlOnExitRequest, D> for (T0,)
1159    {
1160        #[inline]
1161        unsafe fn encode(
1162            self,
1163            encoder: &mut fidl::encoding::Encoder<'_, D>,
1164            offset: usize,
1165            depth: fidl::encoding::Depth,
1166        ) -> fidl::Result<()> {
1167            encoder.debug_check_bounds::<PrefixControlOnExitRequest>(offset);
1168            // Zero out padding regions. There's no need to apply masks
1169            // because the unmasked parts will be overwritten by fields.
1170            // Write the fields.
1171            self.0.encode(encoder, offset + 0, depth)?;
1172            Ok(())
1173        }
1174    }
1175
1176    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1177        for PrefixControlOnExitRequest
1178    {
1179        #[inline(always)]
1180        fn new_empty() -> Self {
1181            Self { reason: fidl::new_empty!(PrefixControlExitReason, D) }
1182        }
1183
1184        #[inline]
1185        unsafe fn decode(
1186            &mut self,
1187            decoder: &mut fidl::encoding::Decoder<'_, D>,
1188            offset: usize,
1189            _depth: fidl::encoding::Depth,
1190        ) -> fidl::Result<()> {
1191            decoder.debug_check_bounds::<Self>(offset);
1192            // Verify that padding bytes are zero.
1193            fidl::decode!(
1194                PrefixControlExitReason,
1195                D,
1196                &mut self.reason,
1197                decoder,
1198                offset + 0,
1199                _depth
1200            )?;
1201            Ok(())
1202        }
1203    }
1204
1205    impl fidl::encoding::ValueTypeMarker for PrefixControlWatchPrefixResponse {
1206        type Borrowed<'a> = &'a Self;
1207        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1208            value
1209        }
1210    }
1211
1212    unsafe impl fidl::encoding::TypeMarker for PrefixControlWatchPrefixResponse {
1213        type Owned = Self;
1214
1215        #[inline(always)]
1216        fn inline_align(_context: fidl::encoding::Context) -> usize {
1217            8
1218        }
1219
1220        #[inline(always)]
1221        fn inline_size(_context: fidl::encoding::Context) -> usize {
1222            16
1223        }
1224    }
1225
1226    unsafe impl<D: fidl::encoding::ResourceDialect>
1227        fidl::encoding::Encode<PrefixControlWatchPrefixResponse, D>
1228        for &PrefixControlWatchPrefixResponse
1229    {
1230        #[inline]
1231        unsafe fn encode(
1232            self,
1233            encoder: &mut fidl::encoding::Encoder<'_, D>,
1234            offset: usize,
1235            _depth: fidl::encoding::Depth,
1236        ) -> fidl::Result<()> {
1237            encoder.debug_check_bounds::<PrefixControlWatchPrefixResponse>(offset);
1238            // Delegate to tuple encoding.
1239            fidl::encoding::Encode::<PrefixControlWatchPrefixResponse, D>::encode(
1240                (<PrefixEvent as fidl::encoding::ValueTypeMarker>::borrow(&self.event),),
1241                encoder,
1242                offset,
1243                _depth,
1244            )
1245        }
1246    }
1247    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<PrefixEvent, D>>
1248        fidl::encoding::Encode<PrefixControlWatchPrefixResponse, D> for (T0,)
1249    {
1250        #[inline]
1251        unsafe fn encode(
1252            self,
1253            encoder: &mut fidl::encoding::Encoder<'_, D>,
1254            offset: usize,
1255            depth: fidl::encoding::Depth,
1256        ) -> fidl::Result<()> {
1257            encoder.debug_check_bounds::<PrefixControlWatchPrefixResponse>(offset);
1258            // Zero out padding regions. There's no need to apply masks
1259            // because the unmasked parts will be overwritten by fields.
1260            // Write the fields.
1261            self.0.encode(encoder, offset + 0, depth)?;
1262            Ok(())
1263        }
1264    }
1265
1266    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1267        for PrefixControlWatchPrefixResponse
1268    {
1269        #[inline(always)]
1270        fn new_empty() -> Self {
1271            Self { event: fidl::new_empty!(PrefixEvent, D) }
1272        }
1273
1274        #[inline]
1275        unsafe fn decode(
1276            &mut self,
1277            decoder: &mut fidl::encoding::Decoder<'_, D>,
1278            offset: usize,
1279            _depth: fidl::encoding::Depth,
1280        ) -> fidl::Result<()> {
1281            decoder.debug_check_bounds::<Self>(offset);
1282            // Verify that padding bytes are zero.
1283            fidl::decode!(PrefixEvent, D, &mut self.event, decoder, offset + 0, _depth)?;
1284            Ok(())
1285        }
1286    }
1287
1288    impl AcquirePrefixConfig {
1289        #[inline(always)]
1290        fn max_ordinal_present(&self) -> u64 {
1291            if let Some(_) = self.preferred_prefix_len {
1292                return 2;
1293            }
1294            if let Some(_) = self.interface_id {
1295                return 1;
1296            }
1297            0
1298        }
1299    }
1300
1301    impl fidl::encoding::ValueTypeMarker for AcquirePrefixConfig {
1302        type Borrowed<'a> = &'a Self;
1303        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1304            value
1305        }
1306    }
1307
1308    unsafe impl fidl::encoding::TypeMarker for AcquirePrefixConfig {
1309        type Owned = Self;
1310
1311        #[inline(always)]
1312        fn inline_align(_context: fidl::encoding::Context) -> usize {
1313            8
1314        }
1315
1316        #[inline(always)]
1317        fn inline_size(_context: fidl::encoding::Context) -> usize {
1318            16
1319        }
1320    }
1321
1322    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<AcquirePrefixConfig, D>
1323        for &AcquirePrefixConfig
1324    {
1325        unsafe fn encode(
1326            self,
1327            encoder: &mut fidl::encoding::Encoder<'_, D>,
1328            offset: usize,
1329            mut depth: fidl::encoding::Depth,
1330        ) -> fidl::Result<()> {
1331            encoder.debug_check_bounds::<AcquirePrefixConfig>(offset);
1332            // Vector header
1333            let max_ordinal: u64 = self.max_ordinal_present();
1334            encoder.write_num(max_ordinal, offset);
1335            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
1336            // Calling encoder.out_of_line_offset(0) is not allowed.
1337            if max_ordinal == 0 {
1338                return Ok(());
1339            }
1340            depth.increment()?;
1341            let envelope_size = 8;
1342            let bytes_len = max_ordinal as usize * envelope_size;
1343            #[allow(unused_variables)]
1344            let offset = encoder.out_of_line_offset(bytes_len);
1345            let mut _prev_end_offset: usize = 0;
1346            if 1 > max_ordinal {
1347                return Ok(());
1348            }
1349
1350            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1351            // are envelope_size bytes.
1352            let cur_offset: usize = (1 - 1) * envelope_size;
1353
1354            // Zero reserved fields.
1355            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1356
1357            // Safety:
1358            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1359            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1360            //   envelope_size bytes, there is always sufficient room.
1361            fidl::encoding::encode_in_envelope_optional::<u64, D>(
1362                self.interface_id.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
1363                encoder,
1364                offset + cur_offset,
1365                depth,
1366            )?;
1367
1368            _prev_end_offset = cur_offset + envelope_size;
1369            if 2 > max_ordinal {
1370                return Ok(());
1371            }
1372
1373            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1374            // are envelope_size bytes.
1375            let cur_offset: usize = (2 - 1) * envelope_size;
1376
1377            // Zero reserved fields.
1378            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1379
1380            // Safety:
1381            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1382            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1383            //   envelope_size bytes, there is always sufficient room.
1384            fidl::encoding::encode_in_envelope_optional::<u8, D>(
1385                self.preferred_prefix_len
1386                    .as_ref()
1387                    .map(<u8 as fidl::encoding::ValueTypeMarker>::borrow),
1388                encoder,
1389                offset + cur_offset,
1390                depth,
1391            )?;
1392
1393            _prev_end_offset = cur_offset + envelope_size;
1394
1395            Ok(())
1396        }
1397    }
1398
1399    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for AcquirePrefixConfig {
1400        #[inline(always)]
1401        fn new_empty() -> Self {
1402            Self::default()
1403        }
1404
1405        unsafe fn decode(
1406            &mut self,
1407            decoder: &mut fidl::encoding::Decoder<'_, D>,
1408            offset: usize,
1409            mut depth: fidl::encoding::Depth,
1410        ) -> fidl::Result<()> {
1411            decoder.debug_check_bounds::<Self>(offset);
1412            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
1413                None => return Err(fidl::Error::NotNullable),
1414                Some(len) => len,
1415            };
1416            // Calling decoder.out_of_line_offset(0) is not allowed.
1417            if len == 0 {
1418                return Ok(());
1419            };
1420            depth.increment()?;
1421            let envelope_size = 8;
1422            let bytes_len = len * envelope_size;
1423            let offset = decoder.out_of_line_offset(bytes_len)?;
1424            // Decode the envelope for each type.
1425            let mut _next_ordinal_to_read = 0;
1426            let mut next_offset = offset;
1427            let end_offset = offset + bytes_len;
1428            _next_ordinal_to_read += 1;
1429            if next_offset >= end_offset {
1430                return Ok(());
1431            }
1432
1433            // Decode unknown envelopes for gaps in ordinals.
1434            while _next_ordinal_to_read < 1 {
1435                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1436                _next_ordinal_to_read += 1;
1437                next_offset += envelope_size;
1438            }
1439
1440            let next_out_of_line = decoder.next_out_of_line();
1441            let handles_before = decoder.remaining_handles();
1442            if let Some((inlined, num_bytes, num_handles)) =
1443                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1444            {
1445                let member_inline_size =
1446                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1447                if inlined != (member_inline_size <= 4) {
1448                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1449                }
1450                let inner_offset;
1451                let mut inner_depth = depth.clone();
1452                if inlined {
1453                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1454                    inner_offset = next_offset;
1455                } else {
1456                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1457                    inner_depth.increment()?;
1458                }
1459                let val_ref = self.interface_id.get_or_insert_with(|| fidl::new_empty!(u64, D));
1460                fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
1461                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1462                {
1463                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
1464                }
1465                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1466                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1467                }
1468            }
1469
1470            next_offset += envelope_size;
1471            _next_ordinal_to_read += 1;
1472            if next_offset >= end_offset {
1473                return Ok(());
1474            }
1475
1476            // Decode unknown envelopes for gaps in ordinals.
1477            while _next_ordinal_to_read < 2 {
1478                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1479                _next_ordinal_to_read += 1;
1480                next_offset += envelope_size;
1481            }
1482
1483            let next_out_of_line = decoder.next_out_of_line();
1484            let handles_before = decoder.remaining_handles();
1485            if let Some((inlined, num_bytes, num_handles)) =
1486                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1487            {
1488                let member_inline_size =
1489                    <u8 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1490                if inlined != (member_inline_size <= 4) {
1491                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1492                }
1493                let inner_offset;
1494                let mut inner_depth = depth.clone();
1495                if inlined {
1496                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1497                    inner_offset = next_offset;
1498                } else {
1499                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1500                    inner_depth.increment()?;
1501                }
1502                let val_ref =
1503                    self.preferred_prefix_len.get_or_insert_with(|| fidl::new_empty!(u8, D));
1504                fidl::decode!(u8, D, val_ref, decoder, inner_offset, inner_depth)?;
1505                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1506                {
1507                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
1508                }
1509                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1510                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1511                }
1512            }
1513
1514            next_offset += envelope_size;
1515
1516            // Decode the remaining unknown envelopes.
1517            while next_offset < end_offset {
1518                _next_ordinal_to_read += 1;
1519                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1520                next_offset += envelope_size;
1521            }
1522
1523            Ok(())
1524        }
1525    }
1526
1527    impl AddressConfig {
1528        #[inline(always)]
1529        fn max_ordinal_present(&self) -> u64 {
1530            if let Some(_) = self.preferred_addresses {
1531                return 2;
1532            }
1533            if let Some(_) = self.address_count {
1534                return 1;
1535            }
1536            0
1537        }
1538    }
1539
1540    impl fidl::encoding::ValueTypeMarker for AddressConfig {
1541        type Borrowed<'a> = &'a Self;
1542        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1543            value
1544        }
1545    }
1546
1547    unsafe impl fidl::encoding::TypeMarker for AddressConfig {
1548        type Owned = Self;
1549
1550        #[inline(always)]
1551        fn inline_align(_context: fidl::encoding::Context) -> usize {
1552            8
1553        }
1554
1555        #[inline(always)]
1556        fn inline_size(_context: fidl::encoding::Context) -> usize {
1557            16
1558        }
1559    }
1560
1561    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<AddressConfig, D>
1562        for &AddressConfig
1563    {
1564        unsafe fn encode(
1565            self,
1566            encoder: &mut fidl::encoding::Encoder<'_, D>,
1567            offset: usize,
1568            mut depth: fidl::encoding::Depth,
1569        ) -> fidl::Result<()> {
1570            encoder.debug_check_bounds::<AddressConfig>(offset);
1571            // Vector header
1572            let max_ordinal: u64 = self.max_ordinal_present();
1573            encoder.write_num(max_ordinal, offset);
1574            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
1575            // Calling encoder.out_of_line_offset(0) is not allowed.
1576            if max_ordinal == 0 {
1577                return Ok(());
1578            }
1579            depth.increment()?;
1580            let envelope_size = 8;
1581            let bytes_len = max_ordinal as usize * envelope_size;
1582            #[allow(unused_variables)]
1583            let offset = encoder.out_of_line_offset(bytes_len);
1584            let mut _prev_end_offset: usize = 0;
1585            if 1 > max_ordinal {
1586                return Ok(());
1587            }
1588
1589            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1590            // are envelope_size bytes.
1591            let cur_offset: usize = (1 - 1) * envelope_size;
1592
1593            // Zero reserved fields.
1594            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1595
1596            // Safety:
1597            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1598            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1599            //   envelope_size bytes, there is always sufficient room.
1600            fidl::encoding::encode_in_envelope_optional::<u8, D>(
1601                self.address_count.as_ref().map(<u8 as fidl::encoding::ValueTypeMarker>::borrow),
1602                encoder,
1603                offset + cur_offset,
1604                depth,
1605            )?;
1606
1607            _prev_end_offset = cur_offset + envelope_size;
1608            if 2 > max_ordinal {
1609                return Ok(());
1610            }
1611
1612            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1613            // are envelope_size bytes.
1614            let cur_offset: usize = (2 - 1) * envelope_size;
1615
1616            // Zero reserved fields.
1617            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1618
1619            // Safety:
1620            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1621            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1622            //   envelope_size bytes, there is always sufficient room.
1623            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedVector<fidl_fuchsia_net_common::Ipv6Address>, D>(
1624            self.preferred_addresses.as_ref().map(<fidl::encoding::UnboundedVector<fidl_fuchsia_net_common::Ipv6Address> as fidl::encoding::ValueTypeMarker>::borrow),
1625            encoder, offset + cur_offset, depth
1626        )?;
1627
1628            _prev_end_offset = cur_offset + envelope_size;
1629
1630            Ok(())
1631        }
1632    }
1633
1634    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for AddressConfig {
1635        #[inline(always)]
1636        fn new_empty() -> Self {
1637            Self::default()
1638        }
1639
1640        unsafe fn decode(
1641            &mut self,
1642            decoder: &mut fidl::encoding::Decoder<'_, D>,
1643            offset: usize,
1644            mut depth: fidl::encoding::Depth,
1645        ) -> fidl::Result<()> {
1646            decoder.debug_check_bounds::<Self>(offset);
1647            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
1648                None => return Err(fidl::Error::NotNullable),
1649                Some(len) => len,
1650            };
1651            // Calling decoder.out_of_line_offset(0) is not allowed.
1652            if len == 0 {
1653                return Ok(());
1654            };
1655            depth.increment()?;
1656            let envelope_size = 8;
1657            let bytes_len = len * envelope_size;
1658            let offset = decoder.out_of_line_offset(bytes_len)?;
1659            // Decode the envelope for each type.
1660            let mut _next_ordinal_to_read = 0;
1661            let mut next_offset = offset;
1662            let end_offset = offset + bytes_len;
1663            _next_ordinal_to_read += 1;
1664            if next_offset >= end_offset {
1665                return Ok(());
1666            }
1667
1668            // Decode unknown envelopes for gaps in ordinals.
1669            while _next_ordinal_to_read < 1 {
1670                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1671                _next_ordinal_to_read += 1;
1672                next_offset += envelope_size;
1673            }
1674
1675            let next_out_of_line = decoder.next_out_of_line();
1676            let handles_before = decoder.remaining_handles();
1677            if let Some((inlined, num_bytes, num_handles)) =
1678                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1679            {
1680                let member_inline_size =
1681                    <u8 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1682                if inlined != (member_inline_size <= 4) {
1683                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1684                }
1685                let inner_offset;
1686                let mut inner_depth = depth.clone();
1687                if inlined {
1688                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1689                    inner_offset = next_offset;
1690                } else {
1691                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1692                    inner_depth.increment()?;
1693                }
1694                let val_ref = self.address_count.get_or_insert_with(|| fidl::new_empty!(u8, D));
1695                fidl::decode!(u8, D, val_ref, decoder, inner_offset, inner_depth)?;
1696                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1697                {
1698                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
1699                }
1700                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1701                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1702                }
1703            }
1704
1705            next_offset += envelope_size;
1706            _next_ordinal_to_read += 1;
1707            if next_offset >= end_offset {
1708                return Ok(());
1709            }
1710
1711            // Decode unknown envelopes for gaps in ordinals.
1712            while _next_ordinal_to_read < 2 {
1713                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1714                _next_ordinal_to_read += 1;
1715                next_offset += envelope_size;
1716            }
1717
1718            let next_out_of_line = decoder.next_out_of_line();
1719            let handles_before = decoder.remaining_handles();
1720            if let Some((inlined, num_bytes, num_handles)) =
1721                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1722            {
1723                let member_inline_size = <fidl::encoding::UnboundedVector<
1724                    fidl_fuchsia_net_common::Ipv6Address,
1725                > as fidl::encoding::TypeMarker>::inline_size(
1726                    decoder.context
1727                );
1728                if inlined != (member_inline_size <= 4) {
1729                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1730                }
1731                let inner_offset;
1732                let mut inner_depth = depth.clone();
1733                if inlined {
1734                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1735                    inner_offset = next_offset;
1736                } else {
1737                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1738                    inner_depth.increment()?;
1739                }
1740                let val_ref = self.preferred_addresses.get_or_insert_with(|| {
1741                    fidl::new_empty!(
1742                        fidl::encoding::UnboundedVector<fidl_fuchsia_net_common::Ipv6Address>,
1743                        D
1744                    )
1745                });
1746                fidl::decode!(
1747                    fidl::encoding::UnboundedVector<fidl_fuchsia_net_common::Ipv6Address>,
1748                    D,
1749                    val_ref,
1750                    decoder,
1751                    inner_offset,
1752                    inner_depth
1753                )?;
1754                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1755                {
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            }
1762
1763            next_offset += envelope_size;
1764
1765            // Decode the remaining unknown envelopes.
1766            while next_offset < end_offset {
1767                _next_ordinal_to_read += 1;
1768                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1769                next_offset += envelope_size;
1770            }
1771
1772            Ok(())
1773        }
1774    }
1775
1776    impl ClientConfig {
1777        #[inline(always)]
1778        fn max_ordinal_present(&self) -> u64 {
1779            if let Some(_) = self.prefix_delegation_config {
1780                return 3;
1781            }
1782            if let Some(_) = self.non_temporary_address_config {
1783                return 2;
1784            }
1785            if let Some(_) = self.information_config {
1786                return 1;
1787            }
1788            0
1789        }
1790    }
1791
1792    impl fidl::encoding::ValueTypeMarker for ClientConfig {
1793        type Borrowed<'a> = &'a Self;
1794        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1795            value
1796        }
1797    }
1798
1799    unsafe impl fidl::encoding::TypeMarker for ClientConfig {
1800        type Owned = Self;
1801
1802        #[inline(always)]
1803        fn inline_align(_context: fidl::encoding::Context) -> usize {
1804            8
1805        }
1806
1807        #[inline(always)]
1808        fn inline_size(_context: fidl::encoding::Context) -> usize {
1809            16
1810        }
1811    }
1812
1813    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<ClientConfig, D>
1814        for &ClientConfig
1815    {
1816        unsafe fn encode(
1817            self,
1818            encoder: &mut fidl::encoding::Encoder<'_, D>,
1819            offset: usize,
1820            mut depth: fidl::encoding::Depth,
1821        ) -> fidl::Result<()> {
1822            encoder.debug_check_bounds::<ClientConfig>(offset);
1823            // Vector header
1824            let max_ordinal: u64 = self.max_ordinal_present();
1825            encoder.write_num(max_ordinal, offset);
1826            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
1827            // Calling encoder.out_of_line_offset(0) is not allowed.
1828            if max_ordinal == 0 {
1829                return Ok(());
1830            }
1831            depth.increment()?;
1832            let envelope_size = 8;
1833            let bytes_len = max_ordinal as usize * envelope_size;
1834            #[allow(unused_variables)]
1835            let offset = encoder.out_of_line_offset(bytes_len);
1836            let mut _prev_end_offset: usize = 0;
1837            if 1 > max_ordinal {
1838                return Ok(());
1839            }
1840
1841            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1842            // are envelope_size bytes.
1843            let cur_offset: usize = (1 - 1) * envelope_size;
1844
1845            // Zero reserved fields.
1846            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1847
1848            // Safety:
1849            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1850            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1851            //   envelope_size bytes, there is always sufficient room.
1852            fidl::encoding::encode_in_envelope_optional::<InformationConfig, D>(
1853                self.information_config
1854                    .as_ref()
1855                    .map(<InformationConfig as fidl::encoding::ValueTypeMarker>::borrow),
1856                encoder,
1857                offset + cur_offset,
1858                depth,
1859            )?;
1860
1861            _prev_end_offset = cur_offset + envelope_size;
1862            if 2 > max_ordinal {
1863                return Ok(());
1864            }
1865
1866            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1867            // are envelope_size bytes.
1868            let cur_offset: usize = (2 - 1) * envelope_size;
1869
1870            // Zero reserved fields.
1871            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1872
1873            // Safety:
1874            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1875            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1876            //   envelope_size bytes, there is always sufficient room.
1877            fidl::encoding::encode_in_envelope_optional::<AddressConfig, D>(
1878                self.non_temporary_address_config
1879                    .as_ref()
1880                    .map(<AddressConfig as fidl::encoding::ValueTypeMarker>::borrow),
1881                encoder,
1882                offset + cur_offset,
1883                depth,
1884            )?;
1885
1886            _prev_end_offset = cur_offset + envelope_size;
1887            if 3 > max_ordinal {
1888                return Ok(());
1889            }
1890
1891            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1892            // are envelope_size bytes.
1893            let cur_offset: usize = (3 - 1) * envelope_size;
1894
1895            // Zero reserved fields.
1896            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1897
1898            // Safety:
1899            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1900            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1901            //   envelope_size bytes, there is always sufficient room.
1902            fidl::encoding::encode_in_envelope_optional::<PrefixDelegationConfig, D>(
1903                self.prefix_delegation_config
1904                    .as_ref()
1905                    .map(<PrefixDelegationConfig as fidl::encoding::ValueTypeMarker>::borrow),
1906                encoder,
1907                offset + cur_offset,
1908                depth,
1909            )?;
1910
1911            _prev_end_offset = cur_offset + envelope_size;
1912
1913            Ok(())
1914        }
1915    }
1916
1917    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ClientConfig {
1918        #[inline(always)]
1919        fn new_empty() -> Self {
1920            Self::default()
1921        }
1922
1923        unsafe fn decode(
1924            &mut self,
1925            decoder: &mut fidl::encoding::Decoder<'_, D>,
1926            offset: usize,
1927            mut depth: fidl::encoding::Depth,
1928        ) -> fidl::Result<()> {
1929            decoder.debug_check_bounds::<Self>(offset);
1930            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
1931                None => return Err(fidl::Error::NotNullable),
1932                Some(len) => len,
1933            };
1934            // Calling decoder.out_of_line_offset(0) is not allowed.
1935            if len == 0 {
1936                return Ok(());
1937            };
1938            depth.increment()?;
1939            let envelope_size = 8;
1940            let bytes_len = len * envelope_size;
1941            let offset = decoder.out_of_line_offset(bytes_len)?;
1942            // Decode the envelope for each type.
1943            let mut _next_ordinal_to_read = 0;
1944            let mut next_offset = offset;
1945            let end_offset = offset + bytes_len;
1946            _next_ordinal_to_read += 1;
1947            if next_offset >= end_offset {
1948                return Ok(());
1949            }
1950
1951            // Decode unknown envelopes for gaps in ordinals.
1952            while _next_ordinal_to_read < 1 {
1953                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1954                _next_ordinal_to_read += 1;
1955                next_offset += envelope_size;
1956            }
1957
1958            let next_out_of_line = decoder.next_out_of_line();
1959            let handles_before = decoder.remaining_handles();
1960            if let Some((inlined, num_bytes, num_handles)) =
1961                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1962            {
1963                let member_inline_size =
1964                    <InformationConfig as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1965                if inlined != (member_inline_size <= 4) {
1966                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1967                }
1968                let inner_offset;
1969                let mut inner_depth = depth.clone();
1970                if inlined {
1971                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1972                    inner_offset = next_offset;
1973                } else {
1974                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1975                    inner_depth.increment()?;
1976                }
1977                let val_ref = self
1978                    .information_config
1979                    .get_or_insert_with(|| fidl::new_empty!(InformationConfig, D));
1980                fidl::decode!(InformationConfig, D, val_ref, decoder, inner_offset, inner_depth)?;
1981                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1982                {
1983                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
1984                }
1985                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1986                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1987                }
1988            }
1989
1990            next_offset += envelope_size;
1991            _next_ordinal_to_read += 1;
1992            if next_offset >= end_offset {
1993                return Ok(());
1994            }
1995
1996            // Decode unknown envelopes for gaps in ordinals.
1997            while _next_ordinal_to_read < 2 {
1998                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1999                _next_ordinal_to_read += 1;
2000                next_offset += envelope_size;
2001            }
2002
2003            let next_out_of_line = decoder.next_out_of_line();
2004            let handles_before = decoder.remaining_handles();
2005            if let Some((inlined, num_bytes, num_handles)) =
2006                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2007            {
2008                let member_inline_size =
2009                    <AddressConfig as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2010                if inlined != (member_inline_size <= 4) {
2011                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2012                }
2013                let inner_offset;
2014                let mut inner_depth = depth.clone();
2015                if inlined {
2016                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2017                    inner_offset = next_offset;
2018                } else {
2019                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2020                    inner_depth.increment()?;
2021                }
2022                let val_ref = self
2023                    .non_temporary_address_config
2024                    .get_or_insert_with(|| fidl::new_empty!(AddressConfig, D));
2025                fidl::decode!(AddressConfig, D, val_ref, decoder, inner_offset, inner_depth)?;
2026                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2027                {
2028                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2029                }
2030                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2031                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2032                }
2033            }
2034
2035            next_offset += envelope_size;
2036            _next_ordinal_to_read += 1;
2037            if next_offset >= end_offset {
2038                return Ok(());
2039            }
2040
2041            // Decode unknown envelopes for gaps in ordinals.
2042            while _next_ordinal_to_read < 3 {
2043                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2044                _next_ordinal_to_read += 1;
2045                next_offset += envelope_size;
2046            }
2047
2048            let next_out_of_line = decoder.next_out_of_line();
2049            let handles_before = decoder.remaining_handles();
2050            if let Some((inlined, num_bytes, num_handles)) =
2051                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2052            {
2053                let member_inline_size =
2054                    <PrefixDelegationConfig as fidl::encoding::TypeMarker>::inline_size(
2055                        decoder.context,
2056                    );
2057                if inlined != (member_inline_size <= 4) {
2058                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2059                }
2060                let inner_offset;
2061                let mut inner_depth = depth.clone();
2062                if inlined {
2063                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2064                    inner_offset = next_offset;
2065                } else {
2066                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2067                    inner_depth.increment()?;
2068                }
2069                let val_ref = self
2070                    .prefix_delegation_config
2071                    .get_or_insert_with(|| fidl::new_empty!(PrefixDelegationConfig, D));
2072                fidl::decode!(
2073                    PrefixDelegationConfig,
2074                    D,
2075                    val_ref,
2076                    decoder,
2077                    inner_offset,
2078                    inner_depth
2079                )?;
2080                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2081                {
2082                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2083                }
2084                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2085                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2086                }
2087            }
2088
2089            next_offset += envelope_size;
2090
2091            // Decode the remaining unknown envelopes.
2092            while next_offset < end_offset {
2093                _next_ordinal_to_read += 1;
2094                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2095                next_offset += envelope_size;
2096            }
2097
2098            Ok(())
2099        }
2100    }
2101
2102    impl InformationConfig {
2103        #[inline(always)]
2104        fn max_ordinal_present(&self) -> u64 {
2105            if let Some(_) = self.dns_servers {
2106                return 1;
2107            }
2108            0
2109        }
2110    }
2111
2112    impl fidl::encoding::ValueTypeMarker for InformationConfig {
2113        type Borrowed<'a> = &'a Self;
2114        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2115            value
2116        }
2117    }
2118
2119    unsafe impl fidl::encoding::TypeMarker for InformationConfig {
2120        type Owned = Self;
2121
2122        #[inline(always)]
2123        fn inline_align(_context: fidl::encoding::Context) -> usize {
2124            8
2125        }
2126
2127        #[inline(always)]
2128        fn inline_size(_context: fidl::encoding::Context) -> usize {
2129            16
2130        }
2131    }
2132
2133    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<InformationConfig, D>
2134        for &InformationConfig
2135    {
2136        unsafe fn encode(
2137            self,
2138            encoder: &mut fidl::encoding::Encoder<'_, D>,
2139            offset: usize,
2140            mut depth: fidl::encoding::Depth,
2141        ) -> fidl::Result<()> {
2142            encoder.debug_check_bounds::<InformationConfig>(offset);
2143            // Vector header
2144            let max_ordinal: u64 = self.max_ordinal_present();
2145            encoder.write_num(max_ordinal, offset);
2146            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
2147            // Calling encoder.out_of_line_offset(0) is not allowed.
2148            if max_ordinal == 0 {
2149                return Ok(());
2150            }
2151            depth.increment()?;
2152            let envelope_size = 8;
2153            let bytes_len = max_ordinal as usize * envelope_size;
2154            #[allow(unused_variables)]
2155            let offset = encoder.out_of_line_offset(bytes_len);
2156            let mut _prev_end_offset: usize = 0;
2157            if 1 > max_ordinal {
2158                return Ok(());
2159            }
2160
2161            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2162            // are envelope_size bytes.
2163            let cur_offset: usize = (1 - 1) * envelope_size;
2164
2165            // Zero reserved fields.
2166            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2167
2168            // Safety:
2169            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2170            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2171            //   envelope_size bytes, there is always sufficient room.
2172            fidl::encoding::encode_in_envelope_optional::<bool, D>(
2173                self.dns_servers.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
2174                encoder,
2175                offset + cur_offset,
2176                depth,
2177            )?;
2178
2179            _prev_end_offset = cur_offset + envelope_size;
2180
2181            Ok(())
2182        }
2183    }
2184
2185    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for InformationConfig {
2186        #[inline(always)]
2187        fn new_empty() -> Self {
2188            Self::default()
2189        }
2190
2191        unsafe fn decode(
2192            &mut self,
2193            decoder: &mut fidl::encoding::Decoder<'_, D>,
2194            offset: usize,
2195            mut depth: fidl::encoding::Depth,
2196        ) -> fidl::Result<()> {
2197            decoder.debug_check_bounds::<Self>(offset);
2198            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
2199                None => return Err(fidl::Error::NotNullable),
2200                Some(len) => len,
2201            };
2202            // Calling decoder.out_of_line_offset(0) is not allowed.
2203            if len == 0 {
2204                return Ok(());
2205            };
2206            depth.increment()?;
2207            let envelope_size = 8;
2208            let bytes_len = len * envelope_size;
2209            let offset = decoder.out_of_line_offset(bytes_len)?;
2210            // Decode the envelope for each type.
2211            let mut _next_ordinal_to_read = 0;
2212            let mut next_offset = offset;
2213            let end_offset = offset + bytes_len;
2214            _next_ordinal_to_read += 1;
2215            if next_offset >= end_offset {
2216                return Ok(());
2217            }
2218
2219            // Decode unknown envelopes for gaps in ordinals.
2220            while _next_ordinal_to_read < 1 {
2221                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2222                _next_ordinal_to_read += 1;
2223                next_offset += envelope_size;
2224            }
2225
2226            let next_out_of_line = decoder.next_out_of_line();
2227            let handles_before = decoder.remaining_handles();
2228            if let Some((inlined, num_bytes, num_handles)) =
2229                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2230            {
2231                let member_inline_size =
2232                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2233                if inlined != (member_inline_size <= 4) {
2234                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2235                }
2236                let inner_offset;
2237                let mut inner_depth = depth.clone();
2238                if inlined {
2239                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2240                    inner_offset = next_offset;
2241                } else {
2242                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2243                    inner_depth.increment()?;
2244                }
2245                let val_ref = self.dns_servers.get_or_insert_with(|| fidl::new_empty!(bool, D));
2246                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
2247                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2248                {
2249                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2250                }
2251                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2252                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2253                }
2254            }
2255
2256            next_offset += envelope_size;
2257
2258            // Decode the remaining unknown envelopes.
2259            while next_offset < end_offset {
2260                _next_ordinal_to_read += 1;
2261                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2262                next_offset += envelope_size;
2263            }
2264
2265            Ok(())
2266        }
2267    }
2268
2269    impl NewClientParams {
2270        #[inline(always)]
2271        fn max_ordinal_present(&self) -> u64 {
2272            if let Some(_) = self.duid {
2273                return 4;
2274            }
2275            if let Some(_) = self.config {
2276                return 3;
2277            }
2278            if let Some(_) = self.address {
2279                return 2;
2280            }
2281            if let Some(_) = self.interface_id {
2282                return 1;
2283            }
2284            0
2285        }
2286    }
2287
2288    impl fidl::encoding::ValueTypeMarker for NewClientParams {
2289        type Borrowed<'a> = &'a Self;
2290        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2291            value
2292        }
2293    }
2294
2295    unsafe impl fidl::encoding::TypeMarker for NewClientParams {
2296        type Owned = Self;
2297
2298        #[inline(always)]
2299        fn inline_align(_context: fidl::encoding::Context) -> usize {
2300            8
2301        }
2302
2303        #[inline(always)]
2304        fn inline_size(_context: fidl::encoding::Context) -> usize {
2305            16
2306        }
2307    }
2308
2309    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<NewClientParams, D>
2310        for &NewClientParams
2311    {
2312        unsafe fn encode(
2313            self,
2314            encoder: &mut fidl::encoding::Encoder<'_, D>,
2315            offset: usize,
2316            mut depth: fidl::encoding::Depth,
2317        ) -> fidl::Result<()> {
2318            encoder.debug_check_bounds::<NewClientParams>(offset);
2319            // Vector header
2320            let max_ordinal: u64 = self.max_ordinal_present();
2321            encoder.write_num(max_ordinal, offset);
2322            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
2323            // Calling encoder.out_of_line_offset(0) is not allowed.
2324            if max_ordinal == 0 {
2325                return Ok(());
2326            }
2327            depth.increment()?;
2328            let envelope_size = 8;
2329            let bytes_len = max_ordinal as usize * envelope_size;
2330            #[allow(unused_variables)]
2331            let offset = encoder.out_of_line_offset(bytes_len);
2332            let mut _prev_end_offset: usize = 0;
2333            if 1 > max_ordinal {
2334                return Ok(());
2335            }
2336
2337            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2338            // are envelope_size bytes.
2339            let cur_offset: usize = (1 - 1) * envelope_size;
2340
2341            // Zero reserved fields.
2342            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2343
2344            // Safety:
2345            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2346            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2347            //   envelope_size bytes, there is always sufficient room.
2348            fidl::encoding::encode_in_envelope_optional::<u64, D>(
2349                self.interface_id.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
2350                encoder,
2351                offset + cur_offset,
2352                depth,
2353            )?;
2354
2355            _prev_end_offset = cur_offset + envelope_size;
2356            if 2 > max_ordinal {
2357                return Ok(());
2358            }
2359
2360            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2361            // are envelope_size bytes.
2362            let cur_offset: usize = (2 - 1) * envelope_size;
2363
2364            // Zero reserved fields.
2365            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2366
2367            // Safety:
2368            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2369            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2370            //   envelope_size bytes, there is always sufficient room.
2371            fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_net_common::Ipv6SocketAddress, D>(
2372            self.address.as_ref().map(<fidl_fuchsia_net_common::Ipv6SocketAddress as fidl::encoding::ValueTypeMarker>::borrow),
2373            encoder, offset + cur_offset, depth
2374        )?;
2375
2376            _prev_end_offset = cur_offset + envelope_size;
2377            if 3 > max_ordinal {
2378                return Ok(());
2379            }
2380
2381            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2382            // are envelope_size bytes.
2383            let cur_offset: usize = (3 - 1) * envelope_size;
2384
2385            // Zero reserved fields.
2386            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2387
2388            // Safety:
2389            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2390            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2391            //   envelope_size bytes, there is always sufficient room.
2392            fidl::encoding::encode_in_envelope_optional::<ClientConfig, D>(
2393                self.config.as_ref().map(<ClientConfig as fidl::encoding::ValueTypeMarker>::borrow),
2394                encoder,
2395                offset + cur_offset,
2396                depth,
2397            )?;
2398
2399            _prev_end_offset = cur_offset + envelope_size;
2400            if 4 > max_ordinal {
2401                return Ok(());
2402            }
2403
2404            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2405            // are envelope_size bytes.
2406            let cur_offset: usize = (4 - 1) * envelope_size;
2407
2408            // Zero reserved fields.
2409            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2410
2411            // Safety:
2412            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2413            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2414            //   envelope_size bytes, there is always sufficient room.
2415            fidl::encoding::encode_in_envelope_optional::<Duid, D>(
2416                self.duid.as_ref().map(<Duid as fidl::encoding::ValueTypeMarker>::borrow),
2417                encoder,
2418                offset + cur_offset,
2419                depth,
2420            )?;
2421
2422            _prev_end_offset = cur_offset + envelope_size;
2423
2424            Ok(())
2425        }
2426    }
2427
2428    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for NewClientParams {
2429        #[inline(always)]
2430        fn new_empty() -> Self {
2431            Self::default()
2432        }
2433
2434        unsafe fn decode(
2435            &mut self,
2436            decoder: &mut fidl::encoding::Decoder<'_, D>,
2437            offset: usize,
2438            mut depth: fidl::encoding::Depth,
2439        ) -> fidl::Result<()> {
2440            decoder.debug_check_bounds::<Self>(offset);
2441            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
2442                None => return Err(fidl::Error::NotNullable),
2443                Some(len) => len,
2444            };
2445            // Calling decoder.out_of_line_offset(0) is not allowed.
2446            if len == 0 {
2447                return Ok(());
2448            };
2449            depth.increment()?;
2450            let envelope_size = 8;
2451            let bytes_len = len * envelope_size;
2452            let offset = decoder.out_of_line_offset(bytes_len)?;
2453            // Decode the envelope for each type.
2454            let mut _next_ordinal_to_read = 0;
2455            let mut next_offset = offset;
2456            let end_offset = offset + bytes_len;
2457            _next_ordinal_to_read += 1;
2458            if next_offset >= end_offset {
2459                return Ok(());
2460            }
2461
2462            // Decode unknown envelopes for gaps in ordinals.
2463            while _next_ordinal_to_read < 1 {
2464                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2465                _next_ordinal_to_read += 1;
2466                next_offset += envelope_size;
2467            }
2468
2469            let next_out_of_line = decoder.next_out_of_line();
2470            let handles_before = decoder.remaining_handles();
2471            if let Some((inlined, num_bytes, num_handles)) =
2472                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2473            {
2474                let member_inline_size =
2475                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2476                if inlined != (member_inline_size <= 4) {
2477                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2478                }
2479                let inner_offset;
2480                let mut inner_depth = depth.clone();
2481                if inlined {
2482                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2483                    inner_offset = next_offset;
2484                } else {
2485                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2486                    inner_depth.increment()?;
2487                }
2488                let val_ref = self.interface_id.get_or_insert_with(|| fidl::new_empty!(u64, D));
2489                fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
2490                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2491                {
2492                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2493                }
2494                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2495                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2496                }
2497            }
2498
2499            next_offset += envelope_size;
2500            _next_ordinal_to_read += 1;
2501            if next_offset >= end_offset {
2502                return Ok(());
2503            }
2504
2505            // Decode unknown envelopes for gaps in ordinals.
2506            while _next_ordinal_to_read < 2 {
2507                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2508                _next_ordinal_to_read += 1;
2509                next_offset += envelope_size;
2510            }
2511
2512            let next_out_of_line = decoder.next_out_of_line();
2513            let handles_before = decoder.remaining_handles();
2514            if let Some((inlined, num_bytes, num_handles)) =
2515                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2516            {
2517                let member_inline_size = <fidl_fuchsia_net_common::Ipv6SocketAddress as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2518                if inlined != (member_inline_size <= 4) {
2519                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2520                }
2521                let inner_offset;
2522                let mut inner_depth = depth.clone();
2523                if inlined {
2524                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2525                    inner_offset = next_offset;
2526                } else {
2527                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2528                    inner_depth.increment()?;
2529                }
2530                let val_ref = self.address.get_or_insert_with(|| {
2531                    fidl::new_empty!(fidl_fuchsia_net_common::Ipv6SocketAddress, D)
2532                });
2533                fidl::decode!(
2534                    fidl_fuchsia_net_common::Ipv6SocketAddress,
2535                    D,
2536                    val_ref,
2537                    decoder,
2538                    inner_offset,
2539                    inner_depth
2540                )?;
2541                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2542                {
2543                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2544                }
2545                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2546                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2547                }
2548            }
2549
2550            next_offset += envelope_size;
2551            _next_ordinal_to_read += 1;
2552            if next_offset >= end_offset {
2553                return Ok(());
2554            }
2555
2556            // Decode unknown envelopes for gaps in ordinals.
2557            while _next_ordinal_to_read < 3 {
2558                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2559                _next_ordinal_to_read += 1;
2560                next_offset += envelope_size;
2561            }
2562
2563            let next_out_of_line = decoder.next_out_of_line();
2564            let handles_before = decoder.remaining_handles();
2565            if let Some((inlined, num_bytes, num_handles)) =
2566                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2567            {
2568                let member_inline_size =
2569                    <ClientConfig as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2570                if inlined != (member_inline_size <= 4) {
2571                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2572                }
2573                let inner_offset;
2574                let mut inner_depth = depth.clone();
2575                if inlined {
2576                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2577                    inner_offset = next_offset;
2578                } else {
2579                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2580                    inner_depth.increment()?;
2581                }
2582                let val_ref = self.config.get_or_insert_with(|| fidl::new_empty!(ClientConfig, D));
2583                fidl::decode!(ClientConfig, D, val_ref, decoder, inner_offset, inner_depth)?;
2584                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2585                {
2586                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2587                }
2588                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2589                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2590                }
2591            }
2592
2593            next_offset += envelope_size;
2594            _next_ordinal_to_read += 1;
2595            if next_offset >= end_offset {
2596                return Ok(());
2597            }
2598
2599            // Decode unknown envelopes for gaps in ordinals.
2600            while _next_ordinal_to_read < 4 {
2601                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2602                _next_ordinal_to_read += 1;
2603                next_offset += envelope_size;
2604            }
2605
2606            let next_out_of_line = decoder.next_out_of_line();
2607            let handles_before = decoder.remaining_handles();
2608            if let Some((inlined, num_bytes, num_handles)) =
2609                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2610            {
2611                let member_inline_size =
2612                    <Duid as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2613                if inlined != (member_inline_size <= 4) {
2614                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2615                }
2616                let inner_offset;
2617                let mut inner_depth = depth.clone();
2618                if inlined {
2619                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2620                    inner_offset = next_offset;
2621                } else {
2622                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2623                    inner_depth.increment()?;
2624                }
2625                let val_ref = self.duid.get_or_insert_with(|| fidl::new_empty!(Duid, D));
2626                fidl::decode!(Duid, D, val_ref, decoder, inner_offset, inner_depth)?;
2627                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2628                {
2629                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2630                }
2631                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2632                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2633                }
2634            }
2635
2636            next_offset += envelope_size;
2637
2638            // Decode the remaining unknown envelopes.
2639            while next_offset < end_offset {
2640                _next_ordinal_to_read += 1;
2641                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2642                next_offset += envelope_size;
2643            }
2644
2645            Ok(())
2646        }
2647    }
2648
2649    impl fidl::encoding::ValueTypeMarker for Duid {
2650        type Borrowed<'a> = &'a Self;
2651        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2652            value
2653        }
2654    }
2655
2656    unsafe impl fidl::encoding::TypeMarker for Duid {
2657        type Owned = Self;
2658
2659        #[inline(always)]
2660        fn inline_align(_context: fidl::encoding::Context) -> usize {
2661            8
2662        }
2663
2664        #[inline(always)]
2665        fn inline_size(_context: fidl::encoding::Context) -> usize {
2666            16
2667        }
2668    }
2669
2670    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Duid, D> for &Duid {
2671        #[inline]
2672        unsafe fn encode(
2673            self,
2674            encoder: &mut fidl::encoding::Encoder<'_, D>,
2675            offset: usize,
2676            _depth: fidl::encoding::Depth,
2677        ) -> fidl::Result<()> {
2678            encoder.debug_check_bounds::<Duid>(offset);
2679            encoder.write_num::<u64>(self.ordinal(), offset);
2680            match self {
2681                Duid::LinkLayerAddressPlusTime(ref val) => {
2682                    fidl::encoding::encode_in_envelope::<LinkLayerAddressPlusTime, D>(
2683                        <LinkLayerAddressPlusTime as fidl::encoding::ValueTypeMarker>::borrow(val),
2684                        encoder,
2685                        offset + 8,
2686                        _depth,
2687                    )
2688                }
2689                Duid::LinkLayerAddress(ref val) => {
2690                    fidl::encoding::encode_in_envelope::<LinkLayerAddress, D>(
2691                        <LinkLayerAddress as fidl::encoding::ValueTypeMarker>::borrow(val),
2692                        encoder,
2693                        offset + 8,
2694                        _depth,
2695                    )
2696                }
2697                Duid::Uuid(ref val) => fidl::encoding::encode_in_envelope::<
2698                    fidl::encoding::Array<u8, 16>,
2699                    D,
2700                >(
2701                    <fidl::encoding::Array<u8, 16> as fidl::encoding::ValueTypeMarker>::borrow(val),
2702                    encoder,
2703                    offset + 8,
2704                    _depth,
2705                ),
2706                Duid::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
2707            }
2708        }
2709    }
2710
2711    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Duid {
2712        #[inline(always)]
2713        fn new_empty() -> Self {
2714            Self::__SourceBreaking { unknown_ordinal: 0 }
2715        }
2716
2717        #[inline]
2718        unsafe fn decode(
2719            &mut self,
2720            decoder: &mut fidl::encoding::Decoder<'_, D>,
2721            offset: usize,
2722            mut depth: fidl::encoding::Depth,
2723        ) -> fidl::Result<()> {
2724            decoder.debug_check_bounds::<Self>(offset);
2725            #[allow(unused_variables)]
2726            let next_out_of_line = decoder.next_out_of_line();
2727            let handles_before = decoder.remaining_handles();
2728            let (ordinal, inlined, num_bytes, num_handles) =
2729                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
2730
2731            let member_inline_size = match ordinal {
2732                1 => <LinkLayerAddressPlusTime as fidl::encoding::TypeMarker>::inline_size(
2733                    decoder.context,
2734                ),
2735                2 => <LinkLayerAddress as fidl::encoding::TypeMarker>::inline_size(decoder.context),
2736                3 => <fidl::encoding::Array<u8, 16> as fidl::encoding::TypeMarker>::inline_size(
2737                    decoder.context,
2738                ),
2739                0 => return Err(fidl::Error::UnknownUnionTag),
2740                _ => num_bytes as usize,
2741            };
2742
2743            if inlined != (member_inline_size <= 4) {
2744                return Err(fidl::Error::InvalidInlineBitInEnvelope);
2745            }
2746            let _inner_offset;
2747            if inlined {
2748                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
2749                _inner_offset = offset + 8;
2750            } else {
2751                depth.increment()?;
2752                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2753            }
2754            match ordinal {
2755                1 => {
2756                    #[allow(irrefutable_let_patterns)]
2757                    if let Duid::LinkLayerAddressPlusTime(_) = self {
2758                        // Do nothing, read the value into the object
2759                    } else {
2760                        // Initialize `self` to the right variant
2761                        *self = Duid::LinkLayerAddressPlusTime(fidl::new_empty!(
2762                            LinkLayerAddressPlusTime,
2763                            D
2764                        ));
2765                    }
2766                    #[allow(irrefutable_let_patterns)]
2767                    if let Duid::LinkLayerAddressPlusTime(ref mut val) = self {
2768                        fidl::decode!(
2769                            LinkLayerAddressPlusTime,
2770                            D,
2771                            val,
2772                            decoder,
2773                            _inner_offset,
2774                            depth
2775                        )?;
2776                    } else {
2777                        unreachable!()
2778                    }
2779                }
2780                2 => {
2781                    #[allow(irrefutable_let_patterns)]
2782                    if let Duid::LinkLayerAddress(_) = self {
2783                        // Do nothing, read the value into the object
2784                    } else {
2785                        // Initialize `self` to the right variant
2786                        *self = Duid::LinkLayerAddress(fidl::new_empty!(LinkLayerAddress, D));
2787                    }
2788                    #[allow(irrefutable_let_patterns)]
2789                    if let Duid::LinkLayerAddress(ref mut val) = self {
2790                        fidl::decode!(LinkLayerAddress, D, val, decoder, _inner_offset, depth)?;
2791                    } else {
2792                        unreachable!()
2793                    }
2794                }
2795                3 => {
2796                    #[allow(irrefutable_let_patterns)]
2797                    if let Duid::Uuid(_) = self {
2798                        // Do nothing, read the value into the object
2799                    } else {
2800                        // Initialize `self` to the right variant
2801                        *self = Duid::Uuid(fidl::new_empty!(fidl::encoding::Array<u8, 16>, D));
2802                    }
2803                    #[allow(irrefutable_let_patterns)]
2804                    if let Duid::Uuid(ref mut val) = self {
2805                        fidl::decode!(fidl::encoding::Array<u8, 16>, D, val, decoder, _inner_offset, depth)?;
2806                    } else {
2807                        unreachable!()
2808                    }
2809                }
2810                #[allow(deprecated)]
2811                ordinal => {
2812                    for _ in 0..num_handles {
2813                        decoder.drop_next_handle()?;
2814                    }
2815                    *self = Duid::__SourceBreaking { unknown_ordinal: ordinal };
2816                }
2817            }
2818            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
2819                return Err(fidl::Error::InvalidNumBytesInEnvelope);
2820            }
2821            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2822                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2823            }
2824            Ok(())
2825        }
2826    }
2827
2828    impl fidl::encoding::ValueTypeMarker for LinkLayerAddress {
2829        type Borrowed<'a> = &'a Self;
2830        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2831            value
2832        }
2833    }
2834
2835    unsafe impl fidl::encoding::TypeMarker for LinkLayerAddress {
2836        type Owned = Self;
2837
2838        #[inline(always)]
2839        fn inline_align(_context: fidl::encoding::Context) -> usize {
2840            8
2841        }
2842
2843        #[inline(always)]
2844        fn inline_size(_context: fidl::encoding::Context) -> usize {
2845            16
2846        }
2847    }
2848
2849    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<LinkLayerAddress, D>
2850        for &LinkLayerAddress
2851    {
2852        #[inline]
2853        unsafe fn encode(
2854            self,
2855            encoder: &mut fidl::encoding::Encoder<'_, D>,
2856            offset: usize,
2857            _depth: fidl::encoding::Depth,
2858        ) -> fidl::Result<()> {
2859            encoder.debug_check_bounds::<LinkLayerAddress>(offset);
2860            encoder.write_num::<u64>(self.ordinal(), offset);
2861            match self {
2862            LinkLayerAddress::Ethernet(ref val) => {
2863                fidl::encoding::encode_in_envelope::<fidl_fuchsia_net_common::MacAddress, D>(
2864                    <fidl_fuchsia_net_common::MacAddress as fidl::encoding::ValueTypeMarker>::borrow(val),
2865                    encoder, offset + 8, _depth
2866                )
2867            }
2868            LinkLayerAddress::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
2869        }
2870        }
2871    }
2872
2873    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for LinkLayerAddress {
2874        #[inline(always)]
2875        fn new_empty() -> Self {
2876            Self::__SourceBreaking { unknown_ordinal: 0 }
2877        }
2878
2879        #[inline]
2880        unsafe fn decode(
2881            &mut self,
2882            decoder: &mut fidl::encoding::Decoder<'_, D>,
2883            offset: usize,
2884            mut depth: fidl::encoding::Depth,
2885        ) -> fidl::Result<()> {
2886            decoder.debug_check_bounds::<Self>(offset);
2887            #[allow(unused_variables)]
2888            let next_out_of_line = decoder.next_out_of_line();
2889            let handles_before = decoder.remaining_handles();
2890            let (ordinal, inlined, num_bytes, num_handles) =
2891                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
2892
2893            let member_inline_size = match ordinal {
2894                1 => {
2895                    <fidl_fuchsia_net_common::MacAddress as fidl::encoding::TypeMarker>::inline_size(
2896                        decoder.context,
2897                    )
2898                }
2899                0 => return Err(fidl::Error::UnknownUnionTag),
2900                _ => num_bytes as usize,
2901            };
2902
2903            if inlined != (member_inline_size <= 4) {
2904                return Err(fidl::Error::InvalidInlineBitInEnvelope);
2905            }
2906            let _inner_offset;
2907            if inlined {
2908                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
2909                _inner_offset = offset + 8;
2910            } else {
2911                depth.increment()?;
2912                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2913            }
2914            match ordinal {
2915                1 => {
2916                    #[allow(irrefutable_let_patterns)]
2917                    if let LinkLayerAddress::Ethernet(_) = self {
2918                        // Do nothing, read the value into the object
2919                    } else {
2920                        // Initialize `self` to the right variant
2921                        *self = LinkLayerAddress::Ethernet(fidl::new_empty!(
2922                            fidl_fuchsia_net_common::MacAddress,
2923                            D
2924                        ));
2925                    }
2926                    #[allow(irrefutable_let_patterns)]
2927                    if let LinkLayerAddress::Ethernet(ref mut val) = self {
2928                        fidl::decode!(
2929                            fidl_fuchsia_net_common::MacAddress,
2930                            D,
2931                            val,
2932                            decoder,
2933                            _inner_offset,
2934                            depth
2935                        )?;
2936                    } else {
2937                        unreachable!()
2938                    }
2939                }
2940                #[allow(deprecated)]
2941                ordinal => {
2942                    for _ in 0..num_handles {
2943                        decoder.drop_next_handle()?;
2944                    }
2945                    *self = LinkLayerAddress::__SourceBreaking { unknown_ordinal: ordinal };
2946                }
2947            }
2948            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
2949                return Err(fidl::Error::InvalidNumBytesInEnvelope);
2950            }
2951            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2952                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2953            }
2954            Ok(())
2955        }
2956    }
2957
2958    impl fidl::encoding::ValueTypeMarker for PrefixDelegationConfig {
2959        type Borrowed<'a> = &'a Self;
2960        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2961            value
2962        }
2963    }
2964
2965    unsafe impl fidl::encoding::TypeMarker for PrefixDelegationConfig {
2966        type Owned = Self;
2967
2968        #[inline(always)]
2969        fn inline_align(_context: fidl::encoding::Context) -> usize {
2970            8
2971        }
2972
2973        #[inline(always)]
2974        fn inline_size(_context: fidl::encoding::Context) -> usize {
2975            16
2976        }
2977    }
2978
2979    unsafe impl<D: fidl::encoding::ResourceDialect>
2980        fidl::encoding::Encode<PrefixDelegationConfig, D> for &PrefixDelegationConfig
2981    {
2982        #[inline]
2983        unsafe fn encode(
2984            self,
2985            encoder: &mut fidl::encoding::Encoder<'_, D>,
2986            offset: usize,
2987            _depth: fidl::encoding::Depth,
2988        ) -> fidl::Result<()> {
2989            encoder.debug_check_bounds::<PrefixDelegationConfig>(offset);
2990            encoder.write_num::<u64>(self.ordinal(), offset);
2991            match self {
2992            PrefixDelegationConfig::Empty(ref val) => {
2993                fidl::encoding::encode_in_envelope::<Empty, D>(
2994                    <Empty as fidl::encoding::ValueTypeMarker>::borrow(val),
2995                    encoder, offset + 8, _depth
2996                )
2997            }
2998            PrefixDelegationConfig::PrefixLength(ref val) => {
2999                fidl::encoding::encode_in_envelope::<u8, D>(
3000                    <u8 as fidl::encoding::ValueTypeMarker>::borrow(val),
3001                    encoder, offset + 8, _depth
3002                )
3003            }
3004            PrefixDelegationConfig::Prefix(ref val) => {
3005                fidl::encoding::encode_in_envelope::<fidl_fuchsia_net_common::Ipv6AddressWithPrefix, D>(
3006                    <fidl_fuchsia_net_common::Ipv6AddressWithPrefix as fidl::encoding::ValueTypeMarker>::borrow(val),
3007                    encoder, offset + 8, _depth
3008                )
3009            }
3010        }
3011        }
3012    }
3013
3014    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3015        for PrefixDelegationConfig
3016    {
3017        #[inline(always)]
3018        fn new_empty() -> Self {
3019            Self::Empty(fidl::new_empty!(Empty, D))
3020        }
3021
3022        #[inline]
3023        unsafe fn decode(
3024            &mut self,
3025            decoder: &mut fidl::encoding::Decoder<'_, D>,
3026            offset: usize,
3027            mut depth: fidl::encoding::Depth,
3028        ) -> fidl::Result<()> {
3029            decoder.debug_check_bounds::<Self>(offset);
3030            #[allow(unused_variables)]
3031            let next_out_of_line = decoder.next_out_of_line();
3032            let handles_before = decoder.remaining_handles();
3033            let (ordinal, inlined, num_bytes, num_handles) =
3034                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
3035
3036            let member_inline_size = match ordinal {
3037            1 => <Empty as fidl::encoding::TypeMarker>::inline_size(decoder.context),
3038            2 => <u8 as fidl::encoding::TypeMarker>::inline_size(decoder.context),
3039            3 => <fidl_fuchsia_net_common::Ipv6AddressWithPrefix as fidl::encoding::TypeMarker>::inline_size(decoder.context),
3040            _ => return Err(fidl::Error::UnknownUnionTag),
3041        };
3042
3043            if inlined != (member_inline_size <= 4) {
3044                return Err(fidl::Error::InvalidInlineBitInEnvelope);
3045            }
3046            let _inner_offset;
3047            if inlined {
3048                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
3049                _inner_offset = offset + 8;
3050            } else {
3051                depth.increment()?;
3052                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3053            }
3054            match ordinal {
3055                1 => {
3056                    #[allow(irrefutable_let_patterns)]
3057                    if let PrefixDelegationConfig::Empty(_) = self {
3058                        // Do nothing, read the value into the object
3059                    } else {
3060                        // Initialize `self` to the right variant
3061                        *self = PrefixDelegationConfig::Empty(fidl::new_empty!(Empty, D));
3062                    }
3063                    #[allow(irrefutable_let_patterns)]
3064                    if let PrefixDelegationConfig::Empty(ref mut val) = self {
3065                        fidl::decode!(Empty, D, val, decoder, _inner_offset, depth)?;
3066                    } else {
3067                        unreachable!()
3068                    }
3069                }
3070                2 => {
3071                    #[allow(irrefutable_let_patterns)]
3072                    if let PrefixDelegationConfig::PrefixLength(_) = self {
3073                        // Do nothing, read the value into the object
3074                    } else {
3075                        // Initialize `self` to the right variant
3076                        *self = PrefixDelegationConfig::PrefixLength(fidl::new_empty!(u8, D));
3077                    }
3078                    #[allow(irrefutable_let_patterns)]
3079                    if let PrefixDelegationConfig::PrefixLength(ref mut val) = self {
3080                        fidl::decode!(u8, D, val, decoder, _inner_offset, depth)?;
3081                    } else {
3082                        unreachable!()
3083                    }
3084                }
3085                3 => {
3086                    #[allow(irrefutable_let_patterns)]
3087                    if let PrefixDelegationConfig::Prefix(_) = self {
3088                        // Do nothing, read the value into the object
3089                    } else {
3090                        // Initialize `self` to the right variant
3091                        *self = PrefixDelegationConfig::Prefix(fidl::new_empty!(
3092                            fidl_fuchsia_net_common::Ipv6AddressWithPrefix,
3093                            D
3094                        ));
3095                    }
3096                    #[allow(irrefutable_let_patterns)]
3097                    if let PrefixDelegationConfig::Prefix(ref mut val) = self {
3098                        fidl::decode!(
3099                            fidl_fuchsia_net_common::Ipv6AddressWithPrefix,
3100                            D,
3101                            val,
3102                            decoder,
3103                            _inner_offset,
3104                            depth
3105                        )?;
3106                    } else {
3107                        unreachable!()
3108                    }
3109                }
3110                ordinal => panic!("unexpected ordinal {:?}", ordinal),
3111            }
3112            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
3113                return Err(fidl::Error::InvalidNumBytesInEnvelope);
3114            }
3115            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3116                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3117            }
3118            Ok(())
3119        }
3120    }
3121
3122    impl fidl::encoding::ValueTypeMarker for PrefixEvent {
3123        type Borrowed<'a> = &'a Self;
3124        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3125            value
3126        }
3127    }
3128
3129    unsafe impl fidl::encoding::TypeMarker for PrefixEvent {
3130        type Owned = Self;
3131
3132        #[inline(always)]
3133        fn inline_align(_context: fidl::encoding::Context) -> usize {
3134            8
3135        }
3136
3137        #[inline(always)]
3138        fn inline_size(_context: fidl::encoding::Context) -> usize {
3139            16
3140        }
3141    }
3142
3143    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<PrefixEvent, D>
3144        for &PrefixEvent
3145    {
3146        #[inline]
3147        unsafe fn encode(
3148            self,
3149            encoder: &mut fidl::encoding::Encoder<'_, D>,
3150            offset: usize,
3151            _depth: fidl::encoding::Depth,
3152        ) -> fidl::Result<()> {
3153            encoder.debug_check_bounds::<PrefixEvent>(offset);
3154            encoder.write_num::<u64>(self.ordinal(), offset);
3155            match self {
3156                PrefixEvent::Unassigned(ref val) => fidl::encoding::encode_in_envelope::<Empty, D>(
3157                    <Empty as fidl::encoding::ValueTypeMarker>::borrow(val),
3158                    encoder,
3159                    offset + 8,
3160                    _depth,
3161                ),
3162                PrefixEvent::Assigned(ref val) => fidl::encoding::encode_in_envelope::<Prefix, D>(
3163                    <Prefix as fidl::encoding::ValueTypeMarker>::borrow(val),
3164                    encoder,
3165                    offset + 8,
3166                    _depth,
3167                ),
3168            }
3169        }
3170    }
3171
3172    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for PrefixEvent {
3173        #[inline(always)]
3174        fn new_empty() -> Self {
3175            Self::Unassigned(fidl::new_empty!(Empty, D))
3176        }
3177
3178        #[inline]
3179        unsafe fn decode(
3180            &mut self,
3181            decoder: &mut fidl::encoding::Decoder<'_, D>,
3182            offset: usize,
3183            mut depth: fidl::encoding::Depth,
3184        ) -> fidl::Result<()> {
3185            decoder.debug_check_bounds::<Self>(offset);
3186            #[allow(unused_variables)]
3187            let next_out_of_line = decoder.next_out_of_line();
3188            let handles_before = decoder.remaining_handles();
3189            let (ordinal, inlined, num_bytes, num_handles) =
3190                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
3191
3192            let member_inline_size = match ordinal {
3193                1 => <Empty as fidl::encoding::TypeMarker>::inline_size(decoder.context),
3194                2 => <Prefix as fidl::encoding::TypeMarker>::inline_size(decoder.context),
3195                _ => return Err(fidl::Error::UnknownUnionTag),
3196            };
3197
3198            if inlined != (member_inline_size <= 4) {
3199                return Err(fidl::Error::InvalidInlineBitInEnvelope);
3200            }
3201            let _inner_offset;
3202            if inlined {
3203                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
3204                _inner_offset = offset + 8;
3205            } else {
3206                depth.increment()?;
3207                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3208            }
3209            match ordinal {
3210                1 => {
3211                    #[allow(irrefutable_let_patterns)]
3212                    if let PrefixEvent::Unassigned(_) = self {
3213                        // Do nothing, read the value into the object
3214                    } else {
3215                        // Initialize `self` to the right variant
3216                        *self = PrefixEvent::Unassigned(fidl::new_empty!(Empty, D));
3217                    }
3218                    #[allow(irrefutable_let_patterns)]
3219                    if let PrefixEvent::Unassigned(ref mut val) = self {
3220                        fidl::decode!(Empty, D, val, decoder, _inner_offset, depth)?;
3221                    } else {
3222                        unreachable!()
3223                    }
3224                }
3225                2 => {
3226                    #[allow(irrefutable_let_patterns)]
3227                    if let PrefixEvent::Assigned(_) = self {
3228                        // Do nothing, read the value into the object
3229                    } else {
3230                        // Initialize `self` to the right variant
3231                        *self = PrefixEvent::Assigned(fidl::new_empty!(Prefix, D));
3232                    }
3233                    #[allow(irrefutable_let_patterns)]
3234                    if let PrefixEvent::Assigned(ref mut val) = self {
3235                        fidl::decode!(Prefix, D, val, decoder, _inner_offset, depth)?;
3236                    } else {
3237                        unreachable!()
3238                    }
3239                }
3240                ordinal => panic!("unexpected ordinal {:?}", ordinal),
3241            }
3242            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
3243                return Err(fidl::Error::InvalidNumBytesInEnvelope);
3244            }
3245            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3246                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3247            }
3248            Ok(())
3249        }
3250    }
3251}