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