Skip to main content

fidl_fuchsia_net_neighbor__common/
fidl_fuchsia_net_neighbor__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/// The maximum number of [`EntryIteratorItem`] returned in a
12/// [`EntryIterator.GetNext`] response.
13pub const MAX_ITEM_BATCH_SIZE: u64 = 256;
14
15/// Errors associated with the neighbor table `Controller` protocol.
16#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
17pub enum ControllerError {
18    /// The specified interface does not exist.
19    InterfaceNotFound,
20    /// The specified interface does not keep a neighbor table (e.g.
21    /// point-to-point links).
22    InterfaceNotSupported,
23    /// The specified neighbor does not exist in the provided interface's
24    /// neighbor table.
25    NeighborNotFound,
26    /// The provided IP address is not a valid neighbor address.
27    InvalidIpAddress,
28    /// The provided MAC address is not a unicast MAC address.
29    MacAddressNotUnicast,
30    /// A probe cannot be manually triggered against the specified neighbor
31    /// because its link address is not known.
32    LinkAddressUnknown,
33    #[doc(hidden)]
34    __SourceBreaking { unknown_ordinal: u32 },
35}
36
37/// Pattern that matches an unknown `ControllerError` member.
38#[macro_export]
39macro_rules! ControllerErrorUnknown {
40    () => {
41        _
42    };
43}
44
45impl ControllerError {
46    #[inline]
47    pub fn from_primitive(prim: u32) -> Option<Self> {
48        match prim {
49            1 => Some(Self::InterfaceNotFound),
50            2 => Some(Self::InterfaceNotSupported),
51            3 => Some(Self::NeighborNotFound),
52            4 => Some(Self::InvalidIpAddress),
53            5 => Some(Self::MacAddressNotUnicast),
54            6 => Some(Self::LinkAddressUnknown),
55            _ => None,
56        }
57    }
58
59    #[inline]
60    pub fn from_primitive_allow_unknown(prim: u32) -> Self {
61        match prim {
62            1 => Self::InterfaceNotFound,
63            2 => Self::InterfaceNotSupported,
64            3 => Self::NeighborNotFound,
65            4 => Self::InvalidIpAddress,
66            5 => Self::MacAddressNotUnicast,
67            6 => Self::LinkAddressUnknown,
68            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
69        }
70    }
71
72    #[inline]
73    pub fn unknown() -> Self {
74        Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
75    }
76
77    #[inline]
78    pub const fn into_primitive(self) -> u32 {
79        match self {
80            Self::InterfaceNotFound => 1,
81            Self::InterfaceNotSupported => 2,
82            Self::NeighborNotFound => 3,
83            Self::InvalidIpAddress => 4,
84            Self::MacAddressNotUnicast => 5,
85            Self::LinkAddressUnknown => 6,
86            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
87        }
88    }
89
90    #[inline]
91    pub fn is_unknown(&self) -> bool {
92        match self {
93            Self::__SourceBreaking { unknown_ordinal: _ } => true,
94            _ => false,
95        }
96    }
97}
98
99#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
100#[repr(u32)]
101pub enum EntryState {
102    /// Reachability is in the process of being confirmed for a newly
103    /// created, non-static entry.
104    Incomplete = 1,
105    /// Positive reachability has been confirmed; the path to the neighbor
106    /// is functioning properly.
107    Reachable = 2,
108    /// Reachability is considered unknown.
109    ///
110    /// Occurs in one of two ways:
111    ///   1. Too much time has elapsed since the last positive reachability
112    ///      confirmation was received.
113    ///   2. Received a reachability confirmation from a neighbor with a
114    ///      different MAC address than the one cached.
115    Stale = 3,
116    /// A packet was recently sent while reachability was considered
117    /// unknown.
118    ///
119    /// This state is an optimization that gives non-Neighbor-Discovery
120    /// related protocols time to confirm reachability after the last
121    /// confirmation of reachability has expired due to lack of recent
122    /// traffic.
123    Delay = 4,
124    /// A reachability confirmation is actively sought by periodically
125    /// retransmitting reachability probes until a reachability confirmation
126    /// is received, or until the maximum number of probes has been sent.
127    Probe = 5,
128    /// Static entries are explicitly added with [`Controller.AddEntry`].
129    /// They do not expire and are not deleted until explicitly removed with
130    /// [`Controller.RemoveEntry`]. A static entry may be converted into a
131    /// dynamic entry with [`Controller.ProbeEntry`], however, at which
132    /// point it may be subject to expiry and deletion.
133    Static = 6,
134    /// Negative reachability has been confirmed; the path to the neighbor
135    /// may not be functioning properly. A reachability confirmation was not
136    /// received after transmitting the maximum number of reachability
137    /// probes.
138    Unreachable = 7,
139}
140
141impl EntryState {
142    #[inline]
143    pub fn from_primitive(prim: u32) -> Option<Self> {
144        match prim {
145            1 => Some(Self::Incomplete),
146            2 => Some(Self::Reachable),
147            3 => Some(Self::Stale),
148            4 => Some(Self::Delay),
149            5 => Some(Self::Probe),
150            6 => Some(Self::Static),
151            7 => Some(Self::Unreachable),
152            _ => None,
153        }
154    }
155
156    #[inline]
157    pub const fn into_primitive(self) -> u32 {
158        self as u32
159    }
160}
161
162#[derive(Clone, Debug, PartialEq)]
163pub struct ControllerAddEntryRequest {
164    pub interface: u64,
165    pub neighbor: fidl_fuchsia_net__common::IpAddress,
166    pub mac: fidl_fuchsia_net__common::MacAddress,
167}
168
169impl fidl::Persistable for ControllerAddEntryRequest {}
170
171#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
172pub struct ControllerClearEntriesRequest {
173    pub interface: u64,
174    pub ip_version: fidl_fuchsia_net__common::IpVersion,
175}
176
177impl fidl::Persistable for ControllerClearEntriesRequest {}
178
179#[derive(Clone, Debug, PartialEq)]
180pub struct ControllerProbeEntryRequest {
181    pub interface: u64,
182    pub neighbor: fidl_fuchsia_net__common::IpAddress,
183}
184
185impl fidl::Persistable for ControllerProbeEntryRequest {}
186
187#[derive(Clone, Debug, PartialEq)]
188pub struct ControllerRemoveEntryRequest {
189    pub interface: u64,
190    pub neighbor: fidl_fuchsia_net__common::IpAddress,
191}
192
193impl fidl::Persistable for ControllerRemoveEntryRequest {}
194
195#[derive(Clone, Debug, PartialEq)]
196pub struct EntryIteratorGetNextResponse {
197    pub events: Vec<EntryIteratorItem>,
198}
199
200impl fidl::Persistable for EntryIteratorGetNextResponse {}
201
202#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
203pub struct IdleEvent;
204
205impl fidl::Persistable for IdleEvent {}
206
207/// Information on a neighboring device in the local network.
208///
209/// There are two types of entries available in the neighbor table.
210///   1. Dynamic entries are discovered automatically by neighbor discovery
211///      protocols (e.g. ARP, NDP). These protocols will attempt to reconfirm
212///      reachability with the device once its `state` becomes
213///      [`EntryState.STALE`].
214///   2. Static entries are explicitly added by a user with
215///      [`Controller.AddEntry`] and have no expiration. Their `state` is always
216///      [`EntryState.STATIC`] unless converted to a dynamic entry as the result
217///      of a [`Controller.ProbeEntry`] call.
218#[derive(Clone, Debug, Default, PartialEq)]
219pub struct Entry {
220    /// Identifier for the interface used for communicating with the neighbor.
221    ///
222    /// Required.
223    pub interface: Option<u64>,
224    /// IP address of the neighbor.
225    ///
226    /// Required.
227    pub neighbor: Option<fidl_fuchsia_net__common::IpAddress>,
228    /// State of the entry within the Neighbor Unreachability Detection (NUD)
229    /// state machine.
230    ///
231    /// Modeled after RFC 4861 section 7.3.2. Descriptions are kept
232    /// implementation-independent by using a set of generic terminology.
233    ///
234    /// ,------------------------------------------------------------------.
235    /// | Generic Term              | ARP Term    | NDP Term               |
236    /// |---------------------------+-------------+------------------------|
237    /// | Reachability Probe        | ARP Request | Neighbor Solicitation  |
238    /// | Reachability Confirmation | ARP Reply   | Neighbor Advertisement |
239    /// `---------------------------+-------------+------------------------'
240    ///
241    /// Required.
242    pub state: Option<EntryState>,
243    /// MAC address of the neighboring device's network interface controller.
244    ///
245    /// May be absent for dynamic entries in [`EntryState.UNREACHABLE`] or
246    /// [`EntryState.INCOMPLETE`].
247    pub mac: Option<fidl_fuchsia_net__common::MacAddress>,
248    /// Timestamp when this entry has changed `state`.
249    ///
250    /// Required.
251    pub updated_at: Option<i64>,
252    #[doc(hidden)]
253    pub __source_breaking: fidl::marker::SourceBreaking,
254}
255
256impl fidl::Persistable for Entry {}
257
258#[derive(Clone, Debug, Default, PartialEq)]
259pub struct EntryIteratorOptions {
260    #[doc(hidden)]
261    pub __source_breaking: fidl::marker::SourceBreaking,
262}
263
264impl fidl::Persistable for EntryIteratorOptions {}
265
266#[derive(Clone, Debug, PartialEq)]
267pub enum EntryIteratorItem {
268    /// An existing entry in the neighbor table. Does not indicate that
269    /// an event occurred.
270    Existing(Entry),
271    /// Empty event for indicating there are no more
272    /// [`EntryIteratorItem.existing`] items to yield.
273    Idle(IdleEvent),
274    /// Event indicating a new entry has been added to the neighbor
275    /// table.
276    Added(Entry),
277    /// Event indicating an entry has changed.
278    Changed(Entry),
279    /// Event indicating an entry has been removed from the neighbor
280    /// table.
281    Removed(Entry),
282}
283
284impl EntryIteratorItem {
285    #[inline]
286    pub fn ordinal(&self) -> u64 {
287        match *self {
288            Self::Existing(_) => 1,
289            Self::Idle(_) => 2,
290            Self::Added(_) => 3,
291            Self::Changed(_) => 4,
292            Self::Removed(_) => 5,
293        }
294    }
295}
296
297impl fidl::Persistable for EntryIteratorItem {}
298
299pub mod controller_ordinals {
300    pub const ADD_ENTRY: u64 = 0x778c829580aa23ac;
301    pub const PROBE_ENTRY: u64 = 0x4f71dd58473f58ad;
302    pub const REMOVE_ENTRY: u64 = 0xfd0b52f53a0f815;
303    pub const CLEAR_ENTRIES: u64 = 0x33e53d9769a999d;
304}
305
306pub mod entry_iterator_ordinals {
307    pub const GET_NEXT: u64 = 0x6d03407803da8647;
308}
309
310pub mod view_ordinals {
311    pub const OPEN_ENTRY_ITERATOR: u64 = 0x3c9531929383e911;
312}
313
314mod internal {
315    use super::*;
316    unsafe impl fidl::encoding::TypeMarker for ControllerError {
317        type Owned = Self;
318
319        #[inline(always)]
320        fn inline_align(_context: fidl::encoding::Context) -> usize {
321            std::mem::align_of::<u32>()
322        }
323
324        #[inline(always)]
325        fn inline_size(_context: fidl::encoding::Context) -> usize {
326            std::mem::size_of::<u32>()
327        }
328
329        #[inline(always)]
330        fn encode_is_copy() -> bool {
331            false
332        }
333
334        #[inline(always)]
335        fn decode_is_copy() -> bool {
336            false
337        }
338    }
339
340    impl fidl::encoding::ValueTypeMarker for ControllerError {
341        type Borrowed<'a> = Self;
342        #[inline(always)]
343        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
344            *value
345        }
346    }
347
348    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
349        for ControllerError
350    {
351        #[inline]
352        unsafe fn encode(
353            self,
354            encoder: &mut fidl::encoding::Encoder<'_, D>,
355            offset: usize,
356            _depth: fidl::encoding::Depth,
357        ) -> fidl::Result<()> {
358            encoder.debug_check_bounds::<Self>(offset);
359            encoder.write_num(self.into_primitive(), offset);
360            Ok(())
361        }
362    }
363
364    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ControllerError {
365        #[inline(always)]
366        fn new_empty() -> Self {
367            Self::unknown()
368        }
369
370        #[inline]
371        unsafe fn decode(
372            &mut self,
373            decoder: &mut fidl::encoding::Decoder<'_, D>,
374            offset: usize,
375            _depth: fidl::encoding::Depth,
376        ) -> fidl::Result<()> {
377            decoder.debug_check_bounds::<Self>(offset);
378            let prim = decoder.read_num::<u32>(offset);
379
380            *self = Self::from_primitive_allow_unknown(prim);
381            Ok(())
382        }
383    }
384    unsafe impl fidl::encoding::TypeMarker for EntryState {
385        type Owned = Self;
386
387        #[inline(always)]
388        fn inline_align(_context: fidl::encoding::Context) -> usize {
389            std::mem::align_of::<u32>()
390        }
391
392        #[inline(always)]
393        fn inline_size(_context: fidl::encoding::Context) -> usize {
394            std::mem::size_of::<u32>()
395        }
396
397        #[inline(always)]
398        fn encode_is_copy() -> bool {
399            true
400        }
401
402        #[inline(always)]
403        fn decode_is_copy() -> bool {
404            false
405        }
406    }
407
408    impl fidl::encoding::ValueTypeMarker for EntryState {
409        type Borrowed<'a> = Self;
410        #[inline(always)]
411        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
412            *value
413        }
414    }
415
416    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for EntryState {
417        #[inline]
418        unsafe fn encode(
419            self,
420            encoder: &mut fidl::encoding::Encoder<'_, D>,
421            offset: usize,
422            _depth: fidl::encoding::Depth,
423        ) -> fidl::Result<()> {
424            encoder.debug_check_bounds::<Self>(offset);
425            encoder.write_num(self.into_primitive(), offset);
426            Ok(())
427        }
428    }
429
430    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for EntryState {
431        #[inline(always)]
432        fn new_empty() -> Self {
433            Self::Incomplete
434        }
435
436        #[inline]
437        unsafe fn decode(
438            &mut self,
439            decoder: &mut fidl::encoding::Decoder<'_, D>,
440            offset: usize,
441            _depth: fidl::encoding::Depth,
442        ) -> fidl::Result<()> {
443            decoder.debug_check_bounds::<Self>(offset);
444            let prim = decoder.read_num::<u32>(offset);
445
446            *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
447            Ok(())
448        }
449    }
450
451    impl fidl::encoding::ValueTypeMarker for ControllerAddEntryRequest {
452        type Borrowed<'a> = &'a Self;
453        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
454            value
455        }
456    }
457
458    unsafe impl fidl::encoding::TypeMarker for ControllerAddEntryRequest {
459        type Owned = Self;
460
461        #[inline(always)]
462        fn inline_align(_context: fidl::encoding::Context) -> usize {
463            8
464        }
465
466        #[inline(always)]
467        fn inline_size(_context: fidl::encoding::Context) -> usize {
468            32
469        }
470    }
471
472    unsafe impl<D: fidl::encoding::ResourceDialect>
473        fidl::encoding::Encode<ControllerAddEntryRequest, D> for &ControllerAddEntryRequest
474    {
475        #[inline]
476        unsafe fn encode(
477            self,
478            encoder: &mut fidl::encoding::Encoder<'_, D>,
479            offset: usize,
480            _depth: fidl::encoding::Depth,
481        ) -> fidl::Result<()> {
482            encoder.debug_check_bounds::<ControllerAddEntryRequest>(offset);
483            // Delegate to tuple encoding.
484            fidl::encoding::Encode::<ControllerAddEntryRequest, D>::encode(
485                (
486                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.interface),
487                    <fidl_fuchsia_net__common::IpAddress as fidl::encoding::ValueTypeMarker>::borrow(&self.neighbor),
488                    <fidl_fuchsia_net__common::MacAddress as fidl::encoding::ValueTypeMarker>::borrow(&self.mac),
489                ),
490                encoder, offset, _depth
491            )
492        }
493    }
494    unsafe impl<
495        D: fidl::encoding::ResourceDialect,
496        T0: fidl::encoding::Encode<u64, D>,
497        T1: fidl::encoding::Encode<fidl_fuchsia_net__common::IpAddress, D>,
498        T2: fidl::encoding::Encode<fidl_fuchsia_net__common::MacAddress, D>,
499    > fidl::encoding::Encode<ControllerAddEntryRequest, D> for (T0, T1, T2)
500    {
501        #[inline]
502        unsafe fn encode(
503            self,
504            encoder: &mut fidl::encoding::Encoder<'_, D>,
505            offset: usize,
506            depth: fidl::encoding::Depth,
507        ) -> fidl::Result<()> {
508            encoder.debug_check_bounds::<ControllerAddEntryRequest>(offset);
509            // Zero out padding regions. There's no need to apply masks
510            // because the unmasked parts will be overwritten by fields.
511            unsafe {
512                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(24);
513                (ptr as *mut u64).write_unaligned(0);
514            }
515            // Write the fields.
516            self.0.encode(encoder, offset + 0, depth)?;
517            self.1.encode(encoder, offset + 8, depth)?;
518            self.2.encode(encoder, offset + 24, depth)?;
519            Ok(())
520        }
521    }
522
523    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
524        for ControllerAddEntryRequest
525    {
526        #[inline(always)]
527        fn new_empty() -> Self {
528            Self {
529                interface: fidl::new_empty!(u64, D),
530                neighbor: fidl::new_empty!(fidl_fuchsia_net__common::IpAddress, D),
531                mac: fidl::new_empty!(fidl_fuchsia_net__common::MacAddress, D),
532            }
533        }
534
535        #[inline]
536        unsafe fn decode(
537            &mut self,
538            decoder: &mut fidl::encoding::Decoder<'_, D>,
539            offset: usize,
540            _depth: fidl::encoding::Depth,
541        ) -> fidl::Result<()> {
542            decoder.debug_check_bounds::<Self>(offset);
543            // Verify that padding bytes are zero.
544            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(24) };
545            let padval = unsafe { (ptr as *const u64).read_unaligned() };
546            let mask = 0xffff000000000000u64;
547            let maskedval = padval & mask;
548            if maskedval != 0 {
549                return Err(fidl::Error::NonZeroPadding {
550                    padding_start: offset + 24 + ((mask as u64).trailing_zeros() / 8) as usize,
551                });
552            }
553            fidl::decode!(u64, D, &mut self.interface, decoder, offset + 0, _depth)?;
554            fidl::decode!(
555                fidl_fuchsia_net__common::IpAddress,
556                D,
557                &mut self.neighbor,
558                decoder,
559                offset + 8,
560                _depth
561            )?;
562            fidl::decode!(
563                fidl_fuchsia_net__common::MacAddress,
564                D,
565                &mut self.mac,
566                decoder,
567                offset + 24,
568                _depth
569            )?;
570            Ok(())
571        }
572    }
573
574    impl fidl::encoding::ValueTypeMarker for ControllerClearEntriesRequest {
575        type Borrowed<'a> = &'a Self;
576        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
577            value
578        }
579    }
580
581    unsafe impl fidl::encoding::TypeMarker for ControllerClearEntriesRequest {
582        type Owned = Self;
583
584        #[inline(always)]
585        fn inline_align(_context: fidl::encoding::Context) -> usize {
586            8
587        }
588
589        #[inline(always)]
590        fn inline_size(_context: fidl::encoding::Context) -> usize {
591            16
592        }
593    }
594
595    unsafe impl<D: fidl::encoding::ResourceDialect>
596        fidl::encoding::Encode<ControllerClearEntriesRequest, D>
597        for &ControllerClearEntriesRequest
598    {
599        #[inline]
600        unsafe fn encode(
601            self,
602            encoder: &mut fidl::encoding::Encoder<'_, D>,
603            offset: usize,
604            _depth: fidl::encoding::Depth,
605        ) -> fidl::Result<()> {
606            encoder.debug_check_bounds::<ControllerClearEntriesRequest>(offset);
607            // Delegate to tuple encoding.
608            fidl::encoding::Encode::<ControllerClearEntriesRequest, D>::encode(
609                (
610                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.interface),
611                    <fidl_fuchsia_net__common::IpVersion as fidl::encoding::ValueTypeMarker>::borrow(&self.ip_version),
612                ),
613                encoder, offset, _depth
614            )
615        }
616    }
617    unsafe impl<
618        D: fidl::encoding::ResourceDialect,
619        T0: fidl::encoding::Encode<u64, D>,
620        T1: fidl::encoding::Encode<fidl_fuchsia_net__common::IpVersion, D>,
621    > fidl::encoding::Encode<ControllerClearEntriesRequest, D> for (T0, T1)
622    {
623        #[inline]
624        unsafe fn encode(
625            self,
626            encoder: &mut fidl::encoding::Encoder<'_, D>,
627            offset: usize,
628            depth: fidl::encoding::Depth,
629        ) -> fidl::Result<()> {
630            encoder.debug_check_bounds::<ControllerClearEntriesRequest>(offset);
631            // Zero out padding regions. There's no need to apply masks
632            // because the unmasked parts will be overwritten by fields.
633            unsafe {
634                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
635                (ptr as *mut u64).write_unaligned(0);
636            }
637            // Write the fields.
638            self.0.encode(encoder, offset + 0, depth)?;
639            self.1.encode(encoder, offset + 8, depth)?;
640            Ok(())
641        }
642    }
643
644    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
645        for ControllerClearEntriesRequest
646    {
647        #[inline(always)]
648        fn new_empty() -> Self {
649            Self {
650                interface: fidl::new_empty!(u64, D),
651                ip_version: fidl::new_empty!(fidl_fuchsia_net__common::IpVersion, D),
652            }
653        }
654
655        #[inline]
656        unsafe fn decode(
657            &mut self,
658            decoder: &mut fidl::encoding::Decoder<'_, D>,
659            offset: usize,
660            _depth: fidl::encoding::Depth,
661        ) -> fidl::Result<()> {
662            decoder.debug_check_bounds::<Self>(offset);
663            // Verify that padding bytes are zero.
664            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(8) };
665            let padval = unsafe { (ptr as *const u64).read_unaligned() };
666            let mask = 0xffffffff00000000u64;
667            let maskedval = padval & mask;
668            if maskedval != 0 {
669                return Err(fidl::Error::NonZeroPadding {
670                    padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
671                });
672            }
673            fidl::decode!(u64, D, &mut self.interface, decoder, offset + 0, _depth)?;
674            fidl::decode!(
675                fidl_fuchsia_net__common::IpVersion,
676                D,
677                &mut self.ip_version,
678                decoder,
679                offset + 8,
680                _depth
681            )?;
682            Ok(())
683        }
684    }
685
686    impl fidl::encoding::ValueTypeMarker for ControllerProbeEntryRequest {
687        type Borrowed<'a> = &'a Self;
688        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
689            value
690        }
691    }
692
693    unsafe impl fidl::encoding::TypeMarker for ControllerProbeEntryRequest {
694        type Owned = Self;
695
696        #[inline(always)]
697        fn inline_align(_context: fidl::encoding::Context) -> usize {
698            8
699        }
700
701        #[inline(always)]
702        fn inline_size(_context: fidl::encoding::Context) -> usize {
703            24
704        }
705    }
706
707    unsafe impl<D: fidl::encoding::ResourceDialect>
708        fidl::encoding::Encode<ControllerProbeEntryRequest, D> for &ControllerProbeEntryRequest
709    {
710        #[inline]
711        unsafe fn encode(
712            self,
713            encoder: &mut fidl::encoding::Encoder<'_, D>,
714            offset: usize,
715            _depth: fidl::encoding::Depth,
716        ) -> fidl::Result<()> {
717            encoder.debug_check_bounds::<ControllerProbeEntryRequest>(offset);
718            // Delegate to tuple encoding.
719            fidl::encoding::Encode::<ControllerProbeEntryRequest, D>::encode(
720                (
721                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.interface),
722                    <fidl_fuchsia_net__common::IpAddress as fidl::encoding::ValueTypeMarker>::borrow(&self.neighbor),
723                ),
724                encoder, offset, _depth
725            )
726        }
727    }
728    unsafe impl<
729        D: fidl::encoding::ResourceDialect,
730        T0: fidl::encoding::Encode<u64, D>,
731        T1: fidl::encoding::Encode<fidl_fuchsia_net__common::IpAddress, D>,
732    > fidl::encoding::Encode<ControllerProbeEntryRequest, D> for (T0, T1)
733    {
734        #[inline]
735        unsafe fn encode(
736            self,
737            encoder: &mut fidl::encoding::Encoder<'_, D>,
738            offset: usize,
739            depth: fidl::encoding::Depth,
740        ) -> fidl::Result<()> {
741            encoder.debug_check_bounds::<ControllerProbeEntryRequest>(offset);
742            // Zero out padding regions. There's no need to apply masks
743            // because the unmasked parts will be overwritten by fields.
744            // Write the fields.
745            self.0.encode(encoder, offset + 0, depth)?;
746            self.1.encode(encoder, offset + 8, depth)?;
747            Ok(())
748        }
749    }
750
751    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
752        for ControllerProbeEntryRequest
753    {
754        #[inline(always)]
755        fn new_empty() -> Self {
756            Self {
757                interface: fidl::new_empty!(u64, D),
758                neighbor: fidl::new_empty!(fidl_fuchsia_net__common::IpAddress, D),
759            }
760        }
761
762        #[inline]
763        unsafe fn decode(
764            &mut self,
765            decoder: &mut fidl::encoding::Decoder<'_, D>,
766            offset: usize,
767            _depth: fidl::encoding::Depth,
768        ) -> fidl::Result<()> {
769            decoder.debug_check_bounds::<Self>(offset);
770            // Verify that padding bytes are zero.
771            fidl::decode!(u64, D, &mut self.interface, decoder, offset + 0, _depth)?;
772            fidl::decode!(
773                fidl_fuchsia_net__common::IpAddress,
774                D,
775                &mut self.neighbor,
776                decoder,
777                offset + 8,
778                _depth
779            )?;
780            Ok(())
781        }
782    }
783
784    impl fidl::encoding::ValueTypeMarker for ControllerRemoveEntryRequest {
785        type Borrowed<'a> = &'a Self;
786        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
787            value
788        }
789    }
790
791    unsafe impl fidl::encoding::TypeMarker for ControllerRemoveEntryRequest {
792        type Owned = Self;
793
794        #[inline(always)]
795        fn inline_align(_context: fidl::encoding::Context) -> usize {
796            8
797        }
798
799        #[inline(always)]
800        fn inline_size(_context: fidl::encoding::Context) -> usize {
801            24
802        }
803    }
804
805    unsafe impl<D: fidl::encoding::ResourceDialect>
806        fidl::encoding::Encode<ControllerRemoveEntryRequest, D> for &ControllerRemoveEntryRequest
807    {
808        #[inline]
809        unsafe fn encode(
810            self,
811            encoder: &mut fidl::encoding::Encoder<'_, D>,
812            offset: usize,
813            _depth: fidl::encoding::Depth,
814        ) -> fidl::Result<()> {
815            encoder.debug_check_bounds::<ControllerRemoveEntryRequest>(offset);
816            // Delegate to tuple encoding.
817            fidl::encoding::Encode::<ControllerRemoveEntryRequest, D>::encode(
818                (
819                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.interface),
820                    <fidl_fuchsia_net__common::IpAddress as fidl::encoding::ValueTypeMarker>::borrow(&self.neighbor),
821                ),
822                encoder, offset, _depth
823            )
824        }
825    }
826    unsafe impl<
827        D: fidl::encoding::ResourceDialect,
828        T0: fidl::encoding::Encode<u64, D>,
829        T1: fidl::encoding::Encode<fidl_fuchsia_net__common::IpAddress, D>,
830    > fidl::encoding::Encode<ControllerRemoveEntryRequest, D> for (T0, T1)
831    {
832        #[inline]
833        unsafe fn encode(
834            self,
835            encoder: &mut fidl::encoding::Encoder<'_, D>,
836            offset: usize,
837            depth: fidl::encoding::Depth,
838        ) -> fidl::Result<()> {
839            encoder.debug_check_bounds::<ControllerRemoveEntryRequest>(offset);
840            // Zero out padding regions. There's no need to apply masks
841            // because the unmasked parts will be overwritten by fields.
842            // Write the fields.
843            self.0.encode(encoder, offset + 0, depth)?;
844            self.1.encode(encoder, offset + 8, depth)?;
845            Ok(())
846        }
847    }
848
849    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
850        for ControllerRemoveEntryRequest
851    {
852        #[inline(always)]
853        fn new_empty() -> Self {
854            Self {
855                interface: fidl::new_empty!(u64, D),
856                neighbor: fidl::new_empty!(fidl_fuchsia_net__common::IpAddress, D),
857            }
858        }
859
860        #[inline]
861        unsafe fn decode(
862            &mut self,
863            decoder: &mut fidl::encoding::Decoder<'_, D>,
864            offset: usize,
865            _depth: fidl::encoding::Depth,
866        ) -> fidl::Result<()> {
867            decoder.debug_check_bounds::<Self>(offset);
868            // Verify that padding bytes are zero.
869            fidl::decode!(u64, D, &mut self.interface, decoder, offset + 0, _depth)?;
870            fidl::decode!(
871                fidl_fuchsia_net__common::IpAddress,
872                D,
873                &mut self.neighbor,
874                decoder,
875                offset + 8,
876                _depth
877            )?;
878            Ok(())
879        }
880    }
881
882    impl fidl::encoding::ValueTypeMarker for EntryIteratorGetNextResponse {
883        type Borrowed<'a> = &'a Self;
884        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
885            value
886        }
887    }
888
889    unsafe impl fidl::encoding::TypeMarker for EntryIteratorGetNextResponse {
890        type Owned = Self;
891
892        #[inline(always)]
893        fn inline_align(_context: fidl::encoding::Context) -> usize {
894            8
895        }
896
897        #[inline(always)]
898        fn inline_size(_context: fidl::encoding::Context) -> usize {
899            16
900        }
901    }
902
903    unsafe impl<D: fidl::encoding::ResourceDialect>
904        fidl::encoding::Encode<EntryIteratorGetNextResponse, D> for &EntryIteratorGetNextResponse
905    {
906        #[inline]
907        unsafe fn encode(
908            self,
909            encoder: &mut fidl::encoding::Encoder<'_, D>,
910            offset: usize,
911            _depth: fidl::encoding::Depth,
912        ) -> fidl::Result<()> {
913            encoder.debug_check_bounds::<EntryIteratorGetNextResponse>(offset);
914            // Delegate to tuple encoding.
915            fidl::encoding::Encode::<EntryIteratorGetNextResponse, D>::encode(
916                (
917                    <fidl::encoding::Vector<EntryIteratorItem, 256> as fidl::encoding::ValueTypeMarker>::borrow(&self.events),
918                ),
919                encoder, offset, _depth
920            )
921        }
922    }
923    unsafe impl<
924        D: fidl::encoding::ResourceDialect,
925        T0: fidl::encoding::Encode<fidl::encoding::Vector<EntryIteratorItem, 256>, D>,
926    > fidl::encoding::Encode<EntryIteratorGetNextResponse, D> for (T0,)
927    {
928        #[inline]
929        unsafe fn encode(
930            self,
931            encoder: &mut fidl::encoding::Encoder<'_, D>,
932            offset: usize,
933            depth: fidl::encoding::Depth,
934        ) -> fidl::Result<()> {
935            encoder.debug_check_bounds::<EntryIteratorGetNextResponse>(offset);
936            // Zero out padding regions. There's no need to apply masks
937            // because the unmasked parts will be overwritten by fields.
938            // Write the fields.
939            self.0.encode(encoder, offset + 0, depth)?;
940            Ok(())
941        }
942    }
943
944    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
945        for EntryIteratorGetNextResponse
946    {
947        #[inline(always)]
948        fn new_empty() -> Self {
949            Self { events: fidl::new_empty!(fidl::encoding::Vector<EntryIteratorItem, 256>, D) }
950        }
951
952        #[inline]
953        unsafe fn decode(
954            &mut self,
955            decoder: &mut fidl::encoding::Decoder<'_, D>,
956            offset: usize,
957            _depth: fidl::encoding::Depth,
958        ) -> fidl::Result<()> {
959            decoder.debug_check_bounds::<Self>(offset);
960            // Verify that padding bytes are zero.
961            fidl::decode!(fidl::encoding::Vector<EntryIteratorItem, 256>, D, &mut self.events, decoder, offset + 0, _depth)?;
962            Ok(())
963        }
964    }
965
966    impl fidl::encoding::ValueTypeMarker for IdleEvent {
967        type Borrowed<'a> = &'a Self;
968        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
969            value
970        }
971    }
972
973    unsafe impl fidl::encoding::TypeMarker for IdleEvent {
974        type Owned = Self;
975
976        #[inline(always)]
977        fn inline_align(_context: fidl::encoding::Context) -> usize {
978            1
979        }
980
981        #[inline(always)]
982        fn inline_size(_context: fidl::encoding::Context) -> usize {
983            1
984        }
985    }
986
987    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<IdleEvent, D>
988        for &IdleEvent
989    {
990        #[inline]
991        unsafe fn encode(
992            self,
993            encoder: &mut fidl::encoding::Encoder<'_, D>,
994            offset: usize,
995            _depth: fidl::encoding::Depth,
996        ) -> fidl::Result<()> {
997            encoder.debug_check_bounds::<IdleEvent>(offset);
998            encoder.write_num(0u8, offset);
999            Ok(())
1000        }
1001    }
1002
1003    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for IdleEvent {
1004        #[inline(always)]
1005        fn new_empty() -> Self {
1006            Self
1007        }
1008
1009        #[inline]
1010        unsafe fn decode(
1011            &mut self,
1012            decoder: &mut fidl::encoding::Decoder<'_, D>,
1013            offset: usize,
1014            _depth: fidl::encoding::Depth,
1015        ) -> fidl::Result<()> {
1016            decoder.debug_check_bounds::<Self>(offset);
1017            match decoder.read_num::<u8>(offset) {
1018                0 => Ok(()),
1019                _ => Err(fidl::Error::Invalid),
1020            }
1021        }
1022    }
1023
1024    impl Entry {
1025        #[inline(always)]
1026        fn max_ordinal_present(&self) -> u64 {
1027            if let Some(_) = self.updated_at {
1028                return 5;
1029            }
1030            if let Some(_) = self.mac {
1031                return 4;
1032            }
1033            if let Some(_) = self.state {
1034                return 3;
1035            }
1036            if let Some(_) = self.neighbor {
1037                return 2;
1038            }
1039            if let Some(_) = self.interface {
1040                return 1;
1041            }
1042            0
1043        }
1044    }
1045
1046    impl fidl::encoding::ValueTypeMarker for Entry {
1047        type Borrowed<'a> = &'a Self;
1048        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1049            value
1050        }
1051    }
1052
1053    unsafe impl fidl::encoding::TypeMarker for Entry {
1054        type Owned = Self;
1055
1056        #[inline(always)]
1057        fn inline_align(_context: fidl::encoding::Context) -> usize {
1058            8
1059        }
1060
1061        #[inline(always)]
1062        fn inline_size(_context: fidl::encoding::Context) -> usize {
1063            16
1064        }
1065    }
1066
1067    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Entry, D> for &Entry {
1068        unsafe fn encode(
1069            self,
1070            encoder: &mut fidl::encoding::Encoder<'_, D>,
1071            offset: usize,
1072            mut depth: fidl::encoding::Depth,
1073        ) -> fidl::Result<()> {
1074            encoder.debug_check_bounds::<Entry>(offset);
1075            // Vector header
1076            let max_ordinal: u64 = self.max_ordinal_present();
1077            encoder.write_num(max_ordinal, offset);
1078            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
1079            // Calling encoder.out_of_line_offset(0) is not allowed.
1080            if max_ordinal == 0 {
1081                return Ok(());
1082            }
1083            depth.increment()?;
1084            let envelope_size = 8;
1085            let bytes_len = max_ordinal as usize * envelope_size;
1086            #[allow(unused_variables)]
1087            let offset = encoder.out_of_line_offset(bytes_len);
1088            let mut _prev_end_offset: usize = 0;
1089            if 1 > max_ordinal {
1090                return Ok(());
1091            }
1092
1093            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1094            // are envelope_size bytes.
1095            let cur_offset: usize = (1 - 1) * envelope_size;
1096
1097            // Zero reserved fields.
1098            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1099
1100            // Safety:
1101            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1102            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1103            //   envelope_size bytes, there is always sufficient room.
1104            fidl::encoding::encode_in_envelope_optional::<u64, D>(
1105                self.interface.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
1106                encoder,
1107                offset + cur_offset,
1108                depth,
1109            )?;
1110
1111            _prev_end_offset = cur_offset + envelope_size;
1112            if 2 > max_ordinal {
1113                return Ok(());
1114            }
1115
1116            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1117            // are envelope_size bytes.
1118            let cur_offset: usize = (2 - 1) * envelope_size;
1119
1120            // Zero reserved fields.
1121            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1122
1123            // Safety:
1124            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1125            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1126            //   envelope_size bytes, there is always sufficient room.
1127            fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_net__common::IpAddress, D>(
1128            self.neighbor.as_ref().map(<fidl_fuchsia_net__common::IpAddress as fidl::encoding::ValueTypeMarker>::borrow),
1129            encoder, offset + cur_offset, depth
1130        )?;
1131
1132            _prev_end_offset = cur_offset + envelope_size;
1133            if 3 > max_ordinal {
1134                return Ok(());
1135            }
1136
1137            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1138            // are envelope_size bytes.
1139            let cur_offset: usize = (3 - 1) * envelope_size;
1140
1141            // Zero reserved fields.
1142            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1143
1144            // Safety:
1145            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1146            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1147            //   envelope_size bytes, there is always sufficient room.
1148            fidl::encoding::encode_in_envelope_optional::<EntryState, D>(
1149                self.state.as_ref().map(<EntryState as fidl::encoding::ValueTypeMarker>::borrow),
1150                encoder,
1151                offset + cur_offset,
1152                depth,
1153            )?;
1154
1155            _prev_end_offset = cur_offset + envelope_size;
1156            if 4 > max_ordinal {
1157                return Ok(());
1158            }
1159
1160            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1161            // are envelope_size bytes.
1162            let cur_offset: usize = (4 - 1) * envelope_size;
1163
1164            // Zero reserved fields.
1165            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1166
1167            // Safety:
1168            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1169            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1170            //   envelope_size bytes, there is always sufficient room.
1171            fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_net__common::MacAddress, D>(
1172            self.mac.as_ref().map(<fidl_fuchsia_net__common::MacAddress as fidl::encoding::ValueTypeMarker>::borrow),
1173            encoder, offset + cur_offset, depth
1174        )?;
1175
1176            _prev_end_offset = cur_offset + envelope_size;
1177            if 5 > max_ordinal {
1178                return Ok(());
1179            }
1180
1181            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1182            // are envelope_size bytes.
1183            let cur_offset: usize = (5 - 1) * envelope_size;
1184
1185            // Zero reserved fields.
1186            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1187
1188            // Safety:
1189            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1190            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1191            //   envelope_size bytes, there is always sufficient room.
1192            fidl::encoding::encode_in_envelope_optional::<i64, D>(
1193                self.updated_at.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
1194                encoder,
1195                offset + cur_offset,
1196                depth,
1197            )?;
1198
1199            _prev_end_offset = cur_offset + envelope_size;
1200
1201            Ok(())
1202        }
1203    }
1204
1205    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Entry {
1206        #[inline(always)]
1207        fn new_empty() -> Self {
1208            Self::default()
1209        }
1210
1211        unsafe fn decode(
1212            &mut self,
1213            decoder: &mut fidl::encoding::Decoder<'_, D>,
1214            offset: usize,
1215            mut depth: fidl::encoding::Depth,
1216        ) -> fidl::Result<()> {
1217            decoder.debug_check_bounds::<Self>(offset);
1218            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
1219                None => return Err(fidl::Error::NotNullable),
1220                Some(len) => len,
1221            };
1222            // Calling decoder.out_of_line_offset(0) is not allowed.
1223            if len == 0 {
1224                return Ok(());
1225            };
1226            depth.increment()?;
1227            let envelope_size = 8;
1228            let bytes_len = len * envelope_size;
1229            let offset = decoder.out_of_line_offset(bytes_len)?;
1230            // Decode the envelope for each type.
1231            let mut _next_ordinal_to_read = 0;
1232            let mut next_offset = offset;
1233            let end_offset = offset + bytes_len;
1234            _next_ordinal_to_read += 1;
1235            if next_offset >= end_offset {
1236                return Ok(());
1237            }
1238
1239            // Decode unknown envelopes for gaps in ordinals.
1240            while _next_ordinal_to_read < 1 {
1241                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1242                _next_ordinal_to_read += 1;
1243                next_offset += envelope_size;
1244            }
1245
1246            let next_out_of_line = decoder.next_out_of_line();
1247            let handles_before = decoder.remaining_handles();
1248            if let Some((inlined, num_bytes, num_handles)) =
1249                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1250            {
1251                let member_inline_size =
1252                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1253                if inlined != (member_inline_size <= 4) {
1254                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1255                }
1256                let inner_offset;
1257                let mut inner_depth = depth.clone();
1258                if inlined {
1259                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1260                    inner_offset = next_offset;
1261                } else {
1262                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1263                    inner_depth.increment()?;
1264                }
1265                let val_ref = self.interface.get_or_insert_with(|| fidl::new_empty!(u64, D));
1266                fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
1267                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1268                {
1269                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
1270                }
1271                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1272                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1273                }
1274            }
1275
1276            next_offset += envelope_size;
1277            _next_ordinal_to_read += 1;
1278            if next_offset >= end_offset {
1279                return Ok(());
1280            }
1281
1282            // Decode unknown envelopes for gaps in ordinals.
1283            while _next_ordinal_to_read < 2 {
1284                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1285                _next_ordinal_to_read += 1;
1286                next_offset += envelope_size;
1287            }
1288
1289            let next_out_of_line = decoder.next_out_of_line();
1290            let handles_before = decoder.remaining_handles();
1291            if let Some((inlined, num_bytes, num_handles)) =
1292                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1293            {
1294                let member_inline_size = <fidl_fuchsia_net__common::IpAddress as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1295                if inlined != (member_inline_size <= 4) {
1296                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1297                }
1298                let inner_offset;
1299                let mut inner_depth = depth.clone();
1300                if inlined {
1301                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1302                    inner_offset = next_offset;
1303                } else {
1304                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1305                    inner_depth.increment()?;
1306                }
1307                let val_ref = self.neighbor.get_or_insert_with(|| {
1308                    fidl::new_empty!(fidl_fuchsia_net__common::IpAddress, D)
1309                });
1310                fidl::decode!(
1311                    fidl_fuchsia_net__common::IpAddress,
1312                    D,
1313                    val_ref,
1314                    decoder,
1315                    inner_offset,
1316                    inner_depth
1317                )?;
1318                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1319                {
1320                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
1321                }
1322                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1323                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1324                }
1325            }
1326
1327            next_offset += envelope_size;
1328            _next_ordinal_to_read += 1;
1329            if next_offset >= end_offset {
1330                return Ok(());
1331            }
1332
1333            // Decode unknown envelopes for gaps in ordinals.
1334            while _next_ordinal_to_read < 3 {
1335                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1336                _next_ordinal_to_read += 1;
1337                next_offset += envelope_size;
1338            }
1339
1340            let next_out_of_line = decoder.next_out_of_line();
1341            let handles_before = decoder.remaining_handles();
1342            if let Some((inlined, num_bytes, num_handles)) =
1343                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1344            {
1345                let member_inline_size =
1346                    <EntryState as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1347                if inlined != (member_inline_size <= 4) {
1348                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1349                }
1350                let inner_offset;
1351                let mut inner_depth = depth.clone();
1352                if inlined {
1353                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1354                    inner_offset = next_offset;
1355                } else {
1356                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1357                    inner_depth.increment()?;
1358                }
1359                let val_ref = self.state.get_or_insert_with(|| fidl::new_empty!(EntryState, D));
1360                fidl::decode!(EntryState, D, val_ref, decoder, inner_offset, inner_depth)?;
1361                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1362                {
1363                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
1364                }
1365                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1366                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1367                }
1368            }
1369
1370            next_offset += envelope_size;
1371            _next_ordinal_to_read += 1;
1372            if next_offset >= end_offset {
1373                return Ok(());
1374            }
1375
1376            // Decode unknown envelopes for gaps in ordinals.
1377            while _next_ordinal_to_read < 4 {
1378                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1379                _next_ordinal_to_read += 1;
1380                next_offset += envelope_size;
1381            }
1382
1383            let next_out_of_line = decoder.next_out_of_line();
1384            let handles_before = decoder.remaining_handles();
1385            if let Some((inlined, num_bytes, num_handles)) =
1386                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1387            {
1388                let member_inline_size = <fidl_fuchsia_net__common::MacAddress as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1389                if inlined != (member_inline_size <= 4) {
1390                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1391                }
1392                let inner_offset;
1393                let mut inner_depth = depth.clone();
1394                if inlined {
1395                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1396                    inner_offset = next_offset;
1397                } else {
1398                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1399                    inner_depth.increment()?;
1400                }
1401                let val_ref = self.mac.get_or_insert_with(|| {
1402                    fidl::new_empty!(fidl_fuchsia_net__common::MacAddress, D)
1403                });
1404                fidl::decode!(
1405                    fidl_fuchsia_net__common::MacAddress,
1406                    D,
1407                    val_ref,
1408                    decoder,
1409                    inner_offset,
1410                    inner_depth
1411                )?;
1412                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1413                {
1414                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
1415                }
1416                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1417                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1418                }
1419            }
1420
1421            next_offset += envelope_size;
1422            _next_ordinal_to_read += 1;
1423            if next_offset >= end_offset {
1424                return Ok(());
1425            }
1426
1427            // Decode unknown envelopes for gaps in ordinals.
1428            while _next_ordinal_to_read < 5 {
1429                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1430                _next_ordinal_to_read += 1;
1431                next_offset += envelope_size;
1432            }
1433
1434            let next_out_of_line = decoder.next_out_of_line();
1435            let handles_before = decoder.remaining_handles();
1436            if let Some((inlined, num_bytes, num_handles)) =
1437                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1438            {
1439                let member_inline_size =
1440                    <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1441                if inlined != (member_inline_size <= 4) {
1442                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1443                }
1444                let inner_offset;
1445                let mut inner_depth = depth.clone();
1446                if inlined {
1447                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1448                    inner_offset = next_offset;
1449                } else {
1450                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1451                    inner_depth.increment()?;
1452                }
1453                let val_ref = self.updated_at.get_or_insert_with(|| fidl::new_empty!(i64, D));
1454                fidl::decode!(i64, D, val_ref, decoder, inner_offset, inner_depth)?;
1455                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1456                {
1457                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
1458                }
1459                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1460                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1461                }
1462            }
1463
1464            next_offset += envelope_size;
1465
1466            // Decode the remaining unknown envelopes.
1467            while next_offset < end_offset {
1468                _next_ordinal_to_read += 1;
1469                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1470                next_offset += envelope_size;
1471            }
1472
1473            Ok(())
1474        }
1475    }
1476
1477    impl EntryIteratorOptions {
1478        #[inline(always)]
1479        fn max_ordinal_present(&self) -> u64 {
1480            0
1481        }
1482    }
1483
1484    impl fidl::encoding::ValueTypeMarker for EntryIteratorOptions {
1485        type Borrowed<'a> = &'a Self;
1486        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1487            value
1488        }
1489    }
1490
1491    unsafe impl fidl::encoding::TypeMarker for EntryIteratorOptions {
1492        type Owned = Self;
1493
1494        #[inline(always)]
1495        fn inline_align(_context: fidl::encoding::Context) -> usize {
1496            8
1497        }
1498
1499        #[inline(always)]
1500        fn inline_size(_context: fidl::encoding::Context) -> usize {
1501            16
1502        }
1503    }
1504
1505    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<EntryIteratorOptions, D>
1506        for &EntryIteratorOptions
1507    {
1508        unsafe fn encode(
1509            self,
1510            encoder: &mut fidl::encoding::Encoder<'_, D>,
1511            offset: usize,
1512            mut depth: fidl::encoding::Depth,
1513        ) -> fidl::Result<()> {
1514            encoder.debug_check_bounds::<EntryIteratorOptions>(offset);
1515            // Vector header
1516            let max_ordinal: u64 = self.max_ordinal_present();
1517            encoder.write_num(max_ordinal, offset);
1518            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
1519            // Calling encoder.out_of_line_offset(0) is not allowed.
1520            if max_ordinal == 0 {
1521                return Ok(());
1522            }
1523            depth.increment()?;
1524            let envelope_size = 8;
1525            let bytes_len = max_ordinal as usize * envelope_size;
1526            #[allow(unused_variables)]
1527            let offset = encoder.out_of_line_offset(bytes_len);
1528            let mut _prev_end_offset: usize = 0;
1529
1530            Ok(())
1531        }
1532    }
1533
1534    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for EntryIteratorOptions {
1535        #[inline(always)]
1536        fn new_empty() -> Self {
1537            Self::default()
1538        }
1539
1540        unsafe fn decode(
1541            &mut self,
1542            decoder: &mut fidl::encoding::Decoder<'_, D>,
1543            offset: usize,
1544            mut depth: fidl::encoding::Depth,
1545        ) -> fidl::Result<()> {
1546            decoder.debug_check_bounds::<Self>(offset);
1547            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
1548                None => return Err(fidl::Error::NotNullable),
1549                Some(len) => len,
1550            };
1551            // Calling decoder.out_of_line_offset(0) is not allowed.
1552            if len == 0 {
1553                return Ok(());
1554            };
1555            depth.increment()?;
1556            let envelope_size = 8;
1557            let bytes_len = len * envelope_size;
1558            let offset = decoder.out_of_line_offset(bytes_len)?;
1559            // Decode the envelope for each type.
1560            let mut _next_ordinal_to_read = 0;
1561            let mut next_offset = offset;
1562            let end_offset = offset + bytes_len;
1563
1564            // Decode the remaining unknown envelopes.
1565            while next_offset < end_offset {
1566                _next_ordinal_to_read += 1;
1567                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1568                next_offset += envelope_size;
1569            }
1570
1571            Ok(())
1572        }
1573    }
1574
1575    impl fidl::encoding::ValueTypeMarker for EntryIteratorItem {
1576        type Borrowed<'a> = &'a Self;
1577        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1578            value
1579        }
1580    }
1581
1582    unsafe impl fidl::encoding::TypeMarker for EntryIteratorItem {
1583        type Owned = Self;
1584
1585        #[inline(always)]
1586        fn inline_align(_context: fidl::encoding::Context) -> usize {
1587            8
1588        }
1589
1590        #[inline(always)]
1591        fn inline_size(_context: fidl::encoding::Context) -> usize {
1592            16
1593        }
1594    }
1595
1596    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<EntryIteratorItem, D>
1597        for &EntryIteratorItem
1598    {
1599        #[inline]
1600        unsafe fn encode(
1601            self,
1602            encoder: &mut fidl::encoding::Encoder<'_, D>,
1603            offset: usize,
1604            _depth: fidl::encoding::Depth,
1605        ) -> fidl::Result<()> {
1606            encoder.debug_check_bounds::<EntryIteratorItem>(offset);
1607            encoder.write_num::<u64>(self.ordinal(), offset);
1608            match self {
1609                EntryIteratorItem::Existing(ref val) => {
1610                    fidl::encoding::encode_in_envelope::<Entry, D>(
1611                        <Entry as fidl::encoding::ValueTypeMarker>::borrow(val),
1612                        encoder,
1613                        offset + 8,
1614                        _depth,
1615                    )
1616                }
1617                EntryIteratorItem::Idle(ref val) => {
1618                    fidl::encoding::encode_in_envelope::<IdleEvent, D>(
1619                        <IdleEvent as fidl::encoding::ValueTypeMarker>::borrow(val),
1620                        encoder,
1621                        offset + 8,
1622                        _depth,
1623                    )
1624                }
1625                EntryIteratorItem::Added(ref val) => {
1626                    fidl::encoding::encode_in_envelope::<Entry, D>(
1627                        <Entry as fidl::encoding::ValueTypeMarker>::borrow(val),
1628                        encoder,
1629                        offset + 8,
1630                        _depth,
1631                    )
1632                }
1633                EntryIteratorItem::Changed(ref val) => {
1634                    fidl::encoding::encode_in_envelope::<Entry, D>(
1635                        <Entry as fidl::encoding::ValueTypeMarker>::borrow(val),
1636                        encoder,
1637                        offset + 8,
1638                        _depth,
1639                    )
1640                }
1641                EntryIteratorItem::Removed(ref val) => {
1642                    fidl::encoding::encode_in_envelope::<Entry, D>(
1643                        <Entry as fidl::encoding::ValueTypeMarker>::borrow(val),
1644                        encoder,
1645                        offset + 8,
1646                        _depth,
1647                    )
1648                }
1649            }
1650        }
1651    }
1652
1653    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for EntryIteratorItem {
1654        #[inline(always)]
1655        fn new_empty() -> Self {
1656            Self::Existing(fidl::new_empty!(Entry, D))
1657        }
1658
1659        #[inline]
1660        unsafe fn decode(
1661            &mut self,
1662            decoder: &mut fidl::encoding::Decoder<'_, D>,
1663            offset: usize,
1664            mut depth: fidl::encoding::Depth,
1665        ) -> fidl::Result<()> {
1666            decoder.debug_check_bounds::<Self>(offset);
1667            #[allow(unused_variables)]
1668            let next_out_of_line = decoder.next_out_of_line();
1669            let handles_before = decoder.remaining_handles();
1670            let (ordinal, inlined, num_bytes, num_handles) =
1671                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
1672
1673            let member_inline_size = match ordinal {
1674                1 => <Entry as fidl::encoding::TypeMarker>::inline_size(decoder.context),
1675                2 => <IdleEvent as fidl::encoding::TypeMarker>::inline_size(decoder.context),
1676                3 => <Entry as fidl::encoding::TypeMarker>::inline_size(decoder.context),
1677                4 => <Entry as fidl::encoding::TypeMarker>::inline_size(decoder.context),
1678                5 => <Entry as fidl::encoding::TypeMarker>::inline_size(decoder.context),
1679                _ => return Err(fidl::Error::UnknownUnionTag),
1680            };
1681
1682            if inlined != (member_inline_size <= 4) {
1683                return Err(fidl::Error::InvalidInlineBitInEnvelope);
1684            }
1685            let _inner_offset;
1686            if inlined {
1687                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
1688                _inner_offset = offset + 8;
1689            } else {
1690                depth.increment()?;
1691                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1692            }
1693            match ordinal {
1694                1 => {
1695                    #[allow(irrefutable_let_patterns)]
1696                    if let EntryIteratorItem::Existing(_) = self {
1697                        // Do nothing, read the value into the object
1698                    } else {
1699                        // Initialize `self` to the right variant
1700                        *self = EntryIteratorItem::Existing(fidl::new_empty!(Entry, D));
1701                    }
1702                    #[allow(irrefutable_let_patterns)]
1703                    if let EntryIteratorItem::Existing(ref mut val) = self {
1704                        fidl::decode!(Entry, D, val, decoder, _inner_offset, depth)?;
1705                    } else {
1706                        unreachable!()
1707                    }
1708                }
1709                2 => {
1710                    #[allow(irrefutable_let_patterns)]
1711                    if let EntryIteratorItem::Idle(_) = self {
1712                        // Do nothing, read the value into the object
1713                    } else {
1714                        // Initialize `self` to the right variant
1715                        *self = EntryIteratorItem::Idle(fidl::new_empty!(IdleEvent, D));
1716                    }
1717                    #[allow(irrefutable_let_patterns)]
1718                    if let EntryIteratorItem::Idle(ref mut val) = self {
1719                        fidl::decode!(IdleEvent, D, val, decoder, _inner_offset, depth)?;
1720                    } else {
1721                        unreachable!()
1722                    }
1723                }
1724                3 => {
1725                    #[allow(irrefutable_let_patterns)]
1726                    if let EntryIteratorItem::Added(_) = self {
1727                        // Do nothing, read the value into the object
1728                    } else {
1729                        // Initialize `self` to the right variant
1730                        *self = EntryIteratorItem::Added(fidl::new_empty!(Entry, D));
1731                    }
1732                    #[allow(irrefutable_let_patterns)]
1733                    if let EntryIteratorItem::Added(ref mut val) = self {
1734                        fidl::decode!(Entry, D, val, decoder, _inner_offset, depth)?;
1735                    } else {
1736                        unreachable!()
1737                    }
1738                }
1739                4 => {
1740                    #[allow(irrefutable_let_patterns)]
1741                    if let EntryIteratorItem::Changed(_) = self {
1742                        // Do nothing, read the value into the object
1743                    } else {
1744                        // Initialize `self` to the right variant
1745                        *self = EntryIteratorItem::Changed(fidl::new_empty!(Entry, D));
1746                    }
1747                    #[allow(irrefutable_let_patterns)]
1748                    if let EntryIteratorItem::Changed(ref mut val) = self {
1749                        fidl::decode!(Entry, D, val, decoder, _inner_offset, depth)?;
1750                    } else {
1751                        unreachable!()
1752                    }
1753                }
1754                5 => {
1755                    #[allow(irrefutable_let_patterns)]
1756                    if let EntryIteratorItem::Removed(_) = self {
1757                        // Do nothing, read the value into the object
1758                    } else {
1759                        // Initialize `self` to the right variant
1760                        *self = EntryIteratorItem::Removed(fidl::new_empty!(Entry, D));
1761                    }
1762                    #[allow(irrefutable_let_patterns)]
1763                    if let EntryIteratorItem::Removed(ref mut val) = self {
1764                        fidl::decode!(Entry, D, val, decoder, _inner_offset, depth)?;
1765                    } else {
1766                        unreachable!()
1767                    }
1768                }
1769                ordinal => panic!("unexpected ordinal {:?}", ordinal),
1770            }
1771            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
1772                return Err(fidl::Error::InvalidNumBytesInEnvelope);
1773            }
1774            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1775                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1776            }
1777            Ok(())
1778        }
1779    }
1780}