fidl_fuchsia_net_interfaces__common/
fidl_fuchsia_net_interfaces__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/// An interface name as a sequence of bytes.
12pub type Name = String;
13
14/// The maximum length of an interface name.
15pub const INTERFACE_NAME_LENGTH: u8 = 15;
16
17bitflags! {
18    #[derive(Clone, Copy, Debug, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
19    pub struct AddressPropertiesInterest: u64 {
20        const VALID_UNTIL = 1;
21        const PREFERRED_LIFETIME_INFO = 2;
22    }
23}
24
25impl AddressPropertiesInterest {
26    #[inline(always)]
27    pub fn from_bits_allow_unknown(bits: u64) -> Self {
28        Self::from_bits_retain(bits)
29    }
30
31    #[inline(always)]
32    pub fn has_unknown_bits(&self) -> bool {
33        self.get_unknown_bits() != 0
34    }
35
36    #[inline(always)]
37    pub fn get_unknown_bits(&self) -> u64 {
38        self.bits() & !Self::all().bits()
39    }
40}
41
42/// Assignment state of an IP address.
43#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
44#[repr(u32)]
45pub enum AddressAssignmentState {
46    /// Address assignment is in progress, e.g. Duplicate Address Detection
47    /// is being performed. The address cannot be used when in this state
48    /// (cannot bind to it yet or receive packets destined to it).
49    ///
50    /// The Duplicate Address Detection mechanism is described in
51    /// [RFC 4862, section 5.4](https://tools.ietf.org/html/rfc4862#section-5.4)
52    Tentative = 1,
53    /// The address is assigned to an interface.
54    Assigned = 2,
55    /// The address is unavailable, e.g. if the interface holding the address
56    /// is offline.
57    Unavailable = 3,
58}
59
60impl AddressAssignmentState {
61    #[inline]
62    pub fn from_primitive(prim: u32) -> Option<Self> {
63        match prim {
64            1 => Some(Self::Tentative),
65            2 => Some(Self::Assigned),
66            3 => Some(Self::Unavailable),
67            _ => None,
68        }
69    }
70
71    #[inline]
72    pub const fn into_primitive(self) -> u32 {
73        self as u32
74    }
75}
76
77#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
78pub struct Empty;
79
80impl fidl::Persistable for Empty {}
81
82#[derive(Clone, Debug, PartialEq)]
83pub struct WatcherWatchResponse {
84    pub event: Event,
85}
86
87impl fidl::Persistable for WatcherWatchResponse {}
88
89#[derive(Clone, Debug, Default, PartialEq)]
90pub struct Address {
91    /// The address and prefix length.
92    ///
93    /// Required.
94    pub addr: Option<fidl_fuchsia_net__common::Subnet>,
95    /// The time after which the address will no longer be valid.
96    ///
97    /// Its value must be greater than 0. A value of `ZX_TIME_INFINITE`
98    /// indicates that the address will always be valid. The value is
99    /// derived from the monotonic clock.
100    ///
101    /// As a `zx.Time`, the value has
102    /// [monotonic clock semantics](https://fuchsia.dev/fuchsia-src/concepts/time/monotonic),
103    /// which implies that it has no meaning outside of the host on which it
104    /// was generated and no meaning across host restarts.
105    ///
106    /// Optional; may be omitted due to disinterest.
107    pub valid_until: Option<i64>,
108    /// Preferred lifetime information.
109    ///
110    /// Optional; may be omitted due to disinterest.
111    pub preferred_lifetime_info: Option<PreferredLifetimeInfo>,
112    /// The address's assignment state.
113    ///
114    /// Required.
115    pub assignment_state: Option<AddressAssignmentState>,
116    #[doc(hidden)]
117    pub __source_breaking: fidl::marker::SourceBreaking,
118}
119
120impl fidl::Persistable for Address {}
121
122/// Properties of a network interface.
123#[derive(Clone, Debug, Default, PartialEq)]
124pub struct Properties {
125    /// An opaque identifier for the interface. Its value will not be reused
126    /// even if the device is removed and subsequently re-added. Immutable.
127    pub id: Option<u64>,
128    /// The addresses currently installed on the interface.
129    ///
130    /// Addresses are sorted on [`Address.addr`], and no two addresses can have
131    /// the same `Address.addr` value.
132    ///
133    /// Only assigned addresses are included unless the watcher was created with
134    /// [`WatcherOptions.include_non_assigned_addresses`] set to `true`.
135    pub addresses: Option<Vec<Address>>,
136    /// The device is enabled and its physical state is online.
137    pub online: Option<bool>,
138    /// The device class of the interface. Immutable.
139    ///
140    /// # Deprecation
141    ///
142    /// Replaced by `port_class`. Scheduled for removal in 2025.
143    pub device_class: Option<DeviceClass>,
144    /// Whether there is a default IPv4 route through this interface.
145    pub has_default_ipv4_route: Option<bool>,
146    /// Whether there is a default IPv6 route through this interface.
147    pub has_default_ipv6_route: Option<bool>,
148    /// The name of the interface. Immutable.
149    pub name: Option<String>,
150    /// The port class of the interface. Immutable.
151    pub port_class: Option<PortClass>,
152    #[doc(hidden)]
153    pub __source_breaking: fidl::marker::SourceBreaking,
154}
155
156impl fidl::Persistable for Properties {}
157
158#[derive(Clone, Debug, Default, PartialEq)]
159pub struct WatcherOptions {
160    /// Bitfield for registering interest in address properties.
161    ///
162    /// Optional; interpreted as all bits set to 0 if not present.
163    pub address_properties_interest: Option<AddressPropertiesInterest>,
164    /// Flag to determine if only assigned addresses are returned (where
165    /// the assignment state is [`AddressAssignmentState::Assigned`]) or
166    /// all addresses are returned.
167    ///
168    /// Optional; interpreted as false if not present.
169    pub include_non_assigned_addresses: Option<bool>,
170    #[doc(hidden)]
171    pub __source_breaking: fidl::marker::SourceBreaking,
172}
173
174impl fidl::Persistable for WatcherOptions {}
175
176#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
177pub enum DeviceClass {
178    /// The interface is loopback.
179    Loopback(Empty),
180    Device(fidl_fuchsia_hardware_network__common::DeviceClass),
181}
182
183impl DeviceClass {
184    #[inline]
185    pub fn ordinal(&self) -> u64 {
186        match *self {
187            Self::Loopback(_) => 1,
188            Self::Device(_) => 2,
189        }
190    }
191}
192
193impl fidl::Persistable for DeviceClass {}
194
195#[derive(Clone, Debug, PartialEq)]
196pub enum Event {
197    /// Properties of an interface that existed when watching started.
198    ///
199    /// All interested fields and [`Properties.id`] are set.
200    Existing(Properties),
201    /// Properties of an interface that was added while watching.
202    ///
203    /// All interested fields and [`Properties.id`] are set.
204    Added(Properties),
205    /// ID of an interface that was removed while watching.
206    Removed(u64),
207    /// Properties of an interface that changed while watching.
208    ///
209    /// Only [`Properties.id`] and interested fields which have changed
210    /// are set with the new values.
211    Changed(Properties),
212    /// Sentinel value indicating no more [`existing`] events will be
213    /// sent.
214    Idle(Empty),
215}
216
217impl Event {
218    #[inline]
219    pub fn ordinal(&self) -> u64 {
220        match *self {
221            Self::Existing(_) => 1,
222            Self::Added(_) => 2,
223            Self::Removed(_) => 3,
224            Self::Changed(_) => 4,
225            Self::Idle(_) => 5,
226        }
227    }
228}
229
230impl fidl::Persistable for Event {}
231
232/// The port class of an interface.
233#[derive(Clone, Debug)]
234pub enum PortClass {
235    /// The interface is loopback.
236    Loopback(Empty),
237    /// The interface's network device port class.
238    Device(fidl_fuchsia_hardware_network__common::PortClass),
239    /// The interface is a blackhole interface.
240    Blackhole(Empty),
241    #[doc(hidden)]
242    __SourceBreaking { unknown_ordinal: u64 },
243}
244
245/// Pattern that matches an unknown `PortClass` member.
246#[macro_export]
247macro_rules! PortClassUnknown {
248    () => {
249        _
250    };
251}
252
253// Custom PartialEq so that unknown variants are not equal to themselves.
254impl PartialEq for PortClass {
255    fn eq(&self, other: &Self) -> bool {
256        match (self, other) {
257            (Self::Loopback(x), Self::Loopback(y)) => *x == *y,
258            (Self::Device(x), Self::Device(y)) => *x == *y,
259            (Self::Blackhole(x), Self::Blackhole(y)) => *x == *y,
260            _ => false,
261        }
262    }
263}
264
265impl PortClass {
266    #[inline]
267    pub fn ordinal(&self) -> u64 {
268        match *self {
269            Self::Loopback(_) => 1,
270            Self::Device(_) => 2,
271            Self::Blackhole(_) => 3,
272            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
273        }
274    }
275
276    #[inline]
277    pub fn unknown_variant_for_testing() -> Self {
278        Self::__SourceBreaking { unknown_ordinal: 0 }
279    }
280
281    #[inline]
282    pub fn is_unknown(&self) -> bool {
283        match self {
284            Self::__SourceBreaking { .. } => true,
285            _ => false,
286        }
287    }
288}
289
290impl fidl::Persistable for PortClass {}
291
292/// Information about the preferred lifetime of an IP address or delegated
293/// prefix.
294#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
295pub enum PreferredLifetimeInfo {
296    /// The end of the preferred lifetime.
297    ///
298    /// The address/prefix should *not* be considered deprecated if `zx.Time`
299    /// is in the past. `preferred_until` is exchanged as a means to inform
300    /// the deadline where deprecation is expected to happen.
301    ///
302    /// The preferred lifetime of addresses is defined in
303    /// [RFC 4862, section 2](https://tools.ietf.org/html/rfc4862#section-2).
304    ///
305    /// Addresses configured using a delegated prefix must have a preferred
306    /// lifetime no longer than that of the prefix according to
307    /// [RFC 8415, section 6.3](https://datatracker.ietf.org/doc/html/rfc8415#section-6.3).
308    ///
309    /// Must be greater than 0. If `zx.Time.INFINITE`, the preferred lifetime
310    /// does not expire.
311    PreferredUntil(i64),
312    /// The address/prefix is deprecated.
313    ///
314    /// Deprecated addresses should no longer be used for initiating
315    /// new connections unless explicitly requested, or if no other
316    /// non-deprecated addresses are assigned (as described in
317    /// [RFC 4862, section 1](https://tools.ietf.org/html/rfc4862#section-1)).
318    ///
319    /// Addresses configured using a deprecated delegated prefix must also be
320    /// deprecated according to
321    /// [RFC 8415, section 6.3](https://datatracker.ietf.org/doc/html/rfc8415#section-6.3).
322    ///
323    /// An address/prefix can become undeprecated if its preferred lifetime is
324    /// extended.
325    Deprecated(Empty),
326}
327
328impl PreferredLifetimeInfo {
329    #[inline]
330    pub fn ordinal(&self) -> u64 {
331        match *self {
332            Self::PreferredUntil(_) => 1,
333            Self::Deprecated(_) => 2,
334        }
335    }
336}
337
338impl fidl::Persistable for PreferredLifetimeInfo {}
339
340pub mod state_ordinals {
341    pub const GET_WATCHER: u64 = 0x4fe223c98b263ae3;
342}
343
344pub mod watcher_ordinals {
345    pub const WATCH: u64 = 0x550767aa9faeeef3;
346}
347
348mod internal {
349    use super::*;
350    unsafe impl fidl::encoding::TypeMarker for AddressPropertiesInterest {
351        type Owned = Self;
352
353        #[inline(always)]
354        fn inline_align(_context: fidl::encoding::Context) -> usize {
355            8
356        }
357
358        #[inline(always)]
359        fn inline_size(_context: fidl::encoding::Context) -> usize {
360            8
361        }
362    }
363
364    impl fidl::encoding::ValueTypeMarker for AddressPropertiesInterest {
365        type Borrowed<'a> = Self;
366        #[inline(always)]
367        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
368            *value
369        }
370    }
371
372    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
373        for AddressPropertiesInterest
374    {
375        #[inline]
376        unsafe fn encode(
377            self,
378            encoder: &mut fidl::encoding::Encoder<'_, D>,
379            offset: usize,
380            _depth: fidl::encoding::Depth,
381        ) -> fidl::Result<()> {
382            encoder.debug_check_bounds::<Self>(offset);
383            encoder.write_num(self.bits(), offset);
384            Ok(())
385        }
386    }
387
388    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
389        for AddressPropertiesInterest
390    {
391        #[inline(always)]
392        fn new_empty() -> Self {
393            Self::empty()
394        }
395
396        #[inline]
397        unsafe fn decode(
398            &mut self,
399            decoder: &mut fidl::encoding::Decoder<'_, D>,
400            offset: usize,
401            _depth: fidl::encoding::Depth,
402        ) -> fidl::Result<()> {
403            decoder.debug_check_bounds::<Self>(offset);
404            let prim = decoder.read_num::<u64>(offset);
405            *self = Self::from_bits_allow_unknown(prim);
406            Ok(())
407        }
408    }
409    unsafe impl fidl::encoding::TypeMarker for AddressAssignmentState {
410        type Owned = Self;
411
412        #[inline(always)]
413        fn inline_align(_context: fidl::encoding::Context) -> usize {
414            std::mem::align_of::<u32>()
415        }
416
417        #[inline(always)]
418        fn inline_size(_context: fidl::encoding::Context) -> usize {
419            std::mem::size_of::<u32>()
420        }
421
422        #[inline(always)]
423        fn encode_is_copy() -> bool {
424            true
425        }
426
427        #[inline(always)]
428        fn decode_is_copy() -> bool {
429            false
430        }
431    }
432
433    impl fidl::encoding::ValueTypeMarker for AddressAssignmentState {
434        type Borrowed<'a> = Self;
435        #[inline(always)]
436        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
437            *value
438        }
439    }
440
441    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
442        for AddressAssignmentState
443    {
444        #[inline]
445        unsafe fn encode(
446            self,
447            encoder: &mut fidl::encoding::Encoder<'_, D>,
448            offset: usize,
449            _depth: fidl::encoding::Depth,
450        ) -> fidl::Result<()> {
451            encoder.debug_check_bounds::<Self>(offset);
452            encoder.write_num(self.into_primitive(), offset);
453            Ok(())
454        }
455    }
456
457    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
458        for AddressAssignmentState
459    {
460        #[inline(always)]
461        fn new_empty() -> Self {
462            Self::Tentative
463        }
464
465        #[inline]
466        unsafe fn decode(
467            &mut self,
468            decoder: &mut fidl::encoding::Decoder<'_, D>,
469            offset: usize,
470            _depth: fidl::encoding::Depth,
471        ) -> fidl::Result<()> {
472            decoder.debug_check_bounds::<Self>(offset);
473            let prim = decoder.read_num::<u32>(offset);
474
475            *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
476            Ok(())
477        }
478    }
479
480    impl fidl::encoding::ValueTypeMarker for Empty {
481        type Borrowed<'a> = &'a Self;
482        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
483            value
484        }
485    }
486
487    unsafe impl fidl::encoding::TypeMarker for Empty {
488        type Owned = Self;
489
490        #[inline(always)]
491        fn inline_align(_context: fidl::encoding::Context) -> usize {
492            1
493        }
494
495        #[inline(always)]
496        fn inline_size(_context: fidl::encoding::Context) -> usize {
497            1
498        }
499    }
500
501    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Empty, D> for &Empty {
502        #[inline]
503        unsafe fn encode(
504            self,
505            encoder: &mut fidl::encoding::Encoder<'_, D>,
506            offset: usize,
507            _depth: fidl::encoding::Depth,
508        ) -> fidl::Result<()> {
509            encoder.debug_check_bounds::<Empty>(offset);
510            encoder.write_num(0u8, offset);
511            Ok(())
512        }
513    }
514
515    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Empty {
516        #[inline(always)]
517        fn new_empty() -> Self {
518            Self
519        }
520
521        #[inline]
522        unsafe fn decode(
523            &mut self,
524            decoder: &mut fidl::encoding::Decoder<'_, D>,
525            offset: usize,
526            _depth: fidl::encoding::Depth,
527        ) -> fidl::Result<()> {
528            decoder.debug_check_bounds::<Self>(offset);
529            match decoder.read_num::<u8>(offset) {
530                0 => Ok(()),
531                _ => Err(fidl::Error::Invalid),
532            }
533        }
534    }
535
536    impl fidl::encoding::ValueTypeMarker for WatcherWatchResponse {
537        type Borrowed<'a> = &'a Self;
538        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
539            value
540        }
541    }
542
543    unsafe impl fidl::encoding::TypeMarker for WatcherWatchResponse {
544        type Owned = Self;
545
546        #[inline(always)]
547        fn inline_align(_context: fidl::encoding::Context) -> usize {
548            8
549        }
550
551        #[inline(always)]
552        fn inline_size(_context: fidl::encoding::Context) -> usize {
553            16
554        }
555    }
556
557    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<WatcherWatchResponse, D>
558        for &WatcherWatchResponse
559    {
560        #[inline]
561        unsafe fn encode(
562            self,
563            encoder: &mut fidl::encoding::Encoder<'_, D>,
564            offset: usize,
565            _depth: fidl::encoding::Depth,
566        ) -> fidl::Result<()> {
567            encoder.debug_check_bounds::<WatcherWatchResponse>(offset);
568            // Delegate to tuple encoding.
569            fidl::encoding::Encode::<WatcherWatchResponse, D>::encode(
570                (<Event as fidl::encoding::ValueTypeMarker>::borrow(&self.event),),
571                encoder,
572                offset,
573                _depth,
574            )
575        }
576    }
577    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<Event, D>>
578        fidl::encoding::Encode<WatcherWatchResponse, D> for (T0,)
579    {
580        #[inline]
581        unsafe fn encode(
582            self,
583            encoder: &mut fidl::encoding::Encoder<'_, D>,
584            offset: usize,
585            depth: fidl::encoding::Depth,
586        ) -> fidl::Result<()> {
587            encoder.debug_check_bounds::<WatcherWatchResponse>(offset);
588            // Zero out padding regions. There's no need to apply masks
589            // because the unmasked parts will be overwritten by fields.
590            // Write the fields.
591            self.0.encode(encoder, offset + 0, depth)?;
592            Ok(())
593        }
594    }
595
596    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for WatcherWatchResponse {
597        #[inline(always)]
598        fn new_empty() -> Self {
599            Self { event: fidl::new_empty!(Event, D) }
600        }
601
602        #[inline]
603        unsafe fn decode(
604            &mut self,
605            decoder: &mut fidl::encoding::Decoder<'_, D>,
606            offset: usize,
607            _depth: fidl::encoding::Depth,
608        ) -> fidl::Result<()> {
609            decoder.debug_check_bounds::<Self>(offset);
610            // Verify that padding bytes are zero.
611            fidl::decode!(Event, D, &mut self.event, decoder, offset + 0, _depth)?;
612            Ok(())
613        }
614    }
615
616    impl Address {
617        #[inline(always)]
618        fn max_ordinal_present(&self) -> u64 {
619            if let Some(_) = self.assignment_state {
620                return 4;
621            }
622            if let Some(_) = self.preferred_lifetime_info {
623                return 3;
624            }
625            if let Some(_) = self.valid_until {
626                return 2;
627            }
628            if let Some(_) = self.addr {
629                return 1;
630            }
631            0
632        }
633    }
634
635    impl fidl::encoding::ValueTypeMarker for Address {
636        type Borrowed<'a> = &'a Self;
637        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
638            value
639        }
640    }
641
642    unsafe impl fidl::encoding::TypeMarker for Address {
643        type Owned = Self;
644
645        #[inline(always)]
646        fn inline_align(_context: fidl::encoding::Context) -> usize {
647            8
648        }
649
650        #[inline(always)]
651        fn inline_size(_context: fidl::encoding::Context) -> usize {
652            16
653        }
654    }
655
656    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Address, D> for &Address {
657        unsafe fn encode(
658            self,
659            encoder: &mut fidl::encoding::Encoder<'_, D>,
660            offset: usize,
661            mut depth: fidl::encoding::Depth,
662        ) -> fidl::Result<()> {
663            encoder.debug_check_bounds::<Address>(offset);
664            // Vector header
665            let max_ordinal: u64 = self.max_ordinal_present();
666            encoder.write_num(max_ordinal, offset);
667            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
668            // Calling encoder.out_of_line_offset(0) is not allowed.
669            if max_ordinal == 0 {
670                return Ok(());
671            }
672            depth.increment()?;
673            let envelope_size = 8;
674            let bytes_len = max_ordinal as usize * envelope_size;
675            #[allow(unused_variables)]
676            let offset = encoder.out_of_line_offset(bytes_len);
677            let mut _prev_end_offset: usize = 0;
678            if 1 > max_ordinal {
679                return Ok(());
680            }
681
682            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
683            // are envelope_size bytes.
684            let cur_offset: usize = (1 - 1) * envelope_size;
685
686            // Zero reserved fields.
687            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
688
689            // Safety:
690            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
691            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
692            //   envelope_size bytes, there is always sufficient room.
693            fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_net__common::Subnet, D>(
694                self.addr.as_ref().map(
695                    <fidl_fuchsia_net__common::Subnet as fidl::encoding::ValueTypeMarker>::borrow,
696                ),
697                encoder,
698                offset + cur_offset,
699                depth,
700            )?;
701
702            _prev_end_offset = cur_offset + envelope_size;
703            if 2 > max_ordinal {
704                return Ok(());
705            }
706
707            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
708            // are envelope_size bytes.
709            let cur_offset: usize = (2 - 1) * envelope_size;
710
711            // Zero reserved fields.
712            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
713
714            // Safety:
715            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
716            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
717            //   envelope_size bytes, there is always sufficient room.
718            fidl::encoding::encode_in_envelope_optional::<i64, D>(
719                self.valid_until.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
720                encoder,
721                offset + cur_offset,
722                depth,
723            )?;
724
725            _prev_end_offset = cur_offset + envelope_size;
726            if 3 > max_ordinal {
727                return Ok(());
728            }
729
730            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
731            // are envelope_size bytes.
732            let cur_offset: usize = (3 - 1) * envelope_size;
733
734            // Zero reserved fields.
735            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
736
737            // Safety:
738            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
739            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
740            //   envelope_size bytes, there is always sufficient room.
741            fidl::encoding::encode_in_envelope_optional::<PreferredLifetimeInfo, D>(
742                self.preferred_lifetime_info
743                    .as_ref()
744                    .map(<PreferredLifetimeInfo as fidl::encoding::ValueTypeMarker>::borrow),
745                encoder,
746                offset + cur_offset,
747                depth,
748            )?;
749
750            _prev_end_offset = cur_offset + envelope_size;
751            if 4 > max_ordinal {
752                return Ok(());
753            }
754
755            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
756            // are envelope_size bytes.
757            let cur_offset: usize = (4 - 1) * envelope_size;
758
759            // Zero reserved fields.
760            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
761
762            // Safety:
763            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
764            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
765            //   envelope_size bytes, there is always sufficient room.
766            fidl::encoding::encode_in_envelope_optional::<AddressAssignmentState, D>(
767                self.assignment_state
768                    .as_ref()
769                    .map(<AddressAssignmentState as fidl::encoding::ValueTypeMarker>::borrow),
770                encoder,
771                offset + cur_offset,
772                depth,
773            )?;
774
775            _prev_end_offset = cur_offset + envelope_size;
776
777            Ok(())
778        }
779    }
780
781    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Address {
782        #[inline(always)]
783        fn new_empty() -> Self {
784            Self::default()
785        }
786
787        unsafe fn decode(
788            &mut self,
789            decoder: &mut fidl::encoding::Decoder<'_, D>,
790            offset: usize,
791            mut depth: fidl::encoding::Depth,
792        ) -> fidl::Result<()> {
793            decoder.debug_check_bounds::<Self>(offset);
794            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
795                None => return Err(fidl::Error::NotNullable),
796                Some(len) => len,
797            };
798            // Calling decoder.out_of_line_offset(0) is not allowed.
799            if len == 0 {
800                return Ok(());
801            };
802            depth.increment()?;
803            let envelope_size = 8;
804            let bytes_len = len * envelope_size;
805            let offset = decoder.out_of_line_offset(bytes_len)?;
806            // Decode the envelope for each type.
807            let mut _next_ordinal_to_read = 0;
808            let mut next_offset = offset;
809            let end_offset = offset + bytes_len;
810            _next_ordinal_to_read += 1;
811            if next_offset >= end_offset {
812                return Ok(());
813            }
814
815            // Decode unknown envelopes for gaps in ordinals.
816            while _next_ordinal_to_read < 1 {
817                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
818                _next_ordinal_to_read += 1;
819                next_offset += envelope_size;
820            }
821
822            let next_out_of_line = decoder.next_out_of_line();
823            let handles_before = decoder.remaining_handles();
824            if let Some((inlined, num_bytes, num_handles)) =
825                fidl::encoding::decode_envelope_header(decoder, next_offset)?
826            {
827                let member_inline_size =
828                    <fidl_fuchsia_net__common::Subnet as fidl::encoding::TypeMarker>::inline_size(
829                        decoder.context,
830                    );
831                if inlined != (member_inline_size <= 4) {
832                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
833                }
834                let inner_offset;
835                let mut inner_depth = depth.clone();
836                if inlined {
837                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
838                    inner_offset = next_offset;
839                } else {
840                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
841                    inner_depth.increment()?;
842                }
843                let val_ref = self
844                    .addr
845                    .get_or_insert_with(|| fidl::new_empty!(fidl_fuchsia_net__common::Subnet, D));
846                fidl::decode!(
847                    fidl_fuchsia_net__common::Subnet,
848                    D,
849                    val_ref,
850                    decoder,
851                    inner_offset,
852                    inner_depth
853                )?;
854                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
855                {
856                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
857                }
858                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
859                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
860                }
861            }
862
863            next_offset += envelope_size;
864            _next_ordinal_to_read += 1;
865            if next_offset >= end_offset {
866                return Ok(());
867            }
868
869            // Decode unknown envelopes for gaps in ordinals.
870            while _next_ordinal_to_read < 2 {
871                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
872                _next_ordinal_to_read += 1;
873                next_offset += envelope_size;
874            }
875
876            let next_out_of_line = decoder.next_out_of_line();
877            let handles_before = decoder.remaining_handles();
878            if let Some((inlined, num_bytes, num_handles)) =
879                fidl::encoding::decode_envelope_header(decoder, next_offset)?
880            {
881                let member_inline_size =
882                    <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
883                if inlined != (member_inline_size <= 4) {
884                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
885                }
886                let inner_offset;
887                let mut inner_depth = depth.clone();
888                if inlined {
889                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
890                    inner_offset = next_offset;
891                } else {
892                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
893                    inner_depth.increment()?;
894                }
895                let val_ref = self.valid_until.get_or_insert_with(|| fidl::new_empty!(i64, D));
896                fidl::decode!(i64, D, val_ref, decoder, inner_offset, inner_depth)?;
897                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
898                {
899                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
900                }
901                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
902                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
903                }
904            }
905
906            next_offset += envelope_size;
907            _next_ordinal_to_read += 1;
908            if next_offset >= end_offset {
909                return Ok(());
910            }
911
912            // Decode unknown envelopes for gaps in ordinals.
913            while _next_ordinal_to_read < 3 {
914                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
915                _next_ordinal_to_read += 1;
916                next_offset += envelope_size;
917            }
918
919            let next_out_of_line = decoder.next_out_of_line();
920            let handles_before = decoder.remaining_handles();
921            if let Some((inlined, num_bytes, num_handles)) =
922                fidl::encoding::decode_envelope_header(decoder, next_offset)?
923            {
924                let member_inline_size =
925                    <PreferredLifetimeInfo as fidl::encoding::TypeMarker>::inline_size(
926                        decoder.context,
927                    );
928                if inlined != (member_inline_size <= 4) {
929                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
930                }
931                let inner_offset;
932                let mut inner_depth = depth.clone();
933                if inlined {
934                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
935                    inner_offset = next_offset;
936                } else {
937                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
938                    inner_depth.increment()?;
939                }
940                let val_ref = self
941                    .preferred_lifetime_info
942                    .get_or_insert_with(|| fidl::new_empty!(PreferredLifetimeInfo, D));
943                fidl::decode!(
944                    PreferredLifetimeInfo,
945                    D,
946                    val_ref,
947                    decoder,
948                    inner_offset,
949                    inner_depth
950                )?;
951                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
952                {
953                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
954                }
955                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
956                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
957                }
958            }
959
960            next_offset += envelope_size;
961            _next_ordinal_to_read += 1;
962            if next_offset >= end_offset {
963                return Ok(());
964            }
965
966            // Decode unknown envelopes for gaps in ordinals.
967            while _next_ordinal_to_read < 4 {
968                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
969                _next_ordinal_to_read += 1;
970                next_offset += envelope_size;
971            }
972
973            let next_out_of_line = decoder.next_out_of_line();
974            let handles_before = decoder.remaining_handles();
975            if let Some((inlined, num_bytes, num_handles)) =
976                fidl::encoding::decode_envelope_header(decoder, next_offset)?
977            {
978                let member_inline_size =
979                    <AddressAssignmentState as fidl::encoding::TypeMarker>::inline_size(
980                        decoder.context,
981                    );
982                if inlined != (member_inline_size <= 4) {
983                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
984                }
985                let inner_offset;
986                let mut inner_depth = depth.clone();
987                if inlined {
988                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
989                    inner_offset = next_offset;
990                } else {
991                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
992                    inner_depth.increment()?;
993                }
994                let val_ref = self
995                    .assignment_state
996                    .get_or_insert_with(|| fidl::new_empty!(AddressAssignmentState, D));
997                fidl::decode!(
998                    AddressAssignmentState,
999                    D,
1000                    val_ref,
1001                    decoder,
1002                    inner_offset,
1003                    inner_depth
1004                )?;
1005                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1006                {
1007                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
1008                }
1009                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1010                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1011                }
1012            }
1013
1014            next_offset += envelope_size;
1015
1016            // Decode the remaining unknown envelopes.
1017            while next_offset < end_offset {
1018                _next_ordinal_to_read += 1;
1019                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1020                next_offset += envelope_size;
1021            }
1022
1023            Ok(())
1024        }
1025    }
1026
1027    impl Properties {
1028        #[inline(always)]
1029        fn max_ordinal_present(&self) -> u64 {
1030            if let Some(_) = self.port_class {
1031                return 8;
1032            }
1033            if let Some(_) = self.name {
1034                return 7;
1035            }
1036            if let Some(_) = self.has_default_ipv6_route {
1037                return 6;
1038            }
1039            if let Some(_) = self.has_default_ipv4_route {
1040                return 5;
1041            }
1042            if let Some(_) = self.device_class {
1043                return 4;
1044            }
1045            if let Some(_) = self.online {
1046                return 3;
1047            }
1048            if let Some(_) = self.addresses {
1049                return 2;
1050            }
1051            if let Some(_) = self.id {
1052                return 1;
1053            }
1054            0
1055        }
1056    }
1057
1058    impl fidl::encoding::ValueTypeMarker for Properties {
1059        type Borrowed<'a> = &'a Self;
1060        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1061            value
1062        }
1063    }
1064
1065    unsafe impl fidl::encoding::TypeMarker for Properties {
1066        type Owned = Self;
1067
1068        #[inline(always)]
1069        fn inline_align(_context: fidl::encoding::Context) -> usize {
1070            8
1071        }
1072
1073        #[inline(always)]
1074        fn inline_size(_context: fidl::encoding::Context) -> usize {
1075            16
1076        }
1077    }
1078
1079    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Properties, D>
1080        for &Properties
1081    {
1082        unsafe fn encode(
1083            self,
1084            encoder: &mut fidl::encoding::Encoder<'_, D>,
1085            offset: usize,
1086            mut depth: fidl::encoding::Depth,
1087        ) -> fidl::Result<()> {
1088            encoder.debug_check_bounds::<Properties>(offset);
1089            // Vector header
1090            let max_ordinal: u64 = self.max_ordinal_present();
1091            encoder.write_num(max_ordinal, offset);
1092            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
1093            // Calling encoder.out_of_line_offset(0) is not allowed.
1094            if max_ordinal == 0 {
1095                return Ok(());
1096            }
1097            depth.increment()?;
1098            let envelope_size = 8;
1099            let bytes_len = max_ordinal as usize * envelope_size;
1100            #[allow(unused_variables)]
1101            let offset = encoder.out_of_line_offset(bytes_len);
1102            let mut _prev_end_offset: usize = 0;
1103            if 1 > max_ordinal {
1104                return Ok(());
1105            }
1106
1107            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1108            // are envelope_size bytes.
1109            let cur_offset: usize = (1 - 1) * envelope_size;
1110
1111            // Zero reserved fields.
1112            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1113
1114            // Safety:
1115            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1116            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1117            //   envelope_size bytes, there is always sufficient room.
1118            fidl::encoding::encode_in_envelope_optional::<u64, D>(
1119                self.id.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
1120                encoder,
1121                offset + cur_offset,
1122                depth,
1123            )?;
1124
1125            _prev_end_offset = cur_offset + envelope_size;
1126            if 2 > max_ordinal {
1127                return Ok(());
1128            }
1129
1130            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1131            // are envelope_size bytes.
1132            let cur_offset: usize = (2 - 1) * envelope_size;
1133
1134            // Zero reserved fields.
1135            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1136
1137            // Safety:
1138            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1139            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1140            //   envelope_size bytes, there is always sufficient room.
1141            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedVector<Address>, D>(
1142            self.addresses.as_ref().map(<fidl::encoding::UnboundedVector<Address> as fidl::encoding::ValueTypeMarker>::borrow),
1143            encoder, offset + cur_offset, depth
1144        )?;
1145
1146            _prev_end_offset = cur_offset + envelope_size;
1147            if 3 > max_ordinal {
1148                return Ok(());
1149            }
1150
1151            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1152            // are envelope_size bytes.
1153            let cur_offset: usize = (3 - 1) * envelope_size;
1154
1155            // Zero reserved fields.
1156            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1157
1158            // Safety:
1159            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1160            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1161            //   envelope_size bytes, there is always sufficient room.
1162            fidl::encoding::encode_in_envelope_optional::<bool, D>(
1163                self.online.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
1164                encoder,
1165                offset + cur_offset,
1166                depth,
1167            )?;
1168
1169            _prev_end_offset = cur_offset + envelope_size;
1170            if 4 > max_ordinal {
1171                return Ok(());
1172            }
1173
1174            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1175            // are envelope_size bytes.
1176            let cur_offset: usize = (4 - 1) * envelope_size;
1177
1178            // Zero reserved fields.
1179            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1180
1181            // Safety:
1182            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1183            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1184            //   envelope_size bytes, there is always sufficient room.
1185            fidl::encoding::encode_in_envelope_optional::<DeviceClass, D>(
1186                self.device_class
1187                    .as_ref()
1188                    .map(<DeviceClass as fidl::encoding::ValueTypeMarker>::borrow),
1189                encoder,
1190                offset + cur_offset,
1191                depth,
1192            )?;
1193
1194            _prev_end_offset = cur_offset + envelope_size;
1195            if 5 > max_ordinal {
1196                return Ok(());
1197            }
1198
1199            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1200            // are envelope_size bytes.
1201            let cur_offset: usize = (5 - 1) * envelope_size;
1202
1203            // Zero reserved fields.
1204            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1205
1206            // Safety:
1207            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1208            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1209            //   envelope_size bytes, there is always sufficient room.
1210            fidl::encoding::encode_in_envelope_optional::<bool, D>(
1211                self.has_default_ipv4_route
1212                    .as_ref()
1213                    .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
1214                encoder,
1215                offset + cur_offset,
1216                depth,
1217            )?;
1218
1219            _prev_end_offset = cur_offset + envelope_size;
1220            if 6 > max_ordinal {
1221                return Ok(());
1222            }
1223
1224            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1225            // are envelope_size bytes.
1226            let cur_offset: usize = (6 - 1) * envelope_size;
1227
1228            // Zero reserved fields.
1229            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1230
1231            // Safety:
1232            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1233            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1234            //   envelope_size bytes, there is always sufficient room.
1235            fidl::encoding::encode_in_envelope_optional::<bool, D>(
1236                self.has_default_ipv6_route
1237                    .as_ref()
1238                    .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
1239                encoder,
1240                offset + cur_offset,
1241                depth,
1242            )?;
1243
1244            _prev_end_offset = cur_offset + envelope_size;
1245            if 7 > max_ordinal {
1246                return Ok(());
1247            }
1248
1249            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1250            // are envelope_size bytes.
1251            let cur_offset: usize = (7 - 1) * envelope_size;
1252
1253            // Zero reserved fields.
1254            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1255
1256            // Safety:
1257            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1258            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1259            //   envelope_size bytes, there is always sufficient room.
1260            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<15>, D>(
1261                self.name.as_ref().map(
1262                    <fidl::encoding::BoundedString<15> as fidl::encoding::ValueTypeMarker>::borrow,
1263                ),
1264                encoder,
1265                offset + cur_offset,
1266                depth,
1267            )?;
1268
1269            _prev_end_offset = cur_offset + envelope_size;
1270            if 8 > max_ordinal {
1271                return Ok(());
1272            }
1273
1274            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1275            // are envelope_size bytes.
1276            let cur_offset: usize = (8 - 1) * envelope_size;
1277
1278            // Zero reserved fields.
1279            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1280
1281            // Safety:
1282            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1283            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1284            //   envelope_size bytes, there is always sufficient room.
1285            fidl::encoding::encode_in_envelope_optional::<PortClass, D>(
1286                self.port_class
1287                    .as_ref()
1288                    .map(<PortClass as fidl::encoding::ValueTypeMarker>::borrow),
1289                encoder,
1290                offset + cur_offset,
1291                depth,
1292            )?;
1293
1294            _prev_end_offset = cur_offset + envelope_size;
1295
1296            Ok(())
1297        }
1298    }
1299
1300    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Properties {
1301        #[inline(always)]
1302        fn new_empty() -> Self {
1303            Self::default()
1304        }
1305
1306        unsafe fn decode(
1307            &mut self,
1308            decoder: &mut fidl::encoding::Decoder<'_, D>,
1309            offset: usize,
1310            mut depth: fidl::encoding::Depth,
1311        ) -> fidl::Result<()> {
1312            decoder.debug_check_bounds::<Self>(offset);
1313            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
1314                None => return Err(fidl::Error::NotNullable),
1315                Some(len) => len,
1316            };
1317            // Calling decoder.out_of_line_offset(0) is not allowed.
1318            if len == 0 {
1319                return Ok(());
1320            };
1321            depth.increment()?;
1322            let envelope_size = 8;
1323            let bytes_len = len * envelope_size;
1324            let offset = decoder.out_of_line_offset(bytes_len)?;
1325            // Decode the envelope for each type.
1326            let mut _next_ordinal_to_read = 0;
1327            let mut next_offset = offset;
1328            let end_offset = offset + bytes_len;
1329            _next_ordinal_to_read += 1;
1330            if next_offset >= end_offset {
1331                return Ok(());
1332            }
1333
1334            // Decode unknown envelopes for gaps in ordinals.
1335            while _next_ordinal_to_read < 1 {
1336                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1337                _next_ordinal_to_read += 1;
1338                next_offset += envelope_size;
1339            }
1340
1341            let next_out_of_line = decoder.next_out_of_line();
1342            let handles_before = decoder.remaining_handles();
1343            if let Some((inlined, num_bytes, num_handles)) =
1344                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1345            {
1346                let member_inline_size =
1347                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1348                if inlined != (member_inline_size <= 4) {
1349                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1350                }
1351                let inner_offset;
1352                let mut inner_depth = depth.clone();
1353                if inlined {
1354                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1355                    inner_offset = next_offset;
1356                } else {
1357                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1358                    inner_depth.increment()?;
1359                }
1360                let val_ref = self.id.get_or_insert_with(|| fidl::new_empty!(u64, D));
1361                fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
1362                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1363                {
1364                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
1365                }
1366                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1367                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1368                }
1369            }
1370
1371            next_offset += envelope_size;
1372            _next_ordinal_to_read += 1;
1373            if next_offset >= end_offset {
1374                return Ok(());
1375            }
1376
1377            // Decode unknown envelopes for gaps in ordinals.
1378            while _next_ordinal_to_read < 2 {
1379                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1380                _next_ordinal_to_read += 1;
1381                next_offset += envelope_size;
1382            }
1383
1384            let next_out_of_line = decoder.next_out_of_line();
1385            let handles_before = decoder.remaining_handles();
1386            if let Some((inlined, num_bytes, num_handles)) =
1387                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1388            {
1389                let member_inline_size = <fidl::encoding::UnboundedVector<Address> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1390                if inlined != (member_inline_size <= 4) {
1391                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1392                }
1393                let inner_offset;
1394                let mut inner_depth = depth.clone();
1395                if inlined {
1396                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1397                    inner_offset = next_offset;
1398                } else {
1399                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1400                    inner_depth.increment()?;
1401                }
1402                let val_ref = self.addresses.get_or_insert_with(|| {
1403                    fidl::new_empty!(fidl::encoding::UnboundedVector<Address>, D)
1404                });
1405                fidl::decode!(
1406                    fidl::encoding::UnboundedVector<Address>,
1407                    D,
1408                    val_ref,
1409                    decoder,
1410                    inner_offset,
1411                    inner_depth
1412                )?;
1413                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1414                {
1415                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
1416                }
1417                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1418                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1419                }
1420            }
1421
1422            next_offset += envelope_size;
1423            _next_ordinal_to_read += 1;
1424            if next_offset >= end_offset {
1425                return Ok(());
1426            }
1427
1428            // Decode unknown envelopes for gaps in ordinals.
1429            while _next_ordinal_to_read < 3 {
1430                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1431                _next_ordinal_to_read += 1;
1432                next_offset += envelope_size;
1433            }
1434
1435            let next_out_of_line = decoder.next_out_of_line();
1436            let handles_before = decoder.remaining_handles();
1437            if let Some((inlined, num_bytes, num_handles)) =
1438                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1439            {
1440                let member_inline_size =
1441                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1442                if inlined != (member_inline_size <= 4) {
1443                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1444                }
1445                let inner_offset;
1446                let mut inner_depth = depth.clone();
1447                if inlined {
1448                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1449                    inner_offset = next_offset;
1450                } else {
1451                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1452                    inner_depth.increment()?;
1453                }
1454                let val_ref = self.online.get_or_insert_with(|| fidl::new_empty!(bool, D));
1455                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
1456                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1457                {
1458                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
1459                }
1460                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1461                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1462                }
1463            }
1464
1465            next_offset += envelope_size;
1466            _next_ordinal_to_read += 1;
1467            if next_offset >= end_offset {
1468                return Ok(());
1469            }
1470
1471            // Decode unknown envelopes for gaps in ordinals.
1472            while _next_ordinal_to_read < 4 {
1473                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1474                _next_ordinal_to_read += 1;
1475                next_offset += envelope_size;
1476            }
1477
1478            let next_out_of_line = decoder.next_out_of_line();
1479            let handles_before = decoder.remaining_handles();
1480            if let Some((inlined, num_bytes, num_handles)) =
1481                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1482            {
1483                let member_inline_size =
1484                    <DeviceClass as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1485                if inlined != (member_inline_size <= 4) {
1486                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1487                }
1488                let inner_offset;
1489                let mut inner_depth = depth.clone();
1490                if inlined {
1491                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1492                    inner_offset = next_offset;
1493                } else {
1494                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1495                    inner_depth.increment()?;
1496                }
1497                let val_ref =
1498                    self.device_class.get_or_insert_with(|| fidl::new_empty!(DeviceClass, D));
1499                fidl::decode!(DeviceClass, D, val_ref, decoder, inner_offset, inner_depth)?;
1500                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1501                {
1502                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
1503                }
1504                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1505                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1506                }
1507            }
1508
1509            next_offset += envelope_size;
1510            _next_ordinal_to_read += 1;
1511            if next_offset >= end_offset {
1512                return Ok(());
1513            }
1514
1515            // Decode unknown envelopes for gaps in ordinals.
1516            while _next_ordinal_to_read < 5 {
1517                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1518                _next_ordinal_to_read += 1;
1519                next_offset += envelope_size;
1520            }
1521
1522            let next_out_of_line = decoder.next_out_of_line();
1523            let handles_before = decoder.remaining_handles();
1524            if let Some((inlined, num_bytes, num_handles)) =
1525                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1526            {
1527                let member_inline_size =
1528                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1529                if inlined != (member_inline_size <= 4) {
1530                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1531                }
1532                let inner_offset;
1533                let mut inner_depth = depth.clone();
1534                if inlined {
1535                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1536                    inner_offset = next_offset;
1537                } else {
1538                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1539                    inner_depth.increment()?;
1540                }
1541                let val_ref =
1542                    self.has_default_ipv4_route.get_or_insert_with(|| fidl::new_empty!(bool, D));
1543                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
1544                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1545                {
1546                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
1547                }
1548                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1549                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1550                }
1551            }
1552
1553            next_offset += envelope_size;
1554            _next_ordinal_to_read += 1;
1555            if next_offset >= end_offset {
1556                return Ok(());
1557            }
1558
1559            // Decode unknown envelopes for gaps in ordinals.
1560            while _next_ordinal_to_read < 6 {
1561                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1562                _next_ordinal_to_read += 1;
1563                next_offset += envelope_size;
1564            }
1565
1566            let next_out_of_line = decoder.next_out_of_line();
1567            let handles_before = decoder.remaining_handles();
1568            if let Some((inlined, num_bytes, num_handles)) =
1569                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1570            {
1571                let member_inline_size =
1572                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1573                if inlined != (member_inline_size <= 4) {
1574                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1575                }
1576                let inner_offset;
1577                let mut inner_depth = depth.clone();
1578                if inlined {
1579                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1580                    inner_offset = next_offset;
1581                } else {
1582                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1583                    inner_depth.increment()?;
1584                }
1585                let val_ref =
1586                    self.has_default_ipv6_route.get_or_insert_with(|| fidl::new_empty!(bool, D));
1587                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
1588                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1589                {
1590                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
1591                }
1592                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1593                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1594                }
1595            }
1596
1597            next_offset += envelope_size;
1598            _next_ordinal_to_read += 1;
1599            if next_offset >= end_offset {
1600                return Ok(());
1601            }
1602
1603            // Decode unknown envelopes for gaps in ordinals.
1604            while _next_ordinal_to_read < 7 {
1605                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1606                _next_ordinal_to_read += 1;
1607                next_offset += envelope_size;
1608            }
1609
1610            let next_out_of_line = decoder.next_out_of_line();
1611            let handles_before = decoder.remaining_handles();
1612            if let Some((inlined, num_bytes, num_handles)) =
1613                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1614            {
1615                let member_inline_size =
1616                    <fidl::encoding::BoundedString<15> as fidl::encoding::TypeMarker>::inline_size(
1617                        decoder.context,
1618                    );
1619                if inlined != (member_inline_size <= 4) {
1620                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1621                }
1622                let inner_offset;
1623                let mut inner_depth = depth.clone();
1624                if inlined {
1625                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1626                    inner_offset = next_offset;
1627                } else {
1628                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1629                    inner_depth.increment()?;
1630                }
1631                let val_ref = self
1632                    .name
1633                    .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::BoundedString<15>, D));
1634                fidl::decode!(
1635                    fidl::encoding::BoundedString<15>,
1636                    D,
1637                    val_ref,
1638                    decoder,
1639                    inner_offset,
1640                    inner_depth
1641                )?;
1642                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1643                {
1644                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
1645                }
1646                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1647                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1648                }
1649            }
1650
1651            next_offset += envelope_size;
1652            _next_ordinal_to_read += 1;
1653            if next_offset >= end_offset {
1654                return Ok(());
1655            }
1656
1657            // Decode unknown envelopes for gaps in ordinals.
1658            while _next_ordinal_to_read < 8 {
1659                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1660                _next_ordinal_to_read += 1;
1661                next_offset += envelope_size;
1662            }
1663
1664            let next_out_of_line = decoder.next_out_of_line();
1665            let handles_before = decoder.remaining_handles();
1666            if let Some((inlined, num_bytes, num_handles)) =
1667                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1668            {
1669                let member_inline_size =
1670                    <PortClass as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1671                if inlined != (member_inline_size <= 4) {
1672                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1673                }
1674                let inner_offset;
1675                let mut inner_depth = depth.clone();
1676                if inlined {
1677                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1678                    inner_offset = next_offset;
1679                } else {
1680                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1681                    inner_depth.increment()?;
1682                }
1683                let val_ref = self.port_class.get_or_insert_with(|| fidl::new_empty!(PortClass, D));
1684                fidl::decode!(PortClass, D, val_ref, decoder, inner_offset, inner_depth)?;
1685                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1686                {
1687                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
1688                }
1689                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1690                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1691                }
1692            }
1693
1694            next_offset += envelope_size;
1695
1696            // Decode the remaining unknown envelopes.
1697            while next_offset < end_offset {
1698                _next_ordinal_to_read += 1;
1699                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1700                next_offset += envelope_size;
1701            }
1702
1703            Ok(())
1704        }
1705    }
1706
1707    impl WatcherOptions {
1708        #[inline(always)]
1709        fn max_ordinal_present(&self) -> u64 {
1710            if let Some(_) = self.include_non_assigned_addresses {
1711                return 2;
1712            }
1713            if let Some(_) = self.address_properties_interest {
1714                return 1;
1715            }
1716            0
1717        }
1718    }
1719
1720    impl fidl::encoding::ValueTypeMarker for WatcherOptions {
1721        type Borrowed<'a> = &'a Self;
1722        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1723            value
1724        }
1725    }
1726
1727    unsafe impl fidl::encoding::TypeMarker for WatcherOptions {
1728        type Owned = Self;
1729
1730        #[inline(always)]
1731        fn inline_align(_context: fidl::encoding::Context) -> usize {
1732            8
1733        }
1734
1735        #[inline(always)]
1736        fn inline_size(_context: fidl::encoding::Context) -> usize {
1737            16
1738        }
1739    }
1740
1741    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<WatcherOptions, D>
1742        for &WatcherOptions
1743    {
1744        unsafe fn encode(
1745            self,
1746            encoder: &mut fidl::encoding::Encoder<'_, D>,
1747            offset: usize,
1748            mut depth: fidl::encoding::Depth,
1749        ) -> fidl::Result<()> {
1750            encoder.debug_check_bounds::<WatcherOptions>(offset);
1751            // Vector header
1752            let max_ordinal: u64 = self.max_ordinal_present();
1753            encoder.write_num(max_ordinal, offset);
1754            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
1755            // Calling encoder.out_of_line_offset(0) is not allowed.
1756            if max_ordinal == 0 {
1757                return Ok(());
1758            }
1759            depth.increment()?;
1760            let envelope_size = 8;
1761            let bytes_len = max_ordinal as usize * envelope_size;
1762            #[allow(unused_variables)]
1763            let offset = encoder.out_of_line_offset(bytes_len);
1764            let mut _prev_end_offset: usize = 0;
1765            if 1 > max_ordinal {
1766                return Ok(());
1767            }
1768
1769            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1770            // are envelope_size bytes.
1771            let cur_offset: usize = (1 - 1) * envelope_size;
1772
1773            // Zero reserved fields.
1774            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1775
1776            // Safety:
1777            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1778            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1779            //   envelope_size bytes, there is always sufficient room.
1780            fidl::encoding::encode_in_envelope_optional::<AddressPropertiesInterest, D>(
1781                self.address_properties_interest
1782                    .as_ref()
1783                    .map(<AddressPropertiesInterest as fidl::encoding::ValueTypeMarker>::borrow),
1784                encoder,
1785                offset + cur_offset,
1786                depth,
1787            )?;
1788
1789            _prev_end_offset = cur_offset + envelope_size;
1790            if 2 > max_ordinal {
1791                return Ok(());
1792            }
1793
1794            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1795            // are envelope_size bytes.
1796            let cur_offset: usize = (2 - 1) * envelope_size;
1797
1798            // Zero reserved fields.
1799            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1800
1801            // Safety:
1802            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1803            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1804            //   envelope_size bytes, there is always sufficient room.
1805            fidl::encoding::encode_in_envelope_optional::<bool, D>(
1806                self.include_non_assigned_addresses
1807                    .as_ref()
1808                    .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
1809                encoder,
1810                offset + cur_offset,
1811                depth,
1812            )?;
1813
1814            _prev_end_offset = cur_offset + envelope_size;
1815
1816            Ok(())
1817        }
1818    }
1819
1820    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for WatcherOptions {
1821        #[inline(always)]
1822        fn new_empty() -> Self {
1823            Self::default()
1824        }
1825
1826        unsafe fn decode(
1827            &mut self,
1828            decoder: &mut fidl::encoding::Decoder<'_, D>,
1829            offset: usize,
1830            mut depth: fidl::encoding::Depth,
1831        ) -> fidl::Result<()> {
1832            decoder.debug_check_bounds::<Self>(offset);
1833            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
1834                None => return Err(fidl::Error::NotNullable),
1835                Some(len) => len,
1836            };
1837            // Calling decoder.out_of_line_offset(0) is not allowed.
1838            if len == 0 {
1839                return Ok(());
1840            };
1841            depth.increment()?;
1842            let envelope_size = 8;
1843            let bytes_len = len * envelope_size;
1844            let offset = decoder.out_of_line_offset(bytes_len)?;
1845            // Decode the envelope for each type.
1846            let mut _next_ordinal_to_read = 0;
1847            let mut next_offset = offset;
1848            let end_offset = offset + bytes_len;
1849            _next_ordinal_to_read += 1;
1850            if next_offset >= end_offset {
1851                return Ok(());
1852            }
1853
1854            // Decode unknown envelopes for gaps in ordinals.
1855            while _next_ordinal_to_read < 1 {
1856                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1857                _next_ordinal_to_read += 1;
1858                next_offset += envelope_size;
1859            }
1860
1861            let next_out_of_line = decoder.next_out_of_line();
1862            let handles_before = decoder.remaining_handles();
1863            if let Some((inlined, num_bytes, num_handles)) =
1864                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1865            {
1866                let member_inline_size =
1867                    <AddressPropertiesInterest as fidl::encoding::TypeMarker>::inline_size(
1868                        decoder.context,
1869                    );
1870                if inlined != (member_inline_size <= 4) {
1871                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1872                }
1873                let inner_offset;
1874                let mut inner_depth = depth.clone();
1875                if inlined {
1876                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1877                    inner_offset = next_offset;
1878                } else {
1879                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1880                    inner_depth.increment()?;
1881                }
1882                let val_ref = self
1883                    .address_properties_interest
1884                    .get_or_insert_with(|| fidl::new_empty!(AddressPropertiesInterest, D));
1885                fidl::decode!(
1886                    AddressPropertiesInterest,
1887                    D,
1888                    val_ref,
1889                    decoder,
1890                    inner_offset,
1891                    inner_depth
1892                )?;
1893                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1894                {
1895                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
1896                }
1897                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1898                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1899                }
1900            }
1901
1902            next_offset += envelope_size;
1903            _next_ordinal_to_read += 1;
1904            if next_offset >= end_offset {
1905                return Ok(());
1906            }
1907
1908            // Decode unknown envelopes for gaps in ordinals.
1909            while _next_ordinal_to_read < 2 {
1910                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1911                _next_ordinal_to_read += 1;
1912                next_offset += envelope_size;
1913            }
1914
1915            let next_out_of_line = decoder.next_out_of_line();
1916            let handles_before = decoder.remaining_handles();
1917            if let Some((inlined, num_bytes, num_handles)) =
1918                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1919            {
1920                let member_inline_size =
1921                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1922                if inlined != (member_inline_size <= 4) {
1923                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1924                }
1925                let inner_offset;
1926                let mut inner_depth = depth.clone();
1927                if inlined {
1928                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1929                    inner_offset = next_offset;
1930                } else {
1931                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1932                    inner_depth.increment()?;
1933                }
1934                let val_ref = self
1935                    .include_non_assigned_addresses
1936                    .get_or_insert_with(|| fidl::new_empty!(bool, D));
1937                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
1938                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1939                {
1940                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
1941                }
1942                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1943                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1944                }
1945            }
1946
1947            next_offset += envelope_size;
1948
1949            // Decode the remaining unknown envelopes.
1950            while next_offset < end_offset {
1951                _next_ordinal_to_read += 1;
1952                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1953                next_offset += envelope_size;
1954            }
1955
1956            Ok(())
1957        }
1958    }
1959
1960    impl fidl::encoding::ValueTypeMarker for DeviceClass {
1961        type Borrowed<'a> = &'a Self;
1962        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1963            value
1964        }
1965    }
1966
1967    unsafe impl fidl::encoding::TypeMarker for DeviceClass {
1968        type Owned = Self;
1969
1970        #[inline(always)]
1971        fn inline_align(_context: fidl::encoding::Context) -> usize {
1972            8
1973        }
1974
1975        #[inline(always)]
1976        fn inline_size(_context: fidl::encoding::Context) -> usize {
1977            16
1978        }
1979    }
1980
1981    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<DeviceClass, D>
1982        for &DeviceClass
1983    {
1984        #[inline]
1985        unsafe fn encode(
1986            self,
1987            encoder: &mut fidl::encoding::Encoder<'_, D>,
1988            offset: usize,
1989            _depth: fidl::encoding::Depth,
1990        ) -> fidl::Result<()> {
1991            encoder.debug_check_bounds::<DeviceClass>(offset);
1992            encoder.write_num::<u64>(self.ordinal(), offset);
1993            match self {
1994            DeviceClass::Loopback(ref val) => {
1995                fidl::encoding::encode_in_envelope::<Empty, D>(
1996                    <Empty as fidl::encoding::ValueTypeMarker>::borrow(val),
1997                    encoder, offset + 8, _depth
1998                )
1999            }
2000            DeviceClass::Device(ref val) => {
2001                fidl::encoding::encode_in_envelope::<fidl_fuchsia_hardware_network__common::DeviceClass, D>(
2002                    <fidl_fuchsia_hardware_network__common::DeviceClass as fidl::encoding::ValueTypeMarker>::borrow(val),
2003                    encoder, offset + 8, _depth
2004                )
2005            }
2006        }
2007        }
2008    }
2009
2010    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for DeviceClass {
2011        #[inline(always)]
2012        fn new_empty() -> Self {
2013            Self::Loopback(fidl::new_empty!(Empty, D))
2014        }
2015
2016        #[inline]
2017        unsafe fn decode(
2018            &mut self,
2019            decoder: &mut fidl::encoding::Decoder<'_, D>,
2020            offset: usize,
2021            mut depth: fidl::encoding::Depth,
2022        ) -> fidl::Result<()> {
2023            decoder.debug_check_bounds::<Self>(offset);
2024            #[allow(unused_variables)]
2025            let next_out_of_line = decoder.next_out_of_line();
2026            let handles_before = decoder.remaining_handles();
2027            let (ordinal, inlined, num_bytes, num_handles) =
2028                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
2029
2030            let member_inline_size = match ordinal {
2031            1 => <Empty as fidl::encoding::TypeMarker>::inline_size(decoder.context),
2032            2 => <fidl_fuchsia_hardware_network__common::DeviceClass as fidl::encoding::TypeMarker>::inline_size(decoder.context),
2033            _ => return Err(fidl::Error::UnknownUnionTag),
2034        };
2035
2036            if inlined != (member_inline_size <= 4) {
2037                return Err(fidl::Error::InvalidInlineBitInEnvelope);
2038            }
2039            let _inner_offset;
2040            if inlined {
2041                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
2042                _inner_offset = offset + 8;
2043            } else {
2044                depth.increment()?;
2045                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2046            }
2047            match ordinal {
2048                1 => {
2049                    #[allow(irrefutable_let_patterns)]
2050                    if let DeviceClass::Loopback(_) = self {
2051                        // Do nothing, read the value into the object
2052                    } else {
2053                        // Initialize `self` to the right variant
2054                        *self = DeviceClass::Loopback(fidl::new_empty!(Empty, D));
2055                    }
2056                    #[allow(irrefutable_let_patterns)]
2057                    if let DeviceClass::Loopback(ref mut val) = self {
2058                        fidl::decode!(Empty, D, val, decoder, _inner_offset, depth)?;
2059                    } else {
2060                        unreachable!()
2061                    }
2062                }
2063                2 => {
2064                    #[allow(irrefutable_let_patterns)]
2065                    if let DeviceClass::Device(_) = self {
2066                        // Do nothing, read the value into the object
2067                    } else {
2068                        // Initialize `self` to the right variant
2069                        *self = DeviceClass::Device(fidl::new_empty!(
2070                            fidl_fuchsia_hardware_network__common::DeviceClass,
2071                            D
2072                        ));
2073                    }
2074                    #[allow(irrefutable_let_patterns)]
2075                    if let DeviceClass::Device(ref mut val) = self {
2076                        fidl::decode!(
2077                            fidl_fuchsia_hardware_network__common::DeviceClass,
2078                            D,
2079                            val,
2080                            decoder,
2081                            _inner_offset,
2082                            depth
2083                        )?;
2084                    } else {
2085                        unreachable!()
2086                    }
2087                }
2088                ordinal => panic!("unexpected ordinal {:?}", ordinal),
2089            }
2090            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
2091                return Err(fidl::Error::InvalidNumBytesInEnvelope);
2092            }
2093            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2094                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2095            }
2096            Ok(())
2097        }
2098    }
2099
2100    impl fidl::encoding::ValueTypeMarker for Event {
2101        type Borrowed<'a> = &'a Self;
2102        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2103            value
2104        }
2105    }
2106
2107    unsafe impl fidl::encoding::TypeMarker for Event {
2108        type Owned = Self;
2109
2110        #[inline(always)]
2111        fn inline_align(_context: fidl::encoding::Context) -> usize {
2112            8
2113        }
2114
2115        #[inline(always)]
2116        fn inline_size(_context: fidl::encoding::Context) -> usize {
2117            16
2118        }
2119    }
2120
2121    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Event, D> for &Event {
2122        #[inline]
2123        unsafe fn encode(
2124            self,
2125            encoder: &mut fidl::encoding::Encoder<'_, D>,
2126            offset: usize,
2127            _depth: fidl::encoding::Depth,
2128        ) -> fidl::Result<()> {
2129            encoder.debug_check_bounds::<Event>(offset);
2130            encoder.write_num::<u64>(self.ordinal(), offset);
2131            match self {
2132                Event::Existing(ref val) => fidl::encoding::encode_in_envelope::<Properties, D>(
2133                    <Properties as fidl::encoding::ValueTypeMarker>::borrow(val),
2134                    encoder,
2135                    offset + 8,
2136                    _depth,
2137                ),
2138                Event::Added(ref val) => fidl::encoding::encode_in_envelope::<Properties, D>(
2139                    <Properties as fidl::encoding::ValueTypeMarker>::borrow(val),
2140                    encoder,
2141                    offset + 8,
2142                    _depth,
2143                ),
2144                Event::Removed(ref val) => fidl::encoding::encode_in_envelope::<u64, D>(
2145                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(val),
2146                    encoder,
2147                    offset + 8,
2148                    _depth,
2149                ),
2150                Event::Changed(ref val) => fidl::encoding::encode_in_envelope::<Properties, D>(
2151                    <Properties as fidl::encoding::ValueTypeMarker>::borrow(val),
2152                    encoder,
2153                    offset + 8,
2154                    _depth,
2155                ),
2156                Event::Idle(ref val) => fidl::encoding::encode_in_envelope::<Empty, D>(
2157                    <Empty as fidl::encoding::ValueTypeMarker>::borrow(val),
2158                    encoder,
2159                    offset + 8,
2160                    _depth,
2161                ),
2162            }
2163        }
2164    }
2165
2166    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Event {
2167        #[inline(always)]
2168        fn new_empty() -> Self {
2169            Self::Existing(fidl::new_empty!(Properties, D))
2170        }
2171
2172        #[inline]
2173        unsafe fn decode(
2174            &mut self,
2175            decoder: &mut fidl::encoding::Decoder<'_, D>,
2176            offset: usize,
2177            mut depth: fidl::encoding::Depth,
2178        ) -> fidl::Result<()> {
2179            decoder.debug_check_bounds::<Self>(offset);
2180            #[allow(unused_variables)]
2181            let next_out_of_line = decoder.next_out_of_line();
2182            let handles_before = decoder.remaining_handles();
2183            let (ordinal, inlined, num_bytes, num_handles) =
2184                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
2185
2186            let member_inline_size = match ordinal {
2187                1 => <Properties as fidl::encoding::TypeMarker>::inline_size(decoder.context),
2188                2 => <Properties as fidl::encoding::TypeMarker>::inline_size(decoder.context),
2189                3 => <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context),
2190                4 => <Properties as fidl::encoding::TypeMarker>::inline_size(decoder.context),
2191                5 => <Empty as fidl::encoding::TypeMarker>::inline_size(decoder.context),
2192                _ => return Err(fidl::Error::UnknownUnionTag),
2193            };
2194
2195            if inlined != (member_inline_size <= 4) {
2196                return Err(fidl::Error::InvalidInlineBitInEnvelope);
2197            }
2198            let _inner_offset;
2199            if inlined {
2200                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
2201                _inner_offset = offset + 8;
2202            } else {
2203                depth.increment()?;
2204                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2205            }
2206            match ordinal {
2207                1 => {
2208                    #[allow(irrefutable_let_patterns)]
2209                    if let Event::Existing(_) = self {
2210                        // Do nothing, read the value into the object
2211                    } else {
2212                        // Initialize `self` to the right variant
2213                        *self = Event::Existing(fidl::new_empty!(Properties, D));
2214                    }
2215                    #[allow(irrefutable_let_patterns)]
2216                    if let Event::Existing(ref mut val) = self {
2217                        fidl::decode!(Properties, D, val, decoder, _inner_offset, depth)?;
2218                    } else {
2219                        unreachable!()
2220                    }
2221                }
2222                2 => {
2223                    #[allow(irrefutable_let_patterns)]
2224                    if let Event::Added(_) = self {
2225                        // Do nothing, read the value into the object
2226                    } else {
2227                        // Initialize `self` to the right variant
2228                        *self = Event::Added(fidl::new_empty!(Properties, D));
2229                    }
2230                    #[allow(irrefutable_let_patterns)]
2231                    if let Event::Added(ref mut val) = self {
2232                        fidl::decode!(Properties, D, val, decoder, _inner_offset, depth)?;
2233                    } else {
2234                        unreachable!()
2235                    }
2236                }
2237                3 => {
2238                    #[allow(irrefutable_let_patterns)]
2239                    if let Event::Removed(_) = self {
2240                        // Do nothing, read the value into the object
2241                    } else {
2242                        // Initialize `self` to the right variant
2243                        *self = Event::Removed(fidl::new_empty!(u64, D));
2244                    }
2245                    #[allow(irrefutable_let_patterns)]
2246                    if let Event::Removed(ref mut val) = self {
2247                        fidl::decode!(u64, D, val, decoder, _inner_offset, depth)?;
2248                    } else {
2249                        unreachable!()
2250                    }
2251                }
2252                4 => {
2253                    #[allow(irrefutable_let_patterns)]
2254                    if let Event::Changed(_) = self {
2255                        // Do nothing, read the value into the object
2256                    } else {
2257                        // Initialize `self` to the right variant
2258                        *self = Event::Changed(fidl::new_empty!(Properties, D));
2259                    }
2260                    #[allow(irrefutable_let_patterns)]
2261                    if let Event::Changed(ref mut val) = self {
2262                        fidl::decode!(Properties, D, val, decoder, _inner_offset, depth)?;
2263                    } else {
2264                        unreachable!()
2265                    }
2266                }
2267                5 => {
2268                    #[allow(irrefutable_let_patterns)]
2269                    if let Event::Idle(_) = self {
2270                        // Do nothing, read the value into the object
2271                    } else {
2272                        // Initialize `self` to the right variant
2273                        *self = Event::Idle(fidl::new_empty!(Empty, D));
2274                    }
2275                    #[allow(irrefutable_let_patterns)]
2276                    if let Event::Idle(ref mut val) = self {
2277                        fidl::decode!(Empty, D, val, decoder, _inner_offset, depth)?;
2278                    } else {
2279                        unreachable!()
2280                    }
2281                }
2282                ordinal => panic!("unexpected ordinal {:?}", ordinal),
2283            }
2284            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
2285                return Err(fidl::Error::InvalidNumBytesInEnvelope);
2286            }
2287            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2288                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2289            }
2290            Ok(())
2291        }
2292    }
2293
2294    impl fidl::encoding::ValueTypeMarker for PortClass {
2295        type Borrowed<'a> = &'a Self;
2296        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2297            value
2298        }
2299    }
2300
2301    unsafe impl fidl::encoding::TypeMarker for PortClass {
2302        type Owned = Self;
2303
2304        #[inline(always)]
2305        fn inline_align(_context: fidl::encoding::Context) -> usize {
2306            8
2307        }
2308
2309        #[inline(always)]
2310        fn inline_size(_context: fidl::encoding::Context) -> usize {
2311            16
2312        }
2313    }
2314
2315    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<PortClass, D>
2316        for &PortClass
2317    {
2318        #[inline]
2319        unsafe fn encode(
2320            self,
2321            encoder: &mut fidl::encoding::Encoder<'_, D>,
2322            offset: usize,
2323            _depth: fidl::encoding::Depth,
2324        ) -> fidl::Result<()> {
2325            encoder.debug_check_bounds::<PortClass>(offset);
2326            encoder.write_num::<u64>(self.ordinal(), offset);
2327            match self {
2328            PortClass::Loopback(ref val) => {
2329                fidl::encoding::encode_in_envelope::<Empty, D>(
2330                    <Empty as fidl::encoding::ValueTypeMarker>::borrow(val),
2331                    encoder, offset + 8, _depth
2332                )
2333            }
2334            PortClass::Device(ref val) => {
2335                fidl::encoding::encode_in_envelope::<fidl_fuchsia_hardware_network__common::PortClass, D>(
2336                    <fidl_fuchsia_hardware_network__common::PortClass as fidl::encoding::ValueTypeMarker>::borrow(val),
2337                    encoder, offset + 8, _depth
2338                )
2339            }
2340            PortClass::Blackhole(ref val) => {
2341                fidl::encoding::encode_in_envelope::<Empty, D>(
2342                    <Empty as fidl::encoding::ValueTypeMarker>::borrow(val),
2343                    encoder, offset + 8, _depth
2344                )
2345            }
2346            PortClass::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
2347        }
2348        }
2349    }
2350
2351    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for PortClass {
2352        #[inline(always)]
2353        fn new_empty() -> Self {
2354            Self::__SourceBreaking { unknown_ordinal: 0 }
2355        }
2356
2357        #[inline]
2358        unsafe fn decode(
2359            &mut self,
2360            decoder: &mut fidl::encoding::Decoder<'_, D>,
2361            offset: usize,
2362            mut depth: fidl::encoding::Depth,
2363        ) -> fidl::Result<()> {
2364            decoder.debug_check_bounds::<Self>(offset);
2365            #[allow(unused_variables)]
2366            let next_out_of_line = decoder.next_out_of_line();
2367            let handles_before = decoder.remaining_handles();
2368            let (ordinal, inlined, num_bytes, num_handles) =
2369                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
2370
2371            let member_inline_size = match ordinal {
2372            1 => <Empty as fidl::encoding::TypeMarker>::inline_size(decoder.context),
2373            2 => <fidl_fuchsia_hardware_network__common::PortClass as fidl::encoding::TypeMarker>::inline_size(decoder.context),
2374            3 => <Empty as fidl::encoding::TypeMarker>::inline_size(decoder.context),
2375            0 => return Err(fidl::Error::UnknownUnionTag),
2376            _ => num_bytes as usize,
2377        };
2378
2379            if inlined != (member_inline_size <= 4) {
2380                return Err(fidl::Error::InvalidInlineBitInEnvelope);
2381            }
2382            let _inner_offset;
2383            if inlined {
2384                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
2385                _inner_offset = offset + 8;
2386            } else {
2387                depth.increment()?;
2388                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2389            }
2390            match ordinal {
2391                1 => {
2392                    #[allow(irrefutable_let_patterns)]
2393                    if let PortClass::Loopback(_) = self {
2394                        // Do nothing, read the value into the object
2395                    } else {
2396                        // Initialize `self` to the right variant
2397                        *self = PortClass::Loopback(fidl::new_empty!(Empty, D));
2398                    }
2399                    #[allow(irrefutable_let_patterns)]
2400                    if let PortClass::Loopback(ref mut val) = self {
2401                        fidl::decode!(Empty, D, val, decoder, _inner_offset, depth)?;
2402                    } else {
2403                        unreachable!()
2404                    }
2405                }
2406                2 => {
2407                    #[allow(irrefutable_let_patterns)]
2408                    if let PortClass::Device(_) = self {
2409                        // Do nothing, read the value into the object
2410                    } else {
2411                        // Initialize `self` to the right variant
2412                        *self = PortClass::Device(fidl::new_empty!(
2413                            fidl_fuchsia_hardware_network__common::PortClass,
2414                            D
2415                        ));
2416                    }
2417                    #[allow(irrefutable_let_patterns)]
2418                    if let PortClass::Device(ref mut val) = self {
2419                        fidl::decode!(
2420                            fidl_fuchsia_hardware_network__common::PortClass,
2421                            D,
2422                            val,
2423                            decoder,
2424                            _inner_offset,
2425                            depth
2426                        )?;
2427                    } else {
2428                        unreachable!()
2429                    }
2430                }
2431                3 => {
2432                    #[allow(irrefutable_let_patterns)]
2433                    if let PortClass::Blackhole(_) = self {
2434                        // Do nothing, read the value into the object
2435                    } else {
2436                        // Initialize `self` to the right variant
2437                        *self = PortClass::Blackhole(fidl::new_empty!(Empty, D));
2438                    }
2439                    #[allow(irrefutable_let_patterns)]
2440                    if let PortClass::Blackhole(ref mut val) = self {
2441                        fidl::decode!(Empty, D, val, decoder, _inner_offset, depth)?;
2442                    } else {
2443                        unreachable!()
2444                    }
2445                }
2446                #[allow(deprecated)]
2447                ordinal => {
2448                    for _ in 0..num_handles {
2449                        decoder.drop_next_handle()?;
2450                    }
2451                    *self = PortClass::__SourceBreaking { unknown_ordinal: ordinal };
2452                }
2453            }
2454            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
2455                return Err(fidl::Error::InvalidNumBytesInEnvelope);
2456            }
2457            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2458                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2459            }
2460            Ok(())
2461        }
2462    }
2463
2464    impl fidl::encoding::ValueTypeMarker for PreferredLifetimeInfo {
2465        type Borrowed<'a> = &'a Self;
2466        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2467            value
2468        }
2469    }
2470
2471    unsafe impl fidl::encoding::TypeMarker for PreferredLifetimeInfo {
2472        type Owned = Self;
2473
2474        #[inline(always)]
2475        fn inline_align(_context: fidl::encoding::Context) -> usize {
2476            8
2477        }
2478
2479        #[inline(always)]
2480        fn inline_size(_context: fidl::encoding::Context) -> usize {
2481            16
2482        }
2483    }
2484
2485    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<PreferredLifetimeInfo, D>
2486        for &PreferredLifetimeInfo
2487    {
2488        #[inline]
2489        unsafe fn encode(
2490            self,
2491            encoder: &mut fidl::encoding::Encoder<'_, D>,
2492            offset: usize,
2493            _depth: fidl::encoding::Depth,
2494        ) -> fidl::Result<()> {
2495            encoder.debug_check_bounds::<PreferredLifetimeInfo>(offset);
2496            encoder.write_num::<u64>(self.ordinal(), offset);
2497            match self {
2498                PreferredLifetimeInfo::PreferredUntil(ref val) => {
2499                    fidl::encoding::encode_in_envelope::<i64, D>(
2500                        <i64 as fidl::encoding::ValueTypeMarker>::borrow(val),
2501                        encoder,
2502                        offset + 8,
2503                        _depth,
2504                    )
2505                }
2506                PreferredLifetimeInfo::Deprecated(ref val) => {
2507                    fidl::encoding::encode_in_envelope::<Empty, D>(
2508                        <Empty as fidl::encoding::ValueTypeMarker>::borrow(val),
2509                        encoder,
2510                        offset + 8,
2511                        _depth,
2512                    )
2513                }
2514            }
2515        }
2516    }
2517
2518    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for PreferredLifetimeInfo {
2519        #[inline(always)]
2520        fn new_empty() -> Self {
2521            Self::PreferredUntil(fidl::new_empty!(i64, D))
2522        }
2523
2524        #[inline]
2525        unsafe fn decode(
2526            &mut self,
2527            decoder: &mut fidl::encoding::Decoder<'_, D>,
2528            offset: usize,
2529            mut depth: fidl::encoding::Depth,
2530        ) -> fidl::Result<()> {
2531            decoder.debug_check_bounds::<Self>(offset);
2532            #[allow(unused_variables)]
2533            let next_out_of_line = decoder.next_out_of_line();
2534            let handles_before = decoder.remaining_handles();
2535            let (ordinal, inlined, num_bytes, num_handles) =
2536                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
2537
2538            let member_inline_size = match ordinal {
2539                1 => <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context),
2540                2 => <Empty as fidl::encoding::TypeMarker>::inline_size(decoder.context),
2541                _ => return Err(fidl::Error::UnknownUnionTag),
2542            };
2543
2544            if inlined != (member_inline_size <= 4) {
2545                return Err(fidl::Error::InvalidInlineBitInEnvelope);
2546            }
2547            let _inner_offset;
2548            if inlined {
2549                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
2550                _inner_offset = offset + 8;
2551            } else {
2552                depth.increment()?;
2553                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2554            }
2555            match ordinal {
2556                1 => {
2557                    #[allow(irrefutable_let_patterns)]
2558                    if let PreferredLifetimeInfo::PreferredUntil(_) = self {
2559                        // Do nothing, read the value into the object
2560                    } else {
2561                        // Initialize `self` to the right variant
2562                        *self = PreferredLifetimeInfo::PreferredUntil(fidl::new_empty!(i64, D));
2563                    }
2564                    #[allow(irrefutable_let_patterns)]
2565                    if let PreferredLifetimeInfo::PreferredUntil(ref mut val) = self {
2566                        fidl::decode!(i64, D, val, decoder, _inner_offset, depth)?;
2567                    } else {
2568                        unreachable!()
2569                    }
2570                }
2571                2 => {
2572                    #[allow(irrefutable_let_patterns)]
2573                    if let PreferredLifetimeInfo::Deprecated(_) = self {
2574                        // Do nothing, read the value into the object
2575                    } else {
2576                        // Initialize `self` to the right variant
2577                        *self = PreferredLifetimeInfo::Deprecated(fidl::new_empty!(Empty, D));
2578                    }
2579                    #[allow(irrefutable_let_patterns)]
2580                    if let PreferredLifetimeInfo::Deprecated(ref mut val) = self {
2581                        fidl::decode!(Empty, D, val, decoder, _inner_offset, depth)?;
2582                    } else {
2583                        unreachable!()
2584                    }
2585                }
2586                ordinal => panic!("unexpected ordinal {:?}", ordinal),
2587            }
2588            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
2589                return Err(fidl::Error::InvalidNumBytesInEnvelope);
2590            }
2591            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2592                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2593            }
2594            Ok(())
2595        }
2596    }
2597}