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
204mod internal {
205    use super::*;
206    unsafe impl fidl::encoding::TypeMarker for EntryState {
207        type Owned = Self;
208
209        #[inline(always)]
210        fn inline_align(_context: fidl::encoding::Context) -> usize {
211            std::mem::align_of::<u32>()
212        }
213
214        #[inline(always)]
215        fn inline_size(_context: fidl::encoding::Context) -> usize {
216            std::mem::size_of::<u32>()
217        }
218
219        #[inline(always)]
220        fn encode_is_copy() -> bool {
221            true
222        }
223
224        #[inline(always)]
225        fn decode_is_copy() -> bool {
226            false
227        }
228    }
229
230    impl fidl::encoding::ValueTypeMarker for EntryState {
231        type Borrowed<'a> = Self;
232        #[inline(always)]
233        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
234            *value
235        }
236    }
237
238    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for EntryState {
239        #[inline]
240        unsafe fn encode(
241            self,
242            encoder: &mut fidl::encoding::Encoder<'_, D>,
243            offset: usize,
244            _depth: fidl::encoding::Depth,
245        ) -> fidl::Result<()> {
246            encoder.debug_check_bounds::<Self>(offset);
247            encoder.write_num(self.into_primitive(), offset);
248            Ok(())
249        }
250    }
251
252    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for EntryState {
253        #[inline(always)]
254        fn new_empty() -> Self {
255            Self::Incomplete
256        }
257
258        #[inline]
259        unsafe fn decode(
260            &mut self,
261            decoder: &mut fidl::encoding::Decoder<'_, D>,
262            offset: usize,
263            _depth: fidl::encoding::Depth,
264        ) -> fidl::Result<()> {
265            decoder.debug_check_bounds::<Self>(offset);
266            let prim = decoder.read_num::<u32>(offset);
267
268            *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
269            Ok(())
270        }
271    }
272
273    impl fidl::encoding::ValueTypeMarker for ControllerAddEntryRequest {
274        type Borrowed<'a> = &'a Self;
275        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
276            value
277        }
278    }
279
280    unsafe impl fidl::encoding::TypeMarker for ControllerAddEntryRequest {
281        type Owned = Self;
282
283        #[inline(always)]
284        fn inline_align(_context: fidl::encoding::Context) -> usize {
285            8
286        }
287
288        #[inline(always)]
289        fn inline_size(_context: fidl::encoding::Context) -> usize {
290            32
291        }
292    }
293
294    unsafe impl<D: fidl::encoding::ResourceDialect>
295        fidl::encoding::Encode<ControllerAddEntryRequest, D> for &ControllerAddEntryRequest
296    {
297        #[inline]
298        unsafe fn encode(
299            self,
300            encoder: &mut fidl::encoding::Encoder<'_, D>,
301            offset: usize,
302            _depth: fidl::encoding::Depth,
303        ) -> fidl::Result<()> {
304            encoder.debug_check_bounds::<ControllerAddEntryRequest>(offset);
305            // Delegate to tuple encoding.
306            fidl::encoding::Encode::<ControllerAddEntryRequest, D>::encode(
307                (
308                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.interface),
309                    <fidl_fuchsia_net__common::IpAddress as fidl::encoding::ValueTypeMarker>::borrow(&self.neighbor),
310                    <fidl_fuchsia_net__common::MacAddress as fidl::encoding::ValueTypeMarker>::borrow(&self.mac),
311                ),
312                encoder, offset, _depth
313            )
314        }
315    }
316    unsafe impl<
317            D: fidl::encoding::ResourceDialect,
318            T0: fidl::encoding::Encode<u64, D>,
319            T1: fidl::encoding::Encode<fidl_fuchsia_net__common::IpAddress, D>,
320            T2: fidl::encoding::Encode<fidl_fuchsia_net__common::MacAddress, D>,
321        > fidl::encoding::Encode<ControllerAddEntryRequest, D> for (T0, T1, T2)
322    {
323        #[inline]
324        unsafe fn encode(
325            self,
326            encoder: &mut fidl::encoding::Encoder<'_, D>,
327            offset: usize,
328            depth: fidl::encoding::Depth,
329        ) -> fidl::Result<()> {
330            encoder.debug_check_bounds::<ControllerAddEntryRequest>(offset);
331            // Zero out padding regions. There's no need to apply masks
332            // because the unmasked parts will be overwritten by fields.
333            unsafe {
334                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(24);
335                (ptr as *mut u64).write_unaligned(0);
336            }
337            // Write the fields.
338            self.0.encode(encoder, offset + 0, depth)?;
339            self.1.encode(encoder, offset + 8, depth)?;
340            self.2.encode(encoder, offset + 24, depth)?;
341            Ok(())
342        }
343    }
344
345    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
346        for ControllerAddEntryRequest
347    {
348        #[inline(always)]
349        fn new_empty() -> Self {
350            Self {
351                interface: fidl::new_empty!(u64, D),
352                neighbor: fidl::new_empty!(fidl_fuchsia_net__common::IpAddress, D),
353                mac: fidl::new_empty!(fidl_fuchsia_net__common::MacAddress, D),
354            }
355        }
356
357        #[inline]
358        unsafe fn decode(
359            &mut self,
360            decoder: &mut fidl::encoding::Decoder<'_, D>,
361            offset: usize,
362            _depth: fidl::encoding::Depth,
363        ) -> fidl::Result<()> {
364            decoder.debug_check_bounds::<Self>(offset);
365            // Verify that padding bytes are zero.
366            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(24) };
367            let padval = unsafe { (ptr as *const u64).read_unaligned() };
368            let mask = 0xffff000000000000u64;
369            let maskedval = padval & mask;
370            if maskedval != 0 {
371                return Err(fidl::Error::NonZeroPadding {
372                    padding_start: offset + 24 + ((mask as u64).trailing_zeros() / 8) as usize,
373                });
374            }
375            fidl::decode!(u64, D, &mut self.interface, decoder, offset + 0, _depth)?;
376            fidl::decode!(
377                fidl_fuchsia_net__common::IpAddress,
378                D,
379                &mut self.neighbor,
380                decoder,
381                offset + 8,
382                _depth
383            )?;
384            fidl::decode!(
385                fidl_fuchsia_net__common::MacAddress,
386                D,
387                &mut self.mac,
388                decoder,
389                offset + 24,
390                _depth
391            )?;
392            Ok(())
393        }
394    }
395
396    impl fidl::encoding::ValueTypeMarker for ControllerClearEntriesRequest {
397        type Borrowed<'a> = &'a Self;
398        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
399            value
400        }
401    }
402
403    unsafe impl fidl::encoding::TypeMarker for ControllerClearEntriesRequest {
404        type Owned = Self;
405
406        #[inline(always)]
407        fn inline_align(_context: fidl::encoding::Context) -> usize {
408            8
409        }
410
411        #[inline(always)]
412        fn inline_size(_context: fidl::encoding::Context) -> usize {
413            16
414        }
415    }
416
417    unsafe impl<D: fidl::encoding::ResourceDialect>
418        fidl::encoding::Encode<ControllerClearEntriesRequest, D>
419        for &ControllerClearEntriesRequest
420    {
421        #[inline]
422        unsafe fn encode(
423            self,
424            encoder: &mut fidl::encoding::Encoder<'_, D>,
425            offset: usize,
426            _depth: fidl::encoding::Depth,
427        ) -> fidl::Result<()> {
428            encoder.debug_check_bounds::<ControllerClearEntriesRequest>(offset);
429            // Delegate to tuple encoding.
430            fidl::encoding::Encode::<ControllerClearEntriesRequest, D>::encode(
431                (
432                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.interface),
433                    <fidl_fuchsia_net__common::IpVersion as fidl::encoding::ValueTypeMarker>::borrow(&self.ip_version),
434                ),
435                encoder, offset, _depth
436            )
437        }
438    }
439    unsafe impl<
440            D: fidl::encoding::ResourceDialect,
441            T0: fidl::encoding::Encode<u64, D>,
442            T1: fidl::encoding::Encode<fidl_fuchsia_net__common::IpVersion, D>,
443        > fidl::encoding::Encode<ControllerClearEntriesRequest, D> for (T0, T1)
444    {
445        #[inline]
446        unsafe fn encode(
447            self,
448            encoder: &mut fidl::encoding::Encoder<'_, D>,
449            offset: usize,
450            depth: fidl::encoding::Depth,
451        ) -> fidl::Result<()> {
452            encoder.debug_check_bounds::<ControllerClearEntriesRequest>(offset);
453            // Zero out padding regions. There's no need to apply masks
454            // because the unmasked parts will be overwritten by fields.
455            unsafe {
456                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
457                (ptr as *mut u64).write_unaligned(0);
458            }
459            // Write the fields.
460            self.0.encode(encoder, offset + 0, depth)?;
461            self.1.encode(encoder, offset + 8, depth)?;
462            Ok(())
463        }
464    }
465
466    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
467        for ControllerClearEntriesRequest
468    {
469        #[inline(always)]
470        fn new_empty() -> Self {
471            Self {
472                interface: fidl::new_empty!(u64, D),
473                ip_version: fidl::new_empty!(fidl_fuchsia_net__common::IpVersion, D),
474            }
475        }
476
477        #[inline]
478        unsafe fn decode(
479            &mut self,
480            decoder: &mut fidl::encoding::Decoder<'_, D>,
481            offset: usize,
482            _depth: fidl::encoding::Depth,
483        ) -> fidl::Result<()> {
484            decoder.debug_check_bounds::<Self>(offset);
485            // Verify that padding bytes are zero.
486            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(8) };
487            let padval = unsafe { (ptr as *const u64).read_unaligned() };
488            let mask = 0xffffffff00000000u64;
489            let maskedval = padval & mask;
490            if maskedval != 0 {
491                return Err(fidl::Error::NonZeroPadding {
492                    padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
493                });
494            }
495            fidl::decode!(u64, D, &mut self.interface, decoder, offset + 0, _depth)?;
496            fidl::decode!(
497                fidl_fuchsia_net__common::IpVersion,
498                D,
499                &mut self.ip_version,
500                decoder,
501                offset + 8,
502                _depth
503            )?;
504            Ok(())
505        }
506    }
507
508    impl fidl::encoding::ValueTypeMarker for ControllerRemoveEntryRequest {
509        type Borrowed<'a> = &'a Self;
510        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
511            value
512        }
513    }
514
515    unsafe impl fidl::encoding::TypeMarker for ControllerRemoveEntryRequest {
516        type Owned = Self;
517
518        #[inline(always)]
519        fn inline_align(_context: fidl::encoding::Context) -> usize {
520            8
521        }
522
523        #[inline(always)]
524        fn inline_size(_context: fidl::encoding::Context) -> usize {
525            24
526        }
527    }
528
529    unsafe impl<D: fidl::encoding::ResourceDialect>
530        fidl::encoding::Encode<ControllerRemoveEntryRequest, D> for &ControllerRemoveEntryRequest
531    {
532        #[inline]
533        unsafe fn encode(
534            self,
535            encoder: &mut fidl::encoding::Encoder<'_, D>,
536            offset: usize,
537            _depth: fidl::encoding::Depth,
538        ) -> fidl::Result<()> {
539            encoder.debug_check_bounds::<ControllerRemoveEntryRequest>(offset);
540            // Delegate to tuple encoding.
541            fidl::encoding::Encode::<ControllerRemoveEntryRequest, D>::encode(
542                (
543                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.interface),
544                    <fidl_fuchsia_net__common::IpAddress as fidl::encoding::ValueTypeMarker>::borrow(&self.neighbor),
545                ),
546                encoder, offset, _depth
547            )
548        }
549    }
550    unsafe impl<
551            D: fidl::encoding::ResourceDialect,
552            T0: fidl::encoding::Encode<u64, D>,
553            T1: fidl::encoding::Encode<fidl_fuchsia_net__common::IpAddress, D>,
554        > fidl::encoding::Encode<ControllerRemoveEntryRequest, D> for (T0, T1)
555    {
556        #[inline]
557        unsafe fn encode(
558            self,
559            encoder: &mut fidl::encoding::Encoder<'_, D>,
560            offset: usize,
561            depth: fidl::encoding::Depth,
562        ) -> fidl::Result<()> {
563            encoder.debug_check_bounds::<ControllerRemoveEntryRequest>(offset);
564            // Zero out padding regions. There's no need to apply masks
565            // because the unmasked parts will be overwritten by fields.
566            // Write the fields.
567            self.0.encode(encoder, offset + 0, depth)?;
568            self.1.encode(encoder, offset + 8, depth)?;
569            Ok(())
570        }
571    }
572
573    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
574        for ControllerRemoveEntryRequest
575    {
576        #[inline(always)]
577        fn new_empty() -> Self {
578            Self {
579                interface: fidl::new_empty!(u64, D),
580                neighbor: fidl::new_empty!(fidl_fuchsia_net__common::IpAddress, D),
581            }
582        }
583
584        #[inline]
585        unsafe fn decode(
586            &mut self,
587            decoder: &mut fidl::encoding::Decoder<'_, D>,
588            offset: usize,
589            _depth: fidl::encoding::Depth,
590        ) -> fidl::Result<()> {
591            decoder.debug_check_bounds::<Self>(offset);
592            // Verify that padding bytes are zero.
593            fidl::decode!(u64, D, &mut self.interface, decoder, offset + 0, _depth)?;
594            fidl::decode!(
595                fidl_fuchsia_net__common::IpAddress,
596                D,
597                &mut self.neighbor,
598                decoder,
599                offset + 8,
600                _depth
601            )?;
602            Ok(())
603        }
604    }
605
606    impl fidl::encoding::ValueTypeMarker for EntryIteratorGetNextResponse {
607        type Borrowed<'a> = &'a Self;
608        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
609            value
610        }
611    }
612
613    unsafe impl fidl::encoding::TypeMarker for EntryIteratorGetNextResponse {
614        type Owned = Self;
615
616        #[inline(always)]
617        fn inline_align(_context: fidl::encoding::Context) -> usize {
618            8
619        }
620
621        #[inline(always)]
622        fn inline_size(_context: fidl::encoding::Context) -> usize {
623            16
624        }
625    }
626
627    unsafe impl<D: fidl::encoding::ResourceDialect>
628        fidl::encoding::Encode<EntryIteratorGetNextResponse, D> for &EntryIteratorGetNextResponse
629    {
630        #[inline]
631        unsafe fn encode(
632            self,
633            encoder: &mut fidl::encoding::Encoder<'_, D>,
634            offset: usize,
635            _depth: fidl::encoding::Depth,
636        ) -> fidl::Result<()> {
637            encoder.debug_check_bounds::<EntryIteratorGetNextResponse>(offset);
638            // Delegate to tuple encoding.
639            fidl::encoding::Encode::<EntryIteratorGetNextResponse, D>::encode(
640                (
641                    <fidl::encoding::Vector<EntryIteratorItem, 256> as fidl::encoding::ValueTypeMarker>::borrow(&self.events),
642                ),
643                encoder, offset, _depth
644            )
645        }
646    }
647    unsafe impl<
648            D: fidl::encoding::ResourceDialect,
649            T0: fidl::encoding::Encode<fidl::encoding::Vector<EntryIteratorItem, 256>, D>,
650        > fidl::encoding::Encode<EntryIteratorGetNextResponse, D> for (T0,)
651    {
652        #[inline]
653        unsafe fn encode(
654            self,
655            encoder: &mut fidl::encoding::Encoder<'_, D>,
656            offset: usize,
657            depth: fidl::encoding::Depth,
658        ) -> fidl::Result<()> {
659            encoder.debug_check_bounds::<EntryIteratorGetNextResponse>(offset);
660            // Zero out padding regions. There's no need to apply masks
661            // because the unmasked parts will be overwritten by fields.
662            // Write the fields.
663            self.0.encode(encoder, offset + 0, depth)?;
664            Ok(())
665        }
666    }
667
668    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
669        for EntryIteratorGetNextResponse
670    {
671        #[inline(always)]
672        fn new_empty() -> Self {
673            Self { events: fidl::new_empty!(fidl::encoding::Vector<EntryIteratorItem, 256>, D) }
674        }
675
676        #[inline]
677        unsafe fn decode(
678            &mut self,
679            decoder: &mut fidl::encoding::Decoder<'_, D>,
680            offset: usize,
681            _depth: fidl::encoding::Depth,
682        ) -> fidl::Result<()> {
683            decoder.debug_check_bounds::<Self>(offset);
684            // Verify that padding bytes are zero.
685            fidl::decode!(fidl::encoding::Vector<EntryIteratorItem, 256>, D, &mut self.events, decoder, offset + 0, _depth)?;
686            Ok(())
687        }
688    }
689
690    impl fidl::encoding::ValueTypeMarker for IdleEvent {
691        type Borrowed<'a> = &'a Self;
692        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
693            value
694        }
695    }
696
697    unsafe impl fidl::encoding::TypeMarker for IdleEvent {
698        type Owned = Self;
699
700        #[inline(always)]
701        fn inline_align(_context: fidl::encoding::Context) -> usize {
702            1
703        }
704
705        #[inline(always)]
706        fn inline_size(_context: fidl::encoding::Context) -> usize {
707            1
708        }
709    }
710
711    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<IdleEvent, D>
712        for &IdleEvent
713    {
714        #[inline]
715        unsafe fn encode(
716            self,
717            encoder: &mut fidl::encoding::Encoder<'_, D>,
718            offset: usize,
719            _depth: fidl::encoding::Depth,
720        ) -> fidl::Result<()> {
721            encoder.debug_check_bounds::<IdleEvent>(offset);
722            encoder.write_num(0u8, offset);
723            Ok(())
724        }
725    }
726
727    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for IdleEvent {
728        #[inline(always)]
729        fn new_empty() -> Self {
730            Self
731        }
732
733        #[inline]
734        unsafe fn decode(
735            &mut self,
736            decoder: &mut fidl::encoding::Decoder<'_, D>,
737            offset: usize,
738            _depth: fidl::encoding::Depth,
739        ) -> fidl::Result<()> {
740            decoder.debug_check_bounds::<Self>(offset);
741            match decoder.read_num::<u8>(offset) {
742                0 => Ok(()),
743                _ => Err(fidl::Error::Invalid),
744            }
745        }
746    }
747
748    impl Entry {
749        #[inline(always)]
750        fn max_ordinal_present(&self) -> u64 {
751            if let Some(_) = self.updated_at {
752                return 5;
753            }
754            if let Some(_) = self.mac {
755                return 4;
756            }
757            if let Some(_) = self.state {
758                return 3;
759            }
760            if let Some(_) = self.neighbor {
761                return 2;
762            }
763            if let Some(_) = self.interface {
764                return 1;
765            }
766            0
767        }
768    }
769
770    impl fidl::encoding::ValueTypeMarker for Entry {
771        type Borrowed<'a> = &'a Self;
772        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
773            value
774        }
775    }
776
777    unsafe impl fidl::encoding::TypeMarker for Entry {
778        type Owned = Self;
779
780        #[inline(always)]
781        fn inline_align(_context: fidl::encoding::Context) -> usize {
782            8
783        }
784
785        #[inline(always)]
786        fn inline_size(_context: fidl::encoding::Context) -> usize {
787            16
788        }
789    }
790
791    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Entry, D> for &Entry {
792        unsafe fn encode(
793            self,
794            encoder: &mut fidl::encoding::Encoder<'_, D>,
795            offset: usize,
796            mut depth: fidl::encoding::Depth,
797        ) -> fidl::Result<()> {
798            encoder.debug_check_bounds::<Entry>(offset);
799            // Vector header
800            let max_ordinal: u64 = self.max_ordinal_present();
801            encoder.write_num(max_ordinal, offset);
802            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
803            // Calling encoder.out_of_line_offset(0) is not allowed.
804            if max_ordinal == 0 {
805                return Ok(());
806            }
807            depth.increment()?;
808            let envelope_size = 8;
809            let bytes_len = max_ordinal as usize * envelope_size;
810            #[allow(unused_variables)]
811            let offset = encoder.out_of_line_offset(bytes_len);
812            let mut _prev_end_offset: usize = 0;
813            if 1 > max_ordinal {
814                return Ok(());
815            }
816
817            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
818            // are envelope_size bytes.
819            let cur_offset: usize = (1 - 1) * envelope_size;
820
821            // Zero reserved fields.
822            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
823
824            // Safety:
825            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
826            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
827            //   envelope_size bytes, there is always sufficient room.
828            fidl::encoding::encode_in_envelope_optional::<u64, D>(
829                self.interface.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
830                encoder,
831                offset + cur_offset,
832                depth,
833            )?;
834
835            _prev_end_offset = cur_offset + envelope_size;
836            if 2 > max_ordinal {
837                return Ok(());
838            }
839
840            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
841            // are envelope_size bytes.
842            let cur_offset: usize = (2 - 1) * envelope_size;
843
844            // Zero reserved fields.
845            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
846
847            // Safety:
848            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
849            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
850            //   envelope_size bytes, there is always sufficient room.
851            fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_net__common::IpAddress, D>(
852            self.neighbor.as_ref().map(<fidl_fuchsia_net__common::IpAddress as fidl::encoding::ValueTypeMarker>::borrow),
853            encoder, offset + cur_offset, depth
854        )?;
855
856            _prev_end_offset = cur_offset + envelope_size;
857            if 3 > max_ordinal {
858                return Ok(());
859            }
860
861            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
862            // are envelope_size bytes.
863            let cur_offset: usize = (3 - 1) * envelope_size;
864
865            // Zero reserved fields.
866            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
867
868            // Safety:
869            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
870            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
871            //   envelope_size bytes, there is always sufficient room.
872            fidl::encoding::encode_in_envelope_optional::<EntryState, D>(
873                self.state.as_ref().map(<EntryState as fidl::encoding::ValueTypeMarker>::borrow),
874                encoder,
875                offset + cur_offset,
876                depth,
877            )?;
878
879            _prev_end_offset = cur_offset + envelope_size;
880            if 4 > max_ordinal {
881                return Ok(());
882            }
883
884            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
885            // are envelope_size bytes.
886            let cur_offset: usize = (4 - 1) * envelope_size;
887
888            // Zero reserved fields.
889            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
890
891            // Safety:
892            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
893            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
894            //   envelope_size bytes, there is always sufficient room.
895            fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_net__common::MacAddress, D>(
896            self.mac.as_ref().map(<fidl_fuchsia_net__common::MacAddress as fidl::encoding::ValueTypeMarker>::borrow),
897            encoder, offset + cur_offset, depth
898        )?;
899
900            _prev_end_offset = cur_offset + envelope_size;
901            if 5 > max_ordinal {
902                return Ok(());
903            }
904
905            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
906            // are envelope_size bytes.
907            let cur_offset: usize = (5 - 1) * envelope_size;
908
909            // Zero reserved fields.
910            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
911
912            // Safety:
913            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
914            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
915            //   envelope_size bytes, there is always sufficient room.
916            fidl::encoding::encode_in_envelope_optional::<i64, D>(
917                self.updated_at.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
918                encoder,
919                offset + cur_offset,
920                depth,
921            )?;
922
923            _prev_end_offset = cur_offset + envelope_size;
924
925            Ok(())
926        }
927    }
928
929    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Entry {
930        #[inline(always)]
931        fn new_empty() -> Self {
932            Self::default()
933        }
934
935        unsafe fn decode(
936            &mut self,
937            decoder: &mut fidl::encoding::Decoder<'_, D>,
938            offset: usize,
939            mut depth: fidl::encoding::Depth,
940        ) -> fidl::Result<()> {
941            decoder.debug_check_bounds::<Self>(offset);
942            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
943                None => return Err(fidl::Error::NotNullable),
944                Some(len) => len,
945            };
946            // Calling decoder.out_of_line_offset(0) is not allowed.
947            if len == 0 {
948                return Ok(());
949            };
950            depth.increment()?;
951            let envelope_size = 8;
952            let bytes_len = len * envelope_size;
953            let offset = decoder.out_of_line_offset(bytes_len)?;
954            // Decode the envelope for each type.
955            let mut _next_ordinal_to_read = 0;
956            let mut next_offset = offset;
957            let end_offset = offset + bytes_len;
958            _next_ordinal_to_read += 1;
959            if next_offset >= end_offset {
960                return Ok(());
961            }
962
963            // Decode unknown envelopes for gaps in ordinals.
964            while _next_ordinal_to_read < 1 {
965                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
966                _next_ordinal_to_read += 1;
967                next_offset += envelope_size;
968            }
969
970            let next_out_of_line = decoder.next_out_of_line();
971            let handles_before = decoder.remaining_handles();
972            if let Some((inlined, num_bytes, num_handles)) =
973                fidl::encoding::decode_envelope_header(decoder, next_offset)?
974            {
975                let member_inline_size =
976                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
977                if inlined != (member_inline_size <= 4) {
978                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
979                }
980                let inner_offset;
981                let mut inner_depth = depth.clone();
982                if inlined {
983                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
984                    inner_offset = next_offset;
985                } else {
986                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
987                    inner_depth.increment()?;
988                }
989                let val_ref = self.interface.get_or_insert_with(|| fidl::new_empty!(u64, D));
990                fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
991                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
992                {
993                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
994                }
995                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
996                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
997                }
998            }
999
1000            next_offset += envelope_size;
1001            _next_ordinal_to_read += 1;
1002            if next_offset >= end_offset {
1003                return Ok(());
1004            }
1005
1006            // Decode unknown envelopes for gaps in ordinals.
1007            while _next_ordinal_to_read < 2 {
1008                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1009                _next_ordinal_to_read += 1;
1010                next_offset += envelope_size;
1011            }
1012
1013            let next_out_of_line = decoder.next_out_of_line();
1014            let handles_before = decoder.remaining_handles();
1015            if let Some((inlined, num_bytes, num_handles)) =
1016                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1017            {
1018                let member_inline_size = <fidl_fuchsia_net__common::IpAddress as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1019                if inlined != (member_inline_size <= 4) {
1020                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1021                }
1022                let inner_offset;
1023                let mut inner_depth = depth.clone();
1024                if inlined {
1025                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1026                    inner_offset = next_offset;
1027                } else {
1028                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1029                    inner_depth.increment()?;
1030                }
1031                let val_ref = self.neighbor.get_or_insert_with(|| {
1032                    fidl::new_empty!(fidl_fuchsia_net__common::IpAddress, D)
1033                });
1034                fidl::decode!(
1035                    fidl_fuchsia_net__common::IpAddress,
1036                    D,
1037                    val_ref,
1038                    decoder,
1039                    inner_offset,
1040                    inner_depth
1041                )?;
1042                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1043                {
1044                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
1045                }
1046                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1047                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1048                }
1049            }
1050
1051            next_offset += envelope_size;
1052            _next_ordinal_to_read += 1;
1053            if next_offset >= end_offset {
1054                return Ok(());
1055            }
1056
1057            // Decode unknown envelopes for gaps in ordinals.
1058            while _next_ordinal_to_read < 3 {
1059                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1060                _next_ordinal_to_read += 1;
1061                next_offset += envelope_size;
1062            }
1063
1064            let next_out_of_line = decoder.next_out_of_line();
1065            let handles_before = decoder.remaining_handles();
1066            if let Some((inlined, num_bytes, num_handles)) =
1067                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1068            {
1069                let member_inline_size =
1070                    <EntryState as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1071                if inlined != (member_inline_size <= 4) {
1072                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1073                }
1074                let inner_offset;
1075                let mut inner_depth = depth.clone();
1076                if inlined {
1077                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1078                    inner_offset = next_offset;
1079                } else {
1080                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1081                    inner_depth.increment()?;
1082                }
1083                let val_ref = self.state.get_or_insert_with(|| fidl::new_empty!(EntryState, D));
1084                fidl::decode!(EntryState, D, val_ref, decoder, inner_offset, inner_depth)?;
1085                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1086                {
1087                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
1088                }
1089                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1090                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1091                }
1092            }
1093
1094            next_offset += envelope_size;
1095            _next_ordinal_to_read += 1;
1096            if next_offset >= end_offset {
1097                return Ok(());
1098            }
1099
1100            // Decode unknown envelopes for gaps in ordinals.
1101            while _next_ordinal_to_read < 4 {
1102                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1103                _next_ordinal_to_read += 1;
1104                next_offset += envelope_size;
1105            }
1106
1107            let next_out_of_line = decoder.next_out_of_line();
1108            let handles_before = decoder.remaining_handles();
1109            if let Some((inlined, num_bytes, num_handles)) =
1110                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1111            {
1112                let member_inline_size = <fidl_fuchsia_net__common::MacAddress as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1113                if inlined != (member_inline_size <= 4) {
1114                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1115                }
1116                let inner_offset;
1117                let mut inner_depth = depth.clone();
1118                if inlined {
1119                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1120                    inner_offset = next_offset;
1121                } else {
1122                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1123                    inner_depth.increment()?;
1124                }
1125                let val_ref = self.mac.get_or_insert_with(|| {
1126                    fidl::new_empty!(fidl_fuchsia_net__common::MacAddress, D)
1127                });
1128                fidl::decode!(
1129                    fidl_fuchsia_net__common::MacAddress,
1130                    D,
1131                    val_ref,
1132                    decoder,
1133                    inner_offset,
1134                    inner_depth
1135                )?;
1136                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1137                {
1138                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
1139                }
1140                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1141                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1142                }
1143            }
1144
1145            next_offset += envelope_size;
1146            _next_ordinal_to_read += 1;
1147            if next_offset >= end_offset {
1148                return Ok(());
1149            }
1150
1151            // Decode unknown envelopes for gaps in ordinals.
1152            while _next_ordinal_to_read < 5 {
1153                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1154                _next_ordinal_to_read += 1;
1155                next_offset += envelope_size;
1156            }
1157
1158            let next_out_of_line = decoder.next_out_of_line();
1159            let handles_before = decoder.remaining_handles();
1160            if let Some((inlined, num_bytes, num_handles)) =
1161                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1162            {
1163                let member_inline_size =
1164                    <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1165                if inlined != (member_inline_size <= 4) {
1166                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1167                }
1168                let inner_offset;
1169                let mut inner_depth = depth.clone();
1170                if inlined {
1171                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1172                    inner_offset = next_offset;
1173                } else {
1174                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1175                    inner_depth.increment()?;
1176                }
1177                let val_ref = self.updated_at.get_or_insert_with(|| fidl::new_empty!(i64, D));
1178                fidl::decode!(i64, D, val_ref, decoder, inner_offset, inner_depth)?;
1179                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1180                {
1181                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
1182                }
1183                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1184                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1185                }
1186            }
1187
1188            next_offset += envelope_size;
1189
1190            // Decode the remaining unknown envelopes.
1191            while next_offset < end_offset {
1192                _next_ordinal_to_read += 1;
1193                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1194                next_offset += envelope_size;
1195            }
1196
1197            Ok(())
1198        }
1199    }
1200
1201    impl EntryIteratorOptions {
1202        #[inline(always)]
1203        fn max_ordinal_present(&self) -> u64 {
1204            0
1205        }
1206    }
1207
1208    impl fidl::encoding::ValueTypeMarker for EntryIteratorOptions {
1209        type Borrowed<'a> = &'a Self;
1210        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1211            value
1212        }
1213    }
1214
1215    unsafe impl fidl::encoding::TypeMarker for EntryIteratorOptions {
1216        type Owned = Self;
1217
1218        #[inline(always)]
1219        fn inline_align(_context: fidl::encoding::Context) -> usize {
1220            8
1221        }
1222
1223        #[inline(always)]
1224        fn inline_size(_context: fidl::encoding::Context) -> usize {
1225            16
1226        }
1227    }
1228
1229    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<EntryIteratorOptions, D>
1230        for &EntryIteratorOptions
1231    {
1232        unsafe fn encode(
1233            self,
1234            encoder: &mut fidl::encoding::Encoder<'_, D>,
1235            offset: usize,
1236            mut depth: fidl::encoding::Depth,
1237        ) -> fidl::Result<()> {
1238            encoder.debug_check_bounds::<EntryIteratorOptions>(offset);
1239            // Vector header
1240            let max_ordinal: u64 = self.max_ordinal_present();
1241            encoder.write_num(max_ordinal, offset);
1242            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
1243            // Calling encoder.out_of_line_offset(0) is not allowed.
1244            if max_ordinal == 0 {
1245                return Ok(());
1246            }
1247            depth.increment()?;
1248            let envelope_size = 8;
1249            let bytes_len = max_ordinal as usize * envelope_size;
1250            #[allow(unused_variables)]
1251            let offset = encoder.out_of_line_offset(bytes_len);
1252            let mut _prev_end_offset: usize = 0;
1253
1254            Ok(())
1255        }
1256    }
1257
1258    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for EntryIteratorOptions {
1259        #[inline(always)]
1260        fn new_empty() -> Self {
1261            Self::default()
1262        }
1263
1264        unsafe fn decode(
1265            &mut self,
1266            decoder: &mut fidl::encoding::Decoder<'_, D>,
1267            offset: usize,
1268            mut depth: fidl::encoding::Depth,
1269        ) -> fidl::Result<()> {
1270            decoder.debug_check_bounds::<Self>(offset);
1271            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
1272                None => return Err(fidl::Error::NotNullable),
1273                Some(len) => len,
1274            };
1275            // Calling decoder.out_of_line_offset(0) is not allowed.
1276            if len == 0 {
1277                return Ok(());
1278            };
1279            depth.increment()?;
1280            let envelope_size = 8;
1281            let bytes_len = len * envelope_size;
1282            let offset = decoder.out_of_line_offset(bytes_len)?;
1283            // Decode the envelope for each type.
1284            let mut _next_ordinal_to_read = 0;
1285            let mut next_offset = offset;
1286            let end_offset = offset + bytes_len;
1287
1288            // Decode the remaining unknown envelopes.
1289            while next_offset < end_offset {
1290                _next_ordinal_to_read += 1;
1291                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1292                next_offset += envelope_size;
1293            }
1294
1295            Ok(())
1296        }
1297    }
1298
1299    impl fidl::encoding::ValueTypeMarker for EntryIteratorItem {
1300        type Borrowed<'a> = &'a Self;
1301        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1302            value
1303        }
1304    }
1305
1306    unsafe impl fidl::encoding::TypeMarker for EntryIteratorItem {
1307        type Owned = Self;
1308
1309        #[inline(always)]
1310        fn inline_align(_context: fidl::encoding::Context) -> usize {
1311            8
1312        }
1313
1314        #[inline(always)]
1315        fn inline_size(_context: fidl::encoding::Context) -> usize {
1316            16
1317        }
1318    }
1319
1320    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<EntryIteratorItem, D>
1321        for &EntryIteratorItem
1322    {
1323        #[inline]
1324        unsafe fn encode(
1325            self,
1326            encoder: &mut fidl::encoding::Encoder<'_, D>,
1327            offset: usize,
1328            _depth: fidl::encoding::Depth,
1329        ) -> fidl::Result<()> {
1330            encoder.debug_check_bounds::<EntryIteratorItem>(offset);
1331            encoder.write_num::<u64>(self.ordinal(), offset);
1332            match self {
1333                EntryIteratorItem::Existing(ref val) => {
1334                    fidl::encoding::encode_in_envelope::<Entry, D>(
1335                        <Entry as fidl::encoding::ValueTypeMarker>::borrow(val),
1336                        encoder,
1337                        offset + 8,
1338                        _depth,
1339                    )
1340                }
1341                EntryIteratorItem::Idle(ref val) => {
1342                    fidl::encoding::encode_in_envelope::<IdleEvent, D>(
1343                        <IdleEvent as fidl::encoding::ValueTypeMarker>::borrow(val),
1344                        encoder,
1345                        offset + 8,
1346                        _depth,
1347                    )
1348                }
1349                EntryIteratorItem::Added(ref val) => {
1350                    fidl::encoding::encode_in_envelope::<Entry, D>(
1351                        <Entry as fidl::encoding::ValueTypeMarker>::borrow(val),
1352                        encoder,
1353                        offset + 8,
1354                        _depth,
1355                    )
1356                }
1357                EntryIteratorItem::Changed(ref val) => {
1358                    fidl::encoding::encode_in_envelope::<Entry, D>(
1359                        <Entry as fidl::encoding::ValueTypeMarker>::borrow(val),
1360                        encoder,
1361                        offset + 8,
1362                        _depth,
1363                    )
1364                }
1365                EntryIteratorItem::Removed(ref val) => {
1366                    fidl::encoding::encode_in_envelope::<Entry, D>(
1367                        <Entry as fidl::encoding::ValueTypeMarker>::borrow(val),
1368                        encoder,
1369                        offset + 8,
1370                        _depth,
1371                    )
1372                }
1373            }
1374        }
1375    }
1376
1377    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for EntryIteratorItem {
1378        #[inline(always)]
1379        fn new_empty() -> Self {
1380            Self::Existing(fidl::new_empty!(Entry, D))
1381        }
1382
1383        #[inline]
1384        unsafe fn decode(
1385            &mut self,
1386            decoder: &mut fidl::encoding::Decoder<'_, D>,
1387            offset: usize,
1388            mut depth: fidl::encoding::Depth,
1389        ) -> fidl::Result<()> {
1390            decoder.debug_check_bounds::<Self>(offset);
1391            #[allow(unused_variables)]
1392            let next_out_of_line = decoder.next_out_of_line();
1393            let handles_before = decoder.remaining_handles();
1394            let (ordinal, inlined, num_bytes, num_handles) =
1395                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
1396
1397            let member_inline_size = match ordinal {
1398                1 => <Entry as fidl::encoding::TypeMarker>::inline_size(decoder.context),
1399                2 => <IdleEvent as fidl::encoding::TypeMarker>::inline_size(decoder.context),
1400                3 => <Entry as fidl::encoding::TypeMarker>::inline_size(decoder.context),
1401                4 => <Entry as fidl::encoding::TypeMarker>::inline_size(decoder.context),
1402                5 => <Entry as fidl::encoding::TypeMarker>::inline_size(decoder.context),
1403                _ => return Err(fidl::Error::UnknownUnionTag),
1404            };
1405
1406            if inlined != (member_inline_size <= 4) {
1407                return Err(fidl::Error::InvalidInlineBitInEnvelope);
1408            }
1409            let _inner_offset;
1410            if inlined {
1411                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
1412                _inner_offset = offset + 8;
1413            } else {
1414                depth.increment()?;
1415                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1416            }
1417            match ordinal {
1418                1 => {
1419                    #[allow(irrefutable_let_patterns)]
1420                    if let EntryIteratorItem::Existing(_) = self {
1421                        // Do nothing, read the value into the object
1422                    } else {
1423                        // Initialize `self` to the right variant
1424                        *self = EntryIteratorItem::Existing(fidl::new_empty!(Entry, D));
1425                    }
1426                    #[allow(irrefutable_let_patterns)]
1427                    if let EntryIteratorItem::Existing(ref mut val) = self {
1428                        fidl::decode!(Entry, D, val, decoder, _inner_offset, depth)?;
1429                    } else {
1430                        unreachable!()
1431                    }
1432                }
1433                2 => {
1434                    #[allow(irrefutable_let_patterns)]
1435                    if let EntryIteratorItem::Idle(_) = self {
1436                        // Do nothing, read the value into the object
1437                    } else {
1438                        // Initialize `self` to the right variant
1439                        *self = EntryIteratorItem::Idle(fidl::new_empty!(IdleEvent, D));
1440                    }
1441                    #[allow(irrefutable_let_patterns)]
1442                    if let EntryIteratorItem::Idle(ref mut val) = self {
1443                        fidl::decode!(IdleEvent, D, val, decoder, _inner_offset, depth)?;
1444                    } else {
1445                        unreachable!()
1446                    }
1447                }
1448                3 => {
1449                    #[allow(irrefutable_let_patterns)]
1450                    if let EntryIteratorItem::Added(_) = self {
1451                        // Do nothing, read the value into the object
1452                    } else {
1453                        // Initialize `self` to the right variant
1454                        *self = EntryIteratorItem::Added(fidl::new_empty!(Entry, D));
1455                    }
1456                    #[allow(irrefutable_let_patterns)]
1457                    if let EntryIteratorItem::Added(ref mut val) = self {
1458                        fidl::decode!(Entry, D, val, decoder, _inner_offset, depth)?;
1459                    } else {
1460                        unreachable!()
1461                    }
1462                }
1463                4 => {
1464                    #[allow(irrefutable_let_patterns)]
1465                    if let EntryIteratorItem::Changed(_) = self {
1466                        // Do nothing, read the value into the object
1467                    } else {
1468                        // Initialize `self` to the right variant
1469                        *self = EntryIteratorItem::Changed(fidl::new_empty!(Entry, D));
1470                    }
1471                    #[allow(irrefutable_let_patterns)]
1472                    if let EntryIteratorItem::Changed(ref mut val) = self {
1473                        fidl::decode!(Entry, D, val, decoder, _inner_offset, depth)?;
1474                    } else {
1475                        unreachable!()
1476                    }
1477                }
1478                5 => {
1479                    #[allow(irrefutable_let_patterns)]
1480                    if let EntryIteratorItem::Removed(_) = self {
1481                        // Do nothing, read the value into the object
1482                    } else {
1483                        // Initialize `self` to the right variant
1484                        *self = EntryIteratorItem::Removed(fidl::new_empty!(Entry, D));
1485                    }
1486                    #[allow(irrefutable_let_patterns)]
1487                    if let EntryIteratorItem::Removed(ref mut val) = self {
1488                        fidl::decode!(Entry, D, val, decoder, _inner_offset, depth)?;
1489                    } else {
1490                        unreachable!()
1491                    }
1492                }
1493                ordinal => panic!("unexpected ordinal {:?}", ordinal),
1494            }
1495            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
1496                return Err(fidl::Error::InvalidNumBytesInEnvelope);
1497            }
1498            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1499                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1500            }
1501            Ok(())
1502        }
1503    }
1504}