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
543pub mod client_ordinals {
544    pub const WATCH_SERVERS: u64 = 0x5748907e7f11b632;
545    pub const WATCH_ADDRESS: u64 = 0x942e6f66f63721c;
546    pub const WATCH_PREFIXES: u64 = 0x3b7908cc71ae2a5e;
547    pub const SHUTDOWN: u64 = 0x6da95f1bcd43fa11;
548}
549
550pub mod client_provider_ordinals {
551    pub const NEW_CLIENT: u64 = 0x269268c97d062419;
552}
553
554pub mod prefix_control_ordinals {
555    pub const WATCH_PREFIX: u64 = 0x1f5c40d4d1e84d84;
556    pub const ON_EXIT: u64 = 0x353b8c435cbe08f9;
557}
558
559pub mod prefix_provider_ordinals {
560    pub const ACQUIRE_PREFIX: u64 = 0x24eff9a5ce404cf8;
561}
562
563mod internal {
564    use super::*;
565    unsafe impl fidl::encoding::TypeMarker for PrefixControlExitReason {
566        type Owned = Self;
567
568        #[inline(always)]
569        fn inline_align(_context: fidl::encoding::Context) -> usize {
570            std::mem::align_of::<u32>()
571        }
572
573        #[inline(always)]
574        fn inline_size(_context: fidl::encoding::Context) -> usize {
575            std::mem::size_of::<u32>()
576        }
577
578        #[inline(always)]
579        fn encode_is_copy() -> bool {
580            false
581        }
582
583        #[inline(always)]
584        fn decode_is_copy() -> bool {
585            false
586        }
587    }
588
589    impl fidl::encoding::ValueTypeMarker for PrefixControlExitReason {
590        type Borrowed<'a> = Self;
591        #[inline(always)]
592        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
593            *value
594        }
595    }
596
597    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
598        for PrefixControlExitReason
599    {
600        #[inline]
601        unsafe fn encode(
602            self,
603            encoder: &mut fidl::encoding::Encoder<'_, D>,
604            offset: usize,
605            _depth: fidl::encoding::Depth,
606        ) -> fidl::Result<()> {
607            encoder.debug_check_bounds::<Self>(offset);
608            encoder.write_num(self.into_primitive(), offset);
609            Ok(())
610        }
611    }
612
613    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
614        for PrefixControlExitReason
615    {
616        #[inline(always)]
617        fn new_empty() -> Self {
618            Self::unknown()
619        }
620
621        #[inline]
622        unsafe fn decode(
623            &mut self,
624            decoder: &mut fidl::encoding::Decoder<'_, D>,
625            offset: usize,
626            _depth: fidl::encoding::Depth,
627        ) -> fidl::Result<()> {
628            decoder.debug_check_bounds::<Self>(offset);
629            let prim = decoder.read_num::<u32>(offset);
630
631            *self = Self::from_primitive_allow_unknown(prim);
632            Ok(())
633        }
634    }
635
636    impl fidl::encoding::ValueTypeMarker for ClientWatchPrefixesResponse {
637        type Borrowed<'a> = &'a Self;
638        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
639            value
640        }
641    }
642
643    unsafe impl fidl::encoding::TypeMarker for ClientWatchPrefixesResponse {
644        type Owned = Self;
645
646        #[inline(always)]
647        fn inline_align(_context: fidl::encoding::Context) -> usize {
648            8
649        }
650
651        #[inline(always)]
652        fn inline_size(_context: fidl::encoding::Context) -> usize {
653            16
654        }
655    }
656
657    unsafe impl<D: fidl::encoding::ResourceDialect>
658        fidl::encoding::Encode<ClientWatchPrefixesResponse, D> for &ClientWatchPrefixesResponse
659    {
660        #[inline]
661        unsafe fn encode(
662            self,
663            encoder: &mut fidl::encoding::Encoder<'_, D>,
664            offset: usize,
665            _depth: fidl::encoding::Depth,
666        ) -> fidl::Result<()> {
667            encoder.debug_check_bounds::<ClientWatchPrefixesResponse>(offset);
668            // Delegate to tuple encoding.
669            fidl::encoding::Encode::<ClientWatchPrefixesResponse, D>::encode(
670                (
671                    <fidl::encoding::UnboundedVector<Prefix> as fidl::encoding::ValueTypeMarker>::borrow(&self.prefixes),
672                ),
673                encoder, offset, _depth
674            )
675        }
676    }
677    unsafe impl<
678            D: fidl::encoding::ResourceDialect,
679            T0: fidl::encoding::Encode<fidl::encoding::UnboundedVector<Prefix>, D>,
680        > fidl::encoding::Encode<ClientWatchPrefixesResponse, D> for (T0,)
681    {
682        #[inline]
683        unsafe fn encode(
684            self,
685            encoder: &mut fidl::encoding::Encoder<'_, D>,
686            offset: usize,
687            depth: fidl::encoding::Depth,
688        ) -> fidl::Result<()> {
689            encoder.debug_check_bounds::<ClientWatchPrefixesResponse>(offset);
690            // Zero out padding regions. There's no need to apply masks
691            // because the unmasked parts will be overwritten by fields.
692            // Write the fields.
693            self.0.encode(encoder, offset + 0, depth)?;
694            Ok(())
695        }
696    }
697
698    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
699        for ClientWatchPrefixesResponse
700    {
701        #[inline(always)]
702        fn new_empty() -> Self {
703            Self { prefixes: fidl::new_empty!(fidl::encoding::UnboundedVector<Prefix>, D) }
704        }
705
706        #[inline]
707        unsafe fn decode(
708            &mut self,
709            decoder: &mut fidl::encoding::Decoder<'_, D>,
710            offset: usize,
711            _depth: fidl::encoding::Depth,
712        ) -> fidl::Result<()> {
713            decoder.debug_check_bounds::<Self>(offset);
714            // Verify that padding bytes are zero.
715            fidl::decode!(
716                fidl::encoding::UnboundedVector<Prefix>,
717                D,
718                &mut self.prefixes,
719                decoder,
720                offset + 0,
721                _depth
722            )?;
723            Ok(())
724        }
725    }
726
727    impl fidl::encoding::ValueTypeMarker for Empty {
728        type Borrowed<'a> = &'a Self;
729        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
730            value
731        }
732    }
733
734    unsafe impl fidl::encoding::TypeMarker for Empty {
735        type Owned = Self;
736
737        #[inline(always)]
738        fn inline_align(_context: fidl::encoding::Context) -> usize {
739            1
740        }
741
742        #[inline(always)]
743        fn inline_size(_context: fidl::encoding::Context) -> usize {
744            1
745        }
746    }
747
748    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Empty, D> for &Empty {
749        #[inline]
750        unsafe fn encode(
751            self,
752            encoder: &mut fidl::encoding::Encoder<'_, D>,
753            offset: usize,
754            _depth: fidl::encoding::Depth,
755        ) -> fidl::Result<()> {
756            encoder.debug_check_bounds::<Empty>(offset);
757            encoder.write_num(0u8, offset);
758            Ok(())
759        }
760    }
761
762    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Empty {
763        #[inline(always)]
764        fn new_empty() -> Self {
765            Self
766        }
767
768        #[inline]
769        unsafe fn decode(
770            &mut self,
771            decoder: &mut fidl::encoding::Decoder<'_, D>,
772            offset: usize,
773            _depth: fidl::encoding::Depth,
774        ) -> fidl::Result<()> {
775            decoder.debug_check_bounds::<Self>(offset);
776            match decoder.read_num::<u8>(offset) {
777                0 => Ok(()),
778                _ => Err(fidl::Error::Invalid),
779            }
780        }
781    }
782
783    impl fidl::encoding::ValueTypeMarker for Lifetimes {
784        type Borrowed<'a> = &'a Self;
785        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
786            value
787        }
788    }
789
790    unsafe impl fidl::encoding::TypeMarker for Lifetimes {
791        type Owned = Self;
792
793        #[inline(always)]
794        fn inline_align(_context: fidl::encoding::Context) -> usize {
795            8
796        }
797
798        #[inline(always)]
799        fn inline_size(_context: fidl::encoding::Context) -> usize {
800            16
801        }
802        #[inline(always)]
803        fn encode_is_copy() -> bool {
804            true
805        }
806
807        #[inline(always)]
808        fn decode_is_copy() -> bool {
809            true
810        }
811    }
812
813    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Lifetimes, D>
814        for &Lifetimes
815    {
816        #[inline]
817        unsafe fn encode(
818            self,
819            encoder: &mut fidl::encoding::Encoder<'_, D>,
820            offset: usize,
821            _depth: fidl::encoding::Depth,
822        ) -> fidl::Result<()> {
823            encoder.debug_check_bounds::<Lifetimes>(offset);
824            unsafe {
825                // Copy the object into the buffer.
826                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
827                (buf_ptr as *mut Lifetimes).write_unaligned((self as *const Lifetimes).read());
828                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
829                // done second because the memcpy will write garbage to these bytes.
830            }
831            Ok(())
832        }
833    }
834    unsafe impl<
835            D: fidl::encoding::ResourceDialect,
836            T0: fidl::encoding::Encode<i64, D>,
837            T1: fidl::encoding::Encode<i64, D>,
838        > fidl::encoding::Encode<Lifetimes, D> for (T0, T1)
839    {
840        #[inline]
841        unsafe fn encode(
842            self,
843            encoder: &mut fidl::encoding::Encoder<'_, D>,
844            offset: usize,
845            depth: fidl::encoding::Depth,
846        ) -> fidl::Result<()> {
847            encoder.debug_check_bounds::<Lifetimes>(offset);
848            // Zero out padding regions. There's no need to apply masks
849            // because the unmasked parts will be overwritten by fields.
850            // Write the fields.
851            self.0.encode(encoder, offset + 0, depth)?;
852            self.1.encode(encoder, offset + 8, depth)?;
853            Ok(())
854        }
855    }
856
857    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Lifetimes {
858        #[inline(always)]
859        fn new_empty() -> Self {
860            Self {
861                valid_until: fidl::new_empty!(i64, D),
862                preferred_until: fidl::new_empty!(i64, D),
863            }
864        }
865
866        #[inline]
867        unsafe fn decode(
868            &mut self,
869            decoder: &mut fidl::encoding::Decoder<'_, D>,
870            offset: usize,
871            _depth: fidl::encoding::Depth,
872        ) -> fidl::Result<()> {
873            decoder.debug_check_bounds::<Self>(offset);
874            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
875            // Verify that padding bytes are zero.
876            // Copy from the buffer into the object.
877            unsafe {
878                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 16);
879            }
880            Ok(())
881        }
882    }
883
884    impl fidl::encoding::ValueTypeMarker for LinkLayerAddressPlusTime {
885        type Borrowed<'a> = &'a Self;
886        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
887            value
888        }
889    }
890
891    unsafe impl fidl::encoding::TypeMarker for LinkLayerAddressPlusTime {
892        type Owned = Self;
893
894        #[inline(always)]
895        fn inline_align(_context: fidl::encoding::Context) -> usize {
896            8
897        }
898
899        #[inline(always)]
900        fn inline_size(_context: fidl::encoding::Context) -> usize {
901            24
902        }
903    }
904
905    unsafe impl<D: fidl::encoding::ResourceDialect>
906        fidl::encoding::Encode<LinkLayerAddressPlusTime, D> for &LinkLayerAddressPlusTime
907    {
908        #[inline]
909        unsafe fn encode(
910            self,
911            encoder: &mut fidl::encoding::Encoder<'_, D>,
912            offset: usize,
913            _depth: fidl::encoding::Depth,
914        ) -> fidl::Result<()> {
915            encoder.debug_check_bounds::<LinkLayerAddressPlusTime>(offset);
916            // Delegate to tuple encoding.
917            fidl::encoding::Encode::<LinkLayerAddressPlusTime, D>::encode(
918                (
919                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.time),
920                    <LinkLayerAddress as fidl::encoding::ValueTypeMarker>::borrow(
921                        &self.link_layer_address,
922                    ),
923                ),
924                encoder,
925                offset,
926                _depth,
927            )
928        }
929    }
930    unsafe impl<
931            D: fidl::encoding::ResourceDialect,
932            T0: fidl::encoding::Encode<u32, D>,
933            T1: fidl::encoding::Encode<LinkLayerAddress, D>,
934        > fidl::encoding::Encode<LinkLayerAddressPlusTime, D> for (T0, T1)
935    {
936        #[inline]
937        unsafe fn encode(
938            self,
939            encoder: &mut fidl::encoding::Encoder<'_, D>,
940            offset: usize,
941            depth: fidl::encoding::Depth,
942        ) -> fidl::Result<()> {
943            encoder.debug_check_bounds::<LinkLayerAddressPlusTime>(offset);
944            // Zero out padding regions. There's no need to apply masks
945            // because the unmasked parts will be overwritten by fields.
946            unsafe {
947                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
948                (ptr as *mut u64).write_unaligned(0);
949            }
950            // Write the fields.
951            self.0.encode(encoder, offset + 0, depth)?;
952            self.1.encode(encoder, offset + 8, depth)?;
953            Ok(())
954        }
955    }
956
957    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
958        for LinkLayerAddressPlusTime
959    {
960        #[inline(always)]
961        fn new_empty() -> Self {
962            Self {
963                time: fidl::new_empty!(u32, D),
964                link_layer_address: fidl::new_empty!(LinkLayerAddress, D),
965            }
966        }
967
968        #[inline]
969        unsafe fn decode(
970            &mut self,
971            decoder: &mut fidl::encoding::Decoder<'_, D>,
972            offset: usize,
973            _depth: fidl::encoding::Depth,
974        ) -> fidl::Result<()> {
975            decoder.debug_check_bounds::<Self>(offset);
976            // Verify that padding bytes are zero.
977            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
978            let padval = unsafe { (ptr as *const u64).read_unaligned() };
979            let mask = 0xffffffff00000000u64;
980            let maskedval = padval & mask;
981            if maskedval != 0 {
982                return Err(fidl::Error::NonZeroPadding {
983                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
984                });
985            }
986            fidl::decode!(u32, D, &mut self.time, decoder, offset + 0, _depth)?;
987            fidl::decode!(
988                LinkLayerAddress,
989                D,
990                &mut self.link_layer_address,
991                decoder,
992                offset + 8,
993                _depth
994            )?;
995            Ok(())
996        }
997    }
998
999    impl fidl::encoding::ValueTypeMarker for Prefix {
1000        type Borrowed<'a> = &'a Self;
1001        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1002            value
1003        }
1004    }
1005
1006    unsafe impl fidl::encoding::TypeMarker for Prefix {
1007        type Owned = Self;
1008
1009        #[inline(always)]
1010        fn inline_align(_context: fidl::encoding::Context) -> usize {
1011            8
1012        }
1013
1014        #[inline(always)]
1015        fn inline_size(_context: fidl::encoding::Context) -> usize {
1016            40
1017        }
1018    }
1019
1020    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Prefix, D> for &Prefix {
1021        #[inline]
1022        unsafe fn encode(
1023            self,
1024            encoder: &mut fidl::encoding::Encoder<'_, D>,
1025            offset: usize,
1026            _depth: fidl::encoding::Depth,
1027        ) -> fidl::Result<()> {
1028            encoder.debug_check_bounds::<Prefix>(offset);
1029            // Delegate to tuple encoding.
1030            fidl::encoding::Encode::<Prefix, D>::encode(
1031                (
1032                    <fidl_fuchsia_net__common::Ipv6AddressWithPrefix as fidl::encoding::ValueTypeMarker>::borrow(&self.prefix),
1033                    <Lifetimes as fidl::encoding::ValueTypeMarker>::borrow(&self.lifetimes),
1034                ),
1035                encoder, offset, _depth
1036            )
1037        }
1038    }
1039    unsafe impl<
1040            D: fidl::encoding::ResourceDialect,
1041            T0: fidl::encoding::Encode<fidl_fuchsia_net__common::Ipv6AddressWithPrefix, D>,
1042            T1: fidl::encoding::Encode<Lifetimes, D>,
1043        > fidl::encoding::Encode<Prefix, D> for (T0, T1)
1044    {
1045        #[inline]
1046        unsafe fn encode(
1047            self,
1048            encoder: &mut fidl::encoding::Encoder<'_, D>,
1049            offset: usize,
1050            depth: fidl::encoding::Depth,
1051        ) -> fidl::Result<()> {
1052            encoder.debug_check_bounds::<Prefix>(offset);
1053            // Zero out padding regions. There's no need to apply masks
1054            // because the unmasked parts will be overwritten by fields.
1055            unsafe {
1056                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
1057                (ptr as *mut u64).write_unaligned(0);
1058            }
1059            // Write the fields.
1060            self.0.encode(encoder, offset + 0, depth)?;
1061            self.1.encode(encoder, offset + 24, depth)?;
1062            Ok(())
1063        }
1064    }
1065
1066    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Prefix {
1067        #[inline(always)]
1068        fn new_empty() -> Self {
1069            Self {
1070                prefix: fidl::new_empty!(fidl_fuchsia_net__common::Ipv6AddressWithPrefix, D),
1071                lifetimes: fidl::new_empty!(Lifetimes, D),
1072            }
1073        }
1074
1075        #[inline]
1076        unsafe fn decode(
1077            &mut self,
1078            decoder: &mut fidl::encoding::Decoder<'_, D>,
1079            offset: usize,
1080            _depth: fidl::encoding::Depth,
1081        ) -> fidl::Result<()> {
1082            decoder.debug_check_bounds::<Self>(offset);
1083            // Verify that padding bytes are zero.
1084            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
1085            let padval = unsafe { (ptr as *const u64).read_unaligned() };
1086            let mask = 0xffffffffffffff00u64;
1087            let maskedval = padval & mask;
1088            if maskedval != 0 {
1089                return Err(fidl::Error::NonZeroPadding {
1090                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
1091                });
1092            }
1093            fidl::decode!(
1094                fidl_fuchsia_net__common::Ipv6AddressWithPrefix,
1095                D,
1096                &mut self.prefix,
1097                decoder,
1098                offset + 0,
1099                _depth
1100            )?;
1101            fidl::decode!(Lifetimes, D, &mut self.lifetimes, decoder, offset + 24, _depth)?;
1102            Ok(())
1103        }
1104    }
1105
1106    impl fidl::encoding::ValueTypeMarker for PrefixControlOnExitRequest {
1107        type Borrowed<'a> = &'a Self;
1108        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1109            value
1110        }
1111    }
1112
1113    unsafe impl fidl::encoding::TypeMarker for PrefixControlOnExitRequest {
1114        type Owned = Self;
1115
1116        #[inline(always)]
1117        fn inline_align(_context: fidl::encoding::Context) -> usize {
1118            4
1119        }
1120
1121        #[inline(always)]
1122        fn inline_size(_context: fidl::encoding::Context) -> usize {
1123            4
1124        }
1125    }
1126
1127    unsafe impl<D: fidl::encoding::ResourceDialect>
1128        fidl::encoding::Encode<PrefixControlOnExitRequest, D> for &PrefixControlOnExitRequest
1129    {
1130        #[inline]
1131        unsafe fn encode(
1132            self,
1133            encoder: &mut fidl::encoding::Encoder<'_, D>,
1134            offset: usize,
1135            _depth: fidl::encoding::Depth,
1136        ) -> fidl::Result<()> {
1137            encoder.debug_check_bounds::<PrefixControlOnExitRequest>(offset);
1138            // Delegate to tuple encoding.
1139            fidl::encoding::Encode::<PrefixControlOnExitRequest, D>::encode(
1140                (<PrefixControlExitReason as fidl::encoding::ValueTypeMarker>::borrow(
1141                    &self.reason,
1142                ),),
1143                encoder,
1144                offset,
1145                _depth,
1146            )
1147        }
1148    }
1149    unsafe impl<
1150            D: fidl::encoding::ResourceDialect,
1151            T0: fidl::encoding::Encode<PrefixControlExitReason, D>,
1152        > fidl::encoding::Encode<PrefixControlOnExitRequest, D> for (T0,)
1153    {
1154        #[inline]
1155        unsafe fn encode(
1156            self,
1157            encoder: &mut fidl::encoding::Encoder<'_, D>,
1158            offset: usize,
1159            depth: fidl::encoding::Depth,
1160        ) -> fidl::Result<()> {
1161            encoder.debug_check_bounds::<PrefixControlOnExitRequest>(offset);
1162            // Zero out padding regions. There's no need to apply masks
1163            // because the unmasked parts will be overwritten by fields.
1164            // Write the fields.
1165            self.0.encode(encoder, offset + 0, depth)?;
1166            Ok(())
1167        }
1168    }
1169
1170    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1171        for PrefixControlOnExitRequest
1172    {
1173        #[inline(always)]
1174        fn new_empty() -> Self {
1175            Self { reason: fidl::new_empty!(PrefixControlExitReason, D) }
1176        }
1177
1178        #[inline]
1179        unsafe fn decode(
1180            &mut self,
1181            decoder: &mut fidl::encoding::Decoder<'_, D>,
1182            offset: usize,
1183            _depth: fidl::encoding::Depth,
1184        ) -> fidl::Result<()> {
1185            decoder.debug_check_bounds::<Self>(offset);
1186            // Verify that padding bytes are zero.
1187            fidl::decode!(
1188                PrefixControlExitReason,
1189                D,
1190                &mut self.reason,
1191                decoder,
1192                offset + 0,
1193                _depth
1194            )?;
1195            Ok(())
1196        }
1197    }
1198
1199    impl fidl::encoding::ValueTypeMarker for PrefixControlWatchPrefixResponse {
1200        type Borrowed<'a> = &'a Self;
1201        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1202            value
1203        }
1204    }
1205
1206    unsafe impl fidl::encoding::TypeMarker for PrefixControlWatchPrefixResponse {
1207        type Owned = Self;
1208
1209        #[inline(always)]
1210        fn inline_align(_context: fidl::encoding::Context) -> usize {
1211            8
1212        }
1213
1214        #[inline(always)]
1215        fn inline_size(_context: fidl::encoding::Context) -> usize {
1216            16
1217        }
1218    }
1219
1220    unsafe impl<D: fidl::encoding::ResourceDialect>
1221        fidl::encoding::Encode<PrefixControlWatchPrefixResponse, D>
1222        for &PrefixControlWatchPrefixResponse
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            // Delegate to tuple encoding.
1233            fidl::encoding::Encode::<PrefixControlWatchPrefixResponse, D>::encode(
1234                (<PrefixEvent as fidl::encoding::ValueTypeMarker>::borrow(&self.event),),
1235                encoder,
1236                offset,
1237                _depth,
1238            )
1239        }
1240    }
1241    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<PrefixEvent, D>>
1242        fidl::encoding::Encode<PrefixControlWatchPrefixResponse, D> for (T0,)
1243    {
1244        #[inline]
1245        unsafe fn encode(
1246            self,
1247            encoder: &mut fidl::encoding::Encoder<'_, D>,
1248            offset: usize,
1249            depth: fidl::encoding::Depth,
1250        ) -> fidl::Result<()> {
1251            encoder.debug_check_bounds::<PrefixControlWatchPrefixResponse>(offset);
1252            // Zero out padding regions. There's no need to apply masks
1253            // because the unmasked parts will be overwritten by fields.
1254            // Write the fields.
1255            self.0.encode(encoder, offset + 0, depth)?;
1256            Ok(())
1257        }
1258    }
1259
1260    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1261        for PrefixControlWatchPrefixResponse
1262    {
1263        #[inline(always)]
1264        fn new_empty() -> Self {
1265            Self { event: fidl::new_empty!(PrefixEvent, D) }
1266        }
1267
1268        #[inline]
1269        unsafe fn decode(
1270            &mut self,
1271            decoder: &mut fidl::encoding::Decoder<'_, D>,
1272            offset: usize,
1273            _depth: fidl::encoding::Depth,
1274        ) -> fidl::Result<()> {
1275            decoder.debug_check_bounds::<Self>(offset);
1276            // Verify that padding bytes are zero.
1277            fidl::decode!(PrefixEvent, D, &mut self.event, decoder, offset + 0, _depth)?;
1278            Ok(())
1279        }
1280    }
1281
1282    impl AcquirePrefixConfig {
1283        #[inline(always)]
1284        fn max_ordinal_present(&self) -> u64 {
1285            if let Some(_) = self.preferred_prefix_len {
1286                return 2;
1287            }
1288            if let Some(_) = self.interface_id {
1289                return 1;
1290            }
1291            0
1292        }
1293    }
1294
1295    impl fidl::encoding::ValueTypeMarker for AcquirePrefixConfig {
1296        type Borrowed<'a> = &'a Self;
1297        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1298            value
1299        }
1300    }
1301
1302    unsafe impl fidl::encoding::TypeMarker for AcquirePrefixConfig {
1303        type Owned = Self;
1304
1305        #[inline(always)]
1306        fn inline_align(_context: fidl::encoding::Context) -> usize {
1307            8
1308        }
1309
1310        #[inline(always)]
1311        fn inline_size(_context: fidl::encoding::Context) -> usize {
1312            16
1313        }
1314    }
1315
1316    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<AcquirePrefixConfig, D>
1317        for &AcquirePrefixConfig
1318    {
1319        unsafe fn encode(
1320            self,
1321            encoder: &mut fidl::encoding::Encoder<'_, D>,
1322            offset: usize,
1323            mut depth: fidl::encoding::Depth,
1324        ) -> fidl::Result<()> {
1325            encoder.debug_check_bounds::<AcquirePrefixConfig>(offset);
1326            // Vector header
1327            let max_ordinal: u64 = self.max_ordinal_present();
1328            encoder.write_num(max_ordinal, offset);
1329            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
1330            // Calling encoder.out_of_line_offset(0) is not allowed.
1331            if max_ordinal == 0 {
1332                return Ok(());
1333            }
1334            depth.increment()?;
1335            let envelope_size = 8;
1336            let bytes_len = max_ordinal as usize * envelope_size;
1337            #[allow(unused_variables)]
1338            let offset = encoder.out_of_line_offset(bytes_len);
1339            let mut _prev_end_offset: usize = 0;
1340            if 1 > max_ordinal {
1341                return Ok(());
1342            }
1343
1344            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1345            // are envelope_size bytes.
1346            let cur_offset: usize = (1 - 1) * envelope_size;
1347
1348            // Zero reserved fields.
1349            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1350
1351            // Safety:
1352            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1353            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1354            //   envelope_size bytes, there is always sufficient room.
1355            fidl::encoding::encode_in_envelope_optional::<u64, D>(
1356                self.interface_id.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
1357                encoder,
1358                offset + cur_offset,
1359                depth,
1360            )?;
1361
1362            _prev_end_offset = cur_offset + envelope_size;
1363            if 2 > max_ordinal {
1364                return Ok(());
1365            }
1366
1367            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1368            // are envelope_size bytes.
1369            let cur_offset: usize = (2 - 1) * envelope_size;
1370
1371            // Zero reserved fields.
1372            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1373
1374            // Safety:
1375            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1376            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1377            //   envelope_size bytes, there is always sufficient room.
1378            fidl::encoding::encode_in_envelope_optional::<u8, D>(
1379                self.preferred_prefix_len
1380                    .as_ref()
1381                    .map(<u8 as fidl::encoding::ValueTypeMarker>::borrow),
1382                encoder,
1383                offset + cur_offset,
1384                depth,
1385            )?;
1386
1387            _prev_end_offset = cur_offset + envelope_size;
1388
1389            Ok(())
1390        }
1391    }
1392
1393    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for AcquirePrefixConfig {
1394        #[inline(always)]
1395        fn new_empty() -> Self {
1396            Self::default()
1397        }
1398
1399        unsafe fn decode(
1400            &mut self,
1401            decoder: &mut fidl::encoding::Decoder<'_, D>,
1402            offset: usize,
1403            mut depth: fidl::encoding::Depth,
1404        ) -> fidl::Result<()> {
1405            decoder.debug_check_bounds::<Self>(offset);
1406            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
1407                None => return Err(fidl::Error::NotNullable),
1408                Some(len) => len,
1409            };
1410            // Calling decoder.out_of_line_offset(0) is not allowed.
1411            if len == 0 {
1412                return Ok(());
1413            };
1414            depth.increment()?;
1415            let envelope_size = 8;
1416            let bytes_len = len * envelope_size;
1417            let offset = decoder.out_of_line_offset(bytes_len)?;
1418            // Decode the envelope for each type.
1419            let mut _next_ordinal_to_read = 0;
1420            let mut next_offset = offset;
1421            let end_offset = offset + bytes_len;
1422            _next_ordinal_to_read += 1;
1423            if next_offset >= end_offset {
1424                return Ok(());
1425            }
1426
1427            // Decode unknown envelopes for gaps in ordinals.
1428            while _next_ordinal_to_read < 1 {
1429                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1430                _next_ordinal_to_read += 1;
1431                next_offset += envelope_size;
1432            }
1433
1434            let next_out_of_line = decoder.next_out_of_line();
1435            let handles_before = decoder.remaining_handles();
1436            if let Some((inlined, num_bytes, num_handles)) =
1437                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1438            {
1439                let member_inline_size =
1440                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1441                if inlined != (member_inline_size <= 4) {
1442                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1443                }
1444                let inner_offset;
1445                let mut inner_depth = depth.clone();
1446                if inlined {
1447                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1448                    inner_offset = next_offset;
1449                } else {
1450                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1451                    inner_depth.increment()?;
1452                }
1453                let val_ref = self.interface_id.get_or_insert_with(|| fidl::new_empty!(u64, D));
1454                fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
1455                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1456                {
1457                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
1458                }
1459                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1460                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1461                }
1462            }
1463
1464            next_offset += envelope_size;
1465            _next_ordinal_to_read += 1;
1466            if next_offset >= end_offset {
1467                return Ok(());
1468            }
1469
1470            // Decode unknown envelopes for gaps in ordinals.
1471            while _next_ordinal_to_read < 2 {
1472                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1473                _next_ordinal_to_read += 1;
1474                next_offset += envelope_size;
1475            }
1476
1477            let next_out_of_line = decoder.next_out_of_line();
1478            let handles_before = decoder.remaining_handles();
1479            if let Some((inlined, num_bytes, num_handles)) =
1480                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1481            {
1482                let member_inline_size =
1483                    <u8 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1484                if inlined != (member_inline_size <= 4) {
1485                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1486                }
1487                let inner_offset;
1488                let mut inner_depth = depth.clone();
1489                if inlined {
1490                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1491                    inner_offset = next_offset;
1492                } else {
1493                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1494                    inner_depth.increment()?;
1495                }
1496                let val_ref =
1497                    self.preferred_prefix_len.get_or_insert_with(|| fidl::new_empty!(u8, D));
1498                fidl::decode!(u8, D, val_ref, decoder, inner_offset, inner_depth)?;
1499                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1500                {
1501                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
1502                }
1503                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1504                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1505                }
1506            }
1507
1508            next_offset += envelope_size;
1509
1510            // Decode the remaining unknown envelopes.
1511            while next_offset < end_offset {
1512                _next_ordinal_to_read += 1;
1513                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1514                next_offset += envelope_size;
1515            }
1516
1517            Ok(())
1518        }
1519    }
1520
1521    impl AddressConfig {
1522        #[inline(always)]
1523        fn max_ordinal_present(&self) -> u64 {
1524            if let Some(_) = self.preferred_addresses {
1525                return 2;
1526            }
1527            if let Some(_) = self.address_count {
1528                return 1;
1529            }
1530            0
1531        }
1532    }
1533
1534    impl fidl::encoding::ValueTypeMarker for AddressConfig {
1535        type Borrowed<'a> = &'a Self;
1536        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1537            value
1538        }
1539    }
1540
1541    unsafe impl fidl::encoding::TypeMarker for AddressConfig {
1542        type Owned = Self;
1543
1544        #[inline(always)]
1545        fn inline_align(_context: fidl::encoding::Context) -> usize {
1546            8
1547        }
1548
1549        #[inline(always)]
1550        fn inline_size(_context: fidl::encoding::Context) -> usize {
1551            16
1552        }
1553    }
1554
1555    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<AddressConfig, D>
1556        for &AddressConfig
1557    {
1558        unsafe fn encode(
1559            self,
1560            encoder: &mut fidl::encoding::Encoder<'_, D>,
1561            offset: usize,
1562            mut depth: fidl::encoding::Depth,
1563        ) -> fidl::Result<()> {
1564            encoder.debug_check_bounds::<AddressConfig>(offset);
1565            // Vector header
1566            let max_ordinal: u64 = self.max_ordinal_present();
1567            encoder.write_num(max_ordinal, offset);
1568            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
1569            // Calling encoder.out_of_line_offset(0) is not allowed.
1570            if max_ordinal == 0 {
1571                return Ok(());
1572            }
1573            depth.increment()?;
1574            let envelope_size = 8;
1575            let bytes_len = max_ordinal as usize * envelope_size;
1576            #[allow(unused_variables)]
1577            let offset = encoder.out_of_line_offset(bytes_len);
1578            let mut _prev_end_offset: usize = 0;
1579            if 1 > max_ordinal {
1580                return Ok(());
1581            }
1582
1583            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1584            // are envelope_size bytes.
1585            let cur_offset: usize = (1 - 1) * envelope_size;
1586
1587            // Zero reserved fields.
1588            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1589
1590            // Safety:
1591            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1592            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1593            //   envelope_size bytes, there is always sufficient room.
1594            fidl::encoding::encode_in_envelope_optional::<u8, D>(
1595                self.address_count.as_ref().map(<u8 as fidl::encoding::ValueTypeMarker>::borrow),
1596                encoder,
1597                offset + cur_offset,
1598                depth,
1599            )?;
1600
1601            _prev_end_offset = cur_offset + envelope_size;
1602            if 2 > max_ordinal {
1603                return Ok(());
1604            }
1605
1606            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1607            // are envelope_size bytes.
1608            let cur_offset: usize = (2 - 1) * envelope_size;
1609
1610            // Zero reserved fields.
1611            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1612
1613            // Safety:
1614            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1615            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1616            //   envelope_size bytes, there is always sufficient room.
1617            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedVector<fidl_fuchsia_net__common::Ipv6Address>, D>(
1618            self.preferred_addresses.as_ref().map(<fidl::encoding::UnboundedVector<fidl_fuchsia_net__common::Ipv6Address> as fidl::encoding::ValueTypeMarker>::borrow),
1619            encoder, offset + cur_offset, depth
1620        )?;
1621
1622            _prev_end_offset = cur_offset + envelope_size;
1623
1624            Ok(())
1625        }
1626    }
1627
1628    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for AddressConfig {
1629        #[inline(always)]
1630        fn new_empty() -> Self {
1631            Self::default()
1632        }
1633
1634        unsafe fn decode(
1635            &mut self,
1636            decoder: &mut fidl::encoding::Decoder<'_, D>,
1637            offset: usize,
1638            mut depth: fidl::encoding::Depth,
1639        ) -> fidl::Result<()> {
1640            decoder.debug_check_bounds::<Self>(offset);
1641            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
1642                None => return Err(fidl::Error::NotNullable),
1643                Some(len) => len,
1644            };
1645            // Calling decoder.out_of_line_offset(0) is not allowed.
1646            if len == 0 {
1647                return Ok(());
1648            };
1649            depth.increment()?;
1650            let envelope_size = 8;
1651            let bytes_len = len * envelope_size;
1652            let offset = decoder.out_of_line_offset(bytes_len)?;
1653            // Decode the envelope for each type.
1654            let mut _next_ordinal_to_read = 0;
1655            let mut next_offset = offset;
1656            let end_offset = offset + bytes_len;
1657            _next_ordinal_to_read += 1;
1658            if next_offset >= end_offset {
1659                return Ok(());
1660            }
1661
1662            // Decode unknown envelopes for gaps in ordinals.
1663            while _next_ordinal_to_read < 1 {
1664                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1665                _next_ordinal_to_read += 1;
1666                next_offset += envelope_size;
1667            }
1668
1669            let next_out_of_line = decoder.next_out_of_line();
1670            let handles_before = decoder.remaining_handles();
1671            if let Some((inlined, num_bytes, num_handles)) =
1672                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1673            {
1674                let member_inline_size =
1675                    <u8 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1676                if inlined != (member_inline_size <= 4) {
1677                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1678                }
1679                let inner_offset;
1680                let mut inner_depth = depth.clone();
1681                if inlined {
1682                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1683                    inner_offset = next_offset;
1684                } else {
1685                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1686                    inner_depth.increment()?;
1687                }
1688                let val_ref = self.address_count.get_or_insert_with(|| fidl::new_empty!(u8, D));
1689                fidl::decode!(u8, D, val_ref, decoder, inner_offset, inner_depth)?;
1690                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1691                {
1692                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
1693                }
1694                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1695                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1696                }
1697            }
1698
1699            next_offset += envelope_size;
1700            _next_ordinal_to_read += 1;
1701            if next_offset >= end_offset {
1702                return Ok(());
1703            }
1704
1705            // Decode unknown envelopes for gaps in ordinals.
1706            while _next_ordinal_to_read < 2 {
1707                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1708                _next_ordinal_to_read += 1;
1709                next_offset += envelope_size;
1710            }
1711
1712            let next_out_of_line = decoder.next_out_of_line();
1713            let handles_before = decoder.remaining_handles();
1714            if let Some((inlined, num_bytes, num_handles)) =
1715                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1716            {
1717                let member_inline_size = <fidl::encoding::UnboundedVector<
1718                    fidl_fuchsia_net__common::Ipv6Address,
1719                > as fidl::encoding::TypeMarker>::inline_size(
1720                    decoder.context
1721                );
1722                if inlined != (member_inline_size <= 4) {
1723                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1724                }
1725                let inner_offset;
1726                let mut inner_depth = depth.clone();
1727                if inlined {
1728                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1729                    inner_offset = next_offset;
1730                } else {
1731                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1732                    inner_depth.increment()?;
1733                }
1734                let val_ref = self.preferred_addresses.get_or_insert_with(|| {
1735                    fidl::new_empty!(
1736                        fidl::encoding::UnboundedVector<fidl_fuchsia_net__common::Ipv6Address>,
1737                        D
1738                    )
1739                });
1740                fidl::decode!(
1741                    fidl::encoding::UnboundedVector<fidl_fuchsia_net__common::Ipv6Address>,
1742                    D,
1743                    val_ref,
1744                    decoder,
1745                    inner_offset,
1746                    inner_depth
1747                )?;
1748                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1749                {
1750                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
1751                }
1752                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1753                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1754                }
1755            }
1756
1757            next_offset += envelope_size;
1758
1759            // Decode the remaining unknown envelopes.
1760            while next_offset < end_offset {
1761                _next_ordinal_to_read += 1;
1762                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1763                next_offset += envelope_size;
1764            }
1765
1766            Ok(())
1767        }
1768    }
1769
1770    impl ClientConfig {
1771        #[inline(always)]
1772        fn max_ordinal_present(&self) -> u64 {
1773            if let Some(_) = self.prefix_delegation_config {
1774                return 3;
1775            }
1776            if let Some(_) = self.non_temporary_address_config {
1777                return 2;
1778            }
1779            if let Some(_) = self.information_config {
1780                return 1;
1781            }
1782            0
1783        }
1784    }
1785
1786    impl fidl::encoding::ValueTypeMarker for ClientConfig {
1787        type Borrowed<'a> = &'a Self;
1788        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1789            value
1790        }
1791    }
1792
1793    unsafe impl fidl::encoding::TypeMarker for ClientConfig {
1794        type Owned = Self;
1795
1796        #[inline(always)]
1797        fn inline_align(_context: fidl::encoding::Context) -> usize {
1798            8
1799        }
1800
1801        #[inline(always)]
1802        fn inline_size(_context: fidl::encoding::Context) -> usize {
1803            16
1804        }
1805    }
1806
1807    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<ClientConfig, D>
1808        for &ClientConfig
1809    {
1810        unsafe fn encode(
1811            self,
1812            encoder: &mut fidl::encoding::Encoder<'_, D>,
1813            offset: usize,
1814            mut depth: fidl::encoding::Depth,
1815        ) -> fidl::Result<()> {
1816            encoder.debug_check_bounds::<ClientConfig>(offset);
1817            // Vector header
1818            let max_ordinal: u64 = self.max_ordinal_present();
1819            encoder.write_num(max_ordinal, offset);
1820            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
1821            // Calling encoder.out_of_line_offset(0) is not allowed.
1822            if max_ordinal == 0 {
1823                return Ok(());
1824            }
1825            depth.increment()?;
1826            let envelope_size = 8;
1827            let bytes_len = max_ordinal as usize * envelope_size;
1828            #[allow(unused_variables)]
1829            let offset = encoder.out_of_line_offset(bytes_len);
1830            let mut _prev_end_offset: usize = 0;
1831            if 1 > max_ordinal {
1832                return Ok(());
1833            }
1834
1835            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1836            // are envelope_size bytes.
1837            let cur_offset: usize = (1 - 1) * envelope_size;
1838
1839            // Zero reserved fields.
1840            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1841
1842            // Safety:
1843            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1844            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1845            //   envelope_size bytes, there is always sufficient room.
1846            fidl::encoding::encode_in_envelope_optional::<InformationConfig, D>(
1847                self.information_config
1848                    .as_ref()
1849                    .map(<InformationConfig as fidl::encoding::ValueTypeMarker>::borrow),
1850                encoder,
1851                offset + cur_offset,
1852                depth,
1853            )?;
1854
1855            _prev_end_offset = cur_offset + envelope_size;
1856            if 2 > max_ordinal {
1857                return Ok(());
1858            }
1859
1860            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1861            // are envelope_size bytes.
1862            let cur_offset: usize = (2 - 1) * envelope_size;
1863
1864            // Zero reserved fields.
1865            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1866
1867            // Safety:
1868            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1869            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1870            //   envelope_size bytes, there is always sufficient room.
1871            fidl::encoding::encode_in_envelope_optional::<AddressConfig, D>(
1872                self.non_temporary_address_config
1873                    .as_ref()
1874                    .map(<AddressConfig as fidl::encoding::ValueTypeMarker>::borrow),
1875                encoder,
1876                offset + cur_offset,
1877                depth,
1878            )?;
1879
1880            _prev_end_offset = cur_offset + envelope_size;
1881            if 3 > max_ordinal {
1882                return Ok(());
1883            }
1884
1885            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1886            // are envelope_size bytes.
1887            let cur_offset: usize = (3 - 1) * envelope_size;
1888
1889            // Zero reserved fields.
1890            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1891
1892            // Safety:
1893            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1894            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1895            //   envelope_size bytes, there is always sufficient room.
1896            fidl::encoding::encode_in_envelope_optional::<PrefixDelegationConfig, D>(
1897                self.prefix_delegation_config
1898                    .as_ref()
1899                    .map(<PrefixDelegationConfig as fidl::encoding::ValueTypeMarker>::borrow),
1900                encoder,
1901                offset + cur_offset,
1902                depth,
1903            )?;
1904
1905            _prev_end_offset = cur_offset + envelope_size;
1906
1907            Ok(())
1908        }
1909    }
1910
1911    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ClientConfig {
1912        #[inline(always)]
1913        fn new_empty() -> Self {
1914            Self::default()
1915        }
1916
1917        unsafe fn decode(
1918            &mut self,
1919            decoder: &mut fidl::encoding::Decoder<'_, D>,
1920            offset: usize,
1921            mut depth: fidl::encoding::Depth,
1922        ) -> fidl::Result<()> {
1923            decoder.debug_check_bounds::<Self>(offset);
1924            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
1925                None => return Err(fidl::Error::NotNullable),
1926                Some(len) => len,
1927            };
1928            // Calling decoder.out_of_line_offset(0) is not allowed.
1929            if len == 0 {
1930                return Ok(());
1931            };
1932            depth.increment()?;
1933            let envelope_size = 8;
1934            let bytes_len = len * envelope_size;
1935            let offset = decoder.out_of_line_offset(bytes_len)?;
1936            // Decode the envelope for each type.
1937            let mut _next_ordinal_to_read = 0;
1938            let mut next_offset = offset;
1939            let end_offset = offset + bytes_len;
1940            _next_ordinal_to_read += 1;
1941            if next_offset >= end_offset {
1942                return Ok(());
1943            }
1944
1945            // Decode unknown envelopes for gaps in ordinals.
1946            while _next_ordinal_to_read < 1 {
1947                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1948                _next_ordinal_to_read += 1;
1949                next_offset += envelope_size;
1950            }
1951
1952            let next_out_of_line = decoder.next_out_of_line();
1953            let handles_before = decoder.remaining_handles();
1954            if let Some((inlined, num_bytes, num_handles)) =
1955                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1956            {
1957                let member_inline_size =
1958                    <InformationConfig as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1959                if inlined != (member_inline_size <= 4) {
1960                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1961                }
1962                let inner_offset;
1963                let mut inner_depth = depth.clone();
1964                if inlined {
1965                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1966                    inner_offset = next_offset;
1967                } else {
1968                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1969                    inner_depth.increment()?;
1970                }
1971                let val_ref = self
1972                    .information_config
1973                    .get_or_insert_with(|| fidl::new_empty!(InformationConfig, D));
1974                fidl::decode!(InformationConfig, D, val_ref, decoder, inner_offset, inner_depth)?;
1975                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1976                {
1977                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
1978                }
1979                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1980                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1981                }
1982            }
1983
1984            next_offset += envelope_size;
1985            _next_ordinal_to_read += 1;
1986            if next_offset >= end_offset {
1987                return Ok(());
1988            }
1989
1990            // Decode unknown envelopes for gaps in ordinals.
1991            while _next_ordinal_to_read < 2 {
1992                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1993                _next_ordinal_to_read += 1;
1994                next_offset += envelope_size;
1995            }
1996
1997            let next_out_of_line = decoder.next_out_of_line();
1998            let handles_before = decoder.remaining_handles();
1999            if let Some((inlined, num_bytes, num_handles)) =
2000                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2001            {
2002                let member_inline_size =
2003                    <AddressConfig as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2004                if inlined != (member_inline_size <= 4) {
2005                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2006                }
2007                let inner_offset;
2008                let mut inner_depth = depth.clone();
2009                if inlined {
2010                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2011                    inner_offset = next_offset;
2012                } else {
2013                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2014                    inner_depth.increment()?;
2015                }
2016                let val_ref = self
2017                    .non_temporary_address_config
2018                    .get_or_insert_with(|| fidl::new_empty!(AddressConfig, D));
2019                fidl::decode!(AddressConfig, D, val_ref, decoder, inner_offset, inner_depth)?;
2020                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2021                {
2022                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2023                }
2024                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2025                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2026                }
2027            }
2028
2029            next_offset += envelope_size;
2030            _next_ordinal_to_read += 1;
2031            if next_offset >= end_offset {
2032                return Ok(());
2033            }
2034
2035            // Decode unknown envelopes for gaps in ordinals.
2036            while _next_ordinal_to_read < 3 {
2037                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2038                _next_ordinal_to_read += 1;
2039                next_offset += envelope_size;
2040            }
2041
2042            let next_out_of_line = decoder.next_out_of_line();
2043            let handles_before = decoder.remaining_handles();
2044            if let Some((inlined, num_bytes, num_handles)) =
2045                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2046            {
2047                let member_inline_size =
2048                    <PrefixDelegationConfig as fidl::encoding::TypeMarker>::inline_size(
2049                        decoder.context,
2050                    );
2051                if inlined != (member_inline_size <= 4) {
2052                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2053                }
2054                let inner_offset;
2055                let mut inner_depth = depth.clone();
2056                if inlined {
2057                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2058                    inner_offset = next_offset;
2059                } else {
2060                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2061                    inner_depth.increment()?;
2062                }
2063                let val_ref = self
2064                    .prefix_delegation_config
2065                    .get_or_insert_with(|| fidl::new_empty!(PrefixDelegationConfig, D));
2066                fidl::decode!(
2067                    PrefixDelegationConfig,
2068                    D,
2069                    val_ref,
2070                    decoder,
2071                    inner_offset,
2072                    inner_depth
2073                )?;
2074                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2075                {
2076                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2077                }
2078                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2079                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2080                }
2081            }
2082
2083            next_offset += envelope_size;
2084
2085            // Decode the remaining unknown envelopes.
2086            while next_offset < end_offset {
2087                _next_ordinal_to_read += 1;
2088                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2089                next_offset += envelope_size;
2090            }
2091
2092            Ok(())
2093        }
2094    }
2095
2096    impl InformationConfig {
2097        #[inline(always)]
2098        fn max_ordinal_present(&self) -> u64 {
2099            if let Some(_) = self.dns_servers {
2100                return 1;
2101            }
2102            0
2103        }
2104    }
2105
2106    impl fidl::encoding::ValueTypeMarker for InformationConfig {
2107        type Borrowed<'a> = &'a Self;
2108        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2109            value
2110        }
2111    }
2112
2113    unsafe impl fidl::encoding::TypeMarker for InformationConfig {
2114        type Owned = Self;
2115
2116        #[inline(always)]
2117        fn inline_align(_context: fidl::encoding::Context) -> usize {
2118            8
2119        }
2120
2121        #[inline(always)]
2122        fn inline_size(_context: fidl::encoding::Context) -> usize {
2123            16
2124        }
2125    }
2126
2127    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<InformationConfig, D>
2128        for &InformationConfig
2129    {
2130        unsafe fn encode(
2131            self,
2132            encoder: &mut fidl::encoding::Encoder<'_, D>,
2133            offset: usize,
2134            mut depth: fidl::encoding::Depth,
2135        ) -> fidl::Result<()> {
2136            encoder.debug_check_bounds::<InformationConfig>(offset);
2137            // Vector header
2138            let max_ordinal: u64 = self.max_ordinal_present();
2139            encoder.write_num(max_ordinal, offset);
2140            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
2141            // Calling encoder.out_of_line_offset(0) is not allowed.
2142            if max_ordinal == 0 {
2143                return Ok(());
2144            }
2145            depth.increment()?;
2146            let envelope_size = 8;
2147            let bytes_len = max_ordinal as usize * envelope_size;
2148            #[allow(unused_variables)]
2149            let offset = encoder.out_of_line_offset(bytes_len);
2150            let mut _prev_end_offset: usize = 0;
2151            if 1 > max_ordinal {
2152                return Ok(());
2153            }
2154
2155            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2156            // are envelope_size bytes.
2157            let cur_offset: usize = (1 - 1) * envelope_size;
2158
2159            // Zero reserved fields.
2160            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2161
2162            // Safety:
2163            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2164            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2165            //   envelope_size bytes, there is always sufficient room.
2166            fidl::encoding::encode_in_envelope_optional::<bool, D>(
2167                self.dns_servers.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
2168                encoder,
2169                offset + cur_offset,
2170                depth,
2171            )?;
2172
2173            _prev_end_offset = cur_offset + envelope_size;
2174
2175            Ok(())
2176        }
2177    }
2178
2179    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for InformationConfig {
2180        #[inline(always)]
2181        fn new_empty() -> Self {
2182            Self::default()
2183        }
2184
2185        unsafe fn decode(
2186            &mut self,
2187            decoder: &mut fidl::encoding::Decoder<'_, D>,
2188            offset: usize,
2189            mut depth: fidl::encoding::Depth,
2190        ) -> fidl::Result<()> {
2191            decoder.debug_check_bounds::<Self>(offset);
2192            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
2193                None => return Err(fidl::Error::NotNullable),
2194                Some(len) => len,
2195            };
2196            // Calling decoder.out_of_line_offset(0) is not allowed.
2197            if len == 0 {
2198                return Ok(());
2199            };
2200            depth.increment()?;
2201            let envelope_size = 8;
2202            let bytes_len = len * envelope_size;
2203            let offset = decoder.out_of_line_offset(bytes_len)?;
2204            // Decode the envelope for each type.
2205            let mut _next_ordinal_to_read = 0;
2206            let mut next_offset = offset;
2207            let end_offset = offset + bytes_len;
2208            _next_ordinal_to_read += 1;
2209            if next_offset >= end_offset {
2210                return Ok(());
2211            }
2212
2213            // Decode unknown envelopes for gaps in ordinals.
2214            while _next_ordinal_to_read < 1 {
2215                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2216                _next_ordinal_to_read += 1;
2217                next_offset += envelope_size;
2218            }
2219
2220            let next_out_of_line = decoder.next_out_of_line();
2221            let handles_before = decoder.remaining_handles();
2222            if let Some((inlined, num_bytes, num_handles)) =
2223                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2224            {
2225                let member_inline_size =
2226                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2227                if inlined != (member_inline_size <= 4) {
2228                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2229                }
2230                let inner_offset;
2231                let mut inner_depth = depth.clone();
2232                if inlined {
2233                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2234                    inner_offset = next_offset;
2235                } else {
2236                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2237                    inner_depth.increment()?;
2238                }
2239                let val_ref = self.dns_servers.get_or_insert_with(|| fidl::new_empty!(bool, D));
2240                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
2241                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2242                {
2243                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2244                }
2245                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2246                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2247                }
2248            }
2249
2250            next_offset += envelope_size;
2251
2252            // Decode the remaining unknown envelopes.
2253            while next_offset < end_offset {
2254                _next_ordinal_to_read += 1;
2255                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2256                next_offset += envelope_size;
2257            }
2258
2259            Ok(())
2260        }
2261    }
2262
2263    impl NewClientParams {
2264        #[inline(always)]
2265        fn max_ordinal_present(&self) -> u64 {
2266            if let Some(_) = self.duid {
2267                return 4;
2268            }
2269            if let Some(_) = self.config {
2270                return 3;
2271            }
2272            if let Some(_) = self.address {
2273                return 2;
2274            }
2275            if let Some(_) = self.interface_id {
2276                return 1;
2277            }
2278            0
2279        }
2280    }
2281
2282    impl fidl::encoding::ValueTypeMarker for NewClientParams {
2283        type Borrowed<'a> = &'a Self;
2284        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2285            value
2286        }
2287    }
2288
2289    unsafe impl fidl::encoding::TypeMarker for NewClientParams {
2290        type Owned = Self;
2291
2292        #[inline(always)]
2293        fn inline_align(_context: fidl::encoding::Context) -> usize {
2294            8
2295        }
2296
2297        #[inline(always)]
2298        fn inline_size(_context: fidl::encoding::Context) -> usize {
2299            16
2300        }
2301    }
2302
2303    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<NewClientParams, D>
2304        for &NewClientParams
2305    {
2306        unsafe fn encode(
2307            self,
2308            encoder: &mut fidl::encoding::Encoder<'_, D>,
2309            offset: usize,
2310            mut depth: fidl::encoding::Depth,
2311        ) -> fidl::Result<()> {
2312            encoder.debug_check_bounds::<NewClientParams>(offset);
2313            // Vector header
2314            let max_ordinal: u64 = self.max_ordinal_present();
2315            encoder.write_num(max_ordinal, offset);
2316            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
2317            // Calling encoder.out_of_line_offset(0) is not allowed.
2318            if max_ordinal == 0 {
2319                return Ok(());
2320            }
2321            depth.increment()?;
2322            let envelope_size = 8;
2323            let bytes_len = max_ordinal as usize * envelope_size;
2324            #[allow(unused_variables)]
2325            let offset = encoder.out_of_line_offset(bytes_len);
2326            let mut _prev_end_offset: usize = 0;
2327            if 1 > max_ordinal {
2328                return Ok(());
2329            }
2330
2331            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2332            // are envelope_size bytes.
2333            let cur_offset: usize = (1 - 1) * envelope_size;
2334
2335            // Zero reserved fields.
2336            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2337
2338            // Safety:
2339            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2340            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2341            //   envelope_size bytes, there is always sufficient room.
2342            fidl::encoding::encode_in_envelope_optional::<u64, D>(
2343                self.interface_id.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
2344                encoder,
2345                offset + cur_offset,
2346                depth,
2347            )?;
2348
2349            _prev_end_offset = cur_offset + envelope_size;
2350            if 2 > max_ordinal {
2351                return Ok(());
2352            }
2353
2354            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2355            // are envelope_size bytes.
2356            let cur_offset: usize = (2 - 1) * envelope_size;
2357
2358            // Zero reserved fields.
2359            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2360
2361            // Safety:
2362            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2363            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2364            //   envelope_size bytes, there is always sufficient room.
2365            fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_net__common::Ipv6SocketAddress, D>(
2366            self.address.as_ref().map(<fidl_fuchsia_net__common::Ipv6SocketAddress as fidl::encoding::ValueTypeMarker>::borrow),
2367            encoder, offset + cur_offset, depth
2368        )?;
2369
2370            _prev_end_offset = cur_offset + envelope_size;
2371            if 3 > max_ordinal {
2372                return Ok(());
2373            }
2374
2375            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2376            // are envelope_size bytes.
2377            let cur_offset: usize = (3 - 1) * envelope_size;
2378
2379            // Zero reserved fields.
2380            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2381
2382            // Safety:
2383            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2384            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2385            //   envelope_size bytes, there is always sufficient room.
2386            fidl::encoding::encode_in_envelope_optional::<ClientConfig, D>(
2387                self.config.as_ref().map(<ClientConfig as fidl::encoding::ValueTypeMarker>::borrow),
2388                encoder,
2389                offset + cur_offset,
2390                depth,
2391            )?;
2392
2393            _prev_end_offset = cur_offset + envelope_size;
2394            if 4 > max_ordinal {
2395                return Ok(());
2396            }
2397
2398            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2399            // are envelope_size bytes.
2400            let cur_offset: usize = (4 - 1) * envelope_size;
2401
2402            // Zero reserved fields.
2403            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2404
2405            // Safety:
2406            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2407            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2408            //   envelope_size bytes, there is always sufficient room.
2409            fidl::encoding::encode_in_envelope_optional::<Duid, D>(
2410                self.duid.as_ref().map(<Duid as fidl::encoding::ValueTypeMarker>::borrow),
2411                encoder,
2412                offset + cur_offset,
2413                depth,
2414            )?;
2415
2416            _prev_end_offset = cur_offset + envelope_size;
2417
2418            Ok(())
2419        }
2420    }
2421
2422    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for NewClientParams {
2423        #[inline(always)]
2424        fn new_empty() -> Self {
2425            Self::default()
2426        }
2427
2428        unsafe fn decode(
2429            &mut self,
2430            decoder: &mut fidl::encoding::Decoder<'_, D>,
2431            offset: usize,
2432            mut depth: fidl::encoding::Depth,
2433        ) -> fidl::Result<()> {
2434            decoder.debug_check_bounds::<Self>(offset);
2435            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
2436                None => return Err(fidl::Error::NotNullable),
2437                Some(len) => len,
2438            };
2439            // Calling decoder.out_of_line_offset(0) is not allowed.
2440            if len == 0 {
2441                return Ok(());
2442            };
2443            depth.increment()?;
2444            let envelope_size = 8;
2445            let bytes_len = len * envelope_size;
2446            let offset = decoder.out_of_line_offset(bytes_len)?;
2447            // Decode the envelope for each type.
2448            let mut _next_ordinal_to_read = 0;
2449            let mut next_offset = offset;
2450            let end_offset = offset + bytes_len;
2451            _next_ordinal_to_read += 1;
2452            if next_offset >= end_offset {
2453                return Ok(());
2454            }
2455
2456            // Decode unknown envelopes for gaps in ordinals.
2457            while _next_ordinal_to_read < 1 {
2458                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2459                _next_ordinal_to_read += 1;
2460                next_offset += envelope_size;
2461            }
2462
2463            let next_out_of_line = decoder.next_out_of_line();
2464            let handles_before = decoder.remaining_handles();
2465            if let Some((inlined, num_bytes, num_handles)) =
2466                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2467            {
2468                let member_inline_size =
2469                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2470                if inlined != (member_inline_size <= 4) {
2471                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2472                }
2473                let inner_offset;
2474                let mut inner_depth = depth.clone();
2475                if inlined {
2476                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2477                    inner_offset = next_offset;
2478                } else {
2479                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2480                    inner_depth.increment()?;
2481                }
2482                let val_ref = self.interface_id.get_or_insert_with(|| fidl::new_empty!(u64, D));
2483                fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
2484                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2485                {
2486                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2487                }
2488                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2489                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2490                }
2491            }
2492
2493            next_offset += envelope_size;
2494            _next_ordinal_to_read += 1;
2495            if next_offset >= end_offset {
2496                return Ok(());
2497            }
2498
2499            // Decode unknown envelopes for gaps in ordinals.
2500            while _next_ordinal_to_read < 2 {
2501                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2502                _next_ordinal_to_read += 1;
2503                next_offset += envelope_size;
2504            }
2505
2506            let next_out_of_line = decoder.next_out_of_line();
2507            let handles_before = decoder.remaining_handles();
2508            if let Some((inlined, num_bytes, num_handles)) =
2509                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2510            {
2511                let member_inline_size = <fidl_fuchsia_net__common::Ipv6SocketAddress as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2512                if inlined != (member_inline_size <= 4) {
2513                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2514                }
2515                let inner_offset;
2516                let mut inner_depth = depth.clone();
2517                if inlined {
2518                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2519                    inner_offset = next_offset;
2520                } else {
2521                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2522                    inner_depth.increment()?;
2523                }
2524                let val_ref = self.address.get_or_insert_with(|| {
2525                    fidl::new_empty!(fidl_fuchsia_net__common::Ipv6SocketAddress, D)
2526                });
2527                fidl::decode!(
2528                    fidl_fuchsia_net__common::Ipv6SocketAddress,
2529                    D,
2530                    val_ref,
2531                    decoder,
2532                    inner_offset,
2533                    inner_depth
2534                )?;
2535                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2536                {
2537                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2538                }
2539                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2540                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2541                }
2542            }
2543
2544            next_offset += envelope_size;
2545            _next_ordinal_to_read += 1;
2546            if next_offset >= end_offset {
2547                return Ok(());
2548            }
2549
2550            // Decode unknown envelopes for gaps in ordinals.
2551            while _next_ordinal_to_read < 3 {
2552                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2553                _next_ordinal_to_read += 1;
2554                next_offset += envelope_size;
2555            }
2556
2557            let next_out_of_line = decoder.next_out_of_line();
2558            let handles_before = decoder.remaining_handles();
2559            if let Some((inlined, num_bytes, num_handles)) =
2560                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2561            {
2562                let member_inline_size =
2563                    <ClientConfig as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2564                if inlined != (member_inline_size <= 4) {
2565                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2566                }
2567                let inner_offset;
2568                let mut inner_depth = depth.clone();
2569                if inlined {
2570                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2571                    inner_offset = next_offset;
2572                } else {
2573                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2574                    inner_depth.increment()?;
2575                }
2576                let val_ref = self.config.get_or_insert_with(|| fidl::new_empty!(ClientConfig, D));
2577                fidl::decode!(ClientConfig, D, val_ref, decoder, inner_offset, inner_depth)?;
2578                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2579                {
2580                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2581                }
2582                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2583                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2584                }
2585            }
2586
2587            next_offset += envelope_size;
2588            _next_ordinal_to_read += 1;
2589            if next_offset >= end_offset {
2590                return Ok(());
2591            }
2592
2593            // Decode unknown envelopes for gaps in ordinals.
2594            while _next_ordinal_to_read < 4 {
2595                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2596                _next_ordinal_to_read += 1;
2597                next_offset += envelope_size;
2598            }
2599
2600            let next_out_of_line = decoder.next_out_of_line();
2601            let handles_before = decoder.remaining_handles();
2602            if let Some((inlined, num_bytes, num_handles)) =
2603                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2604            {
2605                let member_inline_size =
2606                    <Duid as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2607                if inlined != (member_inline_size <= 4) {
2608                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2609                }
2610                let inner_offset;
2611                let mut inner_depth = depth.clone();
2612                if inlined {
2613                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2614                    inner_offset = next_offset;
2615                } else {
2616                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2617                    inner_depth.increment()?;
2618                }
2619                let val_ref = self.duid.get_or_insert_with(|| fidl::new_empty!(Duid, D));
2620                fidl::decode!(Duid, D, val_ref, decoder, inner_offset, inner_depth)?;
2621                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2622                {
2623                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2624                }
2625                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2626                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2627                }
2628            }
2629
2630            next_offset += envelope_size;
2631
2632            // Decode the remaining unknown envelopes.
2633            while next_offset < end_offset {
2634                _next_ordinal_to_read += 1;
2635                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2636                next_offset += envelope_size;
2637            }
2638
2639            Ok(())
2640        }
2641    }
2642
2643    impl fidl::encoding::ValueTypeMarker for Duid {
2644        type Borrowed<'a> = &'a Self;
2645        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2646            value
2647        }
2648    }
2649
2650    unsafe impl fidl::encoding::TypeMarker for Duid {
2651        type Owned = Self;
2652
2653        #[inline(always)]
2654        fn inline_align(_context: fidl::encoding::Context) -> usize {
2655            8
2656        }
2657
2658        #[inline(always)]
2659        fn inline_size(_context: fidl::encoding::Context) -> usize {
2660            16
2661        }
2662    }
2663
2664    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Duid, D> for &Duid {
2665        #[inline]
2666        unsafe fn encode(
2667            self,
2668            encoder: &mut fidl::encoding::Encoder<'_, D>,
2669            offset: usize,
2670            _depth: fidl::encoding::Depth,
2671        ) -> fidl::Result<()> {
2672            encoder.debug_check_bounds::<Duid>(offset);
2673            encoder.write_num::<u64>(self.ordinal(), offset);
2674            match self {
2675                Duid::LinkLayerAddressPlusTime(ref val) => {
2676                    fidl::encoding::encode_in_envelope::<LinkLayerAddressPlusTime, D>(
2677                        <LinkLayerAddressPlusTime as fidl::encoding::ValueTypeMarker>::borrow(val),
2678                        encoder,
2679                        offset + 8,
2680                        _depth,
2681                    )
2682                }
2683                Duid::LinkLayerAddress(ref val) => {
2684                    fidl::encoding::encode_in_envelope::<LinkLayerAddress, D>(
2685                        <LinkLayerAddress as fidl::encoding::ValueTypeMarker>::borrow(val),
2686                        encoder,
2687                        offset + 8,
2688                        _depth,
2689                    )
2690                }
2691                Duid::Uuid(ref val) => fidl::encoding::encode_in_envelope::<
2692                    fidl::encoding::Array<u8, 16>,
2693                    D,
2694                >(
2695                    <fidl::encoding::Array<u8, 16> as fidl::encoding::ValueTypeMarker>::borrow(val),
2696                    encoder,
2697                    offset + 8,
2698                    _depth,
2699                ),
2700                Duid::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
2701            }
2702        }
2703    }
2704
2705    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Duid {
2706        #[inline(always)]
2707        fn new_empty() -> Self {
2708            Self::__SourceBreaking { unknown_ordinal: 0 }
2709        }
2710
2711        #[inline]
2712        unsafe fn decode(
2713            &mut self,
2714            decoder: &mut fidl::encoding::Decoder<'_, D>,
2715            offset: usize,
2716            mut depth: fidl::encoding::Depth,
2717        ) -> fidl::Result<()> {
2718            decoder.debug_check_bounds::<Self>(offset);
2719            #[allow(unused_variables)]
2720            let next_out_of_line = decoder.next_out_of_line();
2721            let handles_before = decoder.remaining_handles();
2722            let (ordinal, inlined, num_bytes, num_handles) =
2723                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
2724
2725            let member_inline_size = match ordinal {
2726                1 => <LinkLayerAddressPlusTime as fidl::encoding::TypeMarker>::inline_size(
2727                    decoder.context,
2728                ),
2729                2 => <LinkLayerAddress as fidl::encoding::TypeMarker>::inline_size(decoder.context),
2730                3 => <fidl::encoding::Array<u8, 16> as fidl::encoding::TypeMarker>::inline_size(
2731                    decoder.context,
2732                ),
2733                0 => return Err(fidl::Error::UnknownUnionTag),
2734                _ => num_bytes as usize,
2735            };
2736
2737            if inlined != (member_inline_size <= 4) {
2738                return Err(fidl::Error::InvalidInlineBitInEnvelope);
2739            }
2740            let _inner_offset;
2741            if inlined {
2742                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
2743                _inner_offset = offset + 8;
2744            } else {
2745                depth.increment()?;
2746                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2747            }
2748            match ordinal {
2749                1 => {
2750                    #[allow(irrefutable_let_patterns)]
2751                    if let Duid::LinkLayerAddressPlusTime(_) = self {
2752                        // Do nothing, read the value into the object
2753                    } else {
2754                        // Initialize `self` to the right variant
2755                        *self = Duid::LinkLayerAddressPlusTime(fidl::new_empty!(
2756                            LinkLayerAddressPlusTime,
2757                            D
2758                        ));
2759                    }
2760                    #[allow(irrefutable_let_patterns)]
2761                    if let Duid::LinkLayerAddressPlusTime(ref mut val) = self {
2762                        fidl::decode!(
2763                            LinkLayerAddressPlusTime,
2764                            D,
2765                            val,
2766                            decoder,
2767                            _inner_offset,
2768                            depth
2769                        )?;
2770                    } else {
2771                        unreachable!()
2772                    }
2773                }
2774                2 => {
2775                    #[allow(irrefutable_let_patterns)]
2776                    if let Duid::LinkLayerAddress(_) = self {
2777                        // Do nothing, read the value into the object
2778                    } else {
2779                        // Initialize `self` to the right variant
2780                        *self = Duid::LinkLayerAddress(fidl::new_empty!(LinkLayerAddress, D));
2781                    }
2782                    #[allow(irrefutable_let_patterns)]
2783                    if let Duid::LinkLayerAddress(ref mut val) = self {
2784                        fidl::decode!(LinkLayerAddress, D, val, decoder, _inner_offset, depth)?;
2785                    } else {
2786                        unreachable!()
2787                    }
2788                }
2789                3 => {
2790                    #[allow(irrefutable_let_patterns)]
2791                    if let Duid::Uuid(_) = self {
2792                        // Do nothing, read the value into the object
2793                    } else {
2794                        // Initialize `self` to the right variant
2795                        *self = Duid::Uuid(fidl::new_empty!(fidl::encoding::Array<u8, 16>, D));
2796                    }
2797                    #[allow(irrefutable_let_patterns)]
2798                    if let Duid::Uuid(ref mut val) = self {
2799                        fidl::decode!(fidl::encoding::Array<u8, 16>, D, val, decoder, _inner_offset, depth)?;
2800                    } else {
2801                        unreachable!()
2802                    }
2803                }
2804                #[allow(deprecated)]
2805                ordinal => {
2806                    for _ in 0..num_handles {
2807                        decoder.drop_next_handle()?;
2808                    }
2809                    *self = Duid::__SourceBreaking { unknown_ordinal: ordinal };
2810                }
2811            }
2812            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
2813                return Err(fidl::Error::InvalidNumBytesInEnvelope);
2814            }
2815            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2816                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2817            }
2818            Ok(())
2819        }
2820    }
2821
2822    impl fidl::encoding::ValueTypeMarker for LinkLayerAddress {
2823        type Borrowed<'a> = &'a Self;
2824        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2825            value
2826        }
2827    }
2828
2829    unsafe impl fidl::encoding::TypeMarker for LinkLayerAddress {
2830        type Owned = Self;
2831
2832        #[inline(always)]
2833        fn inline_align(_context: fidl::encoding::Context) -> usize {
2834            8
2835        }
2836
2837        #[inline(always)]
2838        fn inline_size(_context: fidl::encoding::Context) -> usize {
2839            16
2840        }
2841    }
2842
2843    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<LinkLayerAddress, D>
2844        for &LinkLayerAddress
2845    {
2846        #[inline]
2847        unsafe fn encode(
2848            self,
2849            encoder: &mut fidl::encoding::Encoder<'_, D>,
2850            offset: usize,
2851            _depth: fidl::encoding::Depth,
2852        ) -> fidl::Result<()> {
2853            encoder.debug_check_bounds::<LinkLayerAddress>(offset);
2854            encoder.write_num::<u64>(self.ordinal(), offset);
2855            match self {
2856            LinkLayerAddress::Ethernet(ref val) => {
2857                fidl::encoding::encode_in_envelope::<fidl_fuchsia_net__common::MacAddress, D>(
2858                    <fidl_fuchsia_net__common::MacAddress as fidl::encoding::ValueTypeMarker>::borrow(val),
2859                    encoder, offset + 8, _depth
2860                )
2861            }
2862            LinkLayerAddress::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
2863        }
2864        }
2865    }
2866
2867    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for LinkLayerAddress {
2868        #[inline(always)]
2869        fn new_empty() -> Self {
2870            Self::__SourceBreaking { unknown_ordinal: 0 }
2871        }
2872
2873        #[inline]
2874        unsafe fn decode(
2875            &mut self,
2876            decoder: &mut fidl::encoding::Decoder<'_, D>,
2877            offset: usize,
2878            mut depth: fidl::encoding::Depth,
2879        ) -> fidl::Result<()> {
2880            decoder.debug_check_bounds::<Self>(offset);
2881            #[allow(unused_variables)]
2882            let next_out_of_line = decoder.next_out_of_line();
2883            let handles_before = decoder.remaining_handles();
2884            let (ordinal, inlined, num_bytes, num_handles) =
2885                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
2886
2887            let member_inline_size = match ordinal {
2888            1 => <fidl_fuchsia_net__common::MacAddress as fidl::encoding::TypeMarker>::inline_size(decoder.context),
2889            0 => return Err(fidl::Error::UnknownUnionTag),
2890            _ => num_bytes as usize,
2891        };
2892
2893            if inlined != (member_inline_size <= 4) {
2894                return Err(fidl::Error::InvalidInlineBitInEnvelope);
2895            }
2896            let _inner_offset;
2897            if inlined {
2898                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
2899                _inner_offset = offset + 8;
2900            } else {
2901                depth.increment()?;
2902                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2903            }
2904            match ordinal {
2905                1 => {
2906                    #[allow(irrefutable_let_patterns)]
2907                    if let LinkLayerAddress::Ethernet(_) = self {
2908                        // Do nothing, read the value into the object
2909                    } else {
2910                        // Initialize `self` to the right variant
2911                        *self = LinkLayerAddress::Ethernet(fidl::new_empty!(
2912                            fidl_fuchsia_net__common::MacAddress,
2913                            D
2914                        ));
2915                    }
2916                    #[allow(irrefutable_let_patterns)]
2917                    if let LinkLayerAddress::Ethernet(ref mut val) = self {
2918                        fidl::decode!(
2919                            fidl_fuchsia_net__common::MacAddress,
2920                            D,
2921                            val,
2922                            decoder,
2923                            _inner_offset,
2924                            depth
2925                        )?;
2926                    } else {
2927                        unreachable!()
2928                    }
2929                }
2930                #[allow(deprecated)]
2931                ordinal => {
2932                    for _ in 0..num_handles {
2933                        decoder.drop_next_handle()?;
2934                    }
2935                    *self = LinkLayerAddress::__SourceBreaking { unknown_ordinal: ordinal };
2936                }
2937            }
2938            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
2939                return Err(fidl::Error::InvalidNumBytesInEnvelope);
2940            }
2941            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2942                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2943            }
2944            Ok(())
2945        }
2946    }
2947
2948    impl fidl::encoding::ValueTypeMarker for PrefixDelegationConfig {
2949        type Borrowed<'a> = &'a Self;
2950        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2951            value
2952        }
2953    }
2954
2955    unsafe impl fidl::encoding::TypeMarker for PrefixDelegationConfig {
2956        type Owned = Self;
2957
2958        #[inline(always)]
2959        fn inline_align(_context: fidl::encoding::Context) -> usize {
2960            8
2961        }
2962
2963        #[inline(always)]
2964        fn inline_size(_context: fidl::encoding::Context) -> usize {
2965            16
2966        }
2967    }
2968
2969    unsafe impl<D: fidl::encoding::ResourceDialect>
2970        fidl::encoding::Encode<PrefixDelegationConfig, D> for &PrefixDelegationConfig
2971    {
2972        #[inline]
2973        unsafe fn encode(
2974            self,
2975            encoder: &mut fidl::encoding::Encoder<'_, D>,
2976            offset: usize,
2977            _depth: fidl::encoding::Depth,
2978        ) -> fidl::Result<()> {
2979            encoder.debug_check_bounds::<PrefixDelegationConfig>(offset);
2980            encoder.write_num::<u64>(self.ordinal(), offset);
2981            match self {
2982            PrefixDelegationConfig::Empty(ref val) => {
2983                fidl::encoding::encode_in_envelope::<Empty, D>(
2984                    <Empty as fidl::encoding::ValueTypeMarker>::borrow(val),
2985                    encoder, offset + 8, _depth
2986                )
2987            }
2988            PrefixDelegationConfig::PrefixLength(ref val) => {
2989                fidl::encoding::encode_in_envelope::<u8, D>(
2990                    <u8 as fidl::encoding::ValueTypeMarker>::borrow(val),
2991                    encoder, offset + 8, _depth
2992                )
2993            }
2994            PrefixDelegationConfig::Prefix(ref val) => {
2995                fidl::encoding::encode_in_envelope::<fidl_fuchsia_net__common::Ipv6AddressWithPrefix, D>(
2996                    <fidl_fuchsia_net__common::Ipv6AddressWithPrefix as fidl::encoding::ValueTypeMarker>::borrow(val),
2997                    encoder, offset + 8, _depth
2998                )
2999            }
3000        }
3001        }
3002    }
3003
3004    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3005        for PrefixDelegationConfig
3006    {
3007        #[inline(always)]
3008        fn new_empty() -> Self {
3009            Self::Empty(fidl::new_empty!(Empty, D))
3010        }
3011
3012        #[inline]
3013        unsafe fn decode(
3014            &mut self,
3015            decoder: &mut fidl::encoding::Decoder<'_, D>,
3016            offset: usize,
3017            mut depth: fidl::encoding::Depth,
3018        ) -> fidl::Result<()> {
3019            decoder.debug_check_bounds::<Self>(offset);
3020            #[allow(unused_variables)]
3021            let next_out_of_line = decoder.next_out_of_line();
3022            let handles_before = decoder.remaining_handles();
3023            let (ordinal, inlined, num_bytes, num_handles) =
3024                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
3025
3026            let member_inline_size = match ordinal {
3027            1 => <Empty as fidl::encoding::TypeMarker>::inline_size(decoder.context),
3028            2 => <u8 as fidl::encoding::TypeMarker>::inline_size(decoder.context),
3029            3 => <fidl_fuchsia_net__common::Ipv6AddressWithPrefix as fidl::encoding::TypeMarker>::inline_size(decoder.context),
3030            _ => return Err(fidl::Error::UnknownUnionTag),
3031        };
3032
3033            if inlined != (member_inline_size <= 4) {
3034                return Err(fidl::Error::InvalidInlineBitInEnvelope);
3035            }
3036            let _inner_offset;
3037            if inlined {
3038                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
3039                _inner_offset = offset + 8;
3040            } else {
3041                depth.increment()?;
3042                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3043            }
3044            match ordinal {
3045                1 => {
3046                    #[allow(irrefutable_let_patterns)]
3047                    if let PrefixDelegationConfig::Empty(_) = self {
3048                        // Do nothing, read the value into the object
3049                    } else {
3050                        // Initialize `self` to the right variant
3051                        *self = PrefixDelegationConfig::Empty(fidl::new_empty!(Empty, D));
3052                    }
3053                    #[allow(irrefutable_let_patterns)]
3054                    if let PrefixDelegationConfig::Empty(ref mut val) = self {
3055                        fidl::decode!(Empty, D, val, decoder, _inner_offset, depth)?;
3056                    } else {
3057                        unreachable!()
3058                    }
3059                }
3060                2 => {
3061                    #[allow(irrefutable_let_patterns)]
3062                    if let PrefixDelegationConfig::PrefixLength(_) = self {
3063                        // Do nothing, read the value into the object
3064                    } else {
3065                        // Initialize `self` to the right variant
3066                        *self = PrefixDelegationConfig::PrefixLength(fidl::new_empty!(u8, D));
3067                    }
3068                    #[allow(irrefutable_let_patterns)]
3069                    if let PrefixDelegationConfig::PrefixLength(ref mut val) = self {
3070                        fidl::decode!(u8, D, val, decoder, _inner_offset, depth)?;
3071                    } else {
3072                        unreachable!()
3073                    }
3074                }
3075                3 => {
3076                    #[allow(irrefutable_let_patterns)]
3077                    if let PrefixDelegationConfig::Prefix(_) = self {
3078                        // Do nothing, read the value into the object
3079                    } else {
3080                        // Initialize `self` to the right variant
3081                        *self = PrefixDelegationConfig::Prefix(fidl::new_empty!(
3082                            fidl_fuchsia_net__common::Ipv6AddressWithPrefix,
3083                            D
3084                        ));
3085                    }
3086                    #[allow(irrefutable_let_patterns)]
3087                    if let PrefixDelegationConfig::Prefix(ref mut val) = self {
3088                        fidl::decode!(
3089                            fidl_fuchsia_net__common::Ipv6AddressWithPrefix,
3090                            D,
3091                            val,
3092                            decoder,
3093                            _inner_offset,
3094                            depth
3095                        )?;
3096                    } else {
3097                        unreachable!()
3098                    }
3099                }
3100                ordinal => panic!("unexpected ordinal {:?}", ordinal),
3101            }
3102            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
3103                return Err(fidl::Error::InvalidNumBytesInEnvelope);
3104            }
3105            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3106                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3107            }
3108            Ok(())
3109        }
3110    }
3111
3112    impl fidl::encoding::ValueTypeMarker for PrefixEvent {
3113        type Borrowed<'a> = &'a Self;
3114        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3115            value
3116        }
3117    }
3118
3119    unsafe impl fidl::encoding::TypeMarker for PrefixEvent {
3120        type Owned = Self;
3121
3122        #[inline(always)]
3123        fn inline_align(_context: fidl::encoding::Context) -> usize {
3124            8
3125        }
3126
3127        #[inline(always)]
3128        fn inline_size(_context: fidl::encoding::Context) -> usize {
3129            16
3130        }
3131    }
3132
3133    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<PrefixEvent, D>
3134        for &PrefixEvent
3135    {
3136        #[inline]
3137        unsafe fn encode(
3138            self,
3139            encoder: &mut fidl::encoding::Encoder<'_, D>,
3140            offset: usize,
3141            _depth: fidl::encoding::Depth,
3142        ) -> fidl::Result<()> {
3143            encoder.debug_check_bounds::<PrefixEvent>(offset);
3144            encoder.write_num::<u64>(self.ordinal(), offset);
3145            match self {
3146                PrefixEvent::Unassigned(ref val) => fidl::encoding::encode_in_envelope::<Empty, D>(
3147                    <Empty as fidl::encoding::ValueTypeMarker>::borrow(val),
3148                    encoder,
3149                    offset + 8,
3150                    _depth,
3151                ),
3152                PrefixEvent::Assigned(ref val) => fidl::encoding::encode_in_envelope::<Prefix, D>(
3153                    <Prefix as fidl::encoding::ValueTypeMarker>::borrow(val),
3154                    encoder,
3155                    offset + 8,
3156                    _depth,
3157                ),
3158            }
3159        }
3160    }
3161
3162    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for PrefixEvent {
3163        #[inline(always)]
3164        fn new_empty() -> Self {
3165            Self::Unassigned(fidl::new_empty!(Empty, D))
3166        }
3167
3168        #[inline]
3169        unsafe fn decode(
3170            &mut self,
3171            decoder: &mut fidl::encoding::Decoder<'_, D>,
3172            offset: usize,
3173            mut depth: fidl::encoding::Depth,
3174        ) -> fidl::Result<()> {
3175            decoder.debug_check_bounds::<Self>(offset);
3176            #[allow(unused_variables)]
3177            let next_out_of_line = decoder.next_out_of_line();
3178            let handles_before = decoder.remaining_handles();
3179            let (ordinal, inlined, num_bytes, num_handles) =
3180                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
3181
3182            let member_inline_size = match ordinal {
3183                1 => <Empty as fidl::encoding::TypeMarker>::inline_size(decoder.context),
3184                2 => <Prefix as fidl::encoding::TypeMarker>::inline_size(decoder.context),
3185                _ => return Err(fidl::Error::UnknownUnionTag),
3186            };
3187
3188            if inlined != (member_inline_size <= 4) {
3189                return Err(fidl::Error::InvalidInlineBitInEnvelope);
3190            }
3191            let _inner_offset;
3192            if inlined {
3193                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
3194                _inner_offset = offset + 8;
3195            } else {
3196                depth.increment()?;
3197                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3198            }
3199            match ordinal {
3200                1 => {
3201                    #[allow(irrefutable_let_patterns)]
3202                    if let PrefixEvent::Unassigned(_) = self {
3203                        // Do nothing, read the value into the object
3204                    } else {
3205                        // Initialize `self` to the right variant
3206                        *self = PrefixEvent::Unassigned(fidl::new_empty!(Empty, D));
3207                    }
3208                    #[allow(irrefutable_let_patterns)]
3209                    if let PrefixEvent::Unassigned(ref mut val) = self {
3210                        fidl::decode!(Empty, D, val, decoder, _inner_offset, depth)?;
3211                    } else {
3212                        unreachable!()
3213                    }
3214                }
3215                2 => {
3216                    #[allow(irrefutable_let_patterns)]
3217                    if let PrefixEvent::Assigned(_) = self {
3218                        // Do nothing, read the value into the object
3219                    } else {
3220                        // Initialize `self` to the right variant
3221                        *self = PrefixEvent::Assigned(fidl::new_empty!(Prefix, D));
3222                    }
3223                    #[allow(irrefutable_let_patterns)]
3224                    if let PrefixEvent::Assigned(ref mut val) = self {
3225                        fidl::decode!(Prefix, D, val, decoder, _inner_offset, depth)?;
3226                    } else {
3227                        unreachable!()
3228                    }
3229                }
3230                ordinal => panic!("unexpected ordinal {:?}", ordinal),
3231            }
3232            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
3233                return Err(fidl::Error::InvalidNumBytesInEnvelope);
3234            }
3235            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3236                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3237            }
3238            Ok(())
3239        }
3240    }
3241}