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