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