fidl_fuchsia_lowpan_experimental_common/
fidl_fuchsia_lowpan_experimental_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
11pub const MAX_EXTERNAL_ROUTES: u32 = 32;
12
13pub const MAX_ON_MESH_PREFIXES: u32 = 32;
14
15pub const MAX_PROVISION_URL_LEN: u16 = 64;
16
17pub const MAX_VENDOR_DATA_LEN: u16 = 64;
18
19pub const MAX_VENDOR_MODEL_LEN: u16 = 32;
20
21pub const MAX_VENDOR_NAME_LEN: u16 = 32;
22
23pub const MAX_VENDOR_SW_VER_LEN: u16 = 16;
24
25pub const PSKD_LEN: u16 = 32;
26
27/// Represents the DHCPv6 PD state.
28#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
29pub enum Dhcp6PdState {
30    Dhcp6PdStateUnspecified,
31    /// DHCPv6 PD is disabled on the border router.
32    Dhcp6PdStateDisabled,
33    /// DHCPv6 PD is enabled but won't try to request and publish a prefix.
34    Dhcp6PdStateStopped,
35    /// DHCPv6 PD is enabled and will try to request and publish a prefix.
36    Dhcp6PdStateRunning,
37    #[doc(hidden)]
38    __SourceBreaking {
39        unknown_ordinal: u32,
40    },
41}
42
43/// Pattern that matches an unknown `Dhcp6PdState` member.
44#[macro_export]
45macro_rules! Dhcp6PdStateUnknown {
46    () => {
47        _
48    };
49}
50
51impl Dhcp6PdState {
52    #[inline]
53    pub fn from_primitive(prim: u32) -> Option<Self> {
54        match prim {
55            0 => Some(Self::Dhcp6PdStateUnspecified),
56            1 => Some(Self::Dhcp6PdStateDisabled),
57            2 => Some(Self::Dhcp6PdStateStopped),
58            3 => Some(Self::Dhcp6PdStateRunning),
59            _ => None,
60        }
61    }
62
63    #[inline]
64    pub fn from_primitive_allow_unknown(prim: u32) -> Self {
65        match prim {
66            0 => Self::Dhcp6PdStateUnspecified,
67            1 => Self::Dhcp6PdStateDisabled,
68            2 => Self::Dhcp6PdStateStopped,
69            3 => Self::Dhcp6PdStateRunning,
70            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
71        }
72    }
73
74    #[inline]
75    pub fn unknown() -> Self {
76        Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
77    }
78
79    #[inline]
80    pub const fn into_primitive(self) -> u32 {
81        match self {
82            Self::Dhcp6PdStateUnspecified => 0,
83            Self::Dhcp6PdStateDisabled => 1,
84            Self::Dhcp6PdStateStopped => 2,
85            Self::Dhcp6PdStateRunning => 3,
86            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
87        }
88    }
89
90    #[inline]
91    pub fn is_unknown(&self) -> bool {
92        match self {
93            Self::__SourceBreaking { unknown_ordinal: _ } => true,
94            _ => false,
95        }
96    }
97}
98
99#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
100pub enum Nat64State {
101    Nat64StateUnspecified,
102    Nat64StateDisabled,
103    Nat64StateNotRunning,
104    Nat64StateIdle,
105    Nat64StateActive,
106    #[doc(hidden)]
107    __SourceBreaking {
108        unknown_ordinal: u32,
109    },
110}
111
112/// Pattern that matches an unknown `Nat64State` member.
113#[macro_export]
114macro_rules! Nat64StateUnknown {
115    () => {
116        _
117    };
118}
119
120impl Nat64State {
121    #[inline]
122    pub fn from_primitive(prim: u32) -> Option<Self> {
123        match prim {
124            0 => Some(Self::Nat64StateUnspecified),
125            1 => Some(Self::Nat64StateDisabled),
126            2 => Some(Self::Nat64StateNotRunning),
127            3 => Some(Self::Nat64StateIdle),
128            4 => Some(Self::Nat64StateActive),
129            _ => None,
130        }
131    }
132
133    #[inline]
134    pub fn from_primitive_allow_unknown(prim: u32) -> Self {
135        match prim {
136            0 => Self::Nat64StateUnspecified,
137            1 => Self::Nat64StateDisabled,
138            2 => Self::Nat64StateNotRunning,
139            3 => Self::Nat64StateIdle,
140            4 => Self::Nat64StateActive,
141            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
142        }
143    }
144
145    #[inline]
146    pub fn unknown() -> Self {
147        Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
148    }
149
150    #[inline]
151    pub const fn into_primitive(self) -> u32 {
152        match self {
153            Self::Nat64StateUnspecified => 0,
154            Self::Nat64StateDisabled => 1,
155            Self::Nat64StateNotRunning => 2,
156            Self::Nat64StateIdle => 3,
157            Self::Nat64StateActive => 4,
158            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
159        }
160    }
161
162    #[inline]
163    pub fn is_unknown(&self) -> bool {
164        match self {
165            Self::__SourceBreaking { unknown_ordinal: _ } => true,
166            _ => false,
167        }
168    }
169}
170
171/// LoWPAN Provisioning Error
172///
173/// Returned by [`ProvisioningMonitor.WatchProgress`].
174#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
175pub enum ProvisionError {
176    /// Provisioning did not successfully complete because the
177    /// credential was rejected. For example, the key was incorrect.
178    ///
179    /// This may be interpreted as an argument error.
180    CredentialRejected,
181    /// Provisioning did not successfully complete because the
182    /// no peers on the requested network are in range.
183    NetworkNotFound,
184    /// Forming a new network did not successfully complete because the
185    /// a peer with the requested network identity is in range.
186    NetworkAlreadyExists,
187    /// This operation was canceled due to an incompatible operation
188    /// being started before this one was finished.
189    Canceled,
190    #[doc(hidden)]
191    __SourceBreaking { unknown_ordinal: i32 },
192}
193
194/// Pattern that matches an unknown `ProvisionError` member.
195#[macro_export]
196macro_rules! ProvisionErrorUnknown {
197    () => {
198        _
199    };
200}
201
202impl ProvisionError {
203    #[inline]
204    pub fn from_primitive(prim: i32) -> Option<Self> {
205        match prim {
206            1 => Some(Self::CredentialRejected),
207            2 => Some(Self::NetworkNotFound),
208            3 => Some(Self::NetworkAlreadyExists),
209            4 => Some(Self::Canceled),
210            _ => None,
211        }
212    }
213
214    #[inline]
215    pub fn from_primitive_allow_unknown(prim: i32) -> Self {
216        match prim {
217            1 => Self::CredentialRejected,
218            2 => Self::NetworkNotFound,
219            3 => Self::NetworkAlreadyExists,
220            4 => Self::Canceled,
221            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
222        }
223    }
224
225    #[inline]
226    pub fn unknown() -> Self {
227        Self::__SourceBreaking { unknown_ordinal: 0x7fffffff }
228    }
229
230    #[inline]
231    pub const fn into_primitive(self) -> i32 {
232        match self {
233            Self::CredentialRejected => 1,
234            Self::NetworkNotFound => 2,
235            Self::NetworkAlreadyExists => 3,
236            Self::Canceled => 4,
237            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
238        }
239    }
240
241    #[inline]
242    pub fn is_unknown(&self) -> bool {
243        match self {
244            Self::__SourceBreaking { unknown_ordinal: _ } => true,
245            _ => false,
246        }
247    }
248}
249
250/// Route preference, as described in RFC4191.
251#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
252#[repr(i8)]
253pub enum RoutePreference {
254    /// Low route preference.
255    Low = -1,
256    /// Medium route preference.
257    Medium = 0,
258    /// High route preference.
259    High = 1,
260}
261
262impl RoutePreference {
263    #[inline]
264    pub fn from_primitive(prim: i8) -> Option<Self> {
265        match prim {
266            -1 => Some(Self::Low),
267            0 => Some(Self::Medium),
268            1 => Some(Self::High),
269            _ => None,
270        }
271    }
272
273    #[inline]
274    pub const fn into_primitive(self) -> i8 {
275        self as i8
276    }
277
278    #[deprecated = "Strict enums should not use `is_unknown`"]
279    #[inline]
280    pub fn is_unknown(&self) -> bool {
281        false
282    }
283}
284
285#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
286#[repr(u32)]
287pub enum SrpServerAddressMode {
288    /// Thread network data is published as unicast addresses.
289    Unicast = 1,
290    /// Thread network data is published as anycast addresses.
291    Anycast = 2,
292}
293
294impl SrpServerAddressMode {
295    #[inline]
296    pub fn from_primitive(prim: u32) -> Option<Self> {
297        match prim {
298            1 => Some(Self::Unicast),
299            2 => Some(Self::Anycast),
300            _ => None,
301        }
302    }
303
304    #[inline]
305    pub const fn into_primitive(self) -> u32 {
306        self as u32
307    }
308
309    #[deprecated = "Strict enums should not use `is_unknown`"]
310    #[inline]
311    pub fn is_unknown(&self) -> bool {
312        false
313    }
314}
315
316#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
317#[repr(u32)]
318pub enum SrpServerState {
319    /// The server is disabled.
320    Disabled = 1,
321    /// The server is enabled and running.
322    Running = 2,
323    /// The server is enabled, but stopped.
324    Stopped = 3,
325}
326
327impl SrpServerState {
328    #[inline]
329    pub fn from_primitive(prim: u32) -> Option<Self> {
330        match prim {
331            1 => Some(Self::Disabled),
332            2 => Some(Self::Running),
333            3 => Some(Self::Stopped),
334            _ => None,
335        }
336    }
337
338    #[inline]
339    pub const fn into_primitive(self) -> u32 {
340        self as u32
341    }
342
343    #[deprecated = "Strict enums should not use `is_unknown`"]
344    #[inline]
345    pub fn is_unknown(&self) -> bool {
346        false
347    }
348}
349
350/// Represents the Upstream DNS state
351#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
352pub enum UpstreamDnsQueryState {
353    UpstreamdnsQueryStateUnspecified,
354    UpstreamdnsQueryStateEnabled,
355    UpstreamdnsQueryStateDisabled,
356    #[doc(hidden)]
357    __SourceBreaking {
358        unknown_ordinal: u32,
359    },
360}
361
362/// Pattern that matches an unknown `UpstreamDnsQueryState` member.
363#[macro_export]
364macro_rules! UpstreamDnsQueryStateUnknown {
365    () => {
366        _
367    };
368}
369
370impl UpstreamDnsQueryState {
371    #[inline]
372    pub fn from_primitive(prim: u32) -> Option<Self> {
373        match prim {
374            0 => Some(Self::UpstreamdnsQueryStateUnspecified),
375            1 => Some(Self::UpstreamdnsQueryStateEnabled),
376            2 => Some(Self::UpstreamdnsQueryStateDisabled),
377            _ => None,
378        }
379    }
380
381    #[inline]
382    pub fn from_primitive_allow_unknown(prim: u32) -> Self {
383        match prim {
384            0 => Self::UpstreamdnsQueryStateUnspecified,
385            1 => Self::UpstreamdnsQueryStateEnabled,
386            2 => Self::UpstreamdnsQueryStateDisabled,
387            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
388        }
389    }
390
391    #[inline]
392    pub fn unknown() -> Self {
393        Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
394    }
395
396    #[inline]
397    pub const fn into_primitive(self) -> u32 {
398        match self {
399            Self::UpstreamdnsQueryStateUnspecified => 0,
400            Self::UpstreamdnsQueryStateEnabled => 1,
401            Self::UpstreamdnsQueryStateDisabled => 2,
402            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
403        }
404    }
405
406    #[inline]
407    pub fn is_unknown(&self) -> bool {
408        match self {
409            Self::__SourceBreaking { unknown_ordinal: _ } => true,
410            _ => false,
411        }
412    }
413}
414
415#[derive(Clone, Debug, PartialEq)]
416pub struct BeaconInfoStreamNextResponse {
417    pub beacons: Vec<BeaconInfo>,
418}
419
420impl fidl::Persistable for BeaconInfoStreamNextResponse {}
421
422#[derive(Clone, Debug, PartialEq)]
423pub struct DeviceGetSupportedChannelsResponse {
424    pub channels_info: Vec<ChannelInfo>,
425}
426
427impl fidl::Persistable for DeviceGetSupportedChannelsResponse {}
428
429#[derive(Clone, Debug, PartialEq)]
430pub struct DeviceRouteExtraGetLocalExternalRoutesResponse {
431    pub external_routes: Vec<ExternalRoute>,
432}
433
434impl fidl::Persistable for DeviceRouteExtraGetLocalExternalRoutesResponse {}
435
436#[derive(Clone, Debug, PartialEq)]
437pub struct DeviceRouteExtraGetLocalOnMeshPrefixesResponse {
438    pub prefixes: Vec<OnMeshPrefix>,
439}
440
441impl fidl::Persistable for DeviceRouteExtraGetLocalOnMeshPrefixesResponse {}
442
443#[derive(Clone, Debug, PartialEq)]
444pub struct DeviceRouteRegisterExternalRouteRequest {
445    pub external_route: ExternalRoute,
446}
447
448impl fidl::Persistable for DeviceRouteRegisterExternalRouteRequest {}
449
450#[derive(Clone, Debug, PartialEq)]
451pub struct DeviceRouteRegisterOnMeshPrefixRequest {
452    pub prefix: OnMeshPrefix,
453}
454
455impl fidl::Persistable for DeviceRouteRegisterOnMeshPrefixRequest {}
456
457#[derive(Clone, Debug, PartialEq)]
458pub struct DeviceRouteUnregisterExternalRouteRequest {
459    pub subnet: fidl_fuchsia_net::Ipv6AddressWithPrefix,
460}
461
462impl fidl::Persistable for DeviceRouteUnregisterExternalRouteRequest {}
463
464#[derive(Clone, Debug, PartialEq)]
465pub struct DeviceRouteUnregisterOnMeshPrefixRequest {
466    pub subnet: fidl_fuchsia_net::Ipv6AddressWithPrefix,
467}
468
469impl fidl::Persistable for DeviceRouteUnregisterOnMeshPrefixRequest {}
470
471#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
472#[repr(C)]
473pub struct LegacyJoiningMakeJoinableRequest {
474    pub duration: i64,
475    pub port: u16,
476}
477
478impl fidl::Persistable for LegacyJoiningMakeJoinableRequest {}
479
480#[derive(Clone, Debug, PartialEq)]
481pub struct ProvisioningMonitorWatchProgressResponse {
482    pub progress: ProvisioningProgress,
483}
484
485impl fidl::Persistable for ProvisioningMonitorWatchProgressResponse {}
486
487#[derive(Clone, Debug, PartialEq)]
488pub struct TelemetryProviderGetTelemetryResponse {
489    pub telemetry: Telemetry,
490}
491
492impl fidl::Persistable for TelemetryProviderGetTelemetryResponse {}
493
494#[derive(Clone, Debug, Default, PartialEq)]
495pub struct BeaconInfo {
496    /// The MAC address associated with this beacon.
497    pub address: Option<fidl_fuchsia_lowpan::MacAddress>,
498    /// The identity of the network being advertised by
499    /// this beacon.
500    pub identity: Option<fidl_fuchsia_lowpan_device::Identity>,
501    /// RSSI of the beacon, measured in dBm.
502    ///
503    /// A value of -128 should be treated as if this
504    /// field was absent.
505    pub rssi: Option<i8>,
506    /// Link Quality Index (LQI) of the beacon.
507    ///
508    /// * A value of 0 should be treated as if this
509    ///   field was absent.
510    /// * A value of 1 indicates the worst possible
511    ///   quality where the decoded beacon is still valid.
512    /// * A value of 255 indicates the best possible
513    ///   quality that can be recognized by the radio
514    ///   hardware.
515    /// * Values 2-254 are intended to represent relative
516    ///   quality levels evenly distributed between the
517    ///   worst and best, with lower values always
518    ///   indicating a worse quality than higher values.
519    pub lqi: Option<u8>,
520    #[doc(hidden)]
521    pub __source_breaking: fidl::marker::SourceBreaking,
522}
523
524impl fidl::Persistable for BeaconInfo {}
525
526/// Counters associated with border routing.
527#[derive(Clone, Debug, Default, PartialEq)]
528pub struct BorderRoutingCounters {
529    /// The number of packets associated with inbound unicast messages.
530    ///
531    /// Required.
532    pub inbound_unicast_packets: Option<u64>,
533    /// The number of bytes associated with inbound unicast messages.
534    ///
535    /// Required.
536    pub inbound_unicast_bytes: Option<u64>,
537    /// The number of packets associated with inbound multicast messages.
538    ///
539    /// Required.
540    pub inbound_multicast_packets: Option<u64>,
541    /// The number of bytes associated with inbound multicast messages.
542    ///
543    /// Required.
544    pub inbound_multicast_bytes: Option<u64>,
545    /// The number of packets associated with outbound unicast messages.
546    ///
547    /// Required.
548    pub outbound_unicast_packets: Option<u64>,
549    /// The number of bytes associated with outbound unicast messages.
550    ///
551    /// Required.
552    pub outbound_unicast_bytes: Option<u64>,
553    /// The number of packets associated with outbound multicast messages.
554    ///
555    /// Required.
556    pub outbound_multicast_packets: Option<u64>,
557    /// The number of bytes associated with outbound multicast messages.
558    ///
559    /// Required.
560    pub outbound_multicast_bytes: Option<u64>,
561    /// The number of received RA packets.
562    ///
563    /// Required.
564    pub ra_rx: Option<u32>,
565    /// The number of RA packets successfully transmitted.
566    ///
567    /// Required.
568    pub ra_tx_success: Option<u32>,
569    /// The number of RA packets failed to transmit.
570    ///
571    /// Required.
572    pub ra_tx_failure: Option<u32>,
573    /// The number of received RS packets.
574    ///
575    /// Required.
576    pub rs_rx: Option<u32>,
577    /// The number of RS packets successfully transmitted.
578    ///
579    /// Required.
580    pub rs_tx_success: Option<u32>,
581    /// The number of RS packets failed to transmit.
582    ///
583    /// Required.
584    pub rs_tx_failure: Option<u32>,
585    /// Inbound Internet packets when DHCPv6 PD enabled.
586    ///
587    /// Optional.
588    pub inbound_internet_packets: Option<u64>,
589    /// Inbound Internet bytes when DHCPv6 PD enabled.
590    ///
591    /// Optional.
592    pub inbound_internet_bytes: Option<u64>,
593    /// Outbound Internet packets when DHCPv6 PD enabled.
594    ///
595    /// Optional.
596    pub outbound_internet_packets: Option<u64>,
597    /// Outbound Internet bytes when DHCPv6 PD enabled.
598    ///
599    /// Optional.
600    pub outbound_internet_bytes: Option<u64>,
601    #[doc(hidden)]
602    pub __source_breaking: fidl::marker::SourceBreaking,
603}
604
605impl fidl::Persistable for BorderRoutingCounters {}
606
607/// Information about the state of components of NAT64
608#[derive(Clone, Debug, Default, PartialEq)]
609pub struct BorderRoutingNat64State {
610    /// prefix manager state
611    pub prefix_manager_state: Option<Nat64State>,
612    /// translator state
613    pub translator_state: Option<Nat64State>,
614    #[doc(hidden)]
615    pub __source_breaking: fidl::marker::SourceBreaking,
616}
617
618impl fidl::Persistable for BorderRoutingNat64State {}
619
620#[derive(Clone, Debug, Default, PartialEq)]
621pub struct ChannelInfo {
622    /// The index used by the interface to identify
623    /// this channel.
624    pub index: Option<u16>,
625    /// Human-readable identifier for channel.
626    ///
627    /// For most network types, this is just
628    /// the string representation of the index.
629    /// However, some network types might have
630    /// non-integer ways of identifying specific
631    /// channels. This field allows the application
632    /// to display the name of the channel correctly
633    /// under such circumstances.
634    ///
635    /// The allowed characters include:
636    ///
637    ///  * Dash (`-`), Underscore (`_`), Plus(`+`), Semicolon(`:`)
638    ///  * Numbers (`0`-`9`)
639    ///  * Letters (`a`-`z`, `A`-`Z`)
640    pub id: Option<String>,
641    /// The maximum transmit power allowed on
642    /// this channel, in dBm.
643    pub max_transmit_power_dbm: Option<i8>,
644    /// The center RF frequency of this channel, in Hz.
645    ///
646    /// For example, 802.15.4 has the following values:
647    ///
648    /// Channel | Center Frequency (Hz)
649    /// --------|----------------------
650    /// 11      | 2,405,000,000
651    /// 12      | 2,410,000,000
652    /// 13      | 2,415,000,000
653    /// 14      | 2,420,000,000
654    /// 15      | 2,425,000,000
655    /// 16      | 2,430,000,000
656    /// 17      | 2,435,000,000
657    /// 18      | 2,440,000,000
658    /// 19      | 2,445,000,000
659    /// 20      | 2,450,000,000
660    /// 21      | 2,455,000,000
661    /// 22      | 2,460,000,000
662    /// 23      | 2,465,000,000
663    /// 24      | 2,470,000,000
664    /// 25      | 2,475,000,000
665    /// 26      | 2,480,000,000
666    pub spectrum_center_frequency_hz: Option<u64>,
667    /// The RF spectrum bandwidth used by this
668    /// channel where the power level is expected to
669    /// be higher than -20dBr, in Hz.
670    ///
671    /// For example, 802.15.4 channels 11 thru 26 would
672    /// have the value 2,000,000 (2 MHz).
673    pub spectrum_bandwidth_hz: Option<u64>,
674    /// Indicates if this channel is masked by the
675    /// current regulatory domain and is thus unable
676    /// to be used.
677    pub masked_by_regulatory_domain: Option<bool>,
678    #[doc(hidden)]
679    pub __source_breaking: fidl::marker::SourceBreaking,
680}
681
682impl fidl::Persistable for ChannelInfo {}
683
684/// DHCPv6 PD related info.
685#[derive(Clone, Debug, Default, PartialEq)]
686pub struct Dhcp6PdInfo {
687    /// DHCPv6 PD state.
688    ///
689    /// Required.
690    pub dhcp6pd_state: Option<Dhcp6PdState>,
691    /// DHCPv6 PD processed RA Info.
692    ///
693    /// Optional.
694    pub pd_processed_ra_info: Option<PdProcessedRaInfo>,
695    /// DHCPv6 PD prefix.
696    ///
697    /// Optional.
698    pub hashed_pd_prefix: Option<Vec<u8>>,
699    #[doc(hidden)]
700    pub __source_breaking: fidl::marker::SourceBreaking,
701}
702
703impl fidl::Persistable for Dhcp6PdInfo {}
704
705/// Counters associated with the DNS-SD server.
706#[derive(Clone, Debug, Default, PartialEq)]
707pub struct DnssdCounters {
708    /// The number of successful responses.
709    ///
710    /// Required.
711    pub success_response: Option<u32>,
712    /// The number of 'server failure' responses.
713    ///
714    /// Required.
715    pub server_failure_response: Option<u32>,
716    /// The number of 'format error' responses.
717    ///
718    /// Required.
719    pub format_error_response: Option<u32>,
720    /// The number of 'name error' responses.
721    ///
722    /// Required.
723    pub name_error_response: Option<u32>,
724    /// The number of 'not implemented' responses.
725    ///
726    /// Required.
727    pub not_implemented_response: Option<u32>,
728    /// The number of 'other' responses.
729    ///
730    /// Required.
731    pub other_response: Option<u32>,
732    /// The number of queries completely resolved by the local SRP server.
733    ///
734    /// Required.
735    pub resolved_by_srp: Option<u32>,
736    /// The counters of upstream DNS feature.
737    ///
738    /// Optional.
739    pub upstream_dns_counters: Option<UpstreamDnsCounters>,
740    #[doc(hidden)]
741    pub __source_breaking: fidl::marker::SourceBreaking,
742}
743
744impl fidl::Persistable for DnssdCounters {}
745
746/// LoWPAN External Route.
747///
748/// Informed by the Thread 1.1.1 Specification, section 5.13.3.
749#[derive(Clone, Debug, Default, PartialEq)]
750pub struct ExternalRoute {
751    /// Subnet for route. Required.
752    pub subnet: Option<fidl_fuchsia_net::Ipv6AddressWithPrefix>,
753    /// Indicates the what preference this route should be given relative
754    /// to other devices offering the same external route. If not present,
755    /// `MEDIUM` preference is assumed.
756    ///
757    /// Based on `R_preference` from Section 5.13.3 of the Thread 1.1.1
758    /// Specification.
759    pub route_preference: Option<RoutePreference>,
760    /// True if the route is expected to be available for at least Thread's
761    /// `MIN_STABLE_LIFETIME`; otherwise, `false`. If not present, assumed to
762    /// be `false`.
763    ///
764    /// The Thread specification defines `MIN_STABLE_LIFETIME` as 168 hours.
765    ///
766    /// Based on `R_stable` from Section 5.13.3 of the Thread 1.1.1
767    /// Specification.
768    pub stable: Option<bool>,
769    #[doc(hidden)]
770    pub __source_breaking: fidl::marker::SourceBreaking,
771}
772
773impl fidl::Persistable for ExternalRoute {}
774
775/// Parameters for joiner commissioning.
776///
777/// More information:
778/// https://www.threadgroup.org/Portals/0/documents/support/CommissioningWhitePaper_658_2.pdf
779#[derive(Clone, Debug, Default, PartialEq)]
780pub struct JoinerCommissioningParams {
781    /// Commissioning PSKd. Required.
782    pub pskd: Option<String>,
783    /// Provisioning URL. Optional.
784    pub provisioning_url: Option<String>,
785    /// Vendor name. Optional.
786    pub vendor_name: Option<String>,
787    /// Vendor model. Optional.
788    pub vendor_model: Option<String>,
789    /// Vendor Software Version. Optional.
790    pub vendor_sw_version: Option<String>,
791    /// Vendor data string. Optional.
792    pub vendor_data_string: Option<String>,
793    #[doc(hidden)]
794    pub __source_breaking: fidl::marker::SourceBreaking,
795}
796
797impl fidl::Persistable for JoinerCommissioningParams {}
798
799/// Node information for Thread network leaders.
800#[derive(Clone, Debug, Default, PartialEq)]
801pub struct LeaderData {
802    /// The network partition ID of the leader.
803    ///
804    /// Required.
805    pub partition_id: Option<u32>,
806    /// The weight of this leader on the network.
807    ///
808    /// Required.
809    pub weight: Option<u8>,
810    /// The full network data version.
811    ///
812    /// Required.
813    pub network_data_version: Option<u8>,
814    /// The stable network data version.
815    ///
816    /// Required.
817    pub stable_network_data_version: Option<u8>,
818    /// The router ID of the leader.
819    ///
820    /// Required.
821    pub router_id: Option<u8>,
822    #[doc(hidden)]
823    pub __source_breaking: fidl::marker::SourceBreaking,
824}
825
826impl fidl::Persistable for LeaderData {}
827
828/// Link Metrics info of the neighbors.
829#[derive(Clone, Debug, Default, PartialEq)]
830pub struct LinkMetricsEntry {
831    /// Link Margin value of the neighbor
832    pub link_margin: Option<u8>,
833    /// RSSI value of the neighbor
834    pub rssi: Option<i8>,
835    #[doc(hidden)]
836    pub __source_breaking: fidl::marker::SourceBreaking,
837}
838
839impl fidl::Persistable for LinkMetricsEntry {}
840
841#[derive(Clone, Debug, Default, PartialEq)]
842pub struct Nat64ErrorCounters {
843    /// Packet drop for unknown reasons
844    pub unknown: Option<Nat64PacketCounters>,
845    /// Packet drop due to failed to parse the datagram
846    pub illegal_packet: Option<Nat64PacketCounters>,
847    /// Packet drop due to unsupported IP protocol
848    pub unsupported_protocol: Option<Nat64PacketCounters>,
849    /// Packet drop due to no mappings found or mapping pool exhausted
850    pub no_mapping: Option<Nat64PacketCounters>,
851    #[doc(hidden)]
852    pub __source_breaking: fidl::marker::SourceBreaking,
853}
854
855impl fidl::Persistable for Nat64ErrorCounters {}
856
857#[derive(Clone, Debug, Default, PartialEq)]
858pub struct Nat64Info {
859    /// NAT64 border routing state
860    pub nat64_state: Option<BorderRoutingNat64State>,
861    /// NAT64 mapping
862    pub nat64_mappings: Option<Vec<Nat64Mapping>>,
863    /// NAT64 error counters
864    pub nat64_error_counters: Option<Nat64ErrorCounters>,
865    /// NAT64 protocol counters
866    pub nat64_protocol_counters: Option<Nat64ProtocolCounters>,
867    #[doc(hidden)]
868    pub __source_breaking: fidl::marker::SourceBreaking,
869}
870
871impl fidl::Persistable for Nat64Info {}
872
873/// Information about the mappings of NAT64 translator
874#[derive(Clone, Debug, Default, PartialEq)]
875pub struct Nat64Mapping {
876    /// The unique id for a mapping session
877    pub mapping_id: Option<u64>,
878    /// The IPv4 address of the mapping
879    pub ip4_addr: Option<Vec<u8>>,
880    /// The IPv6 address of the mapping
881    pub ip6_addr: Option<Vec<u8>>,
882    /// Remaining time before expiry in milliseconds
883    pub remaining_time_ms: Option<u32>,
884    /// Nat64 Counters
885    pub counters: Option<Nat64ProtocolCounters>,
886    #[doc(hidden)]
887    pub __source_breaking: fidl::marker::SourceBreaking,
888}
889
890impl fidl::Persistable for Nat64Mapping {}
891
892#[derive(Clone, Debug, Default, PartialEq)]
893pub struct Nat64PacketCounters {
894    /// Number of packets translated from IPv4 to IPv6
895    pub ipv4_to_ipv6_packets: Option<u64>,
896    /// Number of packets translated from IPv6 to IPv4
897    pub ipv6_to_ipv4_packets: Option<u64>,
898    #[doc(hidden)]
899    pub __source_breaking: fidl::marker::SourceBreaking,
900}
901
902impl fidl::Persistable for Nat64PacketCounters {}
903
904#[derive(Clone, Debug, Default, PartialEq)]
905pub struct Nat64ProtocolCounters {
906    /// TCP counters
907    pub tcp: Option<Nat64TrafficCounters>,
908    /// UDP counters
909    pub udp: Option<Nat64TrafficCounters>,
910    /// ICMP counters
911    pub icmp: Option<Nat64TrafficCounters>,
912    /// Total counters
913    pub total: Option<Nat64TrafficCounters>,
914    #[doc(hidden)]
915    pub __source_breaking: fidl::marker::SourceBreaking,
916}
917
918impl fidl::Persistable for Nat64ProtocolCounters {}
919
920#[derive(Clone, Debug, Default, PartialEq)]
921pub struct Nat64TrafficCounters {
922    /// Number of packets translated from IPv4 to IPv6
923    pub ipv4_to_ipv6_packets: Option<u64>,
924    /// Sum of size of packets translated from IPv4 to IPv6
925    pub ipv4_to_ipv6_bytes: Option<u64>,
926    /// Number of packets translated from IPv6 to IPv4
927    pub ipv6_to_ipv4_packets: Option<u64>,
928    /// Sum of size of packets translated from IPv6 to IPv4
929    pub ipv6_to_ipv4_bytes: Option<u64>,
930    #[doc(hidden)]
931    pub __source_breaking: fidl::marker::SourceBreaking,
932}
933
934impl fidl::Persistable for Nat64TrafficCounters {}
935
936/// Describes the parameters of a network scan.
937#[derive(Clone, Debug, Default, PartialEq)]
938pub struct NetworkScanParameters {
939    /// Subset of channels to scan.
940    ///
941    /// If unspecified, all channels will be scanned.
942    pub channels: Option<Vec<u16>>,
943    /// Transmit power (in dBm to the antenna) for transmitting
944    /// beacon requests.
945    ///
946    /// Note that hardware limitations may cause the actual
947    /// used transmit power to differ from what is specified.
948    /// In that case the used transmit power will always be
949    /// the highest available transmit power that is less than
950    /// the specified transmit power. If the desired transmit
951    /// power is lower than the lowest transmit power supported
952    /// by the hardware, then that will be used instead.
953    pub tx_power_dbm: Option<i8>,
954    #[doc(hidden)]
955    pub __source_breaking: fidl::marker::SourceBreaking,
956}
957
958impl fidl::Persistable for NetworkScanParameters {}
959
960/// LoWPAN On-Mesh Prefix.
961///
962/// Informed by the Thread 1.1.1 Specification, section 5.13.2.
963#[derive(Clone, Debug, Default, PartialEq)]
964pub struct OnMeshPrefix {
965    /// Subnet to advertise for devices to use on the network. Required.
966    pub subnet: Option<fidl_fuchsia_net::Ipv6AddressWithPrefix>,
967    /// If present, indicates that this device is offering a default route
968    /// as well as indicating the what preference this default
969    /// route should be given relative to other devices offering default
970    /// routes. If not present, no default route is advertised.
971    ///
972    /// Based on `P_default` and `P_preference` from Section 5.13.2 of the
973    /// Thread 1.1.1 Specification.
974    pub default_route_preference: Option<RoutePreference>,
975    /// True if the route is expected to be available for at least Thread's
976    /// `MIN_STABLE_LIFETIME`; otherwise `false`. If not present, assumed to
977    /// be `false`.
978    ///
979    /// The Thread specification defines `MIN_STABLE_LIFETIME` as 168 hours.
980    ///
981    /// Based on `P_stable` from Section 5.13.2 of the
982    /// Thread 1.1.1 Specification.
983    pub stable: Option<bool>,
984    /// True if network devices are allowed to use previously configured
985    /// addresses using this prefix. If not present, assumed to be `false`.
986    ///
987    /// "SLAAC" referrs to StateLess Address Auto Configuration, described in
988    /// [RFC4862](https://tools.ietf.org/html/rfc4862).
989    ///
990    /// Based on `P_slaac_preferred` from Section 5.13.2 of the
991    /// Thread 1.1.1 Specification.
992    pub slaac_preferred: Option<bool>,
993    /// True if network devices are allowed to autoconfigure addresses using
994    /// this prefix. If not present, assumed to be `false`.
995    ///
996    /// "SLAAC" referrs to StateLess Address Auto Configuration, described in
997    /// [RFC4862](https://tools.ietf.org/html/rfc4862).
998    ///
999    /// Based on `P_slaac_valid` from Section 5.13.2 of the
1000    /// Thread 1.1.1 Specification.
1001    pub slaac_valid: Option<bool>,
1002    #[doc(hidden)]
1003    pub __source_breaking: fidl::marker::SourceBreaking,
1004}
1005
1006impl fidl::Persistable for OnMeshPrefix {}
1007
1008/// Platform counters related to processed RA info when DHCPv6 PD is enabled.
1009#[derive(Clone, Debug, Default, PartialEq)]
1010pub struct PdProcessedRaInfo {
1011    /// The number of platform generated RA handled by ApplyPlatformGeneratedRa.
1012    ///
1013    /// Required.
1014    pub num_platform_ra_received: Option<u32>,
1015    /// The number of PIO processed for adding OMR prefixes.
1016    ///
1017    /// Required.
1018    pub num_platform_pio_processed: Option<u32>,
1019    /// The duration since the last processed RA message.
1020    ///
1021    /// Required.
1022    pub last_platform_ra_msec: Option<u32>,
1023    #[doc(hidden)]
1024    pub __source_breaking: fidl::marker::SourceBreaking,
1025}
1026
1027impl fidl::Persistable for PdProcessedRaInfo {}
1028
1029/// State information about the SRP server.
1030#[derive(Clone, Debug, Default, PartialEq)]
1031pub struct SrpServerInfo {
1032    /// The operational state of the SRP server.
1033    ///
1034    /// Required.
1035    pub state: Option<SrpServerState>,
1036    /// The port the SRP server is listening to.
1037    ///
1038    /// Optional. The port may be omitted when `state` is `DISABLED`.
1039    pub port: Option<u16>,
1040    /// The address mode of the SRP server.
1041    ///
1042    /// Required.
1043    pub address_mode: Option<SrpServerAddressMode>,
1044    /// The response counters of the SRP server.
1045    ///
1046    /// Required.
1047    pub response_counters: Option<SrpServerResponseCounters>,
1048    /// The registration information of SRP hosts.
1049    ///
1050    /// Required.
1051    pub hosts_registration: Option<SrpServerRegistration>,
1052    /// The registration information of SRP services.
1053    ///
1054    /// Required.
1055    pub services_registration: Option<SrpServerRegistration>,
1056    #[doc(hidden)]
1057    pub __source_breaking: fidl::marker::SourceBreaking,
1058}
1059
1060impl fidl::Persistable for SrpServerInfo {}
1061
1062/// Registration information about the SRP server.
1063#[derive(Clone, Debug, Default, PartialEq)]
1064pub struct SrpServerRegistration {
1065    /// Number of hosts/services that have not been deleted.
1066    ///
1067    /// Required.
1068    pub fresh_count: Option<u32>,
1069    /// Number of hosts/services that have been deleted.
1070    ///
1071    /// Required.
1072    pub deleted_count: Option<u32>,
1073    /// Total lease time.
1074    ///
1075    /// Required.
1076    pub lease_time_total: Option<i64>,
1077    /// Total key lease time.
1078    ///
1079    /// Required.
1080    pub key_lease_time_total: Option<i64>,
1081    /// Total remaining lease time.
1082    ///
1083    /// Required.
1084    pub remaining_lease_time_total: Option<i64>,
1085    /// Total remaining key lease time.
1086    ///
1087    /// Required.
1088    pub remaining_key_lease_time_total: Option<i64>,
1089    #[doc(hidden)]
1090    pub __source_breaking: fidl::marker::SourceBreaking,
1091}
1092
1093impl fidl::Persistable for SrpServerRegistration {}
1094
1095#[derive(Clone, Debug, Default, PartialEq)]
1096pub struct SrpServerResponseCounters {
1097    /// The number of successful responses.
1098    ///
1099    /// Required.
1100    pub success_response: Option<u32>,
1101    /// The number of 'server failure' responses.
1102    ///
1103    /// Required.
1104    pub server_failure_response: Option<u32>,
1105    /// The number of 'format error' responses.
1106    ///
1107    /// Required.
1108    pub format_error_response: Option<u32>,
1109    /// The number of 'name exists' responses.
1110    ///
1111    /// Required.
1112    pub name_exists_response: Option<u32>,
1113    /// The number of 'refused' responses.
1114    ///
1115    /// Required.
1116    pub refused_response: Option<u32>,
1117    /// The number of 'other' responses.
1118    ///
1119    /// Required.
1120    pub other_response: Option<u32>,
1121    #[doc(hidden)]
1122    pub __source_breaking: fidl::marker::SourceBreaking,
1123}
1124
1125impl fidl::Persistable for SrpServerResponseCounters {}
1126
1127/// LoWPAN Interface Telemetry Information.
1128///
1129/// The fields in this table are used for providing low-level telemetry and information about the
1130/// LoWPAN interface for debugging and statistics purposes.
1131///
1132/// All fields are optional.
1133#[derive(Clone, Debug, Default, PartialEq)]
1134pub struct Telemetry {
1135    /// The current RSSI of the radio.
1136    pub rssi: Option<i8>,
1137    /// The configured transmit power of the radio.
1138    pub tx_power: Option<i8>,
1139    /// The current channel index of the radio.
1140    pub channel_index: Option<u16>,
1141    /// The partition ID of the currently associated network partition.
1142    pub partition_id: Option<u32>,
1143    /// The version string describing the underlying mesh stack.
1144    pub stack_version: Option<String>,
1145    /// The version string describing the underlying radio control firmware.
1146    pub rcp_version: Option<String>,
1147    /// Thread link mode byte.
1148    ///
1149    /// Only present on Thread networks.
1150    ///
1151    /// Defined by section 4.5.2 of the Thread 1.1.1 specification ("Mode TLV").
1152    pub thread_link_mode: Option<u8>,
1153    /// The router ID of this device in the currently associated network.
1154    ///
1155    /// Only present on Thread networks.
1156    pub thread_router_id: Option<u8>,
1157    /// The current RLOC16 address of this node.
1158    ///
1159    /// Only present on Thread networks.
1160    pub thread_rloc: Option<u16>,
1161    /// The full network data version.
1162    ///
1163    /// Only present on Thread networks.
1164    pub thread_network_data_version: Option<u8>,
1165    /// The stable network data version.
1166    ///
1167    /// Only present on Thread networks.
1168    pub thread_stable_network_data_version: Option<u8>,
1169    /// The current Thread network data, in raw binary form, as defined in section 5.13 of
1170    /// the Thread 1.1.1 specification.
1171    ///
1172    /// Only present on Thread networks.
1173    pub thread_network_data: Option<Vec<u8>>,
1174    /// The current Thread stable network data, in raw binary form, as defined in section 5.13 of
1175    /// the Thread 1.1.1 specification.
1176    ///
1177    /// Only present on Thread networks.
1178    pub thread_stable_network_data: Option<Vec<u8>>,
1179    /// The counters associated with border routing messages.
1180    ///
1181    /// Only present on Thread networks.
1182    pub thread_border_routing_counters: Option<BorderRoutingCounters>,
1183    /// The SRP server information.
1184    ///
1185    /// Only present on Thread networks.
1186    pub srp_server_info: Option<SrpServerInfo>,
1187    /// The DNS-SD server counters.
1188    ///
1189    /// Only present on Thread networks.
1190    pub dnssd_counters: Option<DnssdCounters>,
1191    /// The data associated with the leader of the currently associated Thread network.
1192    ///
1193    /// Only present on Thread networks.
1194    pub leader_data: Option<LeaderData>,
1195    /// The uptime of the current instance.
1196    ///
1197    /// Required.
1198    pub uptime: Option<i64>,
1199    /// Information about the NAT64
1200    ///
1201    /// Only present on Thread networks.
1202    pub nat64_info: Option<Nat64Info>,
1203    /// Information about the TREL interface, if available.
1204    ///
1205    /// Only present on Thread networks.
1206    pub trel_counters: Option<TrelCounters>,
1207    /// Information about the TREL peers, if available.
1208    ///
1209    /// Only present on Thread networks.
1210    pub trel_peers_info: Option<TrelPeersInfo>,
1211    /// Information about the Upstream DNS feature, if available.
1212    ///
1213    /// Only present on Thread networks.
1214    pub upstream_dns_info: Option<UpstreamDnsInfo>,
1215    /// Information about the DHCPv6 PD feature, if available.
1216    ///
1217    /// Only present on Thread networks.
1218    pub dhcp6pd_info: Option<Dhcp6PdInfo>,
1219    /// Link Metrics Manager related info, if available.
1220    ///
1221    /// Only present on Thread networks.
1222    pub link_metrics_entries: Option<Vec<LinkMetricsEntry>>,
1223    #[doc(hidden)]
1224    pub __source_breaking: fidl::marker::SourceBreaking,
1225}
1226
1227impl fidl::Persistable for Telemetry {}
1228
1229/// Represents a group of TREL related counters in the platform layer.
1230///
1231/// Derived from [`otPlatTrelCounters`](https://openthread.io/reference/struct/ot-plat-trel-counters).
1232#[derive(Clone, Debug, Default, PartialEq)]
1233pub struct TrelCounters {
1234    /// Sum of size of packets received through TREL.
1235    pub rx_bytes: Option<u64>,
1236    /// Number of packets received through TREL.
1237    pub rx_packets: Option<u64>,
1238    /// Sum of size of packets successfully transmitted through TREL.
1239    pub tx_bytes: Option<u64>,
1240    /// Number of packet transmission failures through TREL.
1241    pub tx_failure: Option<u64>,
1242    /// Number of packets successfully transmitted through TREL.
1243    pub tx_packets: Option<u64>,
1244    #[doc(hidden)]
1245    pub __source_breaking: fidl::marker::SourceBreaking,
1246}
1247
1248impl fidl::Persistable for TrelCounters {}
1249
1250/// Represents the TREL peer related info.
1251///
1252/// The info is available in OpenThread via https://openthread.io/reference/group/api-trel
1253/// More fields may be added per request.
1254#[derive(Clone, Debug, Default, PartialEq)]
1255pub struct TrelPeersInfo {
1256    /// Number of TREL peers for this Thread Border Router.
1257    ///
1258    /// Required.
1259    pub num_trel_peers: Option<u16>,
1260    #[doc(hidden)]
1261    pub __source_breaking: fidl::marker::SourceBreaking,
1262}
1263
1264impl fidl::Persistable for TrelPeersInfo {}
1265
1266/// Represents the count of queries, responses, failures handled by upstream DNS server
1267///
1268/// Derived from `otUpstreamDnsCounters`(https://openthread.io/reference/group/api-dnssd-server)
1269#[derive(Clone, Debug, Default, PartialEq)]
1270pub struct UpstreamDnsCounters {
1271    /// The number of queries forwarded
1272    ///
1273    /// Required.
1274    pub queries: Option<u32>,
1275    /// The number of responses forwarded
1276    ///
1277    /// Required.
1278    pub responses: Option<u32>,
1279    /// The number of upstream DNS failures
1280    ///
1281    /// Required.
1282    pub failures: Option<u32>,
1283    #[doc(hidden)]
1284    pub __source_breaking: fidl::marker::SourceBreaking,
1285}
1286
1287impl fidl::Persistable for UpstreamDnsCounters {}
1288
1289/// Represents the Upstream DNS related info.
1290///
1291/// The info is available in OpenThread via https://openthread.io/reference/group/api-dnssd-server
1292/// More fields may be added per request.
1293#[derive(Clone, Debug, Default, PartialEq)]
1294pub struct UpstreamDnsInfo {
1295    /// State of upstream DNS query.
1296    ///
1297    /// Required.
1298    pub upstream_dns_query_state: Option<UpstreamDnsQueryState>,
1299    #[doc(hidden)]
1300    pub __source_breaking: fidl::marker::SourceBreaking,
1301}
1302
1303impl fidl::Persistable for UpstreamDnsInfo {}
1304
1305/// Parameters for DeviceExtra::JoinNetwork command.
1306#[derive(Clone, Debug)]
1307pub enum JoinParams {
1308    /// Attempts to find and join a known pre-existing network.
1309    ProvisioningParameter(fidl_fuchsia_lowpan_device::ProvisioningParams),
1310    /// Attempts to find and join an unknown pre-existing network
1311    /// that is configured to accept and provision devices with
1312    /// the given shared secret, or PSKd. This allows new devices to
1313    /// join existing networks without knowing the credentials for
1314    /// the specific network.
1315    JoinerParameter(JoinerCommissioningParams),
1316    #[doc(hidden)]
1317    __SourceBreaking { unknown_ordinal: u64 },
1318}
1319
1320/// Pattern that matches an unknown `JoinParams` member.
1321#[macro_export]
1322macro_rules! JoinParamsUnknown {
1323    () => {
1324        _
1325    };
1326}
1327
1328// Custom PartialEq so that unknown variants are not equal to themselves.
1329impl PartialEq for JoinParams {
1330    fn eq(&self, other: &Self) -> bool {
1331        match (self, other) {
1332            (Self::ProvisioningParameter(x), Self::ProvisioningParameter(y)) => *x == *y,
1333            (Self::JoinerParameter(x), Self::JoinerParameter(y)) => *x == *y,
1334            _ => false,
1335        }
1336    }
1337}
1338
1339impl JoinParams {
1340    #[inline]
1341    pub fn ordinal(&self) -> u64 {
1342        match *self {
1343            Self::ProvisioningParameter(_) => 1,
1344            Self::JoinerParameter(_) => 2,
1345            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
1346        }
1347    }
1348
1349    #[inline]
1350    pub fn unknown_variant_for_testing() -> Self {
1351        Self::__SourceBreaking { unknown_ordinal: 0 }
1352    }
1353
1354    #[inline]
1355    pub fn is_unknown(&self) -> bool {
1356        match self {
1357            Self::__SourceBreaking { .. } => true,
1358            _ => false,
1359        }
1360    }
1361}
1362
1363impl fidl::Persistable for JoinParams {}
1364
1365/// Indicates the current status of the form/join operation.
1366///
1367/// Returned by [`ProvisioningMonitor.WatchProgress`].
1368#[derive(Clone, Debug)]
1369pub enum ProvisioningProgress {
1370    /// Approximate percent complete indication for a user interface.
1371    Progress(f32),
1372    /// The final Identity when the operation has completed successfully.
1373    Identity(fidl_fuchsia_lowpan_device::Identity),
1374    #[doc(hidden)]
1375    __SourceBreaking { unknown_ordinal: u64 },
1376}
1377
1378/// Pattern that matches an unknown `ProvisioningProgress` member.
1379#[macro_export]
1380macro_rules! ProvisioningProgressUnknown {
1381    () => {
1382        _
1383    };
1384}
1385
1386// Custom PartialEq so that unknown variants are not equal to themselves.
1387impl PartialEq for ProvisioningProgress {
1388    fn eq(&self, other: &Self) -> bool {
1389        match (self, other) {
1390            (Self::Progress(x), Self::Progress(y)) => *x == *y,
1391            (Self::Identity(x), Self::Identity(y)) => *x == *y,
1392            _ => false,
1393        }
1394    }
1395}
1396
1397impl ProvisioningProgress {
1398    #[inline]
1399    pub fn ordinal(&self) -> u64 {
1400        match *self {
1401            Self::Progress(_) => 1,
1402            Self::Identity(_) => 2,
1403            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
1404        }
1405    }
1406
1407    #[inline]
1408    pub fn unknown_variant_for_testing() -> Self {
1409        Self::__SourceBreaking { unknown_ordinal: 0 }
1410    }
1411
1412    #[inline]
1413    pub fn is_unknown(&self) -> bool {
1414        match self {
1415            Self::__SourceBreaking { .. } => true,
1416            _ => false,
1417        }
1418    }
1419}
1420
1421impl fidl::Persistable for ProvisioningProgress {}
1422
1423mod internal {
1424    use super::*;
1425    unsafe impl fidl::encoding::TypeMarker for Dhcp6PdState {
1426        type Owned = Self;
1427
1428        #[inline(always)]
1429        fn inline_align(_context: fidl::encoding::Context) -> usize {
1430            std::mem::align_of::<u32>()
1431        }
1432
1433        #[inline(always)]
1434        fn inline_size(_context: fidl::encoding::Context) -> usize {
1435            std::mem::size_of::<u32>()
1436        }
1437
1438        #[inline(always)]
1439        fn encode_is_copy() -> bool {
1440            false
1441        }
1442
1443        #[inline(always)]
1444        fn decode_is_copy() -> bool {
1445            false
1446        }
1447    }
1448
1449    impl fidl::encoding::ValueTypeMarker for Dhcp6PdState {
1450        type Borrowed<'a> = Self;
1451        #[inline(always)]
1452        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1453            *value
1454        }
1455    }
1456
1457    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for Dhcp6PdState {
1458        #[inline]
1459        unsafe fn encode(
1460            self,
1461            encoder: &mut fidl::encoding::Encoder<'_, D>,
1462            offset: usize,
1463            _depth: fidl::encoding::Depth,
1464        ) -> fidl::Result<()> {
1465            encoder.debug_check_bounds::<Self>(offset);
1466            encoder.write_num(self.into_primitive(), offset);
1467            Ok(())
1468        }
1469    }
1470
1471    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Dhcp6PdState {
1472        #[inline(always)]
1473        fn new_empty() -> Self {
1474            Self::unknown()
1475        }
1476
1477        #[inline]
1478        unsafe fn decode(
1479            &mut self,
1480            decoder: &mut fidl::encoding::Decoder<'_, D>,
1481            offset: usize,
1482            _depth: fidl::encoding::Depth,
1483        ) -> fidl::Result<()> {
1484            decoder.debug_check_bounds::<Self>(offset);
1485            let prim = decoder.read_num::<u32>(offset);
1486
1487            *self = Self::from_primitive_allow_unknown(prim);
1488            Ok(())
1489        }
1490    }
1491    unsafe impl fidl::encoding::TypeMarker for Nat64State {
1492        type Owned = Self;
1493
1494        #[inline(always)]
1495        fn inline_align(_context: fidl::encoding::Context) -> usize {
1496            std::mem::align_of::<u32>()
1497        }
1498
1499        #[inline(always)]
1500        fn inline_size(_context: fidl::encoding::Context) -> usize {
1501            std::mem::size_of::<u32>()
1502        }
1503
1504        #[inline(always)]
1505        fn encode_is_copy() -> bool {
1506            false
1507        }
1508
1509        #[inline(always)]
1510        fn decode_is_copy() -> bool {
1511            false
1512        }
1513    }
1514
1515    impl fidl::encoding::ValueTypeMarker for Nat64State {
1516        type Borrowed<'a> = Self;
1517        #[inline(always)]
1518        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1519            *value
1520        }
1521    }
1522
1523    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for Nat64State {
1524        #[inline]
1525        unsafe fn encode(
1526            self,
1527            encoder: &mut fidl::encoding::Encoder<'_, D>,
1528            offset: usize,
1529            _depth: fidl::encoding::Depth,
1530        ) -> fidl::Result<()> {
1531            encoder.debug_check_bounds::<Self>(offset);
1532            encoder.write_num(self.into_primitive(), offset);
1533            Ok(())
1534        }
1535    }
1536
1537    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Nat64State {
1538        #[inline(always)]
1539        fn new_empty() -> Self {
1540            Self::unknown()
1541        }
1542
1543        #[inline]
1544        unsafe fn decode(
1545            &mut self,
1546            decoder: &mut fidl::encoding::Decoder<'_, D>,
1547            offset: usize,
1548            _depth: fidl::encoding::Depth,
1549        ) -> fidl::Result<()> {
1550            decoder.debug_check_bounds::<Self>(offset);
1551            let prim = decoder.read_num::<u32>(offset);
1552
1553            *self = Self::from_primitive_allow_unknown(prim);
1554            Ok(())
1555        }
1556    }
1557    unsafe impl fidl::encoding::TypeMarker for ProvisionError {
1558        type Owned = Self;
1559
1560        #[inline(always)]
1561        fn inline_align(_context: fidl::encoding::Context) -> usize {
1562            std::mem::align_of::<i32>()
1563        }
1564
1565        #[inline(always)]
1566        fn inline_size(_context: fidl::encoding::Context) -> usize {
1567            std::mem::size_of::<i32>()
1568        }
1569
1570        #[inline(always)]
1571        fn encode_is_copy() -> bool {
1572            false
1573        }
1574
1575        #[inline(always)]
1576        fn decode_is_copy() -> bool {
1577            false
1578        }
1579    }
1580
1581    impl fidl::encoding::ValueTypeMarker for ProvisionError {
1582        type Borrowed<'a> = Self;
1583        #[inline(always)]
1584        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1585            *value
1586        }
1587    }
1588
1589    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for ProvisionError {
1590        #[inline]
1591        unsafe fn encode(
1592            self,
1593            encoder: &mut fidl::encoding::Encoder<'_, D>,
1594            offset: usize,
1595            _depth: fidl::encoding::Depth,
1596        ) -> fidl::Result<()> {
1597            encoder.debug_check_bounds::<Self>(offset);
1598            encoder.write_num(self.into_primitive(), offset);
1599            Ok(())
1600        }
1601    }
1602
1603    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ProvisionError {
1604        #[inline(always)]
1605        fn new_empty() -> Self {
1606            Self::unknown()
1607        }
1608
1609        #[inline]
1610        unsafe fn decode(
1611            &mut self,
1612            decoder: &mut fidl::encoding::Decoder<'_, D>,
1613            offset: usize,
1614            _depth: fidl::encoding::Depth,
1615        ) -> fidl::Result<()> {
1616            decoder.debug_check_bounds::<Self>(offset);
1617            let prim = decoder.read_num::<i32>(offset);
1618
1619            *self = Self::from_primitive_allow_unknown(prim);
1620            Ok(())
1621        }
1622    }
1623    unsafe impl fidl::encoding::TypeMarker for RoutePreference {
1624        type Owned = Self;
1625
1626        #[inline(always)]
1627        fn inline_align(_context: fidl::encoding::Context) -> usize {
1628            std::mem::align_of::<i8>()
1629        }
1630
1631        #[inline(always)]
1632        fn inline_size(_context: fidl::encoding::Context) -> usize {
1633            std::mem::size_of::<i8>()
1634        }
1635
1636        #[inline(always)]
1637        fn encode_is_copy() -> bool {
1638            true
1639        }
1640
1641        #[inline(always)]
1642        fn decode_is_copy() -> bool {
1643            false
1644        }
1645    }
1646
1647    impl fidl::encoding::ValueTypeMarker for RoutePreference {
1648        type Borrowed<'a> = Self;
1649        #[inline(always)]
1650        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1651            *value
1652        }
1653    }
1654
1655    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
1656        for RoutePreference
1657    {
1658        #[inline]
1659        unsafe fn encode(
1660            self,
1661            encoder: &mut fidl::encoding::Encoder<'_, D>,
1662            offset: usize,
1663            _depth: fidl::encoding::Depth,
1664        ) -> fidl::Result<()> {
1665            encoder.debug_check_bounds::<Self>(offset);
1666            encoder.write_num(self.into_primitive(), offset);
1667            Ok(())
1668        }
1669    }
1670
1671    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for RoutePreference {
1672        #[inline(always)]
1673        fn new_empty() -> Self {
1674            Self::Low
1675        }
1676
1677        #[inline]
1678        unsafe fn decode(
1679            &mut self,
1680            decoder: &mut fidl::encoding::Decoder<'_, D>,
1681            offset: usize,
1682            _depth: fidl::encoding::Depth,
1683        ) -> fidl::Result<()> {
1684            decoder.debug_check_bounds::<Self>(offset);
1685            let prim = decoder.read_num::<i8>(offset);
1686
1687            *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
1688            Ok(())
1689        }
1690    }
1691    unsafe impl fidl::encoding::TypeMarker for SrpServerAddressMode {
1692        type Owned = Self;
1693
1694        #[inline(always)]
1695        fn inline_align(_context: fidl::encoding::Context) -> usize {
1696            std::mem::align_of::<u32>()
1697        }
1698
1699        #[inline(always)]
1700        fn inline_size(_context: fidl::encoding::Context) -> usize {
1701            std::mem::size_of::<u32>()
1702        }
1703
1704        #[inline(always)]
1705        fn encode_is_copy() -> bool {
1706            true
1707        }
1708
1709        #[inline(always)]
1710        fn decode_is_copy() -> bool {
1711            false
1712        }
1713    }
1714
1715    impl fidl::encoding::ValueTypeMarker for SrpServerAddressMode {
1716        type Borrowed<'a> = Self;
1717        #[inline(always)]
1718        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1719            *value
1720        }
1721    }
1722
1723    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
1724        for SrpServerAddressMode
1725    {
1726        #[inline]
1727        unsafe fn encode(
1728            self,
1729            encoder: &mut fidl::encoding::Encoder<'_, D>,
1730            offset: usize,
1731            _depth: fidl::encoding::Depth,
1732        ) -> fidl::Result<()> {
1733            encoder.debug_check_bounds::<Self>(offset);
1734            encoder.write_num(self.into_primitive(), offset);
1735            Ok(())
1736        }
1737    }
1738
1739    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SrpServerAddressMode {
1740        #[inline(always)]
1741        fn new_empty() -> Self {
1742            Self::Unicast
1743        }
1744
1745        #[inline]
1746        unsafe fn decode(
1747            &mut self,
1748            decoder: &mut fidl::encoding::Decoder<'_, D>,
1749            offset: usize,
1750            _depth: fidl::encoding::Depth,
1751        ) -> fidl::Result<()> {
1752            decoder.debug_check_bounds::<Self>(offset);
1753            let prim = decoder.read_num::<u32>(offset);
1754
1755            *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
1756            Ok(())
1757        }
1758    }
1759    unsafe impl fidl::encoding::TypeMarker for SrpServerState {
1760        type Owned = Self;
1761
1762        #[inline(always)]
1763        fn inline_align(_context: fidl::encoding::Context) -> usize {
1764            std::mem::align_of::<u32>()
1765        }
1766
1767        #[inline(always)]
1768        fn inline_size(_context: fidl::encoding::Context) -> usize {
1769            std::mem::size_of::<u32>()
1770        }
1771
1772        #[inline(always)]
1773        fn encode_is_copy() -> bool {
1774            true
1775        }
1776
1777        #[inline(always)]
1778        fn decode_is_copy() -> bool {
1779            false
1780        }
1781    }
1782
1783    impl fidl::encoding::ValueTypeMarker for SrpServerState {
1784        type Borrowed<'a> = Self;
1785        #[inline(always)]
1786        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1787            *value
1788        }
1789    }
1790
1791    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for SrpServerState {
1792        #[inline]
1793        unsafe fn encode(
1794            self,
1795            encoder: &mut fidl::encoding::Encoder<'_, D>,
1796            offset: usize,
1797            _depth: fidl::encoding::Depth,
1798        ) -> fidl::Result<()> {
1799            encoder.debug_check_bounds::<Self>(offset);
1800            encoder.write_num(self.into_primitive(), offset);
1801            Ok(())
1802        }
1803    }
1804
1805    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SrpServerState {
1806        #[inline(always)]
1807        fn new_empty() -> Self {
1808            Self::Disabled
1809        }
1810
1811        #[inline]
1812        unsafe fn decode(
1813            &mut self,
1814            decoder: &mut fidl::encoding::Decoder<'_, D>,
1815            offset: usize,
1816            _depth: fidl::encoding::Depth,
1817        ) -> fidl::Result<()> {
1818            decoder.debug_check_bounds::<Self>(offset);
1819            let prim = decoder.read_num::<u32>(offset);
1820
1821            *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
1822            Ok(())
1823        }
1824    }
1825    unsafe impl fidl::encoding::TypeMarker for UpstreamDnsQueryState {
1826        type Owned = Self;
1827
1828        #[inline(always)]
1829        fn inline_align(_context: fidl::encoding::Context) -> usize {
1830            std::mem::align_of::<u32>()
1831        }
1832
1833        #[inline(always)]
1834        fn inline_size(_context: fidl::encoding::Context) -> usize {
1835            std::mem::size_of::<u32>()
1836        }
1837
1838        #[inline(always)]
1839        fn encode_is_copy() -> bool {
1840            false
1841        }
1842
1843        #[inline(always)]
1844        fn decode_is_copy() -> bool {
1845            false
1846        }
1847    }
1848
1849    impl fidl::encoding::ValueTypeMarker for UpstreamDnsQueryState {
1850        type Borrowed<'a> = Self;
1851        #[inline(always)]
1852        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1853            *value
1854        }
1855    }
1856
1857    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
1858        for UpstreamDnsQueryState
1859    {
1860        #[inline]
1861        unsafe fn encode(
1862            self,
1863            encoder: &mut fidl::encoding::Encoder<'_, D>,
1864            offset: usize,
1865            _depth: fidl::encoding::Depth,
1866        ) -> fidl::Result<()> {
1867            encoder.debug_check_bounds::<Self>(offset);
1868            encoder.write_num(self.into_primitive(), offset);
1869            Ok(())
1870        }
1871    }
1872
1873    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for UpstreamDnsQueryState {
1874        #[inline(always)]
1875        fn new_empty() -> Self {
1876            Self::unknown()
1877        }
1878
1879        #[inline]
1880        unsafe fn decode(
1881            &mut self,
1882            decoder: &mut fidl::encoding::Decoder<'_, D>,
1883            offset: usize,
1884            _depth: fidl::encoding::Depth,
1885        ) -> fidl::Result<()> {
1886            decoder.debug_check_bounds::<Self>(offset);
1887            let prim = decoder.read_num::<u32>(offset);
1888
1889            *self = Self::from_primitive_allow_unknown(prim);
1890            Ok(())
1891        }
1892    }
1893
1894    impl fidl::encoding::ValueTypeMarker for BeaconInfoStreamNextResponse {
1895        type Borrowed<'a> = &'a Self;
1896        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1897            value
1898        }
1899    }
1900
1901    unsafe impl fidl::encoding::TypeMarker for BeaconInfoStreamNextResponse {
1902        type Owned = Self;
1903
1904        #[inline(always)]
1905        fn inline_align(_context: fidl::encoding::Context) -> usize {
1906            8
1907        }
1908
1909        #[inline(always)]
1910        fn inline_size(_context: fidl::encoding::Context) -> usize {
1911            16
1912        }
1913    }
1914
1915    unsafe impl<D: fidl::encoding::ResourceDialect>
1916        fidl::encoding::Encode<BeaconInfoStreamNextResponse, D> for &BeaconInfoStreamNextResponse
1917    {
1918        #[inline]
1919        unsafe fn encode(
1920            self,
1921            encoder: &mut fidl::encoding::Encoder<'_, D>,
1922            offset: usize,
1923            _depth: fidl::encoding::Depth,
1924        ) -> fidl::Result<()> {
1925            encoder.debug_check_bounds::<BeaconInfoStreamNextResponse>(offset);
1926            // Delegate to tuple encoding.
1927            fidl::encoding::Encode::<BeaconInfoStreamNextResponse, D>::encode(
1928                (
1929                    <fidl::encoding::Vector<BeaconInfo, 32> as fidl::encoding::ValueTypeMarker>::borrow(&self.beacons),
1930                ),
1931                encoder, offset, _depth
1932            )
1933        }
1934    }
1935    unsafe impl<
1936            D: fidl::encoding::ResourceDialect,
1937            T0: fidl::encoding::Encode<fidl::encoding::Vector<BeaconInfo, 32>, D>,
1938        > fidl::encoding::Encode<BeaconInfoStreamNextResponse, D> for (T0,)
1939    {
1940        #[inline]
1941        unsafe fn encode(
1942            self,
1943            encoder: &mut fidl::encoding::Encoder<'_, D>,
1944            offset: usize,
1945            depth: fidl::encoding::Depth,
1946        ) -> fidl::Result<()> {
1947            encoder.debug_check_bounds::<BeaconInfoStreamNextResponse>(offset);
1948            // Zero out padding regions. There's no need to apply masks
1949            // because the unmasked parts will be overwritten by fields.
1950            // Write the fields.
1951            self.0.encode(encoder, offset + 0, depth)?;
1952            Ok(())
1953        }
1954    }
1955
1956    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1957        for BeaconInfoStreamNextResponse
1958    {
1959        #[inline(always)]
1960        fn new_empty() -> Self {
1961            Self { beacons: fidl::new_empty!(fidl::encoding::Vector<BeaconInfo, 32>, D) }
1962        }
1963
1964        #[inline]
1965        unsafe fn decode(
1966            &mut self,
1967            decoder: &mut fidl::encoding::Decoder<'_, D>,
1968            offset: usize,
1969            _depth: fidl::encoding::Depth,
1970        ) -> fidl::Result<()> {
1971            decoder.debug_check_bounds::<Self>(offset);
1972            // Verify that padding bytes are zero.
1973            fidl::decode!(fidl::encoding::Vector<BeaconInfo, 32>, D, &mut self.beacons, decoder, offset + 0, _depth)?;
1974            Ok(())
1975        }
1976    }
1977
1978    impl fidl::encoding::ValueTypeMarker for DeviceGetSupportedChannelsResponse {
1979        type Borrowed<'a> = &'a Self;
1980        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1981            value
1982        }
1983    }
1984
1985    unsafe impl fidl::encoding::TypeMarker for DeviceGetSupportedChannelsResponse {
1986        type Owned = Self;
1987
1988        #[inline(always)]
1989        fn inline_align(_context: fidl::encoding::Context) -> usize {
1990            8
1991        }
1992
1993        #[inline(always)]
1994        fn inline_size(_context: fidl::encoding::Context) -> usize {
1995            16
1996        }
1997    }
1998
1999    unsafe impl<D: fidl::encoding::ResourceDialect>
2000        fidl::encoding::Encode<DeviceGetSupportedChannelsResponse, D>
2001        for &DeviceGetSupportedChannelsResponse
2002    {
2003        #[inline]
2004        unsafe fn encode(
2005            self,
2006            encoder: &mut fidl::encoding::Encoder<'_, D>,
2007            offset: usize,
2008            _depth: fidl::encoding::Depth,
2009        ) -> fidl::Result<()> {
2010            encoder.debug_check_bounds::<DeviceGetSupportedChannelsResponse>(offset);
2011            // Delegate to tuple encoding.
2012            fidl::encoding::Encode::<DeviceGetSupportedChannelsResponse, D>::encode(
2013                (
2014                    <fidl::encoding::Vector<ChannelInfo, 200> as fidl::encoding::ValueTypeMarker>::borrow(&self.channels_info),
2015                ),
2016                encoder, offset, _depth
2017            )
2018        }
2019    }
2020    unsafe impl<
2021            D: fidl::encoding::ResourceDialect,
2022            T0: fidl::encoding::Encode<fidl::encoding::Vector<ChannelInfo, 200>, D>,
2023        > fidl::encoding::Encode<DeviceGetSupportedChannelsResponse, D> for (T0,)
2024    {
2025        #[inline]
2026        unsafe fn encode(
2027            self,
2028            encoder: &mut fidl::encoding::Encoder<'_, D>,
2029            offset: usize,
2030            depth: fidl::encoding::Depth,
2031        ) -> fidl::Result<()> {
2032            encoder.debug_check_bounds::<DeviceGetSupportedChannelsResponse>(offset);
2033            // Zero out padding regions. There's no need to apply masks
2034            // because the unmasked parts will be overwritten by fields.
2035            // Write the fields.
2036            self.0.encode(encoder, offset + 0, depth)?;
2037            Ok(())
2038        }
2039    }
2040
2041    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2042        for DeviceGetSupportedChannelsResponse
2043    {
2044        #[inline(always)]
2045        fn new_empty() -> Self {
2046            Self { channels_info: fidl::new_empty!(fidl::encoding::Vector<ChannelInfo, 200>, D) }
2047        }
2048
2049        #[inline]
2050        unsafe fn decode(
2051            &mut self,
2052            decoder: &mut fidl::encoding::Decoder<'_, D>,
2053            offset: usize,
2054            _depth: fidl::encoding::Depth,
2055        ) -> fidl::Result<()> {
2056            decoder.debug_check_bounds::<Self>(offset);
2057            // Verify that padding bytes are zero.
2058            fidl::decode!(fidl::encoding::Vector<ChannelInfo, 200>, D, &mut self.channels_info, decoder, offset + 0, _depth)?;
2059            Ok(())
2060        }
2061    }
2062
2063    impl fidl::encoding::ValueTypeMarker for DeviceRouteExtraGetLocalExternalRoutesResponse {
2064        type Borrowed<'a> = &'a Self;
2065        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2066            value
2067        }
2068    }
2069
2070    unsafe impl fidl::encoding::TypeMarker for DeviceRouteExtraGetLocalExternalRoutesResponse {
2071        type Owned = Self;
2072
2073        #[inline(always)]
2074        fn inline_align(_context: fidl::encoding::Context) -> usize {
2075            8
2076        }
2077
2078        #[inline(always)]
2079        fn inline_size(_context: fidl::encoding::Context) -> usize {
2080            16
2081        }
2082    }
2083
2084    unsafe impl<D: fidl::encoding::ResourceDialect>
2085        fidl::encoding::Encode<DeviceRouteExtraGetLocalExternalRoutesResponse, D>
2086        for &DeviceRouteExtraGetLocalExternalRoutesResponse
2087    {
2088        #[inline]
2089        unsafe fn encode(
2090            self,
2091            encoder: &mut fidl::encoding::Encoder<'_, D>,
2092            offset: usize,
2093            _depth: fidl::encoding::Depth,
2094        ) -> fidl::Result<()> {
2095            encoder.debug_check_bounds::<DeviceRouteExtraGetLocalExternalRoutesResponse>(offset);
2096            // Delegate to tuple encoding.
2097            fidl::encoding::Encode::<DeviceRouteExtraGetLocalExternalRoutesResponse, D>::encode(
2098                (
2099                    <fidl::encoding::Vector<ExternalRoute, 32> as fidl::encoding::ValueTypeMarker>::borrow(&self.external_routes),
2100                ),
2101                encoder, offset, _depth
2102            )
2103        }
2104    }
2105    unsafe impl<
2106            D: fidl::encoding::ResourceDialect,
2107            T0: fidl::encoding::Encode<fidl::encoding::Vector<ExternalRoute, 32>, D>,
2108        > fidl::encoding::Encode<DeviceRouteExtraGetLocalExternalRoutesResponse, D> for (T0,)
2109    {
2110        #[inline]
2111        unsafe fn encode(
2112            self,
2113            encoder: &mut fidl::encoding::Encoder<'_, D>,
2114            offset: usize,
2115            depth: fidl::encoding::Depth,
2116        ) -> fidl::Result<()> {
2117            encoder.debug_check_bounds::<DeviceRouteExtraGetLocalExternalRoutesResponse>(offset);
2118            // Zero out padding regions. There's no need to apply masks
2119            // because the unmasked parts will be overwritten by fields.
2120            // Write the fields.
2121            self.0.encode(encoder, offset + 0, depth)?;
2122            Ok(())
2123        }
2124    }
2125
2126    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2127        for DeviceRouteExtraGetLocalExternalRoutesResponse
2128    {
2129        #[inline(always)]
2130        fn new_empty() -> Self {
2131            Self { external_routes: fidl::new_empty!(fidl::encoding::Vector<ExternalRoute, 32>, D) }
2132        }
2133
2134        #[inline]
2135        unsafe fn decode(
2136            &mut self,
2137            decoder: &mut fidl::encoding::Decoder<'_, D>,
2138            offset: usize,
2139            _depth: fidl::encoding::Depth,
2140        ) -> fidl::Result<()> {
2141            decoder.debug_check_bounds::<Self>(offset);
2142            // Verify that padding bytes are zero.
2143            fidl::decode!(fidl::encoding::Vector<ExternalRoute, 32>, D, &mut self.external_routes, decoder, offset + 0, _depth)?;
2144            Ok(())
2145        }
2146    }
2147
2148    impl fidl::encoding::ValueTypeMarker for DeviceRouteExtraGetLocalOnMeshPrefixesResponse {
2149        type Borrowed<'a> = &'a Self;
2150        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2151            value
2152        }
2153    }
2154
2155    unsafe impl fidl::encoding::TypeMarker for DeviceRouteExtraGetLocalOnMeshPrefixesResponse {
2156        type Owned = Self;
2157
2158        #[inline(always)]
2159        fn inline_align(_context: fidl::encoding::Context) -> usize {
2160            8
2161        }
2162
2163        #[inline(always)]
2164        fn inline_size(_context: fidl::encoding::Context) -> usize {
2165            16
2166        }
2167    }
2168
2169    unsafe impl<D: fidl::encoding::ResourceDialect>
2170        fidl::encoding::Encode<DeviceRouteExtraGetLocalOnMeshPrefixesResponse, D>
2171        for &DeviceRouteExtraGetLocalOnMeshPrefixesResponse
2172    {
2173        #[inline]
2174        unsafe fn encode(
2175            self,
2176            encoder: &mut fidl::encoding::Encoder<'_, D>,
2177            offset: usize,
2178            _depth: fidl::encoding::Depth,
2179        ) -> fidl::Result<()> {
2180            encoder.debug_check_bounds::<DeviceRouteExtraGetLocalOnMeshPrefixesResponse>(offset);
2181            // Delegate to tuple encoding.
2182            fidl::encoding::Encode::<DeviceRouteExtraGetLocalOnMeshPrefixesResponse, D>::encode(
2183                (
2184                    <fidl::encoding::Vector<OnMeshPrefix, 32> as fidl::encoding::ValueTypeMarker>::borrow(&self.prefixes),
2185                ),
2186                encoder, offset, _depth
2187            )
2188        }
2189    }
2190    unsafe impl<
2191            D: fidl::encoding::ResourceDialect,
2192            T0: fidl::encoding::Encode<fidl::encoding::Vector<OnMeshPrefix, 32>, D>,
2193        > fidl::encoding::Encode<DeviceRouteExtraGetLocalOnMeshPrefixesResponse, D> for (T0,)
2194    {
2195        #[inline]
2196        unsafe fn encode(
2197            self,
2198            encoder: &mut fidl::encoding::Encoder<'_, D>,
2199            offset: usize,
2200            depth: fidl::encoding::Depth,
2201        ) -> fidl::Result<()> {
2202            encoder.debug_check_bounds::<DeviceRouteExtraGetLocalOnMeshPrefixesResponse>(offset);
2203            // Zero out padding regions. There's no need to apply masks
2204            // because the unmasked parts will be overwritten by fields.
2205            // Write the fields.
2206            self.0.encode(encoder, offset + 0, depth)?;
2207            Ok(())
2208        }
2209    }
2210
2211    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2212        for DeviceRouteExtraGetLocalOnMeshPrefixesResponse
2213    {
2214        #[inline(always)]
2215        fn new_empty() -> Self {
2216            Self { prefixes: fidl::new_empty!(fidl::encoding::Vector<OnMeshPrefix, 32>, D) }
2217        }
2218
2219        #[inline]
2220        unsafe fn decode(
2221            &mut self,
2222            decoder: &mut fidl::encoding::Decoder<'_, D>,
2223            offset: usize,
2224            _depth: fidl::encoding::Depth,
2225        ) -> fidl::Result<()> {
2226            decoder.debug_check_bounds::<Self>(offset);
2227            // Verify that padding bytes are zero.
2228            fidl::decode!(fidl::encoding::Vector<OnMeshPrefix, 32>, D, &mut self.prefixes, decoder, offset + 0, _depth)?;
2229            Ok(())
2230        }
2231    }
2232
2233    impl fidl::encoding::ValueTypeMarker for DeviceRouteRegisterExternalRouteRequest {
2234        type Borrowed<'a> = &'a Self;
2235        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2236            value
2237        }
2238    }
2239
2240    unsafe impl fidl::encoding::TypeMarker for DeviceRouteRegisterExternalRouteRequest {
2241        type Owned = Self;
2242
2243        #[inline(always)]
2244        fn inline_align(_context: fidl::encoding::Context) -> usize {
2245            8
2246        }
2247
2248        #[inline(always)]
2249        fn inline_size(_context: fidl::encoding::Context) -> usize {
2250            16
2251        }
2252    }
2253
2254    unsafe impl<D: fidl::encoding::ResourceDialect>
2255        fidl::encoding::Encode<DeviceRouteRegisterExternalRouteRequest, D>
2256        for &DeviceRouteRegisterExternalRouteRequest
2257    {
2258        #[inline]
2259        unsafe fn encode(
2260            self,
2261            encoder: &mut fidl::encoding::Encoder<'_, D>,
2262            offset: usize,
2263            _depth: fidl::encoding::Depth,
2264        ) -> fidl::Result<()> {
2265            encoder.debug_check_bounds::<DeviceRouteRegisterExternalRouteRequest>(offset);
2266            // Delegate to tuple encoding.
2267            fidl::encoding::Encode::<DeviceRouteRegisterExternalRouteRequest, D>::encode(
2268                (<ExternalRoute as fidl::encoding::ValueTypeMarker>::borrow(&self.external_route),),
2269                encoder,
2270                offset,
2271                _depth,
2272            )
2273        }
2274    }
2275    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<ExternalRoute, D>>
2276        fidl::encoding::Encode<DeviceRouteRegisterExternalRouteRequest, D> for (T0,)
2277    {
2278        #[inline]
2279        unsafe fn encode(
2280            self,
2281            encoder: &mut fidl::encoding::Encoder<'_, D>,
2282            offset: usize,
2283            depth: fidl::encoding::Depth,
2284        ) -> fidl::Result<()> {
2285            encoder.debug_check_bounds::<DeviceRouteRegisterExternalRouteRequest>(offset);
2286            // Zero out padding regions. There's no need to apply masks
2287            // because the unmasked parts will be overwritten by fields.
2288            // Write the fields.
2289            self.0.encode(encoder, offset + 0, depth)?;
2290            Ok(())
2291        }
2292    }
2293
2294    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2295        for DeviceRouteRegisterExternalRouteRequest
2296    {
2297        #[inline(always)]
2298        fn new_empty() -> Self {
2299            Self { external_route: fidl::new_empty!(ExternalRoute, D) }
2300        }
2301
2302        #[inline]
2303        unsafe fn decode(
2304            &mut self,
2305            decoder: &mut fidl::encoding::Decoder<'_, D>,
2306            offset: usize,
2307            _depth: fidl::encoding::Depth,
2308        ) -> fidl::Result<()> {
2309            decoder.debug_check_bounds::<Self>(offset);
2310            // Verify that padding bytes are zero.
2311            fidl::decode!(ExternalRoute, D, &mut self.external_route, decoder, offset + 0, _depth)?;
2312            Ok(())
2313        }
2314    }
2315
2316    impl fidl::encoding::ValueTypeMarker for DeviceRouteRegisterOnMeshPrefixRequest {
2317        type Borrowed<'a> = &'a Self;
2318        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2319            value
2320        }
2321    }
2322
2323    unsafe impl fidl::encoding::TypeMarker for DeviceRouteRegisterOnMeshPrefixRequest {
2324        type Owned = Self;
2325
2326        #[inline(always)]
2327        fn inline_align(_context: fidl::encoding::Context) -> usize {
2328            8
2329        }
2330
2331        #[inline(always)]
2332        fn inline_size(_context: fidl::encoding::Context) -> usize {
2333            16
2334        }
2335    }
2336
2337    unsafe impl<D: fidl::encoding::ResourceDialect>
2338        fidl::encoding::Encode<DeviceRouteRegisterOnMeshPrefixRequest, D>
2339        for &DeviceRouteRegisterOnMeshPrefixRequest
2340    {
2341        #[inline]
2342        unsafe fn encode(
2343            self,
2344            encoder: &mut fidl::encoding::Encoder<'_, D>,
2345            offset: usize,
2346            _depth: fidl::encoding::Depth,
2347        ) -> fidl::Result<()> {
2348            encoder.debug_check_bounds::<DeviceRouteRegisterOnMeshPrefixRequest>(offset);
2349            // Delegate to tuple encoding.
2350            fidl::encoding::Encode::<DeviceRouteRegisterOnMeshPrefixRequest, D>::encode(
2351                (<OnMeshPrefix as fidl::encoding::ValueTypeMarker>::borrow(&self.prefix),),
2352                encoder,
2353                offset,
2354                _depth,
2355            )
2356        }
2357    }
2358    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<OnMeshPrefix, D>>
2359        fidl::encoding::Encode<DeviceRouteRegisterOnMeshPrefixRequest, D> for (T0,)
2360    {
2361        #[inline]
2362        unsafe fn encode(
2363            self,
2364            encoder: &mut fidl::encoding::Encoder<'_, D>,
2365            offset: usize,
2366            depth: fidl::encoding::Depth,
2367        ) -> fidl::Result<()> {
2368            encoder.debug_check_bounds::<DeviceRouteRegisterOnMeshPrefixRequest>(offset);
2369            // Zero out padding regions. There's no need to apply masks
2370            // because the unmasked parts will be overwritten by fields.
2371            // Write the fields.
2372            self.0.encode(encoder, offset + 0, depth)?;
2373            Ok(())
2374        }
2375    }
2376
2377    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2378        for DeviceRouteRegisterOnMeshPrefixRequest
2379    {
2380        #[inline(always)]
2381        fn new_empty() -> Self {
2382            Self { prefix: fidl::new_empty!(OnMeshPrefix, D) }
2383        }
2384
2385        #[inline]
2386        unsafe fn decode(
2387            &mut self,
2388            decoder: &mut fidl::encoding::Decoder<'_, D>,
2389            offset: usize,
2390            _depth: fidl::encoding::Depth,
2391        ) -> fidl::Result<()> {
2392            decoder.debug_check_bounds::<Self>(offset);
2393            // Verify that padding bytes are zero.
2394            fidl::decode!(OnMeshPrefix, D, &mut self.prefix, decoder, offset + 0, _depth)?;
2395            Ok(())
2396        }
2397    }
2398
2399    impl fidl::encoding::ValueTypeMarker for DeviceRouteUnregisterExternalRouteRequest {
2400        type Borrowed<'a> = &'a Self;
2401        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2402            value
2403        }
2404    }
2405
2406    unsafe impl fidl::encoding::TypeMarker for DeviceRouteUnregisterExternalRouteRequest {
2407        type Owned = Self;
2408
2409        #[inline(always)]
2410        fn inline_align(_context: fidl::encoding::Context) -> usize {
2411            1
2412        }
2413
2414        #[inline(always)]
2415        fn inline_size(_context: fidl::encoding::Context) -> usize {
2416            17
2417        }
2418    }
2419
2420    unsafe impl<D: fidl::encoding::ResourceDialect>
2421        fidl::encoding::Encode<DeviceRouteUnregisterExternalRouteRequest, D>
2422        for &DeviceRouteUnregisterExternalRouteRequest
2423    {
2424        #[inline]
2425        unsafe fn encode(
2426            self,
2427            encoder: &mut fidl::encoding::Encoder<'_, D>,
2428            offset: usize,
2429            _depth: fidl::encoding::Depth,
2430        ) -> fidl::Result<()> {
2431            encoder.debug_check_bounds::<DeviceRouteUnregisterExternalRouteRequest>(offset);
2432            // Delegate to tuple encoding.
2433            fidl::encoding::Encode::<DeviceRouteUnregisterExternalRouteRequest, D>::encode(
2434                (
2435                    <fidl_fuchsia_net::Ipv6AddressWithPrefix as fidl::encoding::ValueTypeMarker>::borrow(&self.subnet),
2436                ),
2437                encoder, offset, _depth
2438            )
2439        }
2440    }
2441    unsafe impl<
2442            D: fidl::encoding::ResourceDialect,
2443            T0: fidl::encoding::Encode<fidl_fuchsia_net::Ipv6AddressWithPrefix, D>,
2444        > fidl::encoding::Encode<DeviceRouteUnregisterExternalRouteRequest, D> for (T0,)
2445    {
2446        #[inline]
2447        unsafe fn encode(
2448            self,
2449            encoder: &mut fidl::encoding::Encoder<'_, D>,
2450            offset: usize,
2451            depth: fidl::encoding::Depth,
2452        ) -> fidl::Result<()> {
2453            encoder.debug_check_bounds::<DeviceRouteUnregisterExternalRouteRequest>(offset);
2454            // Zero out padding regions. There's no need to apply masks
2455            // because the unmasked parts will be overwritten by fields.
2456            // Write the fields.
2457            self.0.encode(encoder, offset + 0, depth)?;
2458            Ok(())
2459        }
2460    }
2461
2462    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2463        for DeviceRouteUnregisterExternalRouteRequest
2464    {
2465        #[inline(always)]
2466        fn new_empty() -> Self {
2467            Self { subnet: fidl::new_empty!(fidl_fuchsia_net::Ipv6AddressWithPrefix, D) }
2468        }
2469
2470        #[inline]
2471        unsafe fn decode(
2472            &mut self,
2473            decoder: &mut fidl::encoding::Decoder<'_, D>,
2474            offset: usize,
2475            _depth: fidl::encoding::Depth,
2476        ) -> fidl::Result<()> {
2477            decoder.debug_check_bounds::<Self>(offset);
2478            // Verify that padding bytes are zero.
2479            fidl::decode!(
2480                fidl_fuchsia_net::Ipv6AddressWithPrefix,
2481                D,
2482                &mut self.subnet,
2483                decoder,
2484                offset + 0,
2485                _depth
2486            )?;
2487            Ok(())
2488        }
2489    }
2490
2491    impl fidl::encoding::ValueTypeMarker for DeviceRouteUnregisterOnMeshPrefixRequest {
2492        type Borrowed<'a> = &'a Self;
2493        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2494            value
2495        }
2496    }
2497
2498    unsafe impl fidl::encoding::TypeMarker for DeviceRouteUnregisterOnMeshPrefixRequest {
2499        type Owned = Self;
2500
2501        #[inline(always)]
2502        fn inline_align(_context: fidl::encoding::Context) -> usize {
2503            1
2504        }
2505
2506        #[inline(always)]
2507        fn inline_size(_context: fidl::encoding::Context) -> usize {
2508            17
2509        }
2510    }
2511
2512    unsafe impl<D: fidl::encoding::ResourceDialect>
2513        fidl::encoding::Encode<DeviceRouteUnregisterOnMeshPrefixRequest, D>
2514        for &DeviceRouteUnregisterOnMeshPrefixRequest
2515    {
2516        #[inline]
2517        unsafe fn encode(
2518            self,
2519            encoder: &mut fidl::encoding::Encoder<'_, D>,
2520            offset: usize,
2521            _depth: fidl::encoding::Depth,
2522        ) -> fidl::Result<()> {
2523            encoder.debug_check_bounds::<DeviceRouteUnregisterOnMeshPrefixRequest>(offset);
2524            // Delegate to tuple encoding.
2525            fidl::encoding::Encode::<DeviceRouteUnregisterOnMeshPrefixRequest, D>::encode(
2526                (
2527                    <fidl_fuchsia_net::Ipv6AddressWithPrefix as fidl::encoding::ValueTypeMarker>::borrow(&self.subnet),
2528                ),
2529                encoder, offset, _depth
2530            )
2531        }
2532    }
2533    unsafe impl<
2534            D: fidl::encoding::ResourceDialect,
2535            T0: fidl::encoding::Encode<fidl_fuchsia_net::Ipv6AddressWithPrefix, D>,
2536        > fidl::encoding::Encode<DeviceRouteUnregisterOnMeshPrefixRequest, D> for (T0,)
2537    {
2538        #[inline]
2539        unsafe fn encode(
2540            self,
2541            encoder: &mut fidl::encoding::Encoder<'_, D>,
2542            offset: usize,
2543            depth: fidl::encoding::Depth,
2544        ) -> fidl::Result<()> {
2545            encoder.debug_check_bounds::<DeviceRouteUnregisterOnMeshPrefixRequest>(offset);
2546            // Zero out padding regions. There's no need to apply masks
2547            // because the unmasked parts will be overwritten by fields.
2548            // Write the fields.
2549            self.0.encode(encoder, offset + 0, depth)?;
2550            Ok(())
2551        }
2552    }
2553
2554    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2555        for DeviceRouteUnregisterOnMeshPrefixRequest
2556    {
2557        #[inline(always)]
2558        fn new_empty() -> Self {
2559            Self { subnet: fidl::new_empty!(fidl_fuchsia_net::Ipv6AddressWithPrefix, D) }
2560        }
2561
2562        #[inline]
2563        unsafe fn decode(
2564            &mut self,
2565            decoder: &mut fidl::encoding::Decoder<'_, D>,
2566            offset: usize,
2567            _depth: fidl::encoding::Depth,
2568        ) -> fidl::Result<()> {
2569            decoder.debug_check_bounds::<Self>(offset);
2570            // Verify that padding bytes are zero.
2571            fidl::decode!(
2572                fidl_fuchsia_net::Ipv6AddressWithPrefix,
2573                D,
2574                &mut self.subnet,
2575                decoder,
2576                offset + 0,
2577                _depth
2578            )?;
2579            Ok(())
2580        }
2581    }
2582
2583    impl fidl::encoding::ValueTypeMarker for LegacyJoiningMakeJoinableRequest {
2584        type Borrowed<'a> = &'a Self;
2585        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2586            value
2587        }
2588    }
2589
2590    unsafe impl fidl::encoding::TypeMarker for LegacyJoiningMakeJoinableRequest {
2591        type Owned = Self;
2592
2593        #[inline(always)]
2594        fn inline_align(_context: fidl::encoding::Context) -> usize {
2595            8
2596        }
2597
2598        #[inline(always)]
2599        fn inline_size(_context: fidl::encoding::Context) -> usize {
2600            16
2601        }
2602    }
2603
2604    unsafe impl<D: fidl::encoding::ResourceDialect>
2605        fidl::encoding::Encode<LegacyJoiningMakeJoinableRequest, D>
2606        for &LegacyJoiningMakeJoinableRequest
2607    {
2608        #[inline]
2609        unsafe fn encode(
2610            self,
2611            encoder: &mut fidl::encoding::Encoder<'_, D>,
2612            offset: usize,
2613            _depth: fidl::encoding::Depth,
2614        ) -> fidl::Result<()> {
2615            encoder.debug_check_bounds::<LegacyJoiningMakeJoinableRequest>(offset);
2616            unsafe {
2617                // Copy the object into the buffer.
2618                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
2619                (buf_ptr as *mut LegacyJoiningMakeJoinableRequest)
2620                    .write_unaligned((self as *const LegacyJoiningMakeJoinableRequest).read());
2621                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
2622                // done second because the memcpy will write garbage to these bytes.
2623                let padding_ptr = buf_ptr.offset(8) as *mut u64;
2624                let padding_mask = 0xffffffffffff0000u64;
2625                padding_ptr.write_unaligned(padding_ptr.read_unaligned() & !padding_mask);
2626            }
2627            Ok(())
2628        }
2629    }
2630    unsafe impl<
2631            D: fidl::encoding::ResourceDialect,
2632            T0: fidl::encoding::Encode<i64, D>,
2633            T1: fidl::encoding::Encode<u16, D>,
2634        > fidl::encoding::Encode<LegacyJoiningMakeJoinableRequest, D> for (T0, T1)
2635    {
2636        #[inline]
2637        unsafe fn encode(
2638            self,
2639            encoder: &mut fidl::encoding::Encoder<'_, D>,
2640            offset: usize,
2641            depth: fidl::encoding::Depth,
2642        ) -> fidl::Result<()> {
2643            encoder.debug_check_bounds::<LegacyJoiningMakeJoinableRequest>(offset);
2644            // Zero out padding regions. There's no need to apply masks
2645            // because the unmasked parts will be overwritten by fields.
2646            unsafe {
2647                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
2648                (ptr as *mut u64).write_unaligned(0);
2649            }
2650            // Write the fields.
2651            self.0.encode(encoder, offset + 0, depth)?;
2652            self.1.encode(encoder, offset + 8, depth)?;
2653            Ok(())
2654        }
2655    }
2656
2657    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2658        for LegacyJoiningMakeJoinableRequest
2659    {
2660        #[inline(always)]
2661        fn new_empty() -> Self {
2662            Self { duration: fidl::new_empty!(i64, D), port: fidl::new_empty!(u16, D) }
2663        }
2664
2665        #[inline]
2666        unsafe fn decode(
2667            &mut self,
2668            decoder: &mut fidl::encoding::Decoder<'_, D>,
2669            offset: usize,
2670            _depth: fidl::encoding::Depth,
2671        ) -> fidl::Result<()> {
2672            decoder.debug_check_bounds::<Self>(offset);
2673            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
2674            // Verify that padding bytes are zero.
2675            let ptr = unsafe { buf_ptr.offset(8) };
2676            let padval = unsafe { (ptr as *const u64).read_unaligned() };
2677            let mask = 0xffffffffffff0000u64;
2678            let maskedval = padval & mask;
2679            if maskedval != 0 {
2680                return Err(fidl::Error::NonZeroPadding {
2681                    padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
2682                });
2683            }
2684            // Copy from the buffer into the object.
2685            unsafe {
2686                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 16);
2687            }
2688            Ok(())
2689        }
2690    }
2691
2692    impl fidl::encoding::ValueTypeMarker for ProvisioningMonitorWatchProgressResponse {
2693        type Borrowed<'a> = &'a Self;
2694        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2695            value
2696        }
2697    }
2698
2699    unsafe impl fidl::encoding::TypeMarker for ProvisioningMonitorWatchProgressResponse {
2700        type Owned = Self;
2701
2702        #[inline(always)]
2703        fn inline_align(_context: fidl::encoding::Context) -> usize {
2704            8
2705        }
2706
2707        #[inline(always)]
2708        fn inline_size(_context: fidl::encoding::Context) -> usize {
2709            16
2710        }
2711    }
2712
2713    unsafe impl<D: fidl::encoding::ResourceDialect>
2714        fidl::encoding::Encode<ProvisioningMonitorWatchProgressResponse, D>
2715        for &ProvisioningMonitorWatchProgressResponse
2716    {
2717        #[inline]
2718        unsafe fn encode(
2719            self,
2720            encoder: &mut fidl::encoding::Encoder<'_, D>,
2721            offset: usize,
2722            _depth: fidl::encoding::Depth,
2723        ) -> fidl::Result<()> {
2724            encoder.debug_check_bounds::<ProvisioningMonitorWatchProgressResponse>(offset);
2725            // Delegate to tuple encoding.
2726            fidl::encoding::Encode::<ProvisioningMonitorWatchProgressResponse, D>::encode(
2727                (<ProvisioningProgress as fidl::encoding::ValueTypeMarker>::borrow(&self.progress),),
2728                encoder,
2729                offset,
2730                _depth,
2731            )
2732        }
2733    }
2734    unsafe impl<
2735            D: fidl::encoding::ResourceDialect,
2736            T0: fidl::encoding::Encode<ProvisioningProgress, D>,
2737        > fidl::encoding::Encode<ProvisioningMonitorWatchProgressResponse, D> for (T0,)
2738    {
2739        #[inline]
2740        unsafe fn encode(
2741            self,
2742            encoder: &mut fidl::encoding::Encoder<'_, D>,
2743            offset: usize,
2744            depth: fidl::encoding::Depth,
2745        ) -> fidl::Result<()> {
2746            encoder.debug_check_bounds::<ProvisioningMonitorWatchProgressResponse>(offset);
2747            // Zero out padding regions. There's no need to apply masks
2748            // because the unmasked parts will be overwritten by fields.
2749            // Write the fields.
2750            self.0.encode(encoder, offset + 0, depth)?;
2751            Ok(())
2752        }
2753    }
2754
2755    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2756        for ProvisioningMonitorWatchProgressResponse
2757    {
2758        #[inline(always)]
2759        fn new_empty() -> Self {
2760            Self { progress: fidl::new_empty!(ProvisioningProgress, D) }
2761        }
2762
2763        #[inline]
2764        unsafe fn decode(
2765            &mut self,
2766            decoder: &mut fidl::encoding::Decoder<'_, D>,
2767            offset: usize,
2768            _depth: fidl::encoding::Depth,
2769        ) -> fidl::Result<()> {
2770            decoder.debug_check_bounds::<Self>(offset);
2771            // Verify that padding bytes are zero.
2772            fidl::decode!(
2773                ProvisioningProgress,
2774                D,
2775                &mut self.progress,
2776                decoder,
2777                offset + 0,
2778                _depth
2779            )?;
2780            Ok(())
2781        }
2782    }
2783
2784    impl fidl::encoding::ValueTypeMarker for TelemetryProviderGetTelemetryResponse {
2785        type Borrowed<'a> = &'a Self;
2786        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2787            value
2788        }
2789    }
2790
2791    unsafe impl fidl::encoding::TypeMarker for TelemetryProviderGetTelemetryResponse {
2792        type Owned = Self;
2793
2794        #[inline(always)]
2795        fn inline_align(_context: fidl::encoding::Context) -> usize {
2796            8
2797        }
2798
2799        #[inline(always)]
2800        fn inline_size(_context: fidl::encoding::Context) -> usize {
2801            16
2802        }
2803    }
2804
2805    unsafe impl<D: fidl::encoding::ResourceDialect>
2806        fidl::encoding::Encode<TelemetryProviderGetTelemetryResponse, D>
2807        for &TelemetryProviderGetTelemetryResponse
2808    {
2809        #[inline]
2810        unsafe fn encode(
2811            self,
2812            encoder: &mut fidl::encoding::Encoder<'_, D>,
2813            offset: usize,
2814            _depth: fidl::encoding::Depth,
2815        ) -> fidl::Result<()> {
2816            encoder.debug_check_bounds::<TelemetryProviderGetTelemetryResponse>(offset);
2817            // Delegate to tuple encoding.
2818            fidl::encoding::Encode::<TelemetryProviderGetTelemetryResponse, D>::encode(
2819                (<Telemetry as fidl::encoding::ValueTypeMarker>::borrow(&self.telemetry),),
2820                encoder,
2821                offset,
2822                _depth,
2823            )
2824        }
2825    }
2826    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<Telemetry, D>>
2827        fidl::encoding::Encode<TelemetryProviderGetTelemetryResponse, D> for (T0,)
2828    {
2829        #[inline]
2830        unsafe fn encode(
2831            self,
2832            encoder: &mut fidl::encoding::Encoder<'_, D>,
2833            offset: usize,
2834            depth: fidl::encoding::Depth,
2835        ) -> fidl::Result<()> {
2836            encoder.debug_check_bounds::<TelemetryProviderGetTelemetryResponse>(offset);
2837            // Zero out padding regions. There's no need to apply masks
2838            // because the unmasked parts will be overwritten by fields.
2839            // Write the fields.
2840            self.0.encode(encoder, offset + 0, depth)?;
2841            Ok(())
2842        }
2843    }
2844
2845    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2846        for TelemetryProviderGetTelemetryResponse
2847    {
2848        #[inline(always)]
2849        fn new_empty() -> Self {
2850            Self { telemetry: fidl::new_empty!(Telemetry, D) }
2851        }
2852
2853        #[inline]
2854        unsafe fn decode(
2855            &mut self,
2856            decoder: &mut fidl::encoding::Decoder<'_, D>,
2857            offset: usize,
2858            _depth: fidl::encoding::Depth,
2859        ) -> fidl::Result<()> {
2860            decoder.debug_check_bounds::<Self>(offset);
2861            // Verify that padding bytes are zero.
2862            fidl::decode!(Telemetry, D, &mut self.telemetry, decoder, offset + 0, _depth)?;
2863            Ok(())
2864        }
2865    }
2866
2867    impl BeaconInfo {
2868        #[inline(always)]
2869        fn max_ordinal_present(&self) -> u64 {
2870            if let Some(_) = self.lqi {
2871                return 4;
2872            }
2873            if let Some(_) = self.rssi {
2874                return 3;
2875            }
2876            if let Some(_) = self.identity {
2877                return 2;
2878            }
2879            if let Some(_) = self.address {
2880                return 1;
2881            }
2882            0
2883        }
2884    }
2885
2886    impl fidl::encoding::ValueTypeMarker for BeaconInfo {
2887        type Borrowed<'a> = &'a Self;
2888        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2889            value
2890        }
2891    }
2892
2893    unsafe impl fidl::encoding::TypeMarker for BeaconInfo {
2894        type Owned = Self;
2895
2896        #[inline(always)]
2897        fn inline_align(_context: fidl::encoding::Context) -> usize {
2898            8
2899        }
2900
2901        #[inline(always)]
2902        fn inline_size(_context: fidl::encoding::Context) -> usize {
2903            16
2904        }
2905    }
2906
2907    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<BeaconInfo, D>
2908        for &BeaconInfo
2909    {
2910        unsafe fn encode(
2911            self,
2912            encoder: &mut fidl::encoding::Encoder<'_, D>,
2913            offset: usize,
2914            mut depth: fidl::encoding::Depth,
2915        ) -> fidl::Result<()> {
2916            encoder.debug_check_bounds::<BeaconInfo>(offset);
2917            // Vector header
2918            let max_ordinal: u64 = self.max_ordinal_present();
2919            encoder.write_num(max_ordinal, offset);
2920            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
2921            // Calling encoder.out_of_line_offset(0) is not allowed.
2922            if max_ordinal == 0 {
2923                return Ok(());
2924            }
2925            depth.increment()?;
2926            let envelope_size = 8;
2927            let bytes_len = max_ordinal as usize * envelope_size;
2928            #[allow(unused_variables)]
2929            let offset = encoder.out_of_line_offset(bytes_len);
2930            let mut _prev_end_offset: usize = 0;
2931            if 1 > max_ordinal {
2932                return Ok(());
2933            }
2934
2935            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2936            // are envelope_size bytes.
2937            let cur_offset: usize = (1 - 1) * envelope_size;
2938
2939            // Zero reserved fields.
2940            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2941
2942            // Safety:
2943            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2944            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2945            //   envelope_size bytes, there is always sufficient room.
2946            fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_lowpan::MacAddress, D>(
2947                self.address.as_ref().map(
2948                    <fidl_fuchsia_lowpan::MacAddress as fidl::encoding::ValueTypeMarker>::borrow,
2949                ),
2950                encoder,
2951                offset + cur_offset,
2952                depth,
2953            )?;
2954
2955            _prev_end_offset = cur_offset + envelope_size;
2956            if 2 > max_ordinal {
2957                return Ok(());
2958            }
2959
2960            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2961            // are envelope_size bytes.
2962            let cur_offset: usize = (2 - 1) * envelope_size;
2963
2964            // Zero reserved fields.
2965            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2966
2967            // Safety:
2968            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2969            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2970            //   envelope_size bytes, there is always sufficient room.
2971            fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_lowpan_device::Identity, D>(
2972            self.identity.as_ref().map(<fidl_fuchsia_lowpan_device::Identity as fidl::encoding::ValueTypeMarker>::borrow),
2973            encoder, offset + cur_offset, depth
2974        )?;
2975
2976            _prev_end_offset = cur_offset + envelope_size;
2977            if 3 > max_ordinal {
2978                return Ok(());
2979            }
2980
2981            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2982            // are envelope_size bytes.
2983            let cur_offset: usize = (3 - 1) * envelope_size;
2984
2985            // Zero reserved fields.
2986            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2987
2988            // Safety:
2989            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2990            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2991            //   envelope_size bytes, there is always sufficient room.
2992            fidl::encoding::encode_in_envelope_optional::<i8, D>(
2993                self.rssi.as_ref().map(<i8 as fidl::encoding::ValueTypeMarker>::borrow),
2994                encoder,
2995                offset + cur_offset,
2996                depth,
2997            )?;
2998
2999            _prev_end_offset = cur_offset + envelope_size;
3000            if 4 > max_ordinal {
3001                return Ok(());
3002            }
3003
3004            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3005            // are envelope_size bytes.
3006            let cur_offset: usize = (4 - 1) * envelope_size;
3007
3008            // Zero reserved fields.
3009            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3010
3011            // Safety:
3012            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3013            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3014            //   envelope_size bytes, there is always sufficient room.
3015            fidl::encoding::encode_in_envelope_optional::<u8, D>(
3016                self.lqi.as_ref().map(<u8 as fidl::encoding::ValueTypeMarker>::borrow),
3017                encoder,
3018                offset + cur_offset,
3019                depth,
3020            )?;
3021
3022            _prev_end_offset = cur_offset + envelope_size;
3023
3024            Ok(())
3025        }
3026    }
3027
3028    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for BeaconInfo {
3029        #[inline(always)]
3030        fn new_empty() -> Self {
3031            Self::default()
3032        }
3033
3034        unsafe fn decode(
3035            &mut self,
3036            decoder: &mut fidl::encoding::Decoder<'_, D>,
3037            offset: usize,
3038            mut depth: fidl::encoding::Depth,
3039        ) -> fidl::Result<()> {
3040            decoder.debug_check_bounds::<Self>(offset);
3041            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
3042                None => return Err(fidl::Error::NotNullable),
3043                Some(len) => len,
3044            };
3045            // Calling decoder.out_of_line_offset(0) is not allowed.
3046            if len == 0 {
3047                return Ok(());
3048            };
3049            depth.increment()?;
3050            let envelope_size = 8;
3051            let bytes_len = len * envelope_size;
3052            let offset = decoder.out_of_line_offset(bytes_len)?;
3053            // Decode the envelope for each type.
3054            let mut _next_ordinal_to_read = 0;
3055            let mut next_offset = offset;
3056            let end_offset = offset + bytes_len;
3057            _next_ordinal_to_read += 1;
3058            if next_offset >= end_offset {
3059                return Ok(());
3060            }
3061
3062            // Decode unknown envelopes for gaps in ordinals.
3063            while _next_ordinal_to_read < 1 {
3064                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3065                _next_ordinal_to_read += 1;
3066                next_offset += envelope_size;
3067            }
3068
3069            let next_out_of_line = decoder.next_out_of_line();
3070            let handles_before = decoder.remaining_handles();
3071            if let Some((inlined, num_bytes, num_handles)) =
3072                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3073            {
3074                let member_inline_size =
3075                    <fidl_fuchsia_lowpan::MacAddress as fidl::encoding::TypeMarker>::inline_size(
3076                        decoder.context,
3077                    );
3078                if inlined != (member_inline_size <= 4) {
3079                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3080                }
3081                let inner_offset;
3082                let mut inner_depth = depth.clone();
3083                if inlined {
3084                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3085                    inner_offset = next_offset;
3086                } else {
3087                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3088                    inner_depth.increment()?;
3089                }
3090                let val_ref = self
3091                    .address
3092                    .get_or_insert_with(|| fidl::new_empty!(fidl_fuchsia_lowpan::MacAddress, D));
3093                fidl::decode!(
3094                    fidl_fuchsia_lowpan::MacAddress,
3095                    D,
3096                    val_ref,
3097                    decoder,
3098                    inner_offset,
3099                    inner_depth
3100                )?;
3101                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3102                {
3103                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3104                }
3105                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3106                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3107                }
3108            }
3109
3110            next_offset += envelope_size;
3111            _next_ordinal_to_read += 1;
3112            if next_offset >= end_offset {
3113                return Ok(());
3114            }
3115
3116            // Decode unknown envelopes for gaps in ordinals.
3117            while _next_ordinal_to_read < 2 {
3118                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3119                _next_ordinal_to_read += 1;
3120                next_offset += envelope_size;
3121            }
3122
3123            let next_out_of_line = decoder.next_out_of_line();
3124            let handles_before = decoder.remaining_handles();
3125            if let Some((inlined, num_bytes, num_handles)) =
3126                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3127            {
3128                let member_inline_size = <fidl_fuchsia_lowpan_device::Identity as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3129                if inlined != (member_inline_size <= 4) {
3130                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3131                }
3132                let inner_offset;
3133                let mut inner_depth = depth.clone();
3134                if inlined {
3135                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3136                    inner_offset = next_offset;
3137                } else {
3138                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3139                    inner_depth.increment()?;
3140                }
3141                let val_ref = self.identity.get_or_insert_with(|| {
3142                    fidl::new_empty!(fidl_fuchsia_lowpan_device::Identity, D)
3143                });
3144                fidl::decode!(
3145                    fidl_fuchsia_lowpan_device::Identity,
3146                    D,
3147                    val_ref,
3148                    decoder,
3149                    inner_offset,
3150                    inner_depth
3151                )?;
3152                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3153                {
3154                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3155                }
3156                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3157                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3158                }
3159            }
3160
3161            next_offset += envelope_size;
3162            _next_ordinal_to_read += 1;
3163            if next_offset >= end_offset {
3164                return Ok(());
3165            }
3166
3167            // Decode unknown envelopes for gaps in ordinals.
3168            while _next_ordinal_to_read < 3 {
3169                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3170                _next_ordinal_to_read += 1;
3171                next_offset += envelope_size;
3172            }
3173
3174            let next_out_of_line = decoder.next_out_of_line();
3175            let handles_before = decoder.remaining_handles();
3176            if let Some((inlined, num_bytes, num_handles)) =
3177                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3178            {
3179                let member_inline_size =
3180                    <i8 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3181                if inlined != (member_inline_size <= 4) {
3182                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3183                }
3184                let inner_offset;
3185                let mut inner_depth = depth.clone();
3186                if inlined {
3187                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3188                    inner_offset = next_offset;
3189                } else {
3190                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3191                    inner_depth.increment()?;
3192                }
3193                let val_ref = self.rssi.get_or_insert_with(|| fidl::new_empty!(i8, D));
3194                fidl::decode!(i8, D, val_ref, decoder, inner_offset, inner_depth)?;
3195                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3196                {
3197                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3198                }
3199                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3200                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3201                }
3202            }
3203
3204            next_offset += envelope_size;
3205            _next_ordinal_to_read += 1;
3206            if next_offset >= end_offset {
3207                return Ok(());
3208            }
3209
3210            // Decode unknown envelopes for gaps in ordinals.
3211            while _next_ordinal_to_read < 4 {
3212                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3213                _next_ordinal_to_read += 1;
3214                next_offset += envelope_size;
3215            }
3216
3217            let next_out_of_line = decoder.next_out_of_line();
3218            let handles_before = decoder.remaining_handles();
3219            if let Some((inlined, num_bytes, num_handles)) =
3220                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3221            {
3222                let member_inline_size =
3223                    <u8 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3224                if inlined != (member_inline_size <= 4) {
3225                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3226                }
3227                let inner_offset;
3228                let mut inner_depth = depth.clone();
3229                if inlined {
3230                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3231                    inner_offset = next_offset;
3232                } else {
3233                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3234                    inner_depth.increment()?;
3235                }
3236                let val_ref = self.lqi.get_or_insert_with(|| fidl::new_empty!(u8, D));
3237                fidl::decode!(u8, D, val_ref, decoder, inner_offset, inner_depth)?;
3238                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3239                {
3240                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3241                }
3242                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3243                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3244                }
3245            }
3246
3247            next_offset += envelope_size;
3248
3249            // Decode the remaining unknown envelopes.
3250            while next_offset < end_offset {
3251                _next_ordinal_to_read += 1;
3252                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3253                next_offset += envelope_size;
3254            }
3255
3256            Ok(())
3257        }
3258    }
3259
3260    impl BorderRoutingCounters {
3261        #[inline(always)]
3262        fn max_ordinal_present(&self) -> u64 {
3263            if let Some(_) = self.outbound_internet_bytes {
3264                return 18;
3265            }
3266            if let Some(_) = self.outbound_internet_packets {
3267                return 17;
3268            }
3269            if let Some(_) = self.inbound_internet_bytes {
3270                return 16;
3271            }
3272            if let Some(_) = self.inbound_internet_packets {
3273                return 15;
3274            }
3275            if let Some(_) = self.rs_tx_failure {
3276                return 14;
3277            }
3278            if let Some(_) = self.rs_tx_success {
3279                return 13;
3280            }
3281            if let Some(_) = self.rs_rx {
3282                return 12;
3283            }
3284            if let Some(_) = self.ra_tx_failure {
3285                return 11;
3286            }
3287            if let Some(_) = self.ra_tx_success {
3288                return 10;
3289            }
3290            if let Some(_) = self.ra_rx {
3291                return 9;
3292            }
3293            if let Some(_) = self.outbound_multicast_bytes {
3294                return 8;
3295            }
3296            if let Some(_) = self.outbound_multicast_packets {
3297                return 7;
3298            }
3299            if let Some(_) = self.outbound_unicast_bytes {
3300                return 6;
3301            }
3302            if let Some(_) = self.outbound_unicast_packets {
3303                return 5;
3304            }
3305            if let Some(_) = self.inbound_multicast_bytes {
3306                return 4;
3307            }
3308            if let Some(_) = self.inbound_multicast_packets {
3309                return 3;
3310            }
3311            if let Some(_) = self.inbound_unicast_bytes {
3312                return 2;
3313            }
3314            if let Some(_) = self.inbound_unicast_packets {
3315                return 1;
3316            }
3317            0
3318        }
3319    }
3320
3321    impl fidl::encoding::ValueTypeMarker for BorderRoutingCounters {
3322        type Borrowed<'a> = &'a Self;
3323        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3324            value
3325        }
3326    }
3327
3328    unsafe impl fidl::encoding::TypeMarker for BorderRoutingCounters {
3329        type Owned = Self;
3330
3331        #[inline(always)]
3332        fn inline_align(_context: fidl::encoding::Context) -> usize {
3333            8
3334        }
3335
3336        #[inline(always)]
3337        fn inline_size(_context: fidl::encoding::Context) -> usize {
3338            16
3339        }
3340    }
3341
3342    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<BorderRoutingCounters, D>
3343        for &BorderRoutingCounters
3344    {
3345        unsafe fn encode(
3346            self,
3347            encoder: &mut fidl::encoding::Encoder<'_, D>,
3348            offset: usize,
3349            mut depth: fidl::encoding::Depth,
3350        ) -> fidl::Result<()> {
3351            encoder.debug_check_bounds::<BorderRoutingCounters>(offset);
3352            // Vector header
3353            let max_ordinal: u64 = self.max_ordinal_present();
3354            encoder.write_num(max_ordinal, offset);
3355            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
3356            // Calling encoder.out_of_line_offset(0) is not allowed.
3357            if max_ordinal == 0 {
3358                return Ok(());
3359            }
3360            depth.increment()?;
3361            let envelope_size = 8;
3362            let bytes_len = max_ordinal as usize * envelope_size;
3363            #[allow(unused_variables)]
3364            let offset = encoder.out_of_line_offset(bytes_len);
3365            let mut _prev_end_offset: usize = 0;
3366            if 1 > max_ordinal {
3367                return Ok(());
3368            }
3369
3370            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3371            // are envelope_size bytes.
3372            let cur_offset: usize = (1 - 1) * envelope_size;
3373
3374            // Zero reserved fields.
3375            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3376
3377            // Safety:
3378            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3379            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3380            //   envelope_size bytes, there is always sufficient room.
3381            fidl::encoding::encode_in_envelope_optional::<u64, D>(
3382                self.inbound_unicast_packets
3383                    .as_ref()
3384                    .map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
3385                encoder,
3386                offset + cur_offset,
3387                depth,
3388            )?;
3389
3390            _prev_end_offset = cur_offset + envelope_size;
3391            if 2 > max_ordinal {
3392                return Ok(());
3393            }
3394
3395            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3396            // are envelope_size bytes.
3397            let cur_offset: usize = (2 - 1) * envelope_size;
3398
3399            // Zero reserved fields.
3400            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3401
3402            // Safety:
3403            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3404            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3405            //   envelope_size bytes, there is always sufficient room.
3406            fidl::encoding::encode_in_envelope_optional::<u64, D>(
3407                self.inbound_unicast_bytes
3408                    .as_ref()
3409                    .map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
3410                encoder,
3411                offset + cur_offset,
3412                depth,
3413            )?;
3414
3415            _prev_end_offset = cur_offset + envelope_size;
3416            if 3 > max_ordinal {
3417                return Ok(());
3418            }
3419
3420            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3421            // are envelope_size bytes.
3422            let cur_offset: usize = (3 - 1) * envelope_size;
3423
3424            // Zero reserved fields.
3425            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3426
3427            // Safety:
3428            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3429            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3430            //   envelope_size bytes, there is always sufficient room.
3431            fidl::encoding::encode_in_envelope_optional::<u64, D>(
3432                self.inbound_multicast_packets
3433                    .as_ref()
3434                    .map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
3435                encoder,
3436                offset + cur_offset,
3437                depth,
3438            )?;
3439
3440            _prev_end_offset = cur_offset + envelope_size;
3441            if 4 > max_ordinal {
3442                return Ok(());
3443            }
3444
3445            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3446            // are envelope_size bytes.
3447            let cur_offset: usize = (4 - 1) * envelope_size;
3448
3449            // Zero reserved fields.
3450            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3451
3452            // Safety:
3453            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3454            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3455            //   envelope_size bytes, there is always sufficient room.
3456            fidl::encoding::encode_in_envelope_optional::<u64, D>(
3457                self.inbound_multicast_bytes
3458                    .as_ref()
3459                    .map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
3460                encoder,
3461                offset + cur_offset,
3462                depth,
3463            )?;
3464
3465            _prev_end_offset = cur_offset + envelope_size;
3466            if 5 > max_ordinal {
3467                return Ok(());
3468            }
3469
3470            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3471            // are envelope_size bytes.
3472            let cur_offset: usize = (5 - 1) * envelope_size;
3473
3474            // Zero reserved fields.
3475            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3476
3477            // Safety:
3478            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3479            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3480            //   envelope_size bytes, there is always sufficient room.
3481            fidl::encoding::encode_in_envelope_optional::<u64, D>(
3482                self.outbound_unicast_packets
3483                    .as_ref()
3484                    .map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
3485                encoder,
3486                offset + cur_offset,
3487                depth,
3488            )?;
3489
3490            _prev_end_offset = cur_offset + envelope_size;
3491            if 6 > max_ordinal {
3492                return Ok(());
3493            }
3494
3495            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3496            // are envelope_size bytes.
3497            let cur_offset: usize = (6 - 1) * envelope_size;
3498
3499            // Zero reserved fields.
3500            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3501
3502            // Safety:
3503            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3504            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3505            //   envelope_size bytes, there is always sufficient room.
3506            fidl::encoding::encode_in_envelope_optional::<u64, D>(
3507                self.outbound_unicast_bytes
3508                    .as_ref()
3509                    .map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
3510                encoder,
3511                offset + cur_offset,
3512                depth,
3513            )?;
3514
3515            _prev_end_offset = cur_offset + envelope_size;
3516            if 7 > max_ordinal {
3517                return Ok(());
3518            }
3519
3520            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3521            // are envelope_size bytes.
3522            let cur_offset: usize = (7 - 1) * envelope_size;
3523
3524            // Zero reserved fields.
3525            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3526
3527            // Safety:
3528            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3529            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3530            //   envelope_size bytes, there is always sufficient room.
3531            fidl::encoding::encode_in_envelope_optional::<u64, D>(
3532                self.outbound_multicast_packets
3533                    .as_ref()
3534                    .map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
3535                encoder,
3536                offset + cur_offset,
3537                depth,
3538            )?;
3539
3540            _prev_end_offset = cur_offset + envelope_size;
3541            if 8 > max_ordinal {
3542                return Ok(());
3543            }
3544
3545            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3546            // are envelope_size bytes.
3547            let cur_offset: usize = (8 - 1) * envelope_size;
3548
3549            // Zero reserved fields.
3550            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3551
3552            // Safety:
3553            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3554            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3555            //   envelope_size bytes, there is always sufficient room.
3556            fidl::encoding::encode_in_envelope_optional::<u64, D>(
3557                self.outbound_multicast_bytes
3558                    .as_ref()
3559                    .map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
3560                encoder,
3561                offset + cur_offset,
3562                depth,
3563            )?;
3564
3565            _prev_end_offset = cur_offset + envelope_size;
3566            if 9 > max_ordinal {
3567                return Ok(());
3568            }
3569
3570            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3571            // are envelope_size bytes.
3572            let cur_offset: usize = (9 - 1) * envelope_size;
3573
3574            // Zero reserved fields.
3575            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3576
3577            // Safety:
3578            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3579            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3580            //   envelope_size bytes, there is always sufficient room.
3581            fidl::encoding::encode_in_envelope_optional::<u32, D>(
3582                self.ra_rx.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
3583                encoder,
3584                offset + cur_offset,
3585                depth,
3586            )?;
3587
3588            _prev_end_offset = cur_offset + envelope_size;
3589            if 10 > max_ordinal {
3590                return Ok(());
3591            }
3592
3593            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3594            // are envelope_size bytes.
3595            let cur_offset: usize = (10 - 1) * envelope_size;
3596
3597            // Zero reserved fields.
3598            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3599
3600            // Safety:
3601            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3602            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3603            //   envelope_size bytes, there is always sufficient room.
3604            fidl::encoding::encode_in_envelope_optional::<u32, D>(
3605                self.ra_tx_success.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
3606                encoder,
3607                offset + cur_offset,
3608                depth,
3609            )?;
3610
3611            _prev_end_offset = cur_offset + envelope_size;
3612            if 11 > max_ordinal {
3613                return Ok(());
3614            }
3615
3616            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3617            // are envelope_size bytes.
3618            let cur_offset: usize = (11 - 1) * envelope_size;
3619
3620            // Zero reserved fields.
3621            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3622
3623            // Safety:
3624            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3625            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3626            //   envelope_size bytes, there is always sufficient room.
3627            fidl::encoding::encode_in_envelope_optional::<u32, D>(
3628                self.ra_tx_failure.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
3629                encoder,
3630                offset + cur_offset,
3631                depth,
3632            )?;
3633
3634            _prev_end_offset = cur_offset + envelope_size;
3635            if 12 > max_ordinal {
3636                return Ok(());
3637            }
3638
3639            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3640            // are envelope_size bytes.
3641            let cur_offset: usize = (12 - 1) * envelope_size;
3642
3643            // Zero reserved fields.
3644            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3645
3646            // Safety:
3647            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3648            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3649            //   envelope_size bytes, there is always sufficient room.
3650            fidl::encoding::encode_in_envelope_optional::<u32, D>(
3651                self.rs_rx.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
3652                encoder,
3653                offset + cur_offset,
3654                depth,
3655            )?;
3656
3657            _prev_end_offset = cur_offset + envelope_size;
3658            if 13 > max_ordinal {
3659                return Ok(());
3660            }
3661
3662            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3663            // are envelope_size bytes.
3664            let cur_offset: usize = (13 - 1) * envelope_size;
3665
3666            // Zero reserved fields.
3667            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3668
3669            // Safety:
3670            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3671            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3672            //   envelope_size bytes, there is always sufficient room.
3673            fidl::encoding::encode_in_envelope_optional::<u32, D>(
3674                self.rs_tx_success.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
3675                encoder,
3676                offset + cur_offset,
3677                depth,
3678            )?;
3679
3680            _prev_end_offset = cur_offset + envelope_size;
3681            if 14 > max_ordinal {
3682                return Ok(());
3683            }
3684
3685            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3686            // are envelope_size bytes.
3687            let cur_offset: usize = (14 - 1) * envelope_size;
3688
3689            // Zero reserved fields.
3690            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3691
3692            // Safety:
3693            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3694            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3695            //   envelope_size bytes, there is always sufficient room.
3696            fidl::encoding::encode_in_envelope_optional::<u32, D>(
3697                self.rs_tx_failure.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
3698                encoder,
3699                offset + cur_offset,
3700                depth,
3701            )?;
3702
3703            _prev_end_offset = cur_offset + envelope_size;
3704            if 15 > max_ordinal {
3705                return Ok(());
3706            }
3707
3708            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3709            // are envelope_size bytes.
3710            let cur_offset: usize = (15 - 1) * envelope_size;
3711
3712            // Zero reserved fields.
3713            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3714
3715            // Safety:
3716            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3717            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3718            //   envelope_size bytes, there is always sufficient room.
3719            fidl::encoding::encode_in_envelope_optional::<u64, D>(
3720                self.inbound_internet_packets
3721                    .as_ref()
3722                    .map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
3723                encoder,
3724                offset + cur_offset,
3725                depth,
3726            )?;
3727
3728            _prev_end_offset = cur_offset + envelope_size;
3729            if 16 > max_ordinal {
3730                return Ok(());
3731            }
3732
3733            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3734            // are envelope_size bytes.
3735            let cur_offset: usize = (16 - 1) * envelope_size;
3736
3737            // Zero reserved fields.
3738            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3739
3740            // Safety:
3741            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3742            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3743            //   envelope_size bytes, there is always sufficient room.
3744            fidl::encoding::encode_in_envelope_optional::<u64, D>(
3745                self.inbound_internet_bytes
3746                    .as_ref()
3747                    .map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
3748                encoder,
3749                offset + cur_offset,
3750                depth,
3751            )?;
3752
3753            _prev_end_offset = cur_offset + envelope_size;
3754            if 17 > max_ordinal {
3755                return Ok(());
3756            }
3757
3758            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3759            // are envelope_size bytes.
3760            let cur_offset: usize = (17 - 1) * envelope_size;
3761
3762            // Zero reserved fields.
3763            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3764
3765            // Safety:
3766            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3767            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3768            //   envelope_size bytes, there is always sufficient room.
3769            fidl::encoding::encode_in_envelope_optional::<u64, D>(
3770                self.outbound_internet_packets
3771                    .as_ref()
3772                    .map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
3773                encoder,
3774                offset + cur_offset,
3775                depth,
3776            )?;
3777
3778            _prev_end_offset = cur_offset + envelope_size;
3779            if 18 > max_ordinal {
3780                return Ok(());
3781            }
3782
3783            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3784            // are envelope_size bytes.
3785            let cur_offset: usize = (18 - 1) * envelope_size;
3786
3787            // Zero reserved fields.
3788            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3789
3790            // Safety:
3791            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3792            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3793            //   envelope_size bytes, there is always sufficient room.
3794            fidl::encoding::encode_in_envelope_optional::<u64, D>(
3795                self.outbound_internet_bytes
3796                    .as_ref()
3797                    .map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
3798                encoder,
3799                offset + cur_offset,
3800                depth,
3801            )?;
3802
3803            _prev_end_offset = cur_offset + envelope_size;
3804
3805            Ok(())
3806        }
3807    }
3808
3809    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for BorderRoutingCounters {
3810        #[inline(always)]
3811        fn new_empty() -> Self {
3812            Self::default()
3813        }
3814
3815        unsafe fn decode(
3816            &mut self,
3817            decoder: &mut fidl::encoding::Decoder<'_, D>,
3818            offset: usize,
3819            mut depth: fidl::encoding::Depth,
3820        ) -> fidl::Result<()> {
3821            decoder.debug_check_bounds::<Self>(offset);
3822            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
3823                None => return Err(fidl::Error::NotNullable),
3824                Some(len) => len,
3825            };
3826            // Calling decoder.out_of_line_offset(0) is not allowed.
3827            if len == 0 {
3828                return Ok(());
3829            };
3830            depth.increment()?;
3831            let envelope_size = 8;
3832            let bytes_len = len * envelope_size;
3833            let offset = decoder.out_of_line_offset(bytes_len)?;
3834            // Decode the envelope for each type.
3835            let mut _next_ordinal_to_read = 0;
3836            let mut next_offset = offset;
3837            let end_offset = offset + bytes_len;
3838            _next_ordinal_to_read += 1;
3839            if next_offset >= end_offset {
3840                return Ok(());
3841            }
3842
3843            // Decode unknown envelopes for gaps in ordinals.
3844            while _next_ordinal_to_read < 1 {
3845                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3846                _next_ordinal_to_read += 1;
3847                next_offset += envelope_size;
3848            }
3849
3850            let next_out_of_line = decoder.next_out_of_line();
3851            let handles_before = decoder.remaining_handles();
3852            if let Some((inlined, num_bytes, num_handles)) =
3853                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3854            {
3855                let member_inline_size =
3856                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3857                if inlined != (member_inline_size <= 4) {
3858                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3859                }
3860                let inner_offset;
3861                let mut inner_depth = depth.clone();
3862                if inlined {
3863                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3864                    inner_offset = next_offset;
3865                } else {
3866                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3867                    inner_depth.increment()?;
3868                }
3869                let val_ref =
3870                    self.inbound_unicast_packets.get_or_insert_with(|| fidl::new_empty!(u64, D));
3871                fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
3872                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3873                {
3874                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3875                }
3876                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3877                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3878                }
3879            }
3880
3881            next_offset += envelope_size;
3882            _next_ordinal_to_read += 1;
3883            if next_offset >= end_offset {
3884                return Ok(());
3885            }
3886
3887            // Decode unknown envelopes for gaps in ordinals.
3888            while _next_ordinal_to_read < 2 {
3889                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3890                _next_ordinal_to_read += 1;
3891                next_offset += envelope_size;
3892            }
3893
3894            let next_out_of_line = decoder.next_out_of_line();
3895            let handles_before = decoder.remaining_handles();
3896            if let Some((inlined, num_bytes, num_handles)) =
3897                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3898            {
3899                let member_inline_size =
3900                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3901                if inlined != (member_inline_size <= 4) {
3902                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3903                }
3904                let inner_offset;
3905                let mut inner_depth = depth.clone();
3906                if inlined {
3907                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3908                    inner_offset = next_offset;
3909                } else {
3910                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3911                    inner_depth.increment()?;
3912                }
3913                let val_ref =
3914                    self.inbound_unicast_bytes.get_or_insert_with(|| fidl::new_empty!(u64, D));
3915                fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
3916                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3917                {
3918                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3919                }
3920                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3921                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3922                }
3923            }
3924
3925            next_offset += envelope_size;
3926            _next_ordinal_to_read += 1;
3927            if next_offset >= end_offset {
3928                return Ok(());
3929            }
3930
3931            // Decode unknown envelopes for gaps in ordinals.
3932            while _next_ordinal_to_read < 3 {
3933                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3934                _next_ordinal_to_read += 1;
3935                next_offset += envelope_size;
3936            }
3937
3938            let next_out_of_line = decoder.next_out_of_line();
3939            let handles_before = decoder.remaining_handles();
3940            if let Some((inlined, num_bytes, num_handles)) =
3941                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3942            {
3943                let member_inline_size =
3944                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3945                if inlined != (member_inline_size <= 4) {
3946                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3947                }
3948                let inner_offset;
3949                let mut inner_depth = depth.clone();
3950                if inlined {
3951                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3952                    inner_offset = next_offset;
3953                } else {
3954                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3955                    inner_depth.increment()?;
3956                }
3957                let val_ref =
3958                    self.inbound_multicast_packets.get_or_insert_with(|| fidl::new_empty!(u64, D));
3959                fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
3960                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3961                {
3962                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3963                }
3964                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3965                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3966                }
3967            }
3968
3969            next_offset += envelope_size;
3970            _next_ordinal_to_read += 1;
3971            if next_offset >= end_offset {
3972                return Ok(());
3973            }
3974
3975            // Decode unknown envelopes for gaps in ordinals.
3976            while _next_ordinal_to_read < 4 {
3977                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3978                _next_ordinal_to_read += 1;
3979                next_offset += envelope_size;
3980            }
3981
3982            let next_out_of_line = decoder.next_out_of_line();
3983            let handles_before = decoder.remaining_handles();
3984            if let Some((inlined, num_bytes, num_handles)) =
3985                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3986            {
3987                let member_inline_size =
3988                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3989                if inlined != (member_inline_size <= 4) {
3990                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3991                }
3992                let inner_offset;
3993                let mut inner_depth = depth.clone();
3994                if inlined {
3995                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3996                    inner_offset = next_offset;
3997                } else {
3998                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3999                    inner_depth.increment()?;
4000                }
4001                let val_ref =
4002                    self.inbound_multicast_bytes.get_or_insert_with(|| fidl::new_empty!(u64, D));
4003                fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
4004                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4005                {
4006                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4007                }
4008                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4009                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4010                }
4011            }
4012
4013            next_offset += envelope_size;
4014            _next_ordinal_to_read += 1;
4015            if next_offset >= end_offset {
4016                return Ok(());
4017            }
4018
4019            // Decode unknown envelopes for gaps in ordinals.
4020            while _next_ordinal_to_read < 5 {
4021                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4022                _next_ordinal_to_read += 1;
4023                next_offset += envelope_size;
4024            }
4025
4026            let next_out_of_line = decoder.next_out_of_line();
4027            let handles_before = decoder.remaining_handles();
4028            if let Some((inlined, num_bytes, num_handles)) =
4029                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4030            {
4031                let member_inline_size =
4032                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4033                if inlined != (member_inline_size <= 4) {
4034                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4035                }
4036                let inner_offset;
4037                let mut inner_depth = depth.clone();
4038                if inlined {
4039                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4040                    inner_offset = next_offset;
4041                } else {
4042                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4043                    inner_depth.increment()?;
4044                }
4045                let val_ref =
4046                    self.outbound_unicast_packets.get_or_insert_with(|| fidl::new_empty!(u64, D));
4047                fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
4048                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4049                {
4050                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4051                }
4052                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4053                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4054                }
4055            }
4056
4057            next_offset += envelope_size;
4058            _next_ordinal_to_read += 1;
4059            if next_offset >= end_offset {
4060                return Ok(());
4061            }
4062
4063            // Decode unknown envelopes for gaps in ordinals.
4064            while _next_ordinal_to_read < 6 {
4065                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4066                _next_ordinal_to_read += 1;
4067                next_offset += envelope_size;
4068            }
4069
4070            let next_out_of_line = decoder.next_out_of_line();
4071            let handles_before = decoder.remaining_handles();
4072            if let Some((inlined, num_bytes, num_handles)) =
4073                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4074            {
4075                let member_inline_size =
4076                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4077                if inlined != (member_inline_size <= 4) {
4078                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4079                }
4080                let inner_offset;
4081                let mut inner_depth = depth.clone();
4082                if inlined {
4083                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4084                    inner_offset = next_offset;
4085                } else {
4086                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4087                    inner_depth.increment()?;
4088                }
4089                let val_ref =
4090                    self.outbound_unicast_bytes.get_or_insert_with(|| fidl::new_empty!(u64, D));
4091                fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
4092                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4093                {
4094                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4095                }
4096                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4097                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4098                }
4099            }
4100
4101            next_offset += envelope_size;
4102            _next_ordinal_to_read += 1;
4103            if next_offset >= end_offset {
4104                return Ok(());
4105            }
4106
4107            // Decode unknown envelopes for gaps in ordinals.
4108            while _next_ordinal_to_read < 7 {
4109                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4110                _next_ordinal_to_read += 1;
4111                next_offset += envelope_size;
4112            }
4113
4114            let next_out_of_line = decoder.next_out_of_line();
4115            let handles_before = decoder.remaining_handles();
4116            if let Some((inlined, num_bytes, num_handles)) =
4117                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4118            {
4119                let member_inline_size =
4120                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4121                if inlined != (member_inline_size <= 4) {
4122                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4123                }
4124                let inner_offset;
4125                let mut inner_depth = depth.clone();
4126                if inlined {
4127                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4128                    inner_offset = next_offset;
4129                } else {
4130                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4131                    inner_depth.increment()?;
4132                }
4133                let val_ref =
4134                    self.outbound_multicast_packets.get_or_insert_with(|| fidl::new_empty!(u64, D));
4135                fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
4136                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4137                {
4138                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4139                }
4140                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4141                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4142                }
4143            }
4144
4145            next_offset += envelope_size;
4146            _next_ordinal_to_read += 1;
4147            if next_offset >= end_offset {
4148                return Ok(());
4149            }
4150
4151            // Decode unknown envelopes for gaps in ordinals.
4152            while _next_ordinal_to_read < 8 {
4153                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4154                _next_ordinal_to_read += 1;
4155                next_offset += envelope_size;
4156            }
4157
4158            let next_out_of_line = decoder.next_out_of_line();
4159            let handles_before = decoder.remaining_handles();
4160            if let Some((inlined, num_bytes, num_handles)) =
4161                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4162            {
4163                let member_inline_size =
4164                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4165                if inlined != (member_inline_size <= 4) {
4166                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4167                }
4168                let inner_offset;
4169                let mut inner_depth = depth.clone();
4170                if inlined {
4171                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4172                    inner_offset = next_offset;
4173                } else {
4174                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4175                    inner_depth.increment()?;
4176                }
4177                let val_ref =
4178                    self.outbound_multicast_bytes.get_or_insert_with(|| fidl::new_empty!(u64, D));
4179                fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
4180                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4181                {
4182                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4183                }
4184                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4185                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4186                }
4187            }
4188
4189            next_offset += envelope_size;
4190            _next_ordinal_to_read += 1;
4191            if next_offset >= end_offset {
4192                return Ok(());
4193            }
4194
4195            // Decode unknown envelopes for gaps in ordinals.
4196            while _next_ordinal_to_read < 9 {
4197                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4198                _next_ordinal_to_read += 1;
4199                next_offset += envelope_size;
4200            }
4201
4202            let next_out_of_line = decoder.next_out_of_line();
4203            let handles_before = decoder.remaining_handles();
4204            if let Some((inlined, num_bytes, num_handles)) =
4205                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4206            {
4207                let member_inline_size =
4208                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4209                if inlined != (member_inline_size <= 4) {
4210                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4211                }
4212                let inner_offset;
4213                let mut inner_depth = depth.clone();
4214                if inlined {
4215                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4216                    inner_offset = next_offset;
4217                } else {
4218                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4219                    inner_depth.increment()?;
4220                }
4221                let val_ref = self.ra_rx.get_or_insert_with(|| fidl::new_empty!(u32, D));
4222                fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
4223                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4224                {
4225                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4226                }
4227                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4228                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4229                }
4230            }
4231
4232            next_offset += envelope_size;
4233            _next_ordinal_to_read += 1;
4234            if next_offset >= end_offset {
4235                return Ok(());
4236            }
4237
4238            // Decode unknown envelopes for gaps in ordinals.
4239            while _next_ordinal_to_read < 10 {
4240                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4241                _next_ordinal_to_read += 1;
4242                next_offset += envelope_size;
4243            }
4244
4245            let next_out_of_line = decoder.next_out_of_line();
4246            let handles_before = decoder.remaining_handles();
4247            if let Some((inlined, num_bytes, num_handles)) =
4248                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4249            {
4250                let member_inline_size =
4251                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4252                if inlined != (member_inline_size <= 4) {
4253                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4254                }
4255                let inner_offset;
4256                let mut inner_depth = depth.clone();
4257                if inlined {
4258                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4259                    inner_offset = next_offset;
4260                } else {
4261                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4262                    inner_depth.increment()?;
4263                }
4264                let val_ref = self.ra_tx_success.get_or_insert_with(|| fidl::new_empty!(u32, D));
4265                fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
4266                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4267                {
4268                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4269                }
4270                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4271                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4272                }
4273            }
4274
4275            next_offset += envelope_size;
4276            _next_ordinal_to_read += 1;
4277            if next_offset >= end_offset {
4278                return Ok(());
4279            }
4280
4281            // Decode unknown envelopes for gaps in ordinals.
4282            while _next_ordinal_to_read < 11 {
4283                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4284                _next_ordinal_to_read += 1;
4285                next_offset += envelope_size;
4286            }
4287
4288            let next_out_of_line = decoder.next_out_of_line();
4289            let handles_before = decoder.remaining_handles();
4290            if let Some((inlined, num_bytes, num_handles)) =
4291                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4292            {
4293                let member_inline_size =
4294                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4295                if inlined != (member_inline_size <= 4) {
4296                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4297                }
4298                let inner_offset;
4299                let mut inner_depth = depth.clone();
4300                if inlined {
4301                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4302                    inner_offset = next_offset;
4303                } else {
4304                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4305                    inner_depth.increment()?;
4306                }
4307                let val_ref = self.ra_tx_failure.get_or_insert_with(|| fidl::new_empty!(u32, D));
4308                fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
4309                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4310                {
4311                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4312                }
4313                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4314                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4315                }
4316            }
4317
4318            next_offset += envelope_size;
4319            _next_ordinal_to_read += 1;
4320            if next_offset >= end_offset {
4321                return Ok(());
4322            }
4323
4324            // Decode unknown envelopes for gaps in ordinals.
4325            while _next_ordinal_to_read < 12 {
4326                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4327                _next_ordinal_to_read += 1;
4328                next_offset += envelope_size;
4329            }
4330
4331            let next_out_of_line = decoder.next_out_of_line();
4332            let handles_before = decoder.remaining_handles();
4333            if let Some((inlined, num_bytes, num_handles)) =
4334                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4335            {
4336                let member_inline_size =
4337                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4338                if inlined != (member_inline_size <= 4) {
4339                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4340                }
4341                let inner_offset;
4342                let mut inner_depth = depth.clone();
4343                if inlined {
4344                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4345                    inner_offset = next_offset;
4346                } else {
4347                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4348                    inner_depth.increment()?;
4349                }
4350                let val_ref = self.rs_rx.get_or_insert_with(|| fidl::new_empty!(u32, D));
4351                fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
4352                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4353                {
4354                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4355                }
4356                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4357                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4358                }
4359            }
4360
4361            next_offset += envelope_size;
4362            _next_ordinal_to_read += 1;
4363            if next_offset >= end_offset {
4364                return Ok(());
4365            }
4366
4367            // Decode unknown envelopes for gaps in ordinals.
4368            while _next_ordinal_to_read < 13 {
4369                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4370                _next_ordinal_to_read += 1;
4371                next_offset += envelope_size;
4372            }
4373
4374            let next_out_of_line = decoder.next_out_of_line();
4375            let handles_before = decoder.remaining_handles();
4376            if let Some((inlined, num_bytes, num_handles)) =
4377                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4378            {
4379                let member_inline_size =
4380                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4381                if inlined != (member_inline_size <= 4) {
4382                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4383                }
4384                let inner_offset;
4385                let mut inner_depth = depth.clone();
4386                if inlined {
4387                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4388                    inner_offset = next_offset;
4389                } else {
4390                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4391                    inner_depth.increment()?;
4392                }
4393                let val_ref = self.rs_tx_success.get_or_insert_with(|| fidl::new_empty!(u32, D));
4394                fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
4395                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4396                {
4397                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4398                }
4399                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4400                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4401                }
4402            }
4403
4404            next_offset += envelope_size;
4405            _next_ordinal_to_read += 1;
4406            if next_offset >= end_offset {
4407                return Ok(());
4408            }
4409
4410            // Decode unknown envelopes for gaps in ordinals.
4411            while _next_ordinal_to_read < 14 {
4412                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4413                _next_ordinal_to_read += 1;
4414                next_offset += envelope_size;
4415            }
4416
4417            let next_out_of_line = decoder.next_out_of_line();
4418            let handles_before = decoder.remaining_handles();
4419            if let Some((inlined, num_bytes, num_handles)) =
4420                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4421            {
4422                let member_inline_size =
4423                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4424                if inlined != (member_inline_size <= 4) {
4425                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4426                }
4427                let inner_offset;
4428                let mut inner_depth = depth.clone();
4429                if inlined {
4430                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4431                    inner_offset = next_offset;
4432                } else {
4433                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4434                    inner_depth.increment()?;
4435                }
4436                let val_ref = self.rs_tx_failure.get_or_insert_with(|| fidl::new_empty!(u32, D));
4437                fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
4438                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4439                {
4440                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4441                }
4442                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4443                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4444                }
4445            }
4446
4447            next_offset += envelope_size;
4448            _next_ordinal_to_read += 1;
4449            if next_offset >= end_offset {
4450                return Ok(());
4451            }
4452
4453            // Decode unknown envelopes for gaps in ordinals.
4454            while _next_ordinal_to_read < 15 {
4455                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4456                _next_ordinal_to_read += 1;
4457                next_offset += envelope_size;
4458            }
4459
4460            let next_out_of_line = decoder.next_out_of_line();
4461            let handles_before = decoder.remaining_handles();
4462            if let Some((inlined, num_bytes, num_handles)) =
4463                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4464            {
4465                let member_inline_size =
4466                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4467                if inlined != (member_inline_size <= 4) {
4468                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4469                }
4470                let inner_offset;
4471                let mut inner_depth = depth.clone();
4472                if inlined {
4473                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4474                    inner_offset = next_offset;
4475                } else {
4476                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4477                    inner_depth.increment()?;
4478                }
4479                let val_ref =
4480                    self.inbound_internet_packets.get_or_insert_with(|| fidl::new_empty!(u64, D));
4481                fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
4482                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4483                {
4484                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4485                }
4486                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4487                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4488                }
4489            }
4490
4491            next_offset += envelope_size;
4492            _next_ordinal_to_read += 1;
4493            if next_offset >= end_offset {
4494                return Ok(());
4495            }
4496
4497            // Decode unknown envelopes for gaps in ordinals.
4498            while _next_ordinal_to_read < 16 {
4499                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4500                _next_ordinal_to_read += 1;
4501                next_offset += envelope_size;
4502            }
4503
4504            let next_out_of_line = decoder.next_out_of_line();
4505            let handles_before = decoder.remaining_handles();
4506            if let Some((inlined, num_bytes, num_handles)) =
4507                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4508            {
4509                let member_inline_size =
4510                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4511                if inlined != (member_inline_size <= 4) {
4512                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4513                }
4514                let inner_offset;
4515                let mut inner_depth = depth.clone();
4516                if inlined {
4517                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4518                    inner_offset = next_offset;
4519                } else {
4520                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4521                    inner_depth.increment()?;
4522                }
4523                let val_ref =
4524                    self.inbound_internet_bytes.get_or_insert_with(|| fidl::new_empty!(u64, D));
4525                fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
4526                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4527                {
4528                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4529                }
4530                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4531                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4532                }
4533            }
4534
4535            next_offset += envelope_size;
4536            _next_ordinal_to_read += 1;
4537            if next_offset >= end_offset {
4538                return Ok(());
4539            }
4540
4541            // Decode unknown envelopes for gaps in ordinals.
4542            while _next_ordinal_to_read < 17 {
4543                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4544                _next_ordinal_to_read += 1;
4545                next_offset += envelope_size;
4546            }
4547
4548            let next_out_of_line = decoder.next_out_of_line();
4549            let handles_before = decoder.remaining_handles();
4550            if let Some((inlined, num_bytes, num_handles)) =
4551                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4552            {
4553                let member_inline_size =
4554                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4555                if inlined != (member_inline_size <= 4) {
4556                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4557                }
4558                let inner_offset;
4559                let mut inner_depth = depth.clone();
4560                if inlined {
4561                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4562                    inner_offset = next_offset;
4563                } else {
4564                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4565                    inner_depth.increment()?;
4566                }
4567                let val_ref =
4568                    self.outbound_internet_packets.get_or_insert_with(|| fidl::new_empty!(u64, D));
4569                fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
4570                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4571                {
4572                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4573                }
4574                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4575                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4576                }
4577            }
4578
4579            next_offset += envelope_size;
4580            _next_ordinal_to_read += 1;
4581            if next_offset >= end_offset {
4582                return Ok(());
4583            }
4584
4585            // Decode unknown envelopes for gaps in ordinals.
4586            while _next_ordinal_to_read < 18 {
4587                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4588                _next_ordinal_to_read += 1;
4589                next_offset += envelope_size;
4590            }
4591
4592            let next_out_of_line = decoder.next_out_of_line();
4593            let handles_before = decoder.remaining_handles();
4594            if let Some((inlined, num_bytes, num_handles)) =
4595                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4596            {
4597                let member_inline_size =
4598                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4599                if inlined != (member_inline_size <= 4) {
4600                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4601                }
4602                let inner_offset;
4603                let mut inner_depth = depth.clone();
4604                if inlined {
4605                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4606                    inner_offset = next_offset;
4607                } else {
4608                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4609                    inner_depth.increment()?;
4610                }
4611                let val_ref =
4612                    self.outbound_internet_bytes.get_or_insert_with(|| fidl::new_empty!(u64, D));
4613                fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
4614                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4615                {
4616                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4617                }
4618                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4619                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4620                }
4621            }
4622
4623            next_offset += envelope_size;
4624
4625            // Decode the remaining unknown envelopes.
4626            while next_offset < end_offset {
4627                _next_ordinal_to_read += 1;
4628                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4629                next_offset += envelope_size;
4630            }
4631
4632            Ok(())
4633        }
4634    }
4635
4636    impl BorderRoutingNat64State {
4637        #[inline(always)]
4638        fn max_ordinal_present(&self) -> u64 {
4639            if let Some(_) = self.translator_state {
4640                return 2;
4641            }
4642            if let Some(_) = self.prefix_manager_state {
4643                return 1;
4644            }
4645            0
4646        }
4647    }
4648
4649    impl fidl::encoding::ValueTypeMarker for BorderRoutingNat64State {
4650        type Borrowed<'a> = &'a Self;
4651        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4652            value
4653        }
4654    }
4655
4656    unsafe impl fidl::encoding::TypeMarker for BorderRoutingNat64State {
4657        type Owned = Self;
4658
4659        #[inline(always)]
4660        fn inline_align(_context: fidl::encoding::Context) -> usize {
4661            8
4662        }
4663
4664        #[inline(always)]
4665        fn inline_size(_context: fidl::encoding::Context) -> usize {
4666            16
4667        }
4668    }
4669
4670    unsafe impl<D: fidl::encoding::ResourceDialect>
4671        fidl::encoding::Encode<BorderRoutingNat64State, D> for &BorderRoutingNat64State
4672    {
4673        unsafe fn encode(
4674            self,
4675            encoder: &mut fidl::encoding::Encoder<'_, D>,
4676            offset: usize,
4677            mut depth: fidl::encoding::Depth,
4678        ) -> fidl::Result<()> {
4679            encoder.debug_check_bounds::<BorderRoutingNat64State>(offset);
4680            // Vector header
4681            let max_ordinal: u64 = self.max_ordinal_present();
4682            encoder.write_num(max_ordinal, offset);
4683            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
4684            // Calling encoder.out_of_line_offset(0) is not allowed.
4685            if max_ordinal == 0 {
4686                return Ok(());
4687            }
4688            depth.increment()?;
4689            let envelope_size = 8;
4690            let bytes_len = max_ordinal as usize * envelope_size;
4691            #[allow(unused_variables)]
4692            let offset = encoder.out_of_line_offset(bytes_len);
4693            let mut _prev_end_offset: usize = 0;
4694            if 1 > max_ordinal {
4695                return Ok(());
4696            }
4697
4698            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4699            // are envelope_size bytes.
4700            let cur_offset: usize = (1 - 1) * envelope_size;
4701
4702            // Zero reserved fields.
4703            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4704
4705            // Safety:
4706            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4707            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4708            //   envelope_size bytes, there is always sufficient room.
4709            fidl::encoding::encode_in_envelope_optional::<Nat64State, D>(
4710                self.prefix_manager_state
4711                    .as_ref()
4712                    .map(<Nat64State as fidl::encoding::ValueTypeMarker>::borrow),
4713                encoder,
4714                offset + cur_offset,
4715                depth,
4716            )?;
4717
4718            _prev_end_offset = cur_offset + envelope_size;
4719            if 2 > max_ordinal {
4720                return Ok(());
4721            }
4722
4723            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4724            // are envelope_size bytes.
4725            let cur_offset: usize = (2 - 1) * envelope_size;
4726
4727            // Zero reserved fields.
4728            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4729
4730            // Safety:
4731            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4732            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4733            //   envelope_size bytes, there is always sufficient room.
4734            fidl::encoding::encode_in_envelope_optional::<Nat64State, D>(
4735                self.translator_state
4736                    .as_ref()
4737                    .map(<Nat64State as fidl::encoding::ValueTypeMarker>::borrow),
4738                encoder,
4739                offset + cur_offset,
4740                depth,
4741            )?;
4742
4743            _prev_end_offset = cur_offset + envelope_size;
4744
4745            Ok(())
4746        }
4747    }
4748
4749    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
4750        for BorderRoutingNat64State
4751    {
4752        #[inline(always)]
4753        fn new_empty() -> Self {
4754            Self::default()
4755        }
4756
4757        unsafe fn decode(
4758            &mut self,
4759            decoder: &mut fidl::encoding::Decoder<'_, D>,
4760            offset: usize,
4761            mut depth: fidl::encoding::Depth,
4762        ) -> fidl::Result<()> {
4763            decoder.debug_check_bounds::<Self>(offset);
4764            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
4765                None => return Err(fidl::Error::NotNullable),
4766                Some(len) => len,
4767            };
4768            // Calling decoder.out_of_line_offset(0) is not allowed.
4769            if len == 0 {
4770                return Ok(());
4771            };
4772            depth.increment()?;
4773            let envelope_size = 8;
4774            let bytes_len = len * envelope_size;
4775            let offset = decoder.out_of_line_offset(bytes_len)?;
4776            // Decode the envelope for each type.
4777            let mut _next_ordinal_to_read = 0;
4778            let mut next_offset = offset;
4779            let end_offset = offset + bytes_len;
4780            _next_ordinal_to_read += 1;
4781            if next_offset >= end_offset {
4782                return Ok(());
4783            }
4784
4785            // Decode unknown envelopes for gaps in ordinals.
4786            while _next_ordinal_to_read < 1 {
4787                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4788                _next_ordinal_to_read += 1;
4789                next_offset += envelope_size;
4790            }
4791
4792            let next_out_of_line = decoder.next_out_of_line();
4793            let handles_before = decoder.remaining_handles();
4794            if let Some((inlined, num_bytes, num_handles)) =
4795                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4796            {
4797                let member_inline_size =
4798                    <Nat64State as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4799                if inlined != (member_inline_size <= 4) {
4800                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4801                }
4802                let inner_offset;
4803                let mut inner_depth = depth.clone();
4804                if inlined {
4805                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4806                    inner_offset = next_offset;
4807                } else {
4808                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4809                    inner_depth.increment()?;
4810                }
4811                let val_ref = self
4812                    .prefix_manager_state
4813                    .get_or_insert_with(|| fidl::new_empty!(Nat64State, D));
4814                fidl::decode!(Nat64State, D, val_ref, decoder, inner_offset, inner_depth)?;
4815                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4816                {
4817                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4818                }
4819                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4820                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4821                }
4822            }
4823
4824            next_offset += envelope_size;
4825            _next_ordinal_to_read += 1;
4826            if next_offset >= end_offset {
4827                return Ok(());
4828            }
4829
4830            // Decode unknown envelopes for gaps in ordinals.
4831            while _next_ordinal_to_read < 2 {
4832                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4833                _next_ordinal_to_read += 1;
4834                next_offset += envelope_size;
4835            }
4836
4837            let next_out_of_line = decoder.next_out_of_line();
4838            let handles_before = decoder.remaining_handles();
4839            if let Some((inlined, num_bytes, num_handles)) =
4840                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4841            {
4842                let member_inline_size =
4843                    <Nat64State as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4844                if inlined != (member_inline_size <= 4) {
4845                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4846                }
4847                let inner_offset;
4848                let mut inner_depth = depth.clone();
4849                if inlined {
4850                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4851                    inner_offset = next_offset;
4852                } else {
4853                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4854                    inner_depth.increment()?;
4855                }
4856                let val_ref =
4857                    self.translator_state.get_or_insert_with(|| fidl::new_empty!(Nat64State, D));
4858                fidl::decode!(Nat64State, D, val_ref, decoder, inner_offset, inner_depth)?;
4859                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4860                {
4861                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4862                }
4863                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4864                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4865                }
4866            }
4867
4868            next_offset += envelope_size;
4869
4870            // Decode the remaining unknown envelopes.
4871            while next_offset < end_offset {
4872                _next_ordinal_to_read += 1;
4873                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4874                next_offset += envelope_size;
4875            }
4876
4877            Ok(())
4878        }
4879    }
4880
4881    impl ChannelInfo {
4882        #[inline(always)]
4883        fn max_ordinal_present(&self) -> u64 {
4884            if let Some(_) = self.masked_by_regulatory_domain {
4885                return 6;
4886            }
4887            if let Some(_) = self.spectrum_bandwidth_hz {
4888                return 5;
4889            }
4890            if let Some(_) = self.spectrum_center_frequency_hz {
4891                return 4;
4892            }
4893            if let Some(_) = self.max_transmit_power_dbm {
4894                return 3;
4895            }
4896            if let Some(_) = self.id {
4897                return 2;
4898            }
4899            if let Some(_) = self.index {
4900                return 1;
4901            }
4902            0
4903        }
4904    }
4905
4906    impl fidl::encoding::ValueTypeMarker for ChannelInfo {
4907        type Borrowed<'a> = &'a Self;
4908        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4909            value
4910        }
4911    }
4912
4913    unsafe impl fidl::encoding::TypeMarker for ChannelInfo {
4914        type Owned = Self;
4915
4916        #[inline(always)]
4917        fn inline_align(_context: fidl::encoding::Context) -> usize {
4918            8
4919        }
4920
4921        #[inline(always)]
4922        fn inline_size(_context: fidl::encoding::Context) -> usize {
4923            16
4924        }
4925    }
4926
4927    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<ChannelInfo, D>
4928        for &ChannelInfo
4929    {
4930        unsafe fn encode(
4931            self,
4932            encoder: &mut fidl::encoding::Encoder<'_, D>,
4933            offset: usize,
4934            mut depth: fidl::encoding::Depth,
4935        ) -> fidl::Result<()> {
4936            encoder.debug_check_bounds::<ChannelInfo>(offset);
4937            // Vector header
4938            let max_ordinal: u64 = self.max_ordinal_present();
4939            encoder.write_num(max_ordinal, offset);
4940            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
4941            // Calling encoder.out_of_line_offset(0) is not allowed.
4942            if max_ordinal == 0 {
4943                return Ok(());
4944            }
4945            depth.increment()?;
4946            let envelope_size = 8;
4947            let bytes_len = max_ordinal as usize * envelope_size;
4948            #[allow(unused_variables)]
4949            let offset = encoder.out_of_line_offset(bytes_len);
4950            let mut _prev_end_offset: usize = 0;
4951            if 1 > max_ordinal {
4952                return Ok(());
4953            }
4954
4955            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4956            // are envelope_size bytes.
4957            let cur_offset: usize = (1 - 1) * envelope_size;
4958
4959            // Zero reserved fields.
4960            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4961
4962            // Safety:
4963            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4964            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4965            //   envelope_size bytes, there is always sufficient room.
4966            fidl::encoding::encode_in_envelope_optional::<u16, D>(
4967                self.index.as_ref().map(<u16 as fidl::encoding::ValueTypeMarker>::borrow),
4968                encoder,
4969                offset + cur_offset,
4970                depth,
4971            )?;
4972
4973            _prev_end_offset = cur_offset + envelope_size;
4974            if 2 > max_ordinal {
4975                return Ok(());
4976            }
4977
4978            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4979            // are envelope_size bytes.
4980            let cur_offset: usize = (2 - 1) * envelope_size;
4981
4982            // Zero reserved fields.
4983            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4984
4985            // Safety:
4986            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4987            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4988            //   envelope_size bytes, there is always sufficient room.
4989            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<16>, D>(
4990                self.id.as_ref().map(
4991                    <fidl::encoding::BoundedString<16> as fidl::encoding::ValueTypeMarker>::borrow,
4992                ),
4993                encoder,
4994                offset + cur_offset,
4995                depth,
4996            )?;
4997
4998            _prev_end_offset = cur_offset + envelope_size;
4999            if 3 > max_ordinal {
5000                return Ok(());
5001            }
5002
5003            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5004            // are envelope_size bytes.
5005            let cur_offset: usize = (3 - 1) * envelope_size;
5006
5007            // Zero reserved fields.
5008            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5009
5010            // Safety:
5011            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5012            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5013            //   envelope_size bytes, there is always sufficient room.
5014            fidl::encoding::encode_in_envelope_optional::<i8, D>(
5015                self.max_transmit_power_dbm
5016                    .as_ref()
5017                    .map(<i8 as fidl::encoding::ValueTypeMarker>::borrow),
5018                encoder,
5019                offset + cur_offset,
5020                depth,
5021            )?;
5022
5023            _prev_end_offset = cur_offset + envelope_size;
5024            if 4 > max_ordinal {
5025                return Ok(());
5026            }
5027
5028            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5029            // are envelope_size bytes.
5030            let cur_offset: usize = (4 - 1) * envelope_size;
5031
5032            // Zero reserved fields.
5033            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5034
5035            // Safety:
5036            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5037            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5038            //   envelope_size bytes, there is always sufficient room.
5039            fidl::encoding::encode_in_envelope_optional::<u64, D>(
5040                self.spectrum_center_frequency_hz
5041                    .as_ref()
5042                    .map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
5043                encoder,
5044                offset + cur_offset,
5045                depth,
5046            )?;
5047
5048            _prev_end_offset = cur_offset + envelope_size;
5049            if 5 > max_ordinal {
5050                return Ok(());
5051            }
5052
5053            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5054            // are envelope_size bytes.
5055            let cur_offset: usize = (5 - 1) * envelope_size;
5056
5057            // Zero reserved fields.
5058            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5059
5060            // Safety:
5061            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5062            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5063            //   envelope_size bytes, there is always sufficient room.
5064            fidl::encoding::encode_in_envelope_optional::<u64, D>(
5065                self.spectrum_bandwidth_hz
5066                    .as_ref()
5067                    .map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
5068                encoder,
5069                offset + cur_offset,
5070                depth,
5071            )?;
5072
5073            _prev_end_offset = cur_offset + envelope_size;
5074            if 6 > max_ordinal {
5075                return Ok(());
5076            }
5077
5078            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5079            // are envelope_size bytes.
5080            let cur_offset: usize = (6 - 1) * envelope_size;
5081
5082            // Zero reserved fields.
5083            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5084
5085            // Safety:
5086            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5087            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5088            //   envelope_size bytes, there is always sufficient room.
5089            fidl::encoding::encode_in_envelope_optional::<bool, D>(
5090                self.masked_by_regulatory_domain
5091                    .as_ref()
5092                    .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
5093                encoder,
5094                offset + cur_offset,
5095                depth,
5096            )?;
5097
5098            _prev_end_offset = cur_offset + envelope_size;
5099
5100            Ok(())
5101        }
5102    }
5103
5104    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ChannelInfo {
5105        #[inline(always)]
5106        fn new_empty() -> Self {
5107            Self::default()
5108        }
5109
5110        unsafe fn decode(
5111            &mut self,
5112            decoder: &mut fidl::encoding::Decoder<'_, D>,
5113            offset: usize,
5114            mut depth: fidl::encoding::Depth,
5115        ) -> fidl::Result<()> {
5116            decoder.debug_check_bounds::<Self>(offset);
5117            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
5118                None => return Err(fidl::Error::NotNullable),
5119                Some(len) => len,
5120            };
5121            // Calling decoder.out_of_line_offset(0) is not allowed.
5122            if len == 0 {
5123                return Ok(());
5124            };
5125            depth.increment()?;
5126            let envelope_size = 8;
5127            let bytes_len = len * envelope_size;
5128            let offset = decoder.out_of_line_offset(bytes_len)?;
5129            // Decode the envelope for each type.
5130            let mut _next_ordinal_to_read = 0;
5131            let mut next_offset = offset;
5132            let end_offset = offset + bytes_len;
5133            _next_ordinal_to_read += 1;
5134            if next_offset >= end_offset {
5135                return Ok(());
5136            }
5137
5138            // Decode unknown envelopes for gaps in ordinals.
5139            while _next_ordinal_to_read < 1 {
5140                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5141                _next_ordinal_to_read += 1;
5142                next_offset += envelope_size;
5143            }
5144
5145            let next_out_of_line = decoder.next_out_of_line();
5146            let handles_before = decoder.remaining_handles();
5147            if let Some((inlined, num_bytes, num_handles)) =
5148                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5149            {
5150                let member_inline_size =
5151                    <u16 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5152                if inlined != (member_inline_size <= 4) {
5153                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5154                }
5155                let inner_offset;
5156                let mut inner_depth = depth.clone();
5157                if inlined {
5158                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5159                    inner_offset = next_offset;
5160                } else {
5161                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5162                    inner_depth.increment()?;
5163                }
5164                let val_ref = self.index.get_or_insert_with(|| fidl::new_empty!(u16, D));
5165                fidl::decode!(u16, D, val_ref, decoder, inner_offset, inner_depth)?;
5166                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5167                {
5168                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5169                }
5170                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5171                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5172                }
5173            }
5174
5175            next_offset += envelope_size;
5176            _next_ordinal_to_read += 1;
5177            if next_offset >= end_offset {
5178                return Ok(());
5179            }
5180
5181            // Decode unknown envelopes for gaps in ordinals.
5182            while _next_ordinal_to_read < 2 {
5183                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5184                _next_ordinal_to_read += 1;
5185                next_offset += envelope_size;
5186            }
5187
5188            let next_out_of_line = decoder.next_out_of_line();
5189            let handles_before = decoder.remaining_handles();
5190            if let Some((inlined, num_bytes, num_handles)) =
5191                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5192            {
5193                let member_inline_size =
5194                    <fidl::encoding::BoundedString<16> as fidl::encoding::TypeMarker>::inline_size(
5195                        decoder.context,
5196                    );
5197                if inlined != (member_inline_size <= 4) {
5198                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5199                }
5200                let inner_offset;
5201                let mut inner_depth = depth.clone();
5202                if inlined {
5203                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5204                    inner_offset = next_offset;
5205                } else {
5206                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5207                    inner_depth.increment()?;
5208                }
5209                let val_ref = self
5210                    .id
5211                    .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::BoundedString<16>, D));
5212                fidl::decode!(
5213                    fidl::encoding::BoundedString<16>,
5214                    D,
5215                    val_ref,
5216                    decoder,
5217                    inner_offset,
5218                    inner_depth
5219                )?;
5220                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5221                {
5222                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5223                }
5224                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5225                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5226                }
5227            }
5228
5229            next_offset += envelope_size;
5230            _next_ordinal_to_read += 1;
5231            if next_offset >= end_offset {
5232                return Ok(());
5233            }
5234
5235            // Decode unknown envelopes for gaps in ordinals.
5236            while _next_ordinal_to_read < 3 {
5237                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5238                _next_ordinal_to_read += 1;
5239                next_offset += envelope_size;
5240            }
5241
5242            let next_out_of_line = decoder.next_out_of_line();
5243            let handles_before = decoder.remaining_handles();
5244            if let Some((inlined, num_bytes, num_handles)) =
5245                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5246            {
5247                let member_inline_size =
5248                    <i8 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5249                if inlined != (member_inline_size <= 4) {
5250                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5251                }
5252                let inner_offset;
5253                let mut inner_depth = depth.clone();
5254                if inlined {
5255                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5256                    inner_offset = next_offset;
5257                } else {
5258                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5259                    inner_depth.increment()?;
5260                }
5261                let val_ref =
5262                    self.max_transmit_power_dbm.get_or_insert_with(|| fidl::new_empty!(i8, D));
5263                fidl::decode!(i8, D, val_ref, decoder, inner_offset, inner_depth)?;
5264                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5265                {
5266                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5267                }
5268                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5269                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5270                }
5271            }
5272
5273            next_offset += envelope_size;
5274            _next_ordinal_to_read += 1;
5275            if next_offset >= end_offset {
5276                return Ok(());
5277            }
5278
5279            // Decode unknown envelopes for gaps in ordinals.
5280            while _next_ordinal_to_read < 4 {
5281                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5282                _next_ordinal_to_read += 1;
5283                next_offset += envelope_size;
5284            }
5285
5286            let next_out_of_line = decoder.next_out_of_line();
5287            let handles_before = decoder.remaining_handles();
5288            if let Some((inlined, num_bytes, num_handles)) =
5289                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5290            {
5291                let member_inline_size =
5292                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5293                if inlined != (member_inline_size <= 4) {
5294                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5295                }
5296                let inner_offset;
5297                let mut inner_depth = depth.clone();
5298                if inlined {
5299                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5300                    inner_offset = next_offset;
5301                } else {
5302                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5303                    inner_depth.increment()?;
5304                }
5305                let val_ref = self
5306                    .spectrum_center_frequency_hz
5307                    .get_or_insert_with(|| fidl::new_empty!(u64, D));
5308                fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
5309                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5310                {
5311                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5312                }
5313                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5314                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5315                }
5316            }
5317
5318            next_offset += envelope_size;
5319            _next_ordinal_to_read += 1;
5320            if next_offset >= end_offset {
5321                return Ok(());
5322            }
5323
5324            // Decode unknown envelopes for gaps in ordinals.
5325            while _next_ordinal_to_read < 5 {
5326                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5327                _next_ordinal_to_read += 1;
5328                next_offset += envelope_size;
5329            }
5330
5331            let next_out_of_line = decoder.next_out_of_line();
5332            let handles_before = decoder.remaining_handles();
5333            if let Some((inlined, num_bytes, num_handles)) =
5334                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5335            {
5336                let member_inline_size =
5337                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5338                if inlined != (member_inline_size <= 4) {
5339                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5340                }
5341                let inner_offset;
5342                let mut inner_depth = depth.clone();
5343                if inlined {
5344                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5345                    inner_offset = next_offset;
5346                } else {
5347                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5348                    inner_depth.increment()?;
5349                }
5350                let val_ref =
5351                    self.spectrum_bandwidth_hz.get_or_insert_with(|| fidl::new_empty!(u64, D));
5352                fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
5353                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5354                {
5355                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5356                }
5357                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5358                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5359                }
5360            }
5361
5362            next_offset += envelope_size;
5363            _next_ordinal_to_read += 1;
5364            if next_offset >= end_offset {
5365                return Ok(());
5366            }
5367
5368            // Decode unknown envelopes for gaps in ordinals.
5369            while _next_ordinal_to_read < 6 {
5370                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5371                _next_ordinal_to_read += 1;
5372                next_offset += envelope_size;
5373            }
5374
5375            let next_out_of_line = decoder.next_out_of_line();
5376            let handles_before = decoder.remaining_handles();
5377            if let Some((inlined, num_bytes, num_handles)) =
5378                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5379            {
5380                let member_inline_size =
5381                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5382                if inlined != (member_inline_size <= 4) {
5383                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5384                }
5385                let inner_offset;
5386                let mut inner_depth = depth.clone();
5387                if inlined {
5388                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5389                    inner_offset = next_offset;
5390                } else {
5391                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5392                    inner_depth.increment()?;
5393                }
5394                let val_ref = self
5395                    .masked_by_regulatory_domain
5396                    .get_or_insert_with(|| fidl::new_empty!(bool, D));
5397                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
5398                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5399                {
5400                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5401                }
5402                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5403                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5404                }
5405            }
5406
5407            next_offset += envelope_size;
5408
5409            // Decode the remaining unknown envelopes.
5410            while next_offset < end_offset {
5411                _next_ordinal_to_read += 1;
5412                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5413                next_offset += envelope_size;
5414            }
5415
5416            Ok(())
5417        }
5418    }
5419
5420    impl Dhcp6PdInfo {
5421        #[inline(always)]
5422        fn max_ordinal_present(&self) -> u64 {
5423            if let Some(_) = self.hashed_pd_prefix {
5424                return 3;
5425            }
5426            if let Some(_) = self.pd_processed_ra_info {
5427                return 2;
5428            }
5429            if let Some(_) = self.dhcp6pd_state {
5430                return 1;
5431            }
5432            0
5433        }
5434    }
5435
5436    impl fidl::encoding::ValueTypeMarker for Dhcp6PdInfo {
5437        type Borrowed<'a> = &'a Self;
5438        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
5439            value
5440        }
5441    }
5442
5443    unsafe impl fidl::encoding::TypeMarker for Dhcp6PdInfo {
5444        type Owned = Self;
5445
5446        #[inline(always)]
5447        fn inline_align(_context: fidl::encoding::Context) -> usize {
5448            8
5449        }
5450
5451        #[inline(always)]
5452        fn inline_size(_context: fidl::encoding::Context) -> usize {
5453            16
5454        }
5455    }
5456
5457    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Dhcp6PdInfo, D>
5458        for &Dhcp6PdInfo
5459    {
5460        unsafe fn encode(
5461            self,
5462            encoder: &mut fidl::encoding::Encoder<'_, D>,
5463            offset: usize,
5464            mut depth: fidl::encoding::Depth,
5465        ) -> fidl::Result<()> {
5466            encoder.debug_check_bounds::<Dhcp6PdInfo>(offset);
5467            // Vector header
5468            let max_ordinal: u64 = self.max_ordinal_present();
5469            encoder.write_num(max_ordinal, offset);
5470            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
5471            // Calling encoder.out_of_line_offset(0) is not allowed.
5472            if max_ordinal == 0 {
5473                return Ok(());
5474            }
5475            depth.increment()?;
5476            let envelope_size = 8;
5477            let bytes_len = max_ordinal as usize * envelope_size;
5478            #[allow(unused_variables)]
5479            let offset = encoder.out_of_line_offset(bytes_len);
5480            let mut _prev_end_offset: usize = 0;
5481            if 1 > max_ordinal {
5482                return Ok(());
5483            }
5484
5485            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5486            // are envelope_size bytes.
5487            let cur_offset: usize = (1 - 1) * envelope_size;
5488
5489            // Zero reserved fields.
5490            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5491
5492            // Safety:
5493            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5494            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5495            //   envelope_size bytes, there is always sufficient room.
5496            fidl::encoding::encode_in_envelope_optional::<Dhcp6PdState, D>(
5497                self.dhcp6pd_state
5498                    .as_ref()
5499                    .map(<Dhcp6PdState as fidl::encoding::ValueTypeMarker>::borrow),
5500                encoder,
5501                offset + cur_offset,
5502                depth,
5503            )?;
5504
5505            _prev_end_offset = cur_offset + envelope_size;
5506            if 2 > max_ordinal {
5507                return Ok(());
5508            }
5509
5510            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5511            // are envelope_size bytes.
5512            let cur_offset: usize = (2 - 1) * envelope_size;
5513
5514            // Zero reserved fields.
5515            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5516
5517            // Safety:
5518            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5519            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5520            //   envelope_size bytes, there is always sufficient room.
5521            fidl::encoding::encode_in_envelope_optional::<PdProcessedRaInfo, D>(
5522                self.pd_processed_ra_info
5523                    .as_ref()
5524                    .map(<PdProcessedRaInfo as fidl::encoding::ValueTypeMarker>::borrow),
5525                encoder,
5526                offset + cur_offset,
5527                depth,
5528            )?;
5529
5530            _prev_end_offset = cur_offset + envelope_size;
5531            if 3 > max_ordinal {
5532                return Ok(());
5533            }
5534
5535            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5536            // are envelope_size bytes.
5537            let cur_offset: usize = (3 - 1) * envelope_size;
5538
5539            // Zero reserved fields.
5540            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5541
5542            // Safety:
5543            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5544            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5545            //   envelope_size bytes, there is always sufficient room.
5546            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<u8, 32>, D>(
5547                self.hashed_pd_prefix.as_ref().map(
5548                    <fidl::encoding::Vector<u8, 32> as fidl::encoding::ValueTypeMarker>::borrow,
5549                ),
5550                encoder,
5551                offset + cur_offset,
5552                depth,
5553            )?;
5554
5555            _prev_end_offset = cur_offset + envelope_size;
5556
5557            Ok(())
5558        }
5559    }
5560
5561    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Dhcp6PdInfo {
5562        #[inline(always)]
5563        fn new_empty() -> Self {
5564            Self::default()
5565        }
5566
5567        unsafe fn decode(
5568            &mut self,
5569            decoder: &mut fidl::encoding::Decoder<'_, D>,
5570            offset: usize,
5571            mut depth: fidl::encoding::Depth,
5572        ) -> fidl::Result<()> {
5573            decoder.debug_check_bounds::<Self>(offset);
5574            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
5575                None => return Err(fidl::Error::NotNullable),
5576                Some(len) => len,
5577            };
5578            // Calling decoder.out_of_line_offset(0) is not allowed.
5579            if len == 0 {
5580                return Ok(());
5581            };
5582            depth.increment()?;
5583            let envelope_size = 8;
5584            let bytes_len = len * envelope_size;
5585            let offset = decoder.out_of_line_offset(bytes_len)?;
5586            // Decode the envelope for each type.
5587            let mut _next_ordinal_to_read = 0;
5588            let mut next_offset = offset;
5589            let end_offset = offset + bytes_len;
5590            _next_ordinal_to_read += 1;
5591            if next_offset >= end_offset {
5592                return Ok(());
5593            }
5594
5595            // Decode unknown envelopes for gaps in ordinals.
5596            while _next_ordinal_to_read < 1 {
5597                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5598                _next_ordinal_to_read += 1;
5599                next_offset += envelope_size;
5600            }
5601
5602            let next_out_of_line = decoder.next_out_of_line();
5603            let handles_before = decoder.remaining_handles();
5604            if let Some((inlined, num_bytes, num_handles)) =
5605                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5606            {
5607                let member_inline_size =
5608                    <Dhcp6PdState as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5609                if inlined != (member_inline_size <= 4) {
5610                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5611                }
5612                let inner_offset;
5613                let mut inner_depth = depth.clone();
5614                if inlined {
5615                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5616                    inner_offset = next_offset;
5617                } else {
5618                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5619                    inner_depth.increment()?;
5620                }
5621                let val_ref =
5622                    self.dhcp6pd_state.get_or_insert_with(|| fidl::new_empty!(Dhcp6PdState, D));
5623                fidl::decode!(Dhcp6PdState, D, val_ref, decoder, inner_offset, inner_depth)?;
5624                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5625                {
5626                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5627                }
5628                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5629                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5630                }
5631            }
5632
5633            next_offset += envelope_size;
5634            _next_ordinal_to_read += 1;
5635            if next_offset >= end_offset {
5636                return Ok(());
5637            }
5638
5639            // Decode unknown envelopes for gaps in ordinals.
5640            while _next_ordinal_to_read < 2 {
5641                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5642                _next_ordinal_to_read += 1;
5643                next_offset += envelope_size;
5644            }
5645
5646            let next_out_of_line = decoder.next_out_of_line();
5647            let handles_before = decoder.remaining_handles();
5648            if let Some((inlined, num_bytes, num_handles)) =
5649                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5650            {
5651                let member_inline_size =
5652                    <PdProcessedRaInfo as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5653                if inlined != (member_inline_size <= 4) {
5654                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5655                }
5656                let inner_offset;
5657                let mut inner_depth = depth.clone();
5658                if inlined {
5659                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5660                    inner_offset = next_offset;
5661                } else {
5662                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5663                    inner_depth.increment()?;
5664                }
5665                let val_ref = self
5666                    .pd_processed_ra_info
5667                    .get_or_insert_with(|| fidl::new_empty!(PdProcessedRaInfo, D));
5668                fidl::decode!(PdProcessedRaInfo, D, val_ref, decoder, inner_offset, inner_depth)?;
5669                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5670                {
5671                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5672                }
5673                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5674                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5675                }
5676            }
5677
5678            next_offset += envelope_size;
5679            _next_ordinal_to_read += 1;
5680            if next_offset >= end_offset {
5681                return Ok(());
5682            }
5683
5684            // Decode unknown envelopes for gaps in ordinals.
5685            while _next_ordinal_to_read < 3 {
5686                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5687                _next_ordinal_to_read += 1;
5688                next_offset += envelope_size;
5689            }
5690
5691            let next_out_of_line = decoder.next_out_of_line();
5692            let handles_before = decoder.remaining_handles();
5693            if let Some((inlined, num_bytes, num_handles)) =
5694                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5695            {
5696                let member_inline_size =
5697                    <fidl::encoding::Vector<u8, 32> as fidl::encoding::TypeMarker>::inline_size(
5698                        decoder.context,
5699                    );
5700                if inlined != (member_inline_size <= 4) {
5701                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5702                }
5703                let inner_offset;
5704                let mut inner_depth = depth.clone();
5705                if inlined {
5706                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5707                    inner_offset = next_offset;
5708                } else {
5709                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5710                    inner_depth.increment()?;
5711                }
5712                let val_ref = self
5713                    .hashed_pd_prefix
5714                    .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<u8, 32>, D));
5715                fidl::decode!(fidl::encoding::Vector<u8, 32>, D, val_ref, decoder, inner_offset, inner_depth)?;
5716                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5717                {
5718                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5719                }
5720                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5721                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5722                }
5723            }
5724
5725            next_offset += envelope_size;
5726
5727            // Decode the remaining unknown envelopes.
5728            while next_offset < end_offset {
5729                _next_ordinal_to_read += 1;
5730                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5731                next_offset += envelope_size;
5732            }
5733
5734            Ok(())
5735        }
5736    }
5737
5738    impl DnssdCounters {
5739        #[inline(always)]
5740        fn max_ordinal_present(&self) -> u64 {
5741            if let Some(_) = self.upstream_dns_counters {
5742                return 8;
5743            }
5744            if let Some(_) = self.resolved_by_srp {
5745                return 7;
5746            }
5747            if let Some(_) = self.other_response {
5748                return 6;
5749            }
5750            if let Some(_) = self.not_implemented_response {
5751                return 5;
5752            }
5753            if let Some(_) = self.name_error_response {
5754                return 4;
5755            }
5756            if let Some(_) = self.format_error_response {
5757                return 3;
5758            }
5759            if let Some(_) = self.server_failure_response {
5760                return 2;
5761            }
5762            if let Some(_) = self.success_response {
5763                return 1;
5764            }
5765            0
5766        }
5767    }
5768
5769    impl fidl::encoding::ValueTypeMarker for DnssdCounters {
5770        type Borrowed<'a> = &'a Self;
5771        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
5772            value
5773        }
5774    }
5775
5776    unsafe impl fidl::encoding::TypeMarker for DnssdCounters {
5777        type Owned = Self;
5778
5779        #[inline(always)]
5780        fn inline_align(_context: fidl::encoding::Context) -> usize {
5781            8
5782        }
5783
5784        #[inline(always)]
5785        fn inline_size(_context: fidl::encoding::Context) -> usize {
5786            16
5787        }
5788    }
5789
5790    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<DnssdCounters, D>
5791        for &DnssdCounters
5792    {
5793        unsafe fn encode(
5794            self,
5795            encoder: &mut fidl::encoding::Encoder<'_, D>,
5796            offset: usize,
5797            mut depth: fidl::encoding::Depth,
5798        ) -> fidl::Result<()> {
5799            encoder.debug_check_bounds::<DnssdCounters>(offset);
5800            // Vector header
5801            let max_ordinal: u64 = self.max_ordinal_present();
5802            encoder.write_num(max_ordinal, offset);
5803            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
5804            // Calling encoder.out_of_line_offset(0) is not allowed.
5805            if max_ordinal == 0 {
5806                return Ok(());
5807            }
5808            depth.increment()?;
5809            let envelope_size = 8;
5810            let bytes_len = max_ordinal as usize * envelope_size;
5811            #[allow(unused_variables)]
5812            let offset = encoder.out_of_line_offset(bytes_len);
5813            let mut _prev_end_offset: usize = 0;
5814            if 1 > max_ordinal {
5815                return Ok(());
5816            }
5817
5818            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5819            // are envelope_size bytes.
5820            let cur_offset: usize = (1 - 1) * envelope_size;
5821
5822            // Zero reserved fields.
5823            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5824
5825            // Safety:
5826            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5827            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5828            //   envelope_size bytes, there is always sufficient room.
5829            fidl::encoding::encode_in_envelope_optional::<u32, D>(
5830                self.success_response
5831                    .as_ref()
5832                    .map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
5833                encoder,
5834                offset + cur_offset,
5835                depth,
5836            )?;
5837
5838            _prev_end_offset = cur_offset + envelope_size;
5839            if 2 > max_ordinal {
5840                return Ok(());
5841            }
5842
5843            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5844            // are envelope_size bytes.
5845            let cur_offset: usize = (2 - 1) * envelope_size;
5846
5847            // Zero reserved fields.
5848            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5849
5850            // Safety:
5851            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5852            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5853            //   envelope_size bytes, there is always sufficient room.
5854            fidl::encoding::encode_in_envelope_optional::<u32, D>(
5855                self.server_failure_response
5856                    .as_ref()
5857                    .map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
5858                encoder,
5859                offset + cur_offset,
5860                depth,
5861            )?;
5862
5863            _prev_end_offset = cur_offset + envelope_size;
5864            if 3 > max_ordinal {
5865                return Ok(());
5866            }
5867
5868            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5869            // are envelope_size bytes.
5870            let cur_offset: usize = (3 - 1) * envelope_size;
5871
5872            // Zero reserved fields.
5873            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5874
5875            // Safety:
5876            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5877            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5878            //   envelope_size bytes, there is always sufficient room.
5879            fidl::encoding::encode_in_envelope_optional::<u32, D>(
5880                self.format_error_response
5881                    .as_ref()
5882                    .map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
5883                encoder,
5884                offset + cur_offset,
5885                depth,
5886            )?;
5887
5888            _prev_end_offset = cur_offset + envelope_size;
5889            if 4 > max_ordinal {
5890                return Ok(());
5891            }
5892
5893            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5894            // are envelope_size bytes.
5895            let cur_offset: usize = (4 - 1) * envelope_size;
5896
5897            // Zero reserved fields.
5898            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5899
5900            // Safety:
5901            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5902            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5903            //   envelope_size bytes, there is always sufficient room.
5904            fidl::encoding::encode_in_envelope_optional::<u32, D>(
5905                self.name_error_response
5906                    .as_ref()
5907                    .map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
5908                encoder,
5909                offset + cur_offset,
5910                depth,
5911            )?;
5912
5913            _prev_end_offset = cur_offset + envelope_size;
5914            if 5 > max_ordinal {
5915                return Ok(());
5916            }
5917
5918            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5919            // are envelope_size bytes.
5920            let cur_offset: usize = (5 - 1) * envelope_size;
5921
5922            // Zero reserved fields.
5923            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5924
5925            // Safety:
5926            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5927            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5928            //   envelope_size bytes, there is always sufficient room.
5929            fidl::encoding::encode_in_envelope_optional::<u32, D>(
5930                self.not_implemented_response
5931                    .as_ref()
5932                    .map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
5933                encoder,
5934                offset + cur_offset,
5935                depth,
5936            )?;
5937
5938            _prev_end_offset = cur_offset + envelope_size;
5939            if 6 > max_ordinal {
5940                return Ok(());
5941            }
5942
5943            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5944            // are envelope_size bytes.
5945            let cur_offset: usize = (6 - 1) * envelope_size;
5946
5947            // Zero reserved fields.
5948            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5949
5950            // Safety:
5951            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5952            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5953            //   envelope_size bytes, there is always sufficient room.
5954            fidl::encoding::encode_in_envelope_optional::<u32, D>(
5955                self.other_response.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
5956                encoder,
5957                offset + cur_offset,
5958                depth,
5959            )?;
5960
5961            _prev_end_offset = cur_offset + envelope_size;
5962            if 7 > max_ordinal {
5963                return Ok(());
5964            }
5965
5966            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5967            // are envelope_size bytes.
5968            let cur_offset: usize = (7 - 1) * envelope_size;
5969
5970            // Zero reserved fields.
5971            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5972
5973            // Safety:
5974            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5975            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5976            //   envelope_size bytes, there is always sufficient room.
5977            fidl::encoding::encode_in_envelope_optional::<u32, D>(
5978                self.resolved_by_srp.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
5979                encoder,
5980                offset + cur_offset,
5981                depth,
5982            )?;
5983
5984            _prev_end_offset = cur_offset + envelope_size;
5985            if 8 > max_ordinal {
5986                return Ok(());
5987            }
5988
5989            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5990            // are envelope_size bytes.
5991            let cur_offset: usize = (8 - 1) * envelope_size;
5992
5993            // Zero reserved fields.
5994            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5995
5996            // Safety:
5997            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5998            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5999            //   envelope_size bytes, there is always sufficient room.
6000            fidl::encoding::encode_in_envelope_optional::<UpstreamDnsCounters, D>(
6001                self.upstream_dns_counters
6002                    .as_ref()
6003                    .map(<UpstreamDnsCounters as fidl::encoding::ValueTypeMarker>::borrow),
6004                encoder,
6005                offset + cur_offset,
6006                depth,
6007            )?;
6008
6009            _prev_end_offset = cur_offset + envelope_size;
6010
6011            Ok(())
6012        }
6013    }
6014
6015    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for DnssdCounters {
6016        #[inline(always)]
6017        fn new_empty() -> Self {
6018            Self::default()
6019        }
6020
6021        unsafe fn decode(
6022            &mut self,
6023            decoder: &mut fidl::encoding::Decoder<'_, D>,
6024            offset: usize,
6025            mut depth: fidl::encoding::Depth,
6026        ) -> fidl::Result<()> {
6027            decoder.debug_check_bounds::<Self>(offset);
6028            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
6029                None => return Err(fidl::Error::NotNullable),
6030                Some(len) => len,
6031            };
6032            // Calling decoder.out_of_line_offset(0) is not allowed.
6033            if len == 0 {
6034                return Ok(());
6035            };
6036            depth.increment()?;
6037            let envelope_size = 8;
6038            let bytes_len = len * envelope_size;
6039            let offset = decoder.out_of_line_offset(bytes_len)?;
6040            // Decode the envelope for each type.
6041            let mut _next_ordinal_to_read = 0;
6042            let mut next_offset = offset;
6043            let end_offset = offset + bytes_len;
6044            _next_ordinal_to_read += 1;
6045            if next_offset >= end_offset {
6046                return Ok(());
6047            }
6048
6049            // Decode unknown envelopes for gaps in ordinals.
6050            while _next_ordinal_to_read < 1 {
6051                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6052                _next_ordinal_to_read += 1;
6053                next_offset += envelope_size;
6054            }
6055
6056            let next_out_of_line = decoder.next_out_of_line();
6057            let handles_before = decoder.remaining_handles();
6058            if let Some((inlined, num_bytes, num_handles)) =
6059                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6060            {
6061                let member_inline_size =
6062                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
6063                if inlined != (member_inline_size <= 4) {
6064                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6065                }
6066                let inner_offset;
6067                let mut inner_depth = depth.clone();
6068                if inlined {
6069                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6070                    inner_offset = next_offset;
6071                } else {
6072                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6073                    inner_depth.increment()?;
6074                }
6075                let val_ref = self.success_response.get_or_insert_with(|| fidl::new_empty!(u32, D));
6076                fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
6077                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6078                {
6079                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6080                }
6081                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6082                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6083                }
6084            }
6085
6086            next_offset += envelope_size;
6087            _next_ordinal_to_read += 1;
6088            if next_offset >= end_offset {
6089                return Ok(());
6090            }
6091
6092            // Decode unknown envelopes for gaps in ordinals.
6093            while _next_ordinal_to_read < 2 {
6094                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6095                _next_ordinal_to_read += 1;
6096                next_offset += envelope_size;
6097            }
6098
6099            let next_out_of_line = decoder.next_out_of_line();
6100            let handles_before = decoder.remaining_handles();
6101            if let Some((inlined, num_bytes, num_handles)) =
6102                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6103            {
6104                let member_inline_size =
6105                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
6106                if inlined != (member_inline_size <= 4) {
6107                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6108                }
6109                let inner_offset;
6110                let mut inner_depth = depth.clone();
6111                if inlined {
6112                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6113                    inner_offset = next_offset;
6114                } else {
6115                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6116                    inner_depth.increment()?;
6117                }
6118                let val_ref =
6119                    self.server_failure_response.get_or_insert_with(|| fidl::new_empty!(u32, D));
6120                fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
6121                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6122                {
6123                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6124                }
6125                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6126                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6127                }
6128            }
6129
6130            next_offset += envelope_size;
6131            _next_ordinal_to_read += 1;
6132            if next_offset >= end_offset {
6133                return Ok(());
6134            }
6135
6136            // Decode unknown envelopes for gaps in ordinals.
6137            while _next_ordinal_to_read < 3 {
6138                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6139                _next_ordinal_to_read += 1;
6140                next_offset += envelope_size;
6141            }
6142
6143            let next_out_of_line = decoder.next_out_of_line();
6144            let handles_before = decoder.remaining_handles();
6145            if let Some((inlined, num_bytes, num_handles)) =
6146                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6147            {
6148                let member_inline_size =
6149                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
6150                if inlined != (member_inline_size <= 4) {
6151                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6152                }
6153                let inner_offset;
6154                let mut inner_depth = depth.clone();
6155                if inlined {
6156                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6157                    inner_offset = next_offset;
6158                } else {
6159                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6160                    inner_depth.increment()?;
6161                }
6162                let val_ref =
6163                    self.format_error_response.get_or_insert_with(|| fidl::new_empty!(u32, D));
6164                fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
6165                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6166                {
6167                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6168                }
6169                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6170                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6171                }
6172            }
6173
6174            next_offset += envelope_size;
6175            _next_ordinal_to_read += 1;
6176            if next_offset >= end_offset {
6177                return Ok(());
6178            }
6179
6180            // Decode unknown envelopes for gaps in ordinals.
6181            while _next_ordinal_to_read < 4 {
6182                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6183                _next_ordinal_to_read += 1;
6184                next_offset += envelope_size;
6185            }
6186
6187            let next_out_of_line = decoder.next_out_of_line();
6188            let handles_before = decoder.remaining_handles();
6189            if let Some((inlined, num_bytes, num_handles)) =
6190                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6191            {
6192                let member_inline_size =
6193                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
6194                if inlined != (member_inline_size <= 4) {
6195                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6196                }
6197                let inner_offset;
6198                let mut inner_depth = depth.clone();
6199                if inlined {
6200                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6201                    inner_offset = next_offset;
6202                } else {
6203                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6204                    inner_depth.increment()?;
6205                }
6206                let val_ref =
6207                    self.name_error_response.get_or_insert_with(|| fidl::new_empty!(u32, D));
6208                fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
6209                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6210                {
6211                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6212                }
6213                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6214                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6215                }
6216            }
6217
6218            next_offset += envelope_size;
6219            _next_ordinal_to_read += 1;
6220            if next_offset >= end_offset {
6221                return Ok(());
6222            }
6223
6224            // Decode unknown envelopes for gaps in ordinals.
6225            while _next_ordinal_to_read < 5 {
6226                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6227                _next_ordinal_to_read += 1;
6228                next_offset += envelope_size;
6229            }
6230
6231            let next_out_of_line = decoder.next_out_of_line();
6232            let handles_before = decoder.remaining_handles();
6233            if let Some((inlined, num_bytes, num_handles)) =
6234                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6235            {
6236                let member_inline_size =
6237                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
6238                if inlined != (member_inline_size <= 4) {
6239                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6240                }
6241                let inner_offset;
6242                let mut inner_depth = depth.clone();
6243                if inlined {
6244                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6245                    inner_offset = next_offset;
6246                } else {
6247                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6248                    inner_depth.increment()?;
6249                }
6250                let val_ref =
6251                    self.not_implemented_response.get_or_insert_with(|| fidl::new_empty!(u32, D));
6252                fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
6253                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6254                {
6255                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6256                }
6257                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6258                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6259                }
6260            }
6261
6262            next_offset += envelope_size;
6263            _next_ordinal_to_read += 1;
6264            if next_offset >= end_offset {
6265                return Ok(());
6266            }
6267
6268            // Decode unknown envelopes for gaps in ordinals.
6269            while _next_ordinal_to_read < 6 {
6270                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6271                _next_ordinal_to_read += 1;
6272                next_offset += envelope_size;
6273            }
6274
6275            let next_out_of_line = decoder.next_out_of_line();
6276            let handles_before = decoder.remaining_handles();
6277            if let Some((inlined, num_bytes, num_handles)) =
6278                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6279            {
6280                let member_inline_size =
6281                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
6282                if inlined != (member_inline_size <= 4) {
6283                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6284                }
6285                let inner_offset;
6286                let mut inner_depth = depth.clone();
6287                if inlined {
6288                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6289                    inner_offset = next_offset;
6290                } else {
6291                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6292                    inner_depth.increment()?;
6293                }
6294                let val_ref = self.other_response.get_or_insert_with(|| fidl::new_empty!(u32, D));
6295                fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
6296                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6297                {
6298                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6299                }
6300                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6301                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6302                }
6303            }
6304
6305            next_offset += envelope_size;
6306            _next_ordinal_to_read += 1;
6307            if next_offset >= end_offset {
6308                return Ok(());
6309            }
6310
6311            // Decode unknown envelopes for gaps in ordinals.
6312            while _next_ordinal_to_read < 7 {
6313                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6314                _next_ordinal_to_read += 1;
6315                next_offset += envelope_size;
6316            }
6317
6318            let next_out_of_line = decoder.next_out_of_line();
6319            let handles_before = decoder.remaining_handles();
6320            if let Some((inlined, num_bytes, num_handles)) =
6321                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6322            {
6323                let member_inline_size =
6324                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
6325                if inlined != (member_inline_size <= 4) {
6326                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6327                }
6328                let inner_offset;
6329                let mut inner_depth = depth.clone();
6330                if inlined {
6331                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6332                    inner_offset = next_offset;
6333                } else {
6334                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6335                    inner_depth.increment()?;
6336                }
6337                let val_ref = self.resolved_by_srp.get_or_insert_with(|| fidl::new_empty!(u32, D));
6338                fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
6339                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6340                {
6341                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6342                }
6343                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6344                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6345                }
6346            }
6347
6348            next_offset += envelope_size;
6349            _next_ordinal_to_read += 1;
6350            if next_offset >= end_offset {
6351                return Ok(());
6352            }
6353
6354            // Decode unknown envelopes for gaps in ordinals.
6355            while _next_ordinal_to_read < 8 {
6356                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6357                _next_ordinal_to_read += 1;
6358                next_offset += envelope_size;
6359            }
6360
6361            let next_out_of_line = decoder.next_out_of_line();
6362            let handles_before = decoder.remaining_handles();
6363            if let Some((inlined, num_bytes, num_handles)) =
6364                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6365            {
6366                let member_inline_size =
6367                    <UpstreamDnsCounters as fidl::encoding::TypeMarker>::inline_size(
6368                        decoder.context,
6369                    );
6370                if inlined != (member_inline_size <= 4) {
6371                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6372                }
6373                let inner_offset;
6374                let mut inner_depth = depth.clone();
6375                if inlined {
6376                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6377                    inner_offset = next_offset;
6378                } else {
6379                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6380                    inner_depth.increment()?;
6381                }
6382                let val_ref = self
6383                    .upstream_dns_counters
6384                    .get_or_insert_with(|| fidl::new_empty!(UpstreamDnsCounters, D));
6385                fidl::decode!(UpstreamDnsCounters, D, val_ref, decoder, inner_offset, inner_depth)?;
6386                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6387                {
6388                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6389                }
6390                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6391                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6392                }
6393            }
6394
6395            next_offset += envelope_size;
6396
6397            // Decode the remaining unknown envelopes.
6398            while next_offset < end_offset {
6399                _next_ordinal_to_read += 1;
6400                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6401                next_offset += envelope_size;
6402            }
6403
6404            Ok(())
6405        }
6406    }
6407
6408    impl ExternalRoute {
6409        #[inline(always)]
6410        fn max_ordinal_present(&self) -> u64 {
6411            if let Some(_) = self.stable {
6412                return 3;
6413            }
6414            if let Some(_) = self.route_preference {
6415                return 2;
6416            }
6417            if let Some(_) = self.subnet {
6418                return 1;
6419            }
6420            0
6421        }
6422    }
6423
6424    impl fidl::encoding::ValueTypeMarker for ExternalRoute {
6425        type Borrowed<'a> = &'a Self;
6426        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
6427            value
6428        }
6429    }
6430
6431    unsafe impl fidl::encoding::TypeMarker for ExternalRoute {
6432        type Owned = Self;
6433
6434        #[inline(always)]
6435        fn inline_align(_context: fidl::encoding::Context) -> usize {
6436            8
6437        }
6438
6439        #[inline(always)]
6440        fn inline_size(_context: fidl::encoding::Context) -> usize {
6441            16
6442        }
6443    }
6444
6445    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<ExternalRoute, D>
6446        for &ExternalRoute
6447    {
6448        unsafe fn encode(
6449            self,
6450            encoder: &mut fidl::encoding::Encoder<'_, D>,
6451            offset: usize,
6452            mut depth: fidl::encoding::Depth,
6453        ) -> fidl::Result<()> {
6454            encoder.debug_check_bounds::<ExternalRoute>(offset);
6455            // Vector header
6456            let max_ordinal: u64 = self.max_ordinal_present();
6457            encoder.write_num(max_ordinal, offset);
6458            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
6459            // Calling encoder.out_of_line_offset(0) is not allowed.
6460            if max_ordinal == 0 {
6461                return Ok(());
6462            }
6463            depth.increment()?;
6464            let envelope_size = 8;
6465            let bytes_len = max_ordinal as usize * envelope_size;
6466            #[allow(unused_variables)]
6467            let offset = encoder.out_of_line_offset(bytes_len);
6468            let mut _prev_end_offset: usize = 0;
6469            if 1 > max_ordinal {
6470                return Ok(());
6471            }
6472
6473            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
6474            // are envelope_size bytes.
6475            let cur_offset: usize = (1 - 1) * envelope_size;
6476
6477            // Zero reserved fields.
6478            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6479
6480            // Safety:
6481            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
6482            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
6483            //   envelope_size bytes, there is always sufficient room.
6484            fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_net::Ipv6AddressWithPrefix, D>(
6485            self.subnet.as_ref().map(<fidl_fuchsia_net::Ipv6AddressWithPrefix as fidl::encoding::ValueTypeMarker>::borrow),
6486            encoder, offset + cur_offset, depth
6487        )?;
6488
6489            _prev_end_offset = cur_offset + envelope_size;
6490            if 2 > max_ordinal {
6491                return Ok(());
6492            }
6493
6494            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
6495            // are envelope_size bytes.
6496            let cur_offset: usize = (2 - 1) * envelope_size;
6497
6498            // Zero reserved fields.
6499            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6500
6501            // Safety:
6502            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
6503            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
6504            //   envelope_size bytes, there is always sufficient room.
6505            fidl::encoding::encode_in_envelope_optional::<RoutePreference, D>(
6506                self.route_preference
6507                    .as_ref()
6508                    .map(<RoutePreference as fidl::encoding::ValueTypeMarker>::borrow),
6509                encoder,
6510                offset + cur_offset,
6511                depth,
6512            )?;
6513
6514            _prev_end_offset = cur_offset + envelope_size;
6515            if 3 > max_ordinal {
6516                return Ok(());
6517            }
6518
6519            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
6520            // are envelope_size bytes.
6521            let cur_offset: usize = (3 - 1) * envelope_size;
6522
6523            // Zero reserved fields.
6524            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6525
6526            // Safety:
6527            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
6528            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
6529            //   envelope_size bytes, there is always sufficient room.
6530            fidl::encoding::encode_in_envelope_optional::<bool, D>(
6531                self.stable.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
6532                encoder,
6533                offset + cur_offset,
6534                depth,
6535            )?;
6536
6537            _prev_end_offset = cur_offset + envelope_size;
6538
6539            Ok(())
6540        }
6541    }
6542
6543    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ExternalRoute {
6544        #[inline(always)]
6545        fn new_empty() -> Self {
6546            Self::default()
6547        }
6548
6549        unsafe fn decode(
6550            &mut self,
6551            decoder: &mut fidl::encoding::Decoder<'_, D>,
6552            offset: usize,
6553            mut depth: fidl::encoding::Depth,
6554        ) -> fidl::Result<()> {
6555            decoder.debug_check_bounds::<Self>(offset);
6556            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
6557                None => return Err(fidl::Error::NotNullable),
6558                Some(len) => len,
6559            };
6560            // Calling decoder.out_of_line_offset(0) is not allowed.
6561            if len == 0 {
6562                return Ok(());
6563            };
6564            depth.increment()?;
6565            let envelope_size = 8;
6566            let bytes_len = len * envelope_size;
6567            let offset = decoder.out_of_line_offset(bytes_len)?;
6568            // Decode the envelope for each type.
6569            let mut _next_ordinal_to_read = 0;
6570            let mut next_offset = offset;
6571            let end_offset = offset + bytes_len;
6572            _next_ordinal_to_read += 1;
6573            if next_offset >= end_offset {
6574                return Ok(());
6575            }
6576
6577            // Decode unknown envelopes for gaps in ordinals.
6578            while _next_ordinal_to_read < 1 {
6579                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6580                _next_ordinal_to_read += 1;
6581                next_offset += envelope_size;
6582            }
6583
6584            let next_out_of_line = decoder.next_out_of_line();
6585            let handles_before = decoder.remaining_handles();
6586            if let Some((inlined, num_bytes, num_handles)) =
6587                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6588            {
6589                let member_inline_size = <fidl_fuchsia_net::Ipv6AddressWithPrefix as fidl::encoding::TypeMarker>::inline_size(decoder.context);
6590                if inlined != (member_inline_size <= 4) {
6591                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6592                }
6593                let inner_offset;
6594                let mut inner_depth = depth.clone();
6595                if inlined {
6596                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6597                    inner_offset = next_offset;
6598                } else {
6599                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6600                    inner_depth.increment()?;
6601                }
6602                let val_ref = self.subnet.get_or_insert_with(|| {
6603                    fidl::new_empty!(fidl_fuchsia_net::Ipv6AddressWithPrefix, D)
6604                });
6605                fidl::decode!(
6606                    fidl_fuchsia_net::Ipv6AddressWithPrefix,
6607                    D,
6608                    val_ref,
6609                    decoder,
6610                    inner_offset,
6611                    inner_depth
6612                )?;
6613                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6614                {
6615                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6616                }
6617                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6618                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6619                }
6620            }
6621
6622            next_offset += envelope_size;
6623            _next_ordinal_to_read += 1;
6624            if next_offset >= end_offset {
6625                return Ok(());
6626            }
6627
6628            // Decode unknown envelopes for gaps in ordinals.
6629            while _next_ordinal_to_read < 2 {
6630                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6631                _next_ordinal_to_read += 1;
6632                next_offset += envelope_size;
6633            }
6634
6635            let next_out_of_line = decoder.next_out_of_line();
6636            let handles_before = decoder.remaining_handles();
6637            if let Some((inlined, num_bytes, num_handles)) =
6638                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6639            {
6640                let member_inline_size =
6641                    <RoutePreference as fidl::encoding::TypeMarker>::inline_size(decoder.context);
6642                if inlined != (member_inline_size <= 4) {
6643                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6644                }
6645                let inner_offset;
6646                let mut inner_depth = depth.clone();
6647                if inlined {
6648                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6649                    inner_offset = next_offset;
6650                } else {
6651                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6652                    inner_depth.increment()?;
6653                }
6654                let val_ref = self
6655                    .route_preference
6656                    .get_or_insert_with(|| fidl::new_empty!(RoutePreference, D));
6657                fidl::decode!(RoutePreference, D, val_ref, decoder, inner_offset, inner_depth)?;
6658                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6659                {
6660                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6661                }
6662                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6663                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6664                }
6665            }
6666
6667            next_offset += envelope_size;
6668            _next_ordinal_to_read += 1;
6669            if next_offset >= end_offset {
6670                return Ok(());
6671            }
6672
6673            // Decode unknown envelopes for gaps in ordinals.
6674            while _next_ordinal_to_read < 3 {
6675                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6676                _next_ordinal_to_read += 1;
6677                next_offset += envelope_size;
6678            }
6679
6680            let next_out_of_line = decoder.next_out_of_line();
6681            let handles_before = decoder.remaining_handles();
6682            if let Some((inlined, num_bytes, num_handles)) =
6683                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6684            {
6685                let member_inline_size =
6686                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
6687                if inlined != (member_inline_size <= 4) {
6688                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6689                }
6690                let inner_offset;
6691                let mut inner_depth = depth.clone();
6692                if inlined {
6693                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6694                    inner_offset = next_offset;
6695                } else {
6696                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6697                    inner_depth.increment()?;
6698                }
6699                let val_ref = self.stable.get_or_insert_with(|| fidl::new_empty!(bool, D));
6700                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
6701                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6702                {
6703                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6704                }
6705                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6706                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6707                }
6708            }
6709
6710            next_offset += envelope_size;
6711
6712            // Decode the remaining unknown envelopes.
6713            while next_offset < end_offset {
6714                _next_ordinal_to_read += 1;
6715                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6716                next_offset += envelope_size;
6717            }
6718
6719            Ok(())
6720        }
6721    }
6722
6723    impl JoinerCommissioningParams {
6724        #[inline(always)]
6725        fn max_ordinal_present(&self) -> u64 {
6726            if let Some(_) = self.vendor_data_string {
6727                return 6;
6728            }
6729            if let Some(_) = self.vendor_sw_version {
6730                return 5;
6731            }
6732            if let Some(_) = self.vendor_model {
6733                return 4;
6734            }
6735            if let Some(_) = self.vendor_name {
6736                return 3;
6737            }
6738            if let Some(_) = self.provisioning_url {
6739                return 2;
6740            }
6741            if let Some(_) = self.pskd {
6742                return 1;
6743            }
6744            0
6745        }
6746    }
6747
6748    impl fidl::encoding::ValueTypeMarker for JoinerCommissioningParams {
6749        type Borrowed<'a> = &'a Self;
6750        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
6751            value
6752        }
6753    }
6754
6755    unsafe impl fidl::encoding::TypeMarker for JoinerCommissioningParams {
6756        type Owned = Self;
6757
6758        #[inline(always)]
6759        fn inline_align(_context: fidl::encoding::Context) -> usize {
6760            8
6761        }
6762
6763        #[inline(always)]
6764        fn inline_size(_context: fidl::encoding::Context) -> usize {
6765            16
6766        }
6767    }
6768
6769    unsafe impl<D: fidl::encoding::ResourceDialect>
6770        fidl::encoding::Encode<JoinerCommissioningParams, D> for &JoinerCommissioningParams
6771    {
6772        unsafe fn encode(
6773            self,
6774            encoder: &mut fidl::encoding::Encoder<'_, D>,
6775            offset: usize,
6776            mut depth: fidl::encoding::Depth,
6777        ) -> fidl::Result<()> {
6778            encoder.debug_check_bounds::<JoinerCommissioningParams>(offset);
6779            // Vector header
6780            let max_ordinal: u64 = self.max_ordinal_present();
6781            encoder.write_num(max_ordinal, offset);
6782            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
6783            // Calling encoder.out_of_line_offset(0) is not allowed.
6784            if max_ordinal == 0 {
6785                return Ok(());
6786            }
6787            depth.increment()?;
6788            let envelope_size = 8;
6789            let bytes_len = max_ordinal as usize * envelope_size;
6790            #[allow(unused_variables)]
6791            let offset = encoder.out_of_line_offset(bytes_len);
6792            let mut _prev_end_offset: usize = 0;
6793            if 1 > max_ordinal {
6794                return Ok(());
6795            }
6796
6797            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
6798            // are envelope_size bytes.
6799            let cur_offset: usize = (1 - 1) * envelope_size;
6800
6801            // Zero reserved fields.
6802            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6803
6804            // Safety:
6805            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
6806            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
6807            //   envelope_size bytes, there is always sufficient room.
6808            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<32>, D>(
6809                self.pskd.as_ref().map(
6810                    <fidl::encoding::BoundedString<32> as fidl::encoding::ValueTypeMarker>::borrow,
6811                ),
6812                encoder,
6813                offset + cur_offset,
6814                depth,
6815            )?;
6816
6817            _prev_end_offset = cur_offset + envelope_size;
6818            if 2 > max_ordinal {
6819                return Ok(());
6820            }
6821
6822            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
6823            // are envelope_size bytes.
6824            let cur_offset: usize = (2 - 1) * envelope_size;
6825
6826            // Zero reserved fields.
6827            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6828
6829            // Safety:
6830            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
6831            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
6832            //   envelope_size bytes, there is always sufficient room.
6833            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<64>, D>(
6834                self.provisioning_url.as_ref().map(
6835                    <fidl::encoding::BoundedString<64> as fidl::encoding::ValueTypeMarker>::borrow,
6836                ),
6837                encoder,
6838                offset + cur_offset,
6839                depth,
6840            )?;
6841
6842            _prev_end_offset = cur_offset + envelope_size;
6843            if 3 > max_ordinal {
6844                return Ok(());
6845            }
6846
6847            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
6848            // are envelope_size bytes.
6849            let cur_offset: usize = (3 - 1) * envelope_size;
6850
6851            // Zero reserved fields.
6852            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6853
6854            // Safety:
6855            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
6856            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
6857            //   envelope_size bytes, there is always sufficient room.
6858            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<32>, D>(
6859                self.vendor_name.as_ref().map(
6860                    <fidl::encoding::BoundedString<32> as fidl::encoding::ValueTypeMarker>::borrow,
6861                ),
6862                encoder,
6863                offset + cur_offset,
6864                depth,
6865            )?;
6866
6867            _prev_end_offset = cur_offset + envelope_size;
6868            if 4 > max_ordinal {
6869                return Ok(());
6870            }
6871
6872            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
6873            // are envelope_size bytes.
6874            let cur_offset: usize = (4 - 1) * envelope_size;
6875
6876            // Zero reserved fields.
6877            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6878
6879            // Safety:
6880            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
6881            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
6882            //   envelope_size bytes, there is always sufficient room.
6883            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<32>, D>(
6884                self.vendor_model.as_ref().map(
6885                    <fidl::encoding::BoundedString<32> as fidl::encoding::ValueTypeMarker>::borrow,
6886                ),
6887                encoder,
6888                offset + cur_offset,
6889                depth,
6890            )?;
6891
6892            _prev_end_offset = cur_offset + envelope_size;
6893            if 5 > max_ordinal {
6894                return Ok(());
6895            }
6896
6897            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
6898            // are envelope_size bytes.
6899            let cur_offset: usize = (5 - 1) * envelope_size;
6900
6901            // Zero reserved fields.
6902            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6903
6904            // Safety:
6905            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
6906            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
6907            //   envelope_size bytes, there is always sufficient room.
6908            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<16>, D>(
6909                self.vendor_sw_version.as_ref().map(
6910                    <fidl::encoding::BoundedString<16> as fidl::encoding::ValueTypeMarker>::borrow,
6911                ),
6912                encoder,
6913                offset + cur_offset,
6914                depth,
6915            )?;
6916
6917            _prev_end_offset = cur_offset + envelope_size;
6918            if 6 > max_ordinal {
6919                return Ok(());
6920            }
6921
6922            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
6923            // are envelope_size bytes.
6924            let cur_offset: usize = (6 - 1) * envelope_size;
6925
6926            // Zero reserved fields.
6927            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6928
6929            // Safety:
6930            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
6931            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
6932            //   envelope_size bytes, there is always sufficient room.
6933            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<64>, D>(
6934                self.vendor_data_string.as_ref().map(
6935                    <fidl::encoding::BoundedString<64> as fidl::encoding::ValueTypeMarker>::borrow,
6936                ),
6937                encoder,
6938                offset + cur_offset,
6939                depth,
6940            )?;
6941
6942            _prev_end_offset = cur_offset + envelope_size;
6943
6944            Ok(())
6945        }
6946    }
6947
6948    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
6949        for JoinerCommissioningParams
6950    {
6951        #[inline(always)]
6952        fn new_empty() -> Self {
6953            Self::default()
6954        }
6955
6956        unsafe fn decode(
6957            &mut self,
6958            decoder: &mut fidl::encoding::Decoder<'_, D>,
6959            offset: usize,
6960            mut depth: fidl::encoding::Depth,
6961        ) -> fidl::Result<()> {
6962            decoder.debug_check_bounds::<Self>(offset);
6963            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
6964                None => return Err(fidl::Error::NotNullable),
6965                Some(len) => len,
6966            };
6967            // Calling decoder.out_of_line_offset(0) is not allowed.
6968            if len == 0 {
6969                return Ok(());
6970            };
6971            depth.increment()?;
6972            let envelope_size = 8;
6973            let bytes_len = len * envelope_size;
6974            let offset = decoder.out_of_line_offset(bytes_len)?;
6975            // Decode the envelope for each type.
6976            let mut _next_ordinal_to_read = 0;
6977            let mut next_offset = offset;
6978            let end_offset = offset + bytes_len;
6979            _next_ordinal_to_read += 1;
6980            if next_offset >= end_offset {
6981                return Ok(());
6982            }
6983
6984            // Decode unknown envelopes for gaps in ordinals.
6985            while _next_ordinal_to_read < 1 {
6986                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6987                _next_ordinal_to_read += 1;
6988                next_offset += envelope_size;
6989            }
6990
6991            let next_out_of_line = decoder.next_out_of_line();
6992            let handles_before = decoder.remaining_handles();
6993            if let Some((inlined, num_bytes, num_handles)) =
6994                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6995            {
6996                let member_inline_size =
6997                    <fidl::encoding::BoundedString<32> as fidl::encoding::TypeMarker>::inline_size(
6998                        decoder.context,
6999                    );
7000                if inlined != (member_inline_size <= 4) {
7001                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
7002                }
7003                let inner_offset;
7004                let mut inner_depth = depth.clone();
7005                if inlined {
7006                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7007                    inner_offset = next_offset;
7008                } else {
7009                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7010                    inner_depth.increment()?;
7011                }
7012                let val_ref = self
7013                    .pskd
7014                    .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::BoundedString<32>, D));
7015                fidl::decode!(
7016                    fidl::encoding::BoundedString<32>,
7017                    D,
7018                    val_ref,
7019                    decoder,
7020                    inner_offset,
7021                    inner_depth
7022                )?;
7023                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7024                {
7025                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
7026                }
7027                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7028                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7029                }
7030            }
7031
7032            next_offset += envelope_size;
7033            _next_ordinal_to_read += 1;
7034            if next_offset >= end_offset {
7035                return Ok(());
7036            }
7037
7038            // Decode unknown envelopes for gaps in ordinals.
7039            while _next_ordinal_to_read < 2 {
7040                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7041                _next_ordinal_to_read += 1;
7042                next_offset += envelope_size;
7043            }
7044
7045            let next_out_of_line = decoder.next_out_of_line();
7046            let handles_before = decoder.remaining_handles();
7047            if let Some((inlined, num_bytes, num_handles)) =
7048                fidl::encoding::decode_envelope_header(decoder, next_offset)?
7049            {
7050                let member_inline_size =
7051                    <fidl::encoding::BoundedString<64> as fidl::encoding::TypeMarker>::inline_size(
7052                        decoder.context,
7053                    );
7054                if inlined != (member_inline_size <= 4) {
7055                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
7056                }
7057                let inner_offset;
7058                let mut inner_depth = depth.clone();
7059                if inlined {
7060                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7061                    inner_offset = next_offset;
7062                } else {
7063                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7064                    inner_depth.increment()?;
7065                }
7066                let val_ref = self
7067                    .provisioning_url
7068                    .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::BoundedString<64>, D));
7069                fidl::decode!(
7070                    fidl::encoding::BoundedString<64>,
7071                    D,
7072                    val_ref,
7073                    decoder,
7074                    inner_offset,
7075                    inner_depth
7076                )?;
7077                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7078                {
7079                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
7080                }
7081                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7082                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7083                }
7084            }
7085
7086            next_offset += envelope_size;
7087            _next_ordinal_to_read += 1;
7088            if next_offset >= end_offset {
7089                return Ok(());
7090            }
7091
7092            // Decode unknown envelopes for gaps in ordinals.
7093            while _next_ordinal_to_read < 3 {
7094                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7095                _next_ordinal_to_read += 1;
7096                next_offset += envelope_size;
7097            }
7098
7099            let next_out_of_line = decoder.next_out_of_line();
7100            let handles_before = decoder.remaining_handles();
7101            if let Some((inlined, num_bytes, num_handles)) =
7102                fidl::encoding::decode_envelope_header(decoder, next_offset)?
7103            {
7104                let member_inline_size =
7105                    <fidl::encoding::BoundedString<32> as fidl::encoding::TypeMarker>::inline_size(
7106                        decoder.context,
7107                    );
7108                if inlined != (member_inline_size <= 4) {
7109                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
7110                }
7111                let inner_offset;
7112                let mut inner_depth = depth.clone();
7113                if inlined {
7114                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7115                    inner_offset = next_offset;
7116                } else {
7117                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7118                    inner_depth.increment()?;
7119                }
7120                let val_ref = self
7121                    .vendor_name
7122                    .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::BoundedString<32>, D));
7123                fidl::decode!(
7124                    fidl::encoding::BoundedString<32>,
7125                    D,
7126                    val_ref,
7127                    decoder,
7128                    inner_offset,
7129                    inner_depth
7130                )?;
7131                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7132                {
7133                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
7134                }
7135                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7136                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7137                }
7138            }
7139
7140            next_offset += envelope_size;
7141            _next_ordinal_to_read += 1;
7142            if next_offset >= end_offset {
7143                return Ok(());
7144            }
7145
7146            // Decode unknown envelopes for gaps in ordinals.
7147            while _next_ordinal_to_read < 4 {
7148                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7149                _next_ordinal_to_read += 1;
7150                next_offset += envelope_size;
7151            }
7152
7153            let next_out_of_line = decoder.next_out_of_line();
7154            let handles_before = decoder.remaining_handles();
7155            if let Some((inlined, num_bytes, num_handles)) =
7156                fidl::encoding::decode_envelope_header(decoder, next_offset)?
7157            {
7158                let member_inline_size =
7159                    <fidl::encoding::BoundedString<32> as fidl::encoding::TypeMarker>::inline_size(
7160                        decoder.context,
7161                    );
7162                if inlined != (member_inline_size <= 4) {
7163                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
7164                }
7165                let inner_offset;
7166                let mut inner_depth = depth.clone();
7167                if inlined {
7168                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7169                    inner_offset = next_offset;
7170                } else {
7171                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7172                    inner_depth.increment()?;
7173                }
7174                let val_ref = self
7175                    .vendor_model
7176                    .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::BoundedString<32>, D));
7177                fidl::decode!(
7178                    fidl::encoding::BoundedString<32>,
7179                    D,
7180                    val_ref,
7181                    decoder,
7182                    inner_offset,
7183                    inner_depth
7184                )?;
7185                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7186                {
7187                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
7188                }
7189                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7190                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7191                }
7192            }
7193
7194            next_offset += envelope_size;
7195            _next_ordinal_to_read += 1;
7196            if next_offset >= end_offset {
7197                return Ok(());
7198            }
7199
7200            // Decode unknown envelopes for gaps in ordinals.
7201            while _next_ordinal_to_read < 5 {
7202                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7203                _next_ordinal_to_read += 1;
7204                next_offset += envelope_size;
7205            }
7206
7207            let next_out_of_line = decoder.next_out_of_line();
7208            let handles_before = decoder.remaining_handles();
7209            if let Some((inlined, num_bytes, num_handles)) =
7210                fidl::encoding::decode_envelope_header(decoder, next_offset)?
7211            {
7212                let member_inline_size =
7213                    <fidl::encoding::BoundedString<16> as fidl::encoding::TypeMarker>::inline_size(
7214                        decoder.context,
7215                    );
7216                if inlined != (member_inline_size <= 4) {
7217                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
7218                }
7219                let inner_offset;
7220                let mut inner_depth = depth.clone();
7221                if inlined {
7222                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7223                    inner_offset = next_offset;
7224                } else {
7225                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7226                    inner_depth.increment()?;
7227                }
7228                let val_ref = self
7229                    .vendor_sw_version
7230                    .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::BoundedString<16>, D));
7231                fidl::decode!(
7232                    fidl::encoding::BoundedString<16>,
7233                    D,
7234                    val_ref,
7235                    decoder,
7236                    inner_offset,
7237                    inner_depth
7238                )?;
7239                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7240                {
7241                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
7242                }
7243                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7244                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7245                }
7246            }
7247
7248            next_offset += envelope_size;
7249            _next_ordinal_to_read += 1;
7250            if next_offset >= end_offset {
7251                return Ok(());
7252            }
7253
7254            // Decode unknown envelopes for gaps in ordinals.
7255            while _next_ordinal_to_read < 6 {
7256                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7257                _next_ordinal_to_read += 1;
7258                next_offset += envelope_size;
7259            }
7260
7261            let next_out_of_line = decoder.next_out_of_line();
7262            let handles_before = decoder.remaining_handles();
7263            if let Some((inlined, num_bytes, num_handles)) =
7264                fidl::encoding::decode_envelope_header(decoder, next_offset)?
7265            {
7266                let member_inline_size =
7267                    <fidl::encoding::BoundedString<64> as fidl::encoding::TypeMarker>::inline_size(
7268                        decoder.context,
7269                    );
7270                if inlined != (member_inline_size <= 4) {
7271                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
7272                }
7273                let inner_offset;
7274                let mut inner_depth = depth.clone();
7275                if inlined {
7276                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7277                    inner_offset = next_offset;
7278                } else {
7279                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7280                    inner_depth.increment()?;
7281                }
7282                let val_ref = self
7283                    .vendor_data_string
7284                    .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::BoundedString<64>, D));
7285                fidl::decode!(
7286                    fidl::encoding::BoundedString<64>,
7287                    D,
7288                    val_ref,
7289                    decoder,
7290                    inner_offset,
7291                    inner_depth
7292                )?;
7293                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7294                {
7295                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
7296                }
7297                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7298                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7299                }
7300            }
7301
7302            next_offset += envelope_size;
7303
7304            // Decode the remaining unknown envelopes.
7305            while next_offset < end_offset {
7306                _next_ordinal_to_read += 1;
7307                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7308                next_offset += envelope_size;
7309            }
7310
7311            Ok(())
7312        }
7313    }
7314
7315    impl LeaderData {
7316        #[inline(always)]
7317        fn max_ordinal_present(&self) -> u64 {
7318            if let Some(_) = self.router_id {
7319                return 5;
7320            }
7321            if let Some(_) = self.stable_network_data_version {
7322                return 4;
7323            }
7324            if let Some(_) = self.network_data_version {
7325                return 3;
7326            }
7327            if let Some(_) = self.weight {
7328                return 2;
7329            }
7330            if let Some(_) = self.partition_id {
7331                return 1;
7332            }
7333            0
7334        }
7335    }
7336
7337    impl fidl::encoding::ValueTypeMarker for LeaderData {
7338        type Borrowed<'a> = &'a Self;
7339        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
7340            value
7341        }
7342    }
7343
7344    unsafe impl fidl::encoding::TypeMarker for LeaderData {
7345        type Owned = Self;
7346
7347        #[inline(always)]
7348        fn inline_align(_context: fidl::encoding::Context) -> usize {
7349            8
7350        }
7351
7352        #[inline(always)]
7353        fn inline_size(_context: fidl::encoding::Context) -> usize {
7354            16
7355        }
7356    }
7357
7358    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<LeaderData, D>
7359        for &LeaderData
7360    {
7361        unsafe fn encode(
7362            self,
7363            encoder: &mut fidl::encoding::Encoder<'_, D>,
7364            offset: usize,
7365            mut depth: fidl::encoding::Depth,
7366        ) -> fidl::Result<()> {
7367            encoder.debug_check_bounds::<LeaderData>(offset);
7368            // Vector header
7369            let max_ordinal: u64 = self.max_ordinal_present();
7370            encoder.write_num(max_ordinal, offset);
7371            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
7372            // Calling encoder.out_of_line_offset(0) is not allowed.
7373            if max_ordinal == 0 {
7374                return Ok(());
7375            }
7376            depth.increment()?;
7377            let envelope_size = 8;
7378            let bytes_len = max_ordinal as usize * envelope_size;
7379            #[allow(unused_variables)]
7380            let offset = encoder.out_of_line_offset(bytes_len);
7381            let mut _prev_end_offset: usize = 0;
7382            if 1 > max_ordinal {
7383                return Ok(());
7384            }
7385
7386            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
7387            // are envelope_size bytes.
7388            let cur_offset: usize = (1 - 1) * envelope_size;
7389
7390            // Zero reserved fields.
7391            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7392
7393            // Safety:
7394            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
7395            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
7396            //   envelope_size bytes, there is always sufficient room.
7397            fidl::encoding::encode_in_envelope_optional::<u32, D>(
7398                self.partition_id.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
7399                encoder,
7400                offset + cur_offset,
7401                depth,
7402            )?;
7403
7404            _prev_end_offset = cur_offset + envelope_size;
7405            if 2 > max_ordinal {
7406                return Ok(());
7407            }
7408
7409            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
7410            // are envelope_size bytes.
7411            let cur_offset: usize = (2 - 1) * envelope_size;
7412
7413            // Zero reserved fields.
7414            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7415
7416            // Safety:
7417            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
7418            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
7419            //   envelope_size bytes, there is always sufficient room.
7420            fidl::encoding::encode_in_envelope_optional::<u8, D>(
7421                self.weight.as_ref().map(<u8 as fidl::encoding::ValueTypeMarker>::borrow),
7422                encoder,
7423                offset + cur_offset,
7424                depth,
7425            )?;
7426
7427            _prev_end_offset = cur_offset + envelope_size;
7428            if 3 > max_ordinal {
7429                return Ok(());
7430            }
7431
7432            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
7433            // are envelope_size bytes.
7434            let cur_offset: usize = (3 - 1) * envelope_size;
7435
7436            // Zero reserved fields.
7437            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7438
7439            // Safety:
7440            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
7441            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
7442            //   envelope_size bytes, there is always sufficient room.
7443            fidl::encoding::encode_in_envelope_optional::<u8, D>(
7444                self.network_data_version
7445                    .as_ref()
7446                    .map(<u8 as fidl::encoding::ValueTypeMarker>::borrow),
7447                encoder,
7448                offset + cur_offset,
7449                depth,
7450            )?;
7451
7452            _prev_end_offset = cur_offset + envelope_size;
7453            if 4 > max_ordinal {
7454                return Ok(());
7455            }
7456
7457            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
7458            // are envelope_size bytes.
7459            let cur_offset: usize = (4 - 1) * envelope_size;
7460
7461            // Zero reserved fields.
7462            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7463
7464            // Safety:
7465            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
7466            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
7467            //   envelope_size bytes, there is always sufficient room.
7468            fidl::encoding::encode_in_envelope_optional::<u8, D>(
7469                self.stable_network_data_version
7470                    .as_ref()
7471                    .map(<u8 as fidl::encoding::ValueTypeMarker>::borrow),
7472                encoder,
7473                offset + cur_offset,
7474                depth,
7475            )?;
7476
7477            _prev_end_offset = cur_offset + envelope_size;
7478            if 5 > max_ordinal {
7479                return Ok(());
7480            }
7481
7482            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
7483            // are envelope_size bytes.
7484            let cur_offset: usize = (5 - 1) * envelope_size;
7485
7486            // Zero reserved fields.
7487            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7488
7489            // Safety:
7490            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
7491            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
7492            //   envelope_size bytes, there is always sufficient room.
7493            fidl::encoding::encode_in_envelope_optional::<u8, D>(
7494                self.router_id.as_ref().map(<u8 as fidl::encoding::ValueTypeMarker>::borrow),
7495                encoder,
7496                offset + cur_offset,
7497                depth,
7498            )?;
7499
7500            _prev_end_offset = cur_offset + envelope_size;
7501
7502            Ok(())
7503        }
7504    }
7505
7506    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for LeaderData {
7507        #[inline(always)]
7508        fn new_empty() -> Self {
7509            Self::default()
7510        }
7511
7512        unsafe fn decode(
7513            &mut self,
7514            decoder: &mut fidl::encoding::Decoder<'_, D>,
7515            offset: usize,
7516            mut depth: fidl::encoding::Depth,
7517        ) -> fidl::Result<()> {
7518            decoder.debug_check_bounds::<Self>(offset);
7519            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
7520                None => return Err(fidl::Error::NotNullable),
7521                Some(len) => len,
7522            };
7523            // Calling decoder.out_of_line_offset(0) is not allowed.
7524            if len == 0 {
7525                return Ok(());
7526            };
7527            depth.increment()?;
7528            let envelope_size = 8;
7529            let bytes_len = len * envelope_size;
7530            let offset = decoder.out_of_line_offset(bytes_len)?;
7531            // Decode the envelope for each type.
7532            let mut _next_ordinal_to_read = 0;
7533            let mut next_offset = offset;
7534            let end_offset = offset + bytes_len;
7535            _next_ordinal_to_read += 1;
7536            if next_offset >= end_offset {
7537                return Ok(());
7538            }
7539
7540            // Decode unknown envelopes for gaps in ordinals.
7541            while _next_ordinal_to_read < 1 {
7542                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7543                _next_ordinal_to_read += 1;
7544                next_offset += envelope_size;
7545            }
7546
7547            let next_out_of_line = decoder.next_out_of_line();
7548            let handles_before = decoder.remaining_handles();
7549            if let Some((inlined, num_bytes, num_handles)) =
7550                fidl::encoding::decode_envelope_header(decoder, next_offset)?
7551            {
7552                let member_inline_size =
7553                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
7554                if inlined != (member_inline_size <= 4) {
7555                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
7556                }
7557                let inner_offset;
7558                let mut inner_depth = depth.clone();
7559                if inlined {
7560                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7561                    inner_offset = next_offset;
7562                } else {
7563                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7564                    inner_depth.increment()?;
7565                }
7566                let val_ref = self.partition_id.get_or_insert_with(|| fidl::new_empty!(u32, D));
7567                fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
7568                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7569                {
7570                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
7571                }
7572                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7573                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7574                }
7575            }
7576
7577            next_offset += envelope_size;
7578            _next_ordinal_to_read += 1;
7579            if next_offset >= end_offset {
7580                return Ok(());
7581            }
7582
7583            // Decode unknown envelopes for gaps in ordinals.
7584            while _next_ordinal_to_read < 2 {
7585                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7586                _next_ordinal_to_read += 1;
7587                next_offset += envelope_size;
7588            }
7589
7590            let next_out_of_line = decoder.next_out_of_line();
7591            let handles_before = decoder.remaining_handles();
7592            if let Some((inlined, num_bytes, num_handles)) =
7593                fidl::encoding::decode_envelope_header(decoder, next_offset)?
7594            {
7595                let member_inline_size =
7596                    <u8 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
7597                if inlined != (member_inline_size <= 4) {
7598                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
7599                }
7600                let inner_offset;
7601                let mut inner_depth = depth.clone();
7602                if inlined {
7603                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7604                    inner_offset = next_offset;
7605                } else {
7606                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7607                    inner_depth.increment()?;
7608                }
7609                let val_ref = self.weight.get_or_insert_with(|| fidl::new_empty!(u8, D));
7610                fidl::decode!(u8, D, val_ref, decoder, inner_offset, inner_depth)?;
7611                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7612                {
7613                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
7614                }
7615                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7616                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7617                }
7618            }
7619
7620            next_offset += envelope_size;
7621            _next_ordinal_to_read += 1;
7622            if next_offset >= end_offset {
7623                return Ok(());
7624            }
7625
7626            // Decode unknown envelopes for gaps in ordinals.
7627            while _next_ordinal_to_read < 3 {
7628                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7629                _next_ordinal_to_read += 1;
7630                next_offset += envelope_size;
7631            }
7632
7633            let next_out_of_line = decoder.next_out_of_line();
7634            let handles_before = decoder.remaining_handles();
7635            if let Some((inlined, num_bytes, num_handles)) =
7636                fidl::encoding::decode_envelope_header(decoder, next_offset)?
7637            {
7638                let member_inline_size =
7639                    <u8 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
7640                if inlined != (member_inline_size <= 4) {
7641                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
7642                }
7643                let inner_offset;
7644                let mut inner_depth = depth.clone();
7645                if inlined {
7646                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7647                    inner_offset = next_offset;
7648                } else {
7649                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7650                    inner_depth.increment()?;
7651                }
7652                let val_ref =
7653                    self.network_data_version.get_or_insert_with(|| fidl::new_empty!(u8, D));
7654                fidl::decode!(u8, D, val_ref, decoder, inner_offset, inner_depth)?;
7655                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7656                {
7657                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
7658                }
7659                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7660                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7661                }
7662            }
7663
7664            next_offset += envelope_size;
7665            _next_ordinal_to_read += 1;
7666            if next_offset >= end_offset {
7667                return Ok(());
7668            }
7669
7670            // Decode unknown envelopes for gaps in ordinals.
7671            while _next_ordinal_to_read < 4 {
7672                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7673                _next_ordinal_to_read += 1;
7674                next_offset += envelope_size;
7675            }
7676
7677            let next_out_of_line = decoder.next_out_of_line();
7678            let handles_before = decoder.remaining_handles();
7679            if let Some((inlined, num_bytes, num_handles)) =
7680                fidl::encoding::decode_envelope_header(decoder, next_offset)?
7681            {
7682                let member_inline_size =
7683                    <u8 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
7684                if inlined != (member_inline_size <= 4) {
7685                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
7686                }
7687                let inner_offset;
7688                let mut inner_depth = depth.clone();
7689                if inlined {
7690                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7691                    inner_offset = next_offset;
7692                } else {
7693                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7694                    inner_depth.increment()?;
7695                }
7696                let val_ref =
7697                    self.stable_network_data_version.get_or_insert_with(|| fidl::new_empty!(u8, D));
7698                fidl::decode!(u8, D, val_ref, decoder, inner_offset, inner_depth)?;
7699                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7700                {
7701                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
7702                }
7703                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7704                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7705                }
7706            }
7707
7708            next_offset += envelope_size;
7709            _next_ordinal_to_read += 1;
7710            if next_offset >= end_offset {
7711                return Ok(());
7712            }
7713
7714            // Decode unknown envelopes for gaps in ordinals.
7715            while _next_ordinal_to_read < 5 {
7716                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7717                _next_ordinal_to_read += 1;
7718                next_offset += envelope_size;
7719            }
7720
7721            let next_out_of_line = decoder.next_out_of_line();
7722            let handles_before = decoder.remaining_handles();
7723            if let Some((inlined, num_bytes, num_handles)) =
7724                fidl::encoding::decode_envelope_header(decoder, next_offset)?
7725            {
7726                let member_inline_size =
7727                    <u8 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
7728                if inlined != (member_inline_size <= 4) {
7729                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
7730                }
7731                let inner_offset;
7732                let mut inner_depth = depth.clone();
7733                if inlined {
7734                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7735                    inner_offset = next_offset;
7736                } else {
7737                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7738                    inner_depth.increment()?;
7739                }
7740                let val_ref = self.router_id.get_or_insert_with(|| fidl::new_empty!(u8, D));
7741                fidl::decode!(u8, D, val_ref, decoder, inner_offset, inner_depth)?;
7742                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7743                {
7744                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
7745                }
7746                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7747                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7748                }
7749            }
7750
7751            next_offset += envelope_size;
7752
7753            // Decode the remaining unknown envelopes.
7754            while next_offset < end_offset {
7755                _next_ordinal_to_read += 1;
7756                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7757                next_offset += envelope_size;
7758            }
7759
7760            Ok(())
7761        }
7762    }
7763
7764    impl LinkMetricsEntry {
7765        #[inline(always)]
7766        fn max_ordinal_present(&self) -> u64 {
7767            if let Some(_) = self.rssi {
7768                return 2;
7769            }
7770            if let Some(_) = self.link_margin {
7771                return 1;
7772            }
7773            0
7774        }
7775    }
7776
7777    impl fidl::encoding::ValueTypeMarker for LinkMetricsEntry {
7778        type Borrowed<'a> = &'a Self;
7779        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
7780            value
7781        }
7782    }
7783
7784    unsafe impl fidl::encoding::TypeMarker for LinkMetricsEntry {
7785        type Owned = Self;
7786
7787        #[inline(always)]
7788        fn inline_align(_context: fidl::encoding::Context) -> usize {
7789            8
7790        }
7791
7792        #[inline(always)]
7793        fn inline_size(_context: fidl::encoding::Context) -> usize {
7794            16
7795        }
7796    }
7797
7798    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<LinkMetricsEntry, D>
7799        for &LinkMetricsEntry
7800    {
7801        unsafe fn encode(
7802            self,
7803            encoder: &mut fidl::encoding::Encoder<'_, D>,
7804            offset: usize,
7805            mut depth: fidl::encoding::Depth,
7806        ) -> fidl::Result<()> {
7807            encoder.debug_check_bounds::<LinkMetricsEntry>(offset);
7808            // Vector header
7809            let max_ordinal: u64 = self.max_ordinal_present();
7810            encoder.write_num(max_ordinal, offset);
7811            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
7812            // Calling encoder.out_of_line_offset(0) is not allowed.
7813            if max_ordinal == 0 {
7814                return Ok(());
7815            }
7816            depth.increment()?;
7817            let envelope_size = 8;
7818            let bytes_len = max_ordinal as usize * envelope_size;
7819            #[allow(unused_variables)]
7820            let offset = encoder.out_of_line_offset(bytes_len);
7821            let mut _prev_end_offset: usize = 0;
7822            if 1 > max_ordinal {
7823                return Ok(());
7824            }
7825
7826            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
7827            // are envelope_size bytes.
7828            let cur_offset: usize = (1 - 1) * envelope_size;
7829
7830            // Zero reserved fields.
7831            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7832
7833            // Safety:
7834            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
7835            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
7836            //   envelope_size bytes, there is always sufficient room.
7837            fidl::encoding::encode_in_envelope_optional::<u8, D>(
7838                self.link_margin.as_ref().map(<u8 as fidl::encoding::ValueTypeMarker>::borrow),
7839                encoder,
7840                offset + cur_offset,
7841                depth,
7842            )?;
7843
7844            _prev_end_offset = cur_offset + envelope_size;
7845            if 2 > max_ordinal {
7846                return Ok(());
7847            }
7848
7849            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
7850            // are envelope_size bytes.
7851            let cur_offset: usize = (2 - 1) * envelope_size;
7852
7853            // Zero reserved fields.
7854            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7855
7856            // Safety:
7857            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
7858            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
7859            //   envelope_size bytes, there is always sufficient room.
7860            fidl::encoding::encode_in_envelope_optional::<i8, D>(
7861                self.rssi.as_ref().map(<i8 as fidl::encoding::ValueTypeMarker>::borrow),
7862                encoder,
7863                offset + cur_offset,
7864                depth,
7865            )?;
7866
7867            _prev_end_offset = cur_offset + envelope_size;
7868
7869            Ok(())
7870        }
7871    }
7872
7873    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for LinkMetricsEntry {
7874        #[inline(always)]
7875        fn new_empty() -> Self {
7876            Self::default()
7877        }
7878
7879        unsafe fn decode(
7880            &mut self,
7881            decoder: &mut fidl::encoding::Decoder<'_, D>,
7882            offset: usize,
7883            mut depth: fidl::encoding::Depth,
7884        ) -> fidl::Result<()> {
7885            decoder.debug_check_bounds::<Self>(offset);
7886            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
7887                None => return Err(fidl::Error::NotNullable),
7888                Some(len) => len,
7889            };
7890            // Calling decoder.out_of_line_offset(0) is not allowed.
7891            if len == 0 {
7892                return Ok(());
7893            };
7894            depth.increment()?;
7895            let envelope_size = 8;
7896            let bytes_len = len * envelope_size;
7897            let offset = decoder.out_of_line_offset(bytes_len)?;
7898            // Decode the envelope for each type.
7899            let mut _next_ordinal_to_read = 0;
7900            let mut next_offset = offset;
7901            let end_offset = offset + bytes_len;
7902            _next_ordinal_to_read += 1;
7903            if next_offset >= end_offset {
7904                return Ok(());
7905            }
7906
7907            // Decode unknown envelopes for gaps in ordinals.
7908            while _next_ordinal_to_read < 1 {
7909                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7910                _next_ordinal_to_read += 1;
7911                next_offset += envelope_size;
7912            }
7913
7914            let next_out_of_line = decoder.next_out_of_line();
7915            let handles_before = decoder.remaining_handles();
7916            if let Some((inlined, num_bytes, num_handles)) =
7917                fidl::encoding::decode_envelope_header(decoder, next_offset)?
7918            {
7919                let member_inline_size =
7920                    <u8 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
7921                if inlined != (member_inline_size <= 4) {
7922                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
7923                }
7924                let inner_offset;
7925                let mut inner_depth = depth.clone();
7926                if inlined {
7927                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7928                    inner_offset = next_offset;
7929                } else {
7930                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7931                    inner_depth.increment()?;
7932                }
7933                let val_ref = self.link_margin.get_or_insert_with(|| fidl::new_empty!(u8, D));
7934                fidl::decode!(u8, D, val_ref, decoder, inner_offset, inner_depth)?;
7935                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7936                {
7937                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
7938                }
7939                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7940                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7941                }
7942            }
7943
7944            next_offset += envelope_size;
7945            _next_ordinal_to_read += 1;
7946            if next_offset >= end_offset {
7947                return Ok(());
7948            }
7949
7950            // Decode unknown envelopes for gaps in ordinals.
7951            while _next_ordinal_to_read < 2 {
7952                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7953                _next_ordinal_to_read += 1;
7954                next_offset += envelope_size;
7955            }
7956
7957            let next_out_of_line = decoder.next_out_of_line();
7958            let handles_before = decoder.remaining_handles();
7959            if let Some((inlined, num_bytes, num_handles)) =
7960                fidl::encoding::decode_envelope_header(decoder, next_offset)?
7961            {
7962                let member_inline_size =
7963                    <i8 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
7964                if inlined != (member_inline_size <= 4) {
7965                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
7966                }
7967                let inner_offset;
7968                let mut inner_depth = depth.clone();
7969                if inlined {
7970                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7971                    inner_offset = next_offset;
7972                } else {
7973                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7974                    inner_depth.increment()?;
7975                }
7976                let val_ref = self.rssi.get_or_insert_with(|| fidl::new_empty!(i8, D));
7977                fidl::decode!(i8, D, val_ref, decoder, inner_offset, inner_depth)?;
7978                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7979                {
7980                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
7981                }
7982                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7983                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7984                }
7985            }
7986
7987            next_offset += envelope_size;
7988
7989            // Decode the remaining unknown envelopes.
7990            while next_offset < end_offset {
7991                _next_ordinal_to_read += 1;
7992                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7993                next_offset += envelope_size;
7994            }
7995
7996            Ok(())
7997        }
7998    }
7999
8000    impl Nat64ErrorCounters {
8001        #[inline(always)]
8002        fn max_ordinal_present(&self) -> u64 {
8003            if let Some(_) = self.no_mapping {
8004                return 4;
8005            }
8006            if let Some(_) = self.unsupported_protocol {
8007                return 3;
8008            }
8009            if let Some(_) = self.illegal_packet {
8010                return 2;
8011            }
8012            if let Some(_) = self.unknown {
8013                return 1;
8014            }
8015            0
8016        }
8017    }
8018
8019    impl fidl::encoding::ValueTypeMarker for Nat64ErrorCounters {
8020        type Borrowed<'a> = &'a Self;
8021        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
8022            value
8023        }
8024    }
8025
8026    unsafe impl fidl::encoding::TypeMarker for Nat64ErrorCounters {
8027        type Owned = Self;
8028
8029        #[inline(always)]
8030        fn inline_align(_context: fidl::encoding::Context) -> usize {
8031            8
8032        }
8033
8034        #[inline(always)]
8035        fn inline_size(_context: fidl::encoding::Context) -> usize {
8036            16
8037        }
8038    }
8039
8040    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Nat64ErrorCounters, D>
8041        for &Nat64ErrorCounters
8042    {
8043        unsafe fn encode(
8044            self,
8045            encoder: &mut fidl::encoding::Encoder<'_, D>,
8046            offset: usize,
8047            mut depth: fidl::encoding::Depth,
8048        ) -> fidl::Result<()> {
8049            encoder.debug_check_bounds::<Nat64ErrorCounters>(offset);
8050            // Vector header
8051            let max_ordinal: u64 = self.max_ordinal_present();
8052            encoder.write_num(max_ordinal, offset);
8053            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
8054            // Calling encoder.out_of_line_offset(0) is not allowed.
8055            if max_ordinal == 0 {
8056                return Ok(());
8057            }
8058            depth.increment()?;
8059            let envelope_size = 8;
8060            let bytes_len = max_ordinal as usize * envelope_size;
8061            #[allow(unused_variables)]
8062            let offset = encoder.out_of_line_offset(bytes_len);
8063            let mut _prev_end_offset: usize = 0;
8064            if 1 > max_ordinal {
8065                return Ok(());
8066            }
8067
8068            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
8069            // are envelope_size bytes.
8070            let cur_offset: usize = (1 - 1) * envelope_size;
8071
8072            // Zero reserved fields.
8073            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
8074
8075            // Safety:
8076            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
8077            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
8078            //   envelope_size bytes, there is always sufficient room.
8079            fidl::encoding::encode_in_envelope_optional::<Nat64PacketCounters, D>(
8080                self.unknown
8081                    .as_ref()
8082                    .map(<Nat64PacketCounters as fidl::encoding::ValueTypeMarker>::borrow),
8083                encoder,
8084                offset + cur_offset,
8085                depth,
8086            )?;
8087
8088            _prev_end_offset = cur_offset + envelope_size;
8089            if 2 > max_ordinal {
8090                return Ok(());
8091            }
8092
8093            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
8094            // are envelope_size bytes.
8095            let cur_offset: usize = (2 - 1) * envelope_size;
8096
8097            // Zero reserved fields.
8098            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
8099
8100            // Safety:
8101            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
8102            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
8103            //   envelope_size bytes, there is always sufficient room.
8104            fidl::encoding::encode_in_envelope_optional::<Nat64PacketCounters, D>(
8105                self.illegal_packet
8106                    .as_ref()
8107                    .map(<Nat64PacketCounters as fidl::encoding::ValueTypeMarker>::borrow),
8108                encoder,
8109                offset + cur_offset,
8110                depth,
8111            )?;
8112
8113            _prev_end_offset = cur_offset + envelope_size;
8114            if 3 > max_ordinal {
8115                return Ok(());
8116            }
8117
8118            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
8119            // are envelope_size bytes.
8120            let cur_offset: usize = (3 - 1) * envelope_size;
8121
8122            // Zero reserved fields.
8123            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
8124
8125            // Safety:
8126            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
8127            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
8128            //   envelope_size bytes, there is always sufficient room.
8129            fidl::encoding::encode_in_envelope_optional::<Nat64PacketCounters, D>(
8130                self.unsupported_protocol
8131                    .as_ref()
8132                    .map(<Nat64PacketCounters as fidl::encoding::ValueTypeMarker>::borrow),
8133                encoder,
8134                offset + cur_offset,
8135                depth,
8136            )?;
8137
8138            _prev_end_offset = cur_offset + envelope_size;
8139            if 4 > max_ordinal {
8140                return Ok(());
8141            }
8142
8143            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
8144            // are envelope_size bytes.
8145            let cur_offset: usize = (4 - 1) * envelope_size;
8146
8147            // Zero reserved fields.
8148            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
8149
8150            // Safety:
8151            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
8152            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
8153            //   envelope_size bytes, there is always sufficient room.
8154            fidl::encoding::encode_in_envelope_optional::<Nat64PacketCounters, D>(
8155                self.no_mapping
8156                    .as_ref()
8157                    .map(<Nat64PacketCounters as fidl::encoding::ValueTypeMarker>::borrow),
8158                encoder,
8159                offset + cur_offset,
8160                depth,
8161            )?;
8162
8163            _prev_end_offset = cur_offset + envelope_size;
8164
8165            Ok(())
8166        }
8167    }
8168
8169    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Nat64ErrorCounters {
8170        #[inline(always)]
8171        fn new_empty() -> Self {
8172            Self::default()
8173        }
8174
8175        unsafe fn decode(
8176            &mut self,
8177            decoder: &mut fidl::encoding::Decoder<'_, D>,
8178            offset: usize,
8179            mut depth: fidl::encoding::Depth,
8180        ) -> fidl::Result<()> {
8181            decoder.debug_check_bounds::<Self>(offset);
8182            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
8183                None => return Err(fidl::Error::NotNullable),
8184                Some(len) => len,
8185            };
8186            // Calling decoder.out_of_line_offset(0) is not allowed.
8187            if len == 0 {
8188                return Ok(());
8189            };
8190            depth.increment()?;
8191            let envelope_size = 8;
8192            let bytes_len = len * envelope_size;
8193            let offset = decoder.out_of_line_offset(bytes_len)?;
8194            // Decode the envelope for each type.
8195            let mut _next_ordinal_to_read = 0;
8196            let mut next_offset = offset;
8197            let end_offset = offset + bytes_len;
8198            _next_ordinal_to_read += 1;
8199            if next_offset >= end_offset {
8200                return Ok(());
8201            }
8202
8203            // Decode unknown envelopes for gaps in ordinals.
8204            while _next_ordinal_to_read < 1 {
8205                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8206                _next_ordinal_to_read += 1;
8207                next_offset += envelope_size;
8208            }
8209
8210            let next_out_of_line = decoder.next_out_of_line();
8211            let handles_before = decoder.remaining_handles();
8212            if let Some((inlined, num_bytes, num_handles)) =
8213                fidl::encoding::decode_envelope_header(decoder, next_offset)?
8214            {
8215                let member_inline_size =
8216                    <Nat64PacketCounters as fidl::encoding::TypeMarker>::inline_size(
8217                        decoder.context,
8218                    );
8219                if inlined != (member_inline_size <= 4) {
8220                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
8221                }
8222                let inner_offset;
8223                let mut inner_depth = depth.clone();
8224                if inlined {
8225                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8226                    inner_offset = next_offset;
8227                } else {
8228                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8229                    inner_depth.increment()?;
8230                }
8231                let val_ref =
8232                    self.unknown.get_or_insert_with(|| fidl::new_empty!(Nat64PacketCounters, D));
8233                fidl::decode!(Nat64PacketCounters, D, val_ref, decoder, inner_offset, inner_depth)?;
8234                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8235                {
8236                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
8237                }
8238                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8239                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8240                }
8241            }
8242
8243            next_offset += envelope_size;
8244            _next_ordinal_to_read += 1;
8245            if next_offset >= end_offset {
8246                return Ok(());
8247            }
8248
8249            // Decode unknown envelopes for gaps in ordinals.
8250            while _next_ordinal_to_read < 2 {
8251                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8252                _next_ordinal_to_read += 1;
8253                next_offset += envelope_size;
8254            }
8255
8256            let next_out_of_line = decoder.next_out_of_line();
8257            let handles_before = decoder.remaining_handles();
8258            if let Some((inlined, num_bytes, num_handles)) =
8259                fidl::encoding::decode_envelope_header(decoder, next_offset)?
8260            {
8261                let member_inline_size =
8262                    <Nat64PacketCounters as fidl::encoding::TypeMarker>::inline_size(
8263                        decoder.context,
8264                    );
8265                if inlined != (member_inline_size <= 4) {
8266                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
8267                }
8268                let inner_offset;
8269                let mut inner_depth = depth.clone();
8270                if inlined {
8271                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8272                    inner_offset = next_offset;
8273                } else {
8274                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8275                    inner_depth.increment()?;
8276                }
8277                let val_ref = self
8278                    .illegal_packet
8279                    .get_or_insert_with(|| fidl::new_empty!(Nat64PacketCounters, D));
8280                fidl::decode!(Nat64PacketCounters, D, val_ref, decoder, inner_offset, inner_depth)?;
8281                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8282                {
8283                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
8284                }
8285                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8286                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8287                }
8288            }
8289
8290            next_offset += envelope_size;
8291            _next_ordinal_to_read += 1;
8292            if next_offset >= end_offset {
8293                return Ok(());
8294            }
8295
8296            // Decode unknown envelopes for gaps in ordinals.
8297            while _next_ordinal_to_read < 3 {
8298                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8299                _next_ordinal_to_read += 1;
8300                next_offset += envelope_size;
8301            }
8302
8303            let next_out_of_line = decoder.next_out_of_line();
8304            let handles_before = decoder.remaining_handles();
8305            if let Some((inlined, num_bytes, num_handles)) =
8306                fidl::encoding::decode_envelope_header(decoder, next_offset)?
8307            {
8308                let member_inline_size =
8309                    <Nat64PacketCounters as fidl::encoding::TypeMarker>::inline_size(
8310                        decoder.context,
8311                    );
8312                if inlined != (member_inline_size <= 4) {
8313                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
8314                }
8315                let inner_offset;
8316                let mut inner_depth = depth.clone();
8317                if inlined {
8318                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8319                    inner_offset = next_offset;
8320                } else {
8321                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8322                    inner_depth.increment()?;
8323                }
8324                let val_ref = self
8325                    .unsupported_protocol
8326                    .get_or_insert_with(|| fidl::new_empty!(Nat64PacketCounters, D));
8327                fidl::decode!(Nat64PacketCounters, D, val_ref, decoder, inner_offset, inner_depth)?;
8328                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8329                {
8330                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
8331                }
8332                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8333                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8334                }
8335            }
8336
8337            next_offset += envelope_size;
8338            _next_ordinal_to_read += 1;
8339            if next_offset >= end_offset {
8340                return Ok(());
8341            }
8342
8343            // Decode unknown envelopes for gaps in ordinals.
8344            while _next_ordinal_to_read < 4 {
8345                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8346                _next_ordinal_to_read += 1;
8347                next_offset += envelope_size;
8348            }
8349
8350            let next_out_of_line = decoder.next_out_of_line();
8351            let handles_before = decoder.remaining_handles();
8352            if let Some((inlined, num_bytes, num_handles)) =
8353                fidl::encoding::decode_envelope_header(decoder, next_offset)?
8354            {
8355                let member_inline_size =
8356                    <Nat64PacketCounters as fidl::encoding::TypeMarker>::inline_size(
8357                        decoder.context,
8358                    );
8359                if inlined != (member_inline_size <= 4) {
8360                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
8361                }
8362                let inner_offset;
8363                let mut inner_depth = depth.clone();
8364                if inlined {
8365                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8366                    inner_offset = next_offset;
8367                } else {
8368                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8369                    inner_depth.increment()?;
8370                }
8371                let val_ref =
8372                    self.no_mapping.get_or_insert_with(|| fidl::new_empty!(Nat64PacketCounters, D));
8373                fidl::decode!(Nat64PacketCounters, D, val_ref, decoder, inner_offset, inner_depth)?;
8374                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8375                {
8376                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
8377                }
8378                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8379                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8380                }
8381            }
8382
8383            next_offset += envelope_size;
8384
8385            // Decode the remaining unknown envelopes.
8386            while next_offset < end_offset {
8387                _next_ordinal_to_read += 1;
8388                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8389                next_offset += envelope_size;
8390            }
8391
8392            Ok(())
8393        }
8394    }
8395
8396    impl Nat64Info {
8397        #[inline(always)]
8398        fn max_ordinal_present(&self) -> u64 {
8399            if let Some(_) = self.nat64_protocol_counters {
8400                return 4;
8401            }
8402            if let Some(_) = self.nat64_error_counters {
8403                return 3;
8404            }
8405            if let Some(_) = self.nat64_mappings {
8406                return 2;
8407            }
8408            if let Some(_) = self.nat64_state {
8409                return 1;
8410            }
8411            0
8412        }
8413    }
8414
8415    impl fidl::encoding::ValueTypeMarker for Nat64Info {
8416        type Borrowed<'a> = &'a Self;
8417        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
8418            value
8419        }
8420    }
8421
8422    unsafe impl fidl::encoding::TypeMarker for Nat64Info {
8423        type Owned = Self;
8424
8425        #[inline(always)]
8426        fn inline_align(_context: fidl::encoding::Context) -> usize {
8427            8
8428        }
8429
8430        #[inline(always)]
8431        fn inline_size(_context: fidl::encoding::Context) -> usize {
8432            16
8433        }
8434    }
8435
8436    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Nat64Info, D>
8437        for &Nat64Info
8438    {
8439        unsafe fn encode(
8440            self,
8441            encoder: &mut fidl::encoding::Encoder<'_, D>,
8442            offset: usize,
8443            mut depth: fidl::encoding::Depth,
8444        ) -> fidl::Result<()> {
8445            encoder.debug_check_bounds::<Nat64Info>(offset);
8446            // Vector header
8447            let max_ordinal: u64 = self.max_ordinal_present();
8448            encoder.write_num(max_ordinal, offset);
8449            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
8450            // Calling encoder.out_of_line_offset(0) is not allowed.
8451            if max_ordinal == 0 {
8452                return Ok(());
8453            }
8454            depth.increment()?;
8455            let envelope_size = 8;
8456            let bytes_len = max_ordinal as usize * envelope_size;
8457            #[allow(unused_variables)]
8458            let offset = encoder.out_of_line_offset(bytes_len);
8459            let mut _prev_end_offset: usize = 0;
8460            if 1 > max_ordinal {
8461                return Ok(());
8462            }
8463
8464            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
8465            // are envelope_size bytes.
8466            let cur_offset: usize = (1 - 1) * envelope_size;
8467
8468            // Zero reserved fields.
8469            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
8470
8471            // Safety:
8472            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
8473            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
8474            //   envelope_size bytes, there is always sufficient room.
8475            fidl::encoding::encode_in_envelope_optional::<BorderRoutingNat64State, D>(
8476                self.nat64_state
8477                    .as_ref()
8478                    .map(<BorderRoutingNat64State as fidl::encoding::ValueTypeMarker>::borrow),
8479                encoder,
8480                offset + cur_offset,
8481                depth,
8482            )?;
8483
8484            _prev_end_offset = cur_offset + envelope_size;
8485            if 2 > max_ordinal {
8486                return Ok(());
8487            }
8488
8489            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
8490            // are envelope_size bytes.
8491            let cur_offset: usize = (2 - 1) * envelope_size;
8492
8493            // Zero reserved fields.
8494            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
8495
8496            // Safety:
8497            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
8498            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
8499            //   envelope_size bytes, there is always sufficient room.
8500            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedVector<Nat64Mapping>, D>(
8501            self.nat64_mappings.as_ref().map(<fidl::encoding::UnboundedVector<Nat64Mapping> as fidl::encoding::ValueTypeMarker>::borrow),
8502            encoder, offset + cur_offset, depth
8503        )?;
8504
8505            _prev_end_offset = cur_offset + envelope_size;
8506            if 3 > max_ordinal {
8507                return Ok(());
8508            }
8509
8510            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
8511            // are envelope_size bytes.
8512            let cur_offset: usize = (3 - 1) * envelope_size;
8513
8514            // Zero reserved fields.
8515            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
8516
8517            // Safety:
8518            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
8519            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
8520            //   envelope_size bytes, there is always sufficient room.
8521            fidl::encoding::encode_in_envelope_optional::<Nat64ErrorCounters, D>(
8522                self.nat64_error_counters
8523                    .as_ref()
8524                    .map(<Nat64ErrorCounters as fidl::encoding::ValueTypeMarker>::borrow),
8525                encoder,
8526                offset + cur_offset,
8527                depth,
8528            )?;
8529
8530            _prev_end_offset = cur_offset + envelope_size;
8531            if 4 > max_ordinal {
8532                return Ok(());
8533            }
8534
8535            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
8536            // are envelope_size bytes.
8537            let cur_offset: usize = (4 - 1) * envelope_size;
8538
8539            // Zero reserved fields.
8540            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
8541
8542            // Safety:
8543            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
8544            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
8545            //   envelope_size bytes, there is always sufficient room.
8546            fidl::encoding::encode_in_envelope_optional::<Nat64ProtocolCounters, D>(
8547                self.nat64_protocol_counters
8548                    .as_ref()
8549                    .map(<Nat64ProtocolCounters as fidl::encoding::ValueTypeMarker>::borrow),
8550                encoder,
8551                offset + cur_offset,
8552                depth,
8553            )?;
8554
8555            _prev_end_offset = cur_offset + envelope_size;
8556
8557            Ok(())
8558        }
8559    }
8560
8561    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Nat64Info {
8562        #[inline(always)]
8563        fn new_empty() -> Self {
8564            Self::default()
8565        }
8566
8567        unsafe fn decode(
8568            &mut self,
8569            decoder: &mut fidl::encoding::Decoder<'_, D>,
8570            offset: usize,
8571            mut depth: fidl::encoding::Depth,
8572        ) -> fidl::Result<()> {
8573            decoder.debug_check_bounds::<Self>(offset);
8574            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
8575                None => return Err(fidl::Error::NotNullable),
8576                Some(len) => len,
8577            };
8578            // Calling decoder.out_of_line_offset(0) is not allowed.
8579            if len == 0 {
8580                return Ok(());
8581            };
8582            depth.increment()?;
8583            let envelope_size = 8;
8584            let bytes_len = len * envelope_size;
8585            let offset = decoder.out_of_line_offset(bytes_len)?;
8586            // Decode the envelope for each type.
8587            let mut _next_ordinal_to_read = 0;
8588            let mut next_offset = offset;
8589            let end_offset = offset + bytes_len;
8590            _next_ordinal_to_read += 1;
8591            if next_offset >= end_offset {
8592                return Ok(());
8593            }
8594
8595            // Decode unknown envelopes for gaps in ordinals.
8596            while _next_ordinal_to_read < 1 {
8597                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8598                _next_ordinal_to_read += 1;
8599                next_offset += envelope_size;
8600            }
8601
8602            let next_out_of_line = decoder.next_out_of_line();
8603            let handles_before = decoder.remaining_handles();
8604            if let Some((inlined, num_bytes, num_handles)) =
8605                fidl::encoding::decode_envelope_header(decoder, next_offset)?
8606            {
8607                let member_inline_size =
8608                    <BorderRoutingNat64State as fidl::encoding::TypeMarker>::inline_size(
8609                        decoder.context,
8610                    );
8611                if inlined != (member_inline_size <= 4) {
8612                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
8613                }
8614                let inner_offset;
8615                let mut inner_depth = depth.clone();
8616                if inlined {
8617                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8618                    inner_offset = next_offset;
8619                } else {
8620                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8621                    inner_depth.increment()?;
8622                }
8623                let val_ref = self
8624                    .nat64_state
8625                    .get_or_insert_with(|| fidl::new_empty!(BorderRoutingNat64State, D));
8626                fidl::decode!(
8627                    BorderRoutingNat64State,
8628                    D,
8629                    val_ref,
8630                    decoder,
8631                    inner_offset,
8632                    inner_depth
8633                )?;
8634                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8635                {
8636                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
8637                }
8638                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8639                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8640                }
8641            }
8642
8643            next_offset += envelope_size;
8644            _next_ordinal_to_read += 1;
8645            if next_offset >= end_offset {
8646                return Ok(());
8647            }
8648
8649            // Decode unknown envelopes for gaps in ordinals.
8650            while _next_ordinal_to_read < 2 {
8651                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8652                _next_ordinal_to_read += 1;
8653                next_offset += envelope_size;
8654            }
8655
8656            let next_out_of_line = decoder.next_out_of_line();
8657            let handles_before = decoder.remaining_handles();
8658            if let Some((inlined, num_bytes, num_handles)) =
8659                fidl::encoding::decode_envelope_header(decoder, next_offset)?
8660            {
8661                let member_inline_size = <fidl::encoding::UnboundedVector<Nat64Mapping> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
8662                if inlined != (member_inline_size <= 4) {
8663                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
8664                }
8665                let inner_offset;
8666                let mut inner_depth = depth.clone();
8667                if inlined {
8668                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8669                    inner_offset = next_offset;
8670                } else {
8671                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8672                    inner_depth.increment()?;
8673                }
8674                let val_ref = self.nat64_mappings.get_or_insert_with(|| {
8675                    fidl::new_empty!(fidl::encoding::UnboundedVector<Nat64Mapping>, D)
8676                });
8677                fidl::decode!(
8678                    fidl::encoding::UnboundedVector<Nat64Mapping>,
8679                    D,
8680                    val_ref,
8681                    decoder,
8682                    inner_offset,
8683                    inner_depth
8684                )?;
8685                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8686                {
8687                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
8688                }
8689                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8690                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8691                }
8692            }
8693
8694            next_offset += envelope_size;
8695            _next_ordinal_to_read += 1;
8696            if next_offset >= end_offset {
8697                return Ok(());
8698            }
8699
8700            // Decode unknown envelopes for gaps in ordinals.
8701            while _next_ordinal_to_read < 3 {
8702                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8703                _next_ordinal_to_read += 1;
8704                next_offset += envelope_size;
8705            }
8706
8707            let next_out_of_line = decoder.next_out_of_line();
8708            let handles_before = decoder.remaining_handles();
8709            if let Some((inlined, num_bytes, num_handles)) =
8710                fidl::encoding::decode_envelope_header(decoder, next_offset)?
8711            {
8712                let member_inline_size =
8713                    <Nat64ErrorCounters as fidl::encoding::TypeMarker>::inline_size(
8714                        decoder.context,
8715                    );
8716                if inlined != (member_inline_size <= 4) {
8717                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
8718                }
8719                let inner_offset;
8720                let mut inner_depth = depth.clone();
8721                if inlined {
8722                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8723                    inner_offset = next_offset;
8724                } else {
8725                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8726                    inner_depth.increment()?;
8727                }
8728                let val_ref = self
8729                    .nat64_error_counters
8730                    .get_or_insert_with(|| fidl::new_empty!(Nat64ErrorCounters, D));
8731                fidl::decode!(Nat64ErrorCounters, D, val_ref, decoder, inner_offset, inner_depth)?;
8732                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8733                {
8734                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
8735                }
8736                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8737                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8738                }
8739            }
8740
8741            next_offset += envelope_size;
8742            _next_ordinal_to_read += 1;
8743            if next_offset >= end_offset {
8744                return Ok(());
8745            }
8746
8747            // Decode unknown envelopes for gaps in ordinals.
8748            while _next_ordinal_to_read < 4 {
8749                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8750                _next_ordinal_to_read += 1;
8751                next_offset += envelope_size;
8752            }
8753
8754            let next_out_of_line = decoder.next_out_of_line();
8755            let handles_before = decoder.remaining_handles();
8756            if let Some((inlined, num_bytes, num_handles)) =
8757                fidl::encoding::decode_envelope_header(decoder, next_offset)?
8758            {
8759                let member_inline_size =
8760                    <Nat64ProtocolCounters as fidl::encoding::TypeMarker>::inline_size(
8761                        decoder.context,
8762                    );
8763                if inlined != (member_inline_size <= 4) {
8764                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
8765                }
8766                let inner_offset;
8767                let mut inner_depth = depth.clone();
8768                if inlined {
8769                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8770                    inner_offset = next_offset;
8771                } else {
8772                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8773                    inner_depth.increment()?;
8774                }
8775                let val_ref = self
8776                    .nat64_protocol_counters
8777                    .get_or_insert_with(|| fidl::new_empty!(Nat64ProtocolCounters, D));
8778                fidl::decode!(
8779                    Nat64ProtocolCounters,
8780                    D,
8781                    val_ref,
8782                    decoder,
8783                    inner_offset,
8784                    inner_depth
8785                )?;
8786                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8787                {
8788                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
8789                }
8790                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8791                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8792                }
8793            }
8794
8795            next_offset += envelope_size;
8796
8797            // Decode the remaining unknown envelopes.
8798            while next_offset < end_offset {
8799                _next_ordinal_to_read += 1;
8800                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8801                next_offset += envelope_size;
8802            }
8803
8804            Ok(())
8805        }
8806    }
8807
8808    impl Nat64Mapping {
8809        #[inline(always)]
8810        fn max_ordinal_present(&self) -> u64 {
8811            if let Some(_) = self.counters {
8812                return 5;
8813            }
8814            if let Some(_) = self.remaining_time_ms {
8815                return 4;
8816            }
8817            if let Some(_) = self.ip6_addr {
8818                return 3;
8819            }
8820            if let Some(_) = self.ip4_addr {
8821                return 2;
8822            }
8823            if let Some(_) = self.mapping_id {
8824                return 1;
8825            }
8826            0
8827        }
8828    }
8829
8830    impl fidl::encoding::ValueTypeMarker for Nat64Mapping {
8831        type Borrowed<'a> = &'a Self;
8832        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
8833            value
8834        }
8835    }
8836
8837    unsafe impl fidl::encoding::TypeMarker for Nat64Mapping {
8838        type Owned = Self;
8839
8840        #[inline(always)]
8841        fn inline_align(_context: fidl::encoding::Context) -> usize {
8842            8
8843        }
8844
8845        #[inline(always)]
8846        fn inline_size(_context: fidl::encoding::Context) -> usize {
8847            16
8848        }
8849    }
8850
8851    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Nat64Mapping, D>
8852        for &Nat64Mapping
8853    {
8854        unsafe fn encode(
8855            self,
8856            encoder: &mut fidl::encoding::Encoder<'_, D>,
8857            offset: usize,
8858            mut depth: fidl::encoding::Depth,
8859        ) -> fidl::Result<()> {
8860            encoder.debug_check_bounds::<Nat64Mapping>(offset);
8861            // Vector header
8862            let max_ordinal: u64 = self.max_ordinal_present();
8863            encoder.write_num(max_ordinal, offset);
8864            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
8865            // Calling encoder.out_of_line_offset(0) is not allowed.
8866            if max_ordinal == 0 {
8867                return Ok(());
8868            }
8869            depth.increment()?;
8870            let envelope_size = 8;
8871            let bytes_len = max_ordinal as usize * envelope_size;
8872            #[allow(unused_variables)]
8873            let offset = encoder.out_of_line_offset(bytes_len);
8874            let mut _prev_end_offset: usize = 0;
8875            if 1 > max_ordinal {
8876                return Ok(());
8877            }
8878
8879            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
8880            // are envelope_size bytes.
8881            let cur_offset: usize = (1 - 1) * envelope_size;
8882
8883            // Zero reserved fields.
8884            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
8885
8886            // Safety:
8887            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
8888            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
8889            //   envelope_size bytes, there is always sufficient room.
8890            fidl::encoding::encode_in_envelope_optional::<u64, D>(
8891                self.mapping_id.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
8892                encoder,
8893                offset + cur_offset,
8894                depth,
8895            )?;
8896
8897            _prev_end_offset = cur_offset + envelope_size;
8898            if 2 > max_ordinal {
8899                return Ok(());
8900            }
8901
8902            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
8903            // are envelope_size bytes.
8904            let cur_offset: usize = (2 - 1) * envelope_size;
8905
8906            // Zero reserved fields.
8907            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
8908
8909            // Safety:
8910            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
8911            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
8912            //   envelope_size bytes, there is always sufficient room.
8913            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedVector<u8>, D>(
8914            self.ip4_addr.as_ref().map(<fidl::encoding::UnboundedVector<u8> as fidl::encoding::ValueTypeMarker>::borrow),
8915            encoder, offset + cur_offset, depth
8916        )?;
8917
8918            _prev_end_offset = cur_offset + envelope_size;
8919            if 3 > max_ordinal {
8920                return Ok(());
8921            }
8922
8923            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
8924            // are envelope_size bytes.
8925            let cur_offset: usize = (3 - 1) * envelope_size;
8926
8927            // Zero reserved fields.
8928            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
8929
8930            // Safety:
8931            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
8932            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
8933            //   envelope_size bytes, there is always sufficient room.
8934            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedVector<u8>, D>(
8935            self.ip6_addr.as_ref().map(<fidl::encoding::UnboundedVector<u8> as fidl::encoding::ValueTypeMarker>::borrow),
8936            encoder, offset + cur_offset, depth
8937        )?;
8938
8939            _prev_end_offset = cur_offset + envelope_size;
8940            if 4 > max_ordinal {
8941                return Ok(());
8942            }
8943
8944            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
8945            // are envelope_size bytes.
8946            let cur_offset: usize = (4 - 1) * envelope_size;
8947
8948            // Zero reserved fields.
8949            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
8950
8951            // Safety:
8952            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
8953            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
8954            //   envelope_size bytes, there is always sufficient room.
8955            fidl::encoding::encode_in_envelope_optional::<u32, D>(
8956                self.remaining_time_ms
8957                    .as_ref()
8958                    .map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
8959                encoder,
8960                offset + cur_offset,
8961                depth,
8962            )?;
8963
8964            _prev_end_offset = cur_offset + envelope_size;
8965            if 5 > max_ordinal {
8966                return Ok(());
8967            }
8968
8969            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
8970            // are envelope_size bytes.
8971            let cur_offset: usize = (5 - 1) * envelope_size;
8972
8973            // Zero reserved fields.
8974            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
8975
8976            // Safety:
8977            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
8978            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
8979            //   envelope_size bytes, there is always sufficient room.
8980            fidl::encoding::encode_in_envelope_optional::<Nat64ProtocolCounters, D>(
8981                self.counters
8982                    .as_ref()
8983                    .map(<Nat64ProtocolCounters as fidl::encoding::ValueTypeMarker>::borrow),
8984                encoder,
8985                offset + cur_offset,
8986                depth,
8987            )?;
8988
8989            _prev_end_offset = cur_offset + envelope_size;
8990
8991            Ok(())
8992        }
8993    }
8994
8995    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Nat64Mapping {
8996        #[inline(always)]
8997        fn new_empty() -> Self {
8998            Self::default()
8999        }
9000
9001        unsafe fn decode(
9002            &mut self,
9003            decoder: &mut fidl::encoding::Decoder<'_, D>,
9004            offset: usize,
9005            mut depth: fidl::encoding::Depth,
9006        ) -> fidl::Result<()> {
9007            decoder.debug_check_bounds::<Self>(offset);
9008            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
9009                None => return Err(fidl::Error::NotNullable),
9010                Some(len) => len,
9011            };
9012            // Calling decoder.out_of_line_offset(0) is not allowed.
9013            if len == 0 {
9014                return Ok(());
9015            };
9016            depth.increment()?;
9017            let envelope_size = 8;
9018            let bytes_len = len * envelope_size;
9019            let offset = decoder.out_of_line_offset(bytes_len)?;
9020            // Decode the envelope for each type.
9021            let mut _next_ordinal_to_read = 0;
9022            let mut next_offset = offset;
9023            let end_offset = offset + bytes_len;
9024            _next_ordinal_to_read += 1;
9025            if next_offset >= end_offset {
9026                return Ok(());
9027            }
9028
9029            // Decode unknown envelopes for gaps in ordinals.
9030            while _next_ordinal_to_read < 1 {
9031                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
9032                _next_ordinal_to_read += 1;
9033                next_offset += envelope_size;
9034            }
9035
9036            let next_out_of_line = decoder.next_out_of_line();
9037            let handles_before = decoder.remaining_handles();
9038            if let Some((inlined, num_bytes, num_handles)) =
9039                fidl::encoding::decode_envelope_header(decoder, next_offset)?
9040            {
9041                let member_inline_size =
9042                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
9043                if inlined != (member_inline_size <= 4) {
9044                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
9045                }
9046                let inner_offset;
9047                let mut inner_depth = depth.clone();
9048                if inlined {
9049                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
9050                    inner_offset = next_offset;
9051                } else {
9052                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
9053                    inner_depth.increment()?;
9054                }
9055                let val_ref = self.mapping_id.get_or_insert_with(|| fidl::new_empty!(u64, D));
9056                fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
9057                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
9058                {
9059                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
9060                }
9061                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
9062                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
9063                }
9064            }
9065
9066            next_offset += envelope_size;
9067            _next_ordinal_to_read += 1;
9068            if next_offset >= end_offset {
9069                return Ok(());
9070            }
9071
9072            // Decode unknown envelopes for gaps in ordinals.
9073            while _next_ordinal_to_read < 2 {
9074                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
9075                _next_ordinal_to_read += 1;
9076                next_offset += envelope_size;
9077            }
9078
9079            let next_out_of_line = decoder.next_out_of_line();
9080            let handles_before = decoder.remaining_handles();
9081            if let Some((inlined, num_bytes, num_handles)) =
9082                fidl::encoding::decode_envelope_header(decoder, next_offset)?
9083            {
9084                let member_inline_size = <fidl::encoding::UnboundedVector<u8> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
9085                if inlined != (member_inline_size <= 4) {
9086                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
9087                }
9088                let inner_offset;
9089                let mut inner_depth = depth.clone();
9090                if inlined {
9091                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
9092                    inner_offset = next_offset;
9093                } else {
9094                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
9095                    inner_depth.increment()?;
9096                }
9097                let val_ref = self.ip4_addr.get_or_insert_with(|| {
9098                    fidl::new_empty!(fidl::encoding::UnboundedVector<u8>, D)
9099                });
9100                fidl::decode!(
9101                    fidl::encoding::UnboundedVector<u8>,
9102                    D,
9103                    val_ref,
9104                    decoder,
9105                    inner_offset,
9106                    inner_depth
9107                )?;
9108                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
9109                {
9110                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
9111                }
9112                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
9113                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
9114                }
9115            }
9116
9117            next_offset += envelope_size;
9118            _next_ordinal_to_read += 1;
9119            if next_offset >= end_offset {
9120                return Ok(());
9121            }
9122
9123            // Decode unknown envelopes for gaps in ordinals.
9124            while _next_ordinal_to_read < 3 {
9125                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
9126                _next_ordinal_to_read += 1;
9127                next_offset += envelope_size;
9128            }
9129
9130            let next_out_of_line = decoder.next_out_of_line();
9131            let handles_before = decoder.remaining_handles();
9132            if let Some((inlined, num_bytes, num_handles)) =
9133                fidl::encoding::decode_envelope_header(decoder, next_offset)?
9134            {
9135                let member_inline_size = <fidl::encoding::UnboundedVector<u8> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
9136                if inlined != (member_inline_size <= 4) {
9137                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
9138                }
9139                let inner_offset;
9140                let mut inner_depth = depth.clone();
9141                if inlined {
9142                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
9143                    inner_offset = next_offset;
9144                } else {
9145                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
9146                    inner_depth.increment()?;
9147                }
9148                let val_ref = self.ip6_addr.get_or_insert_with(|| {
9149                    fidl::new_empty!(fidl::encoding::UnboundedVector<u8>, D)
9150                });
9151                fidl::decode!(
9152                    fidl::encoding::UnboundedVector<u8>,
9153                    D,
9154                    val_ref,
9155                    decoder,
9156                    inner_offset,
9157                    inner_depth
9158                )?;
9159                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
9160                {
9161                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
9162                }
9163                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
9164                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
9165                }
9166            }
9167
9168            next_offset += envelope_size;
9169            _next_ordinal_to_read += 1;
9170            if next_offset >= end_offset {
9171                return Ok(());
9172            }
9173
9174            // Decode unknown envelopes for gaps in ordinals.
9175            while _next_ordinal_to_read < 4 {
9176                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
9177                _next_ordinal_to_read += 1;
9178                next_offset += envelope_size;
9179            }
9180
9181            let next_out_of_line = decoder.next_out_of_line();
9182            let handles_before = decoder.remaining_handles();
9183            if let Some((inlined, num_bytes, num_handles)) =
9184                fidl::encoding::decode_envelope_header(decoder, next_offset)?
9185            {
9186                let member_inline_size =
9187                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
9188                if inlined != (member_inline_size <= 4) {
9189                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
9190                }
9191                let inner_offset;
9192                let mut inner_depth = depth.clone();
9193                if inlined {
9194                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
9195                    inner_offset = next_offset;
9196                } else {
9197                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
9198                    inner_depth.increment()?;
9199                }
9200                let val_ref =
9201                    self.remaining_time_ms.get_or_insert_with(|| fidl::new_empty!(u32, D));
9202                fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
9203                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
9204                {
9205                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
9206                }
9207                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
9208                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
9209                }
9210            }
9211
9212            next_offset += envelope_size;
9213            _next_ordinal_to_read += 1;
9214            if next_offset >= end_offset {
9215                return Ok(());
9216            }
9217
9218            // Decode unknown envelopes for gaps in ordinals.
9219            while _next_ordinal_to_read < 5 {
9220                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
9221                _next_ordinal_to_read += 1;
9222                next_offset += envelope_size;
9223            }
9224
9225            let next_out_of_line = decoder.next_out_of_line();
9226            let handles_before = decoder.remaining_handles();
9227            if let Some((inlined, num_bytes, num_handles)) =
9228                fidl::encoding::decode_envelope_header(decoder, next_offset)?
9229            {
9230                let member_inline_size =
9231                    <Nat64ProtocolCounters as fidl::encoding::TypeMarker>::inline_size(
9232                        decoder.context,
9233                    );
9234                if inlined != (member_inline_size <= 4) {
9235                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
9236                }
9237                let inner_offset;
9238                let mut inner_depth = depth.clone();
9239                if inlined {
9240                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
9241                    inner_offset = next_offset;
9242                } else {
9243                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
9244                    inner_depth.increment()?;
9245                }
9246                let val_ref =
9247                    self.counters.get_or_insert_with(|| fidl::new_empty!(Nat64ProtocolCounters, D));
9248                fidl::decode!(
9249                    Nat64ProtocolCounters,
9250                    D,
9251                    val_ref,
9252                    decoder,
9253                    inner_offset,
9254                    inner_depth
9255                )?;
9256                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
9257                {
9258                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
9259                }
9260                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
9261                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
9262                }
9263            }
9264
9265            next_offset += envelope_size;
9266
9267            // Decode the remaining unknown envelopes.
9268            while next_offset < end_offset {
9269                _next_ordinal_to_read += 1;
9270                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
9271                next_offset += envelope_size;
9272            }
9273
9274            Ok(())
9275        }
9276    }
9277
9278    impl Nat64PacketCounters {
9279        #[inline(always)]
9280        fn max_ordinal_present(&self) -> u64 {
9281            if let Some(_) = self.ipv6_to_ipv4_packets {
9282                return 2;
9283            }
9284            if let Some(_) = self.ipv4_to_ipv6_packets {
9285                return 1;
9286            }
9287            0
9288        }
9289    }
9290
9291    impl fidl::encoding::ValueTypeMarker for Nat64PacketCounters {
9292        type Borrowed<'a> = &'a Self;
9293        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
9294            value
9295        }
9296    }
9297
9298    unsafe impl fidl::encoding::TypeMarker for Nat64PacketCounters {
9299        type Owned = Self;
9300
9301        #[inline(always)]
9302        fn inline_align(_context: fidl::encoding::Context) -> usize {
9303            8
9304        }
9305
9306        #[inline(always)]
9307        fn inline_size(_context: fidl::encoding::Context) -> usize {
9308            16
9309        }
9310    }
9311
9312    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Nat64PacketCounters, D>
9313        for &Nat64PacketCounters
9314    {
9315        unsafe fn encode(
9316            self,
9317            encoder: &mut fidl::encoding::Encoder<'_, D>,
9318            offset: usize,
9319            mut depth: fidl::encoding::Depth,
9320        ) -> fidl::Result<()> {
9321            encoder.debug_check_bounds::<Nat64PacketCounters>(offset);
9322            // Vector header
9323            let max_ordinal: u64 = self.max_ordinal_present();
9324            encoder.write_num(max_ordinal, offset);
9325            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
9326            // Calling encoder.out_of_line_offset(0) is not allowed.
9327            if max_ordinal == 0 {
9328                return Ok(());
9329            }
9330            depth.increment()?;
9331            let envelope_size = 8;
9332            let bytes_len = max_ordinal as usize * envelope_size;
9333            #[allow(unused_variables)]
9334            let offset = encoder.out_of_line_offset(bytes_len);
9335            let mut _prev_end_offset: usize = 0;
9336            if 1 > max_ordinal {
9337                return Ok(());
9338            }
9339
9340            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
9341            // are envelope_size bytes.
9342            let cur_offset: usize = (1 - 1) * envelope_size;
9343
9344            // Zero reserved fields.
9345            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
9346
9347            // Safety:
9348            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
9349            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
9350            //   envelope_size bytes, there is always sufficient room.
9351            fidl::encoding::encode_in_envelope_optional::<u64, D>(
9352                self.ipv4_to_ipv6_packets
9353                    .as_ref()
9354                    .map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
9355                encoder,
9356                offset + cur_offset,
9357                depth,
9358            )?;
9359
9360            _prev_end_offset = cur_offset + envelope_size;
9361            if 2 > max_ordinal {
9362                return Ok(());
9363            }
9364
9365            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
9366            // are envelope_size bytes.
9367            let cur_offset: usize = (2 - 1) * envelope_size;
9368
9369            // Zero reserved fields.
9370            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
9371
9372            // Safety:
9373            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
9374            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
9375            //   envelope_size bytes, there is always sufficient room.
9376            fidl::encoding::encode_in_envelope_optional::<u64, D>(
9377                self.ipv6_to_ipv4_packets
9378                    .as_ref()
9379                    .map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
9380                encoder,
9381                offset + cur_offset,
9382                depth,
9383            )?;
9384
9385            _prev_end_offset = cur_offset + envelope_size;
9386
9387            Ok(())
9388        }
9389    }
9390
9391    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Nat64PacketCounters {
9392        #[inline(always)]
9393        fn new_empty() -> Self {
9394            Self::default()
9395        }
9396
9397        unsafe fn decode(
9398            &mut self,
9399            decoder: &mut fidl::encoding::Decoder<'_, D>,
9400            offset: usize,
9401            mut depth: fidl::encoding::Depth,
9402        ) -> fidl::Result<()> {
9403            decoder.debug_check_bounds::<Self>(offset);
9404            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
9405                None => return Err(fidl::Error::NotNullable),
9406                Some(len) => len,
9407            };
9408            // Calling decoder.out_of_line_offset(0) is not allowed.
9409            if len == 0 {
9410                return Ok(());
9411            };
9412            depth.increment()?;
9413            let envelope_size = 8;
9414            let bytes_len = len * envelope_size;
9415            let offset = decoder.out_of_line_offset(bytes_len)?;
9416            // Decode the envelope for each type.
9417            let mut _next_ordinal_to_read = 0;
9418            let mut next_offset = offset;
9419            let end_offset = offset + bytes_len;
9420            _next_ordinal_to_read += 1;
9421            if next_offset >= end_offset {
9422                return Ok(());
9423            }
9424
9425            // Decode unknown envelopes for gaps in ordinals.
9426            while _next_ordinal_to_read < 1 {
9427                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
9428                _next_ordinal_to_read += 1;
9429                next_offset += envelope_size;
9430            }
9431
9432            let next_out_of_line = decoder.next_out_of_line();
9433            let handles_before = decoder.remaining_handles();
9434            if let Some((inlined, num_bytes, num_handles)) =
9435                fidl::encoding::decode_envelope_header(decoder, next_offset)?
9436            {
9437                let member_inline_size =
9438                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
9439                if inlined != (member_inline_size <= 4) {
9440                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
9441                }
9442                let inner_offset;
9443                let mut inner_depth = depth.clone();
9444                if inlined {
9445                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
9446                    inner_offset = next_offset;
9447                } else {
9448                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
9449                    inner_depth.increment()?;
9450                }
9451                let val_ref =
9452                    self.ipv4_to_ipv6_packets.get_or_insert_with(|| fidl::new_empty!(u64, D));
9453                fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
9454                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
9455                {
9456                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
9457                }
9458                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
9459                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
9460                }
9461            }
9462
9463            next_offset += envelope_size;
9464            _next_ordinal_to_read += 1;
9465            if next_offset >= end_offset {
9466                return Ok(());
9467            }
9468
9469            // Decode unknown envelopes for gaps in ordinals.
9470            while _next_ordinal_to_read < 2 {
9471                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
9472                _next_ordinal_to_read += 1;
9473                next_offset += envelope_size;
9474            }
9475
9476            let next_out_of_line = decoder.next_out_of_line();
9477            let handles_before = decoder.remaining_handles();
9478            if let Some((inlined, num_bytes, num_handles)) =
9479                fidl::encoding::decode_envelope_header(decoder, next_offset)?
9480            {
9481                let member_inline_size =
9482                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
9483                if inlined != (member_inline_size <= 4) {
9484                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
9485                }
9486                let inner_offset;
9487                let mut inner_depth = depth.clone();
9488                if inlined {
9489                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
9490                    inner_offset = next_offset;
9491                } else {
9492                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
9493                    inner_depth.increment()?;
9494                }
9495                let val_ref =
9496                    self.ipv6_to_ipv4_packets.get_or_insert_with(|| fidl::new_empty!(u64, D));
9497                fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
9498                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
9499                {
9500                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
9501                }
9502                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
9503                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
9504                }
9505            }
9506
9507            next_offset += envelope_size;
9508
9509            // Decode the remaining unknown envelopes.
9510            while next_offset < end_offset {
9511                _next_ordinal_to_read += 1;
9512                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
9513                next_offset += envelope_size;
9514            }
9515
9516            Ok(())
9517        }
9518    }
9519
9520    impl Nat64ProtocolCounters {
9521        #[inline(always)]
9522        fn max_ordinal_present(&self) -> u64 {
9523            if let Some(_) = self.total {
9524                return 4;
9525            }
9526            if let Some(_) = self.icmp {
9527                return 3;
9528            }
9529            if let Some(_) = self.udp {
9530                return 2;
9531            }
9532            if let Some(_) = self.tcp {
9533                return 1;
9534            }
9535            0
9536        }
9537    }
9538
9539    impl fidl::encoding::ValueTypeMarker for Nat64ProtocolCounters {
9540        type Borrowed<'a> = &'a Self;
9541        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
9542            value
9543        }
9544    }
9545
9546    unsafe impl fidl::encoding::TypeMarker for Nat64ProtocolCounters {
9547        type Owned = Self;
9548
9549        #[inline(always)]
9550        fn inline_align(_context: fidl::encoding::Context) -> usize {
9551            8
9552        }
9553
9554        #[inline(always)]
9555        fn inline_size(_context: fidl::encoding::Context) -> usize {
9556            16
9557        }
9558    }
9559
9560    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Nat64ProtocolCounters, D>
9561        for &Nat64ProtocolCounters
9562    {
9563        unsafe fn encode(
9564            self,
9565            encoder: &mut fidl::encoding::Encoder<'_, D>,
9566            offset: usize,
9567            mut depth: fidl::encoding::Depth,
9568        ) -> fidl::Result<()> {
9569            encoder.debug_check_bounds::<Nat64ProtocolCounters>(offset);
9570            // Vector header
9571            let max_ordinal: u64 = self.max_ordinal_present();
9572            encoder.write_num(max_ordinal, offset);
9573            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
9574            // Calling encoder.out_of_line_offset(0) is not allowed.
9575            if max_ordinal == 0 {
9576                return Ok(());
9577            }
9578            depth.increment()?;
9579            let envelope_size = 8;
9580            let bytes_len = max_ordinal as usize * envelope_size;
9581            #[allow(unused_variables)]
9582            let offset = encoder.out_of_line_offset(bytes_len);
9583            let mut _prev_end_offset: usize = 0;
9584            if 1 > max_ordinal {
9585                return Ok(());
9586            }
9587
9588            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
9589            // are envelope_size bytes.
9590            let cur_offset: usize = (1 - 1) * envelope_size;
9591
9592            // Zero reserved fields.
9593            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
9594
9595            // Safety:
9596            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
9597            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
9598            //   envelope_size bytes, there is always sufficient room.
9599            fidl::encoding::encode_in_envelope_optional::<Nat64TrafficCounters, D>(
9600                self.tcp
9601                    .as_ref()
9602                    .map(<Nat64TrafficCounters as fidl::encoding::ValueTypeMarker>::borrow),
9603                encoder,
9604                offset + cur_offset,
9605                depth,
9606            )?;
9607
9608            _prev_end_offset = cur_offset + envelope_size;
9609            if 2 > max_ordinal {
9610                return Ok(());
9611            }
9612
9613            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
9614            // are envelope_size bytes.
9615            let cur_offset: usize = (2 - 1) * envelope_size;
9616
9617            // Zero reserved fields.
9618            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
9619
9620            // Safety:
9621            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
9622            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
9623            //   envelope_size bytes, there is always sufficient room.
9624            fidl::encoding::encode_in_envelope_optional::<Nat64TrafficCounters, D>(
9625                self.udp
9626                    .as_ref()
9627                    .map(<Nat64TrafficCounters as fidl::encoding::ValueTypeMarker>::borrow),
9628                encoder,
9629                offset + cur_offset,
9630                depth,
9631            )?;
9632
9633            _prev_end_offset = cur_offset + envelope_size;
9634            if 3 > max_ordinal {
9635                return Ok(());
9636            }
9637
9638            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
9639            // are envelope_size bytes.
9640            let cur_offset: usize = (3 - 1) * envelope_size;
9641
9642            // Zero reserved fields.
9643            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
9644
9645            // Safety:
9646            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
9647            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
9648            //   envelope_size bytes, there is always sufficient room.
9649            fidl::encoding::encode_in_envelope_optional::<Nat64TrafficCounters, D>(
9650                self.icmp
9651                    .as_ref()
9652                    .map(<Nat64TrafficCounters as fidl::encoding::ValueTypeMarker>::borrow),
9653                encoder,
9654                offset + cur_offset,
9655                depth,
9656            )?;
9657
9658            _prev_end_offset = cur_offset + envelope_size;
9659            if 4 > max_ordinal {
9660                return Ok(());
9661            }
9662
9663            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
9664            // are envelope_size bytes.
9665            let cur_offset: usize = (4 - 1) * envelope_size;
9666
9667            // Zero reserved fields.
9668            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
9669
9670            // Safety:
9671            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
9672            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
9673            //   envelope_size bytes, there is always sufficient room.
9674            fidl::encoding::encode_in_envelope_optional::<Nat64TrafficCounters, D>(
9675                self.total
9676                    .as_ref()
9677                    .map(<Nat64TrafficCounters as fidl::encoding::ValueTypeMarker>::borrow),
9678                encoder,
9679                offset + cur_offset,
9680                depth,
9681            )?;
9682
9683            _prev_end_offset = cur_offset + envelope_size;
9684
9685            Ok(())
9686        }
9687    }
9688
9689    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Nat64ProtocolCounters {
9690        #[inline(always)]
9691        fn new_empty() -> Self {
9692            Self::default()
9693        }
9694
9695        unsafe fn decode(
9696            &mut self,
9697            decoder: &mut fidl::encoding::Decoder<'_, D>,
9698            offset: usize,
9699            mut depth: fidl::encoding::Depth,
9700        ) -> fidl::Result<()> {
9701            decoder.debug_check_bounds::<Self>(offset);
9702            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
9703                None => return Err(fidl::Error::NotNullable),
9704                Some(len) => len,
9705            };
9706            // Calling decoder.out_of_line_offset(0) is not allowed.
9707            if len == 0 {
9708                return Ok(());
9709            };
9710            depth.increment()?;
9711            let envelope_size = 8;
9712            let bytes_len = len * envelope_size;
9713            let offset = decoder.out_of_line_offset(bytes_len)?;
9714            // Decode the envelope for each type.
9715            let mut _next_ordinal_to_read = 0;
9716            let mut next_offset = offset;
9717            let end_offset = offset + bytes_len;
9718            _next_ordinal_to_read += 1;
9719            if next_offset >= end_offset {
9720                return Ok(());
9721            }
9722
9723            // Decode unknown envelopes for gaps in ordinals.
9724            while _next_ordinal_to_read < 1 {
9725                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
9726                _next_ordinal_to_read += 1;
9727                next_offset += envelope_size;
9728            }
9729
9730            let next_out_of_line = decoder.next_out_of_line();
9731            let handles_before = decoder.remaining_handles();
9732            if let Some((inlined, num_bytes, num_handles)) =
9733                fidl::encoding::decode_envelope_header(decoder, next_offset)?
9734            {
9735                let member_inline_size =
9736                    <Nat64TrafficCounters as fidl::encoding::TypeMarker>::inline_size(
9737                        decoder.context,
9738                    );
9739                if inlined != (member_inline_size <= 4) {
9740                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
9741                }
9742                let inner_offset;
9743                let mut inner_depth = depth.clone();
9744                if inlined {
9745                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
9746                    inner_offset = next_offset;
9747                } else {
9748                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
9749                    inner_depth.increment()?;
9750                }
9751                let val_ref =
9752                    self.tcp.get_or_insert_with(|| fidl::new_empty!(Nat64TrafficCounters, D));
9753                fidl::decode!(
9754                    Nat64TrafficCounters,
9755                    D,
9756                    val_ref,
9757                    decoder,
9758                    inner_offset,
9759                    inner_depth
9760                )?;
9761                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
9762                {
9763                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
9764                }
9765                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
9766                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
9767                }
9768            }
9769
9770            next_offset += envelope_size;
9771            _next_ordinal_to_read += 1;
9772            if next_offset >= end_offset {
9773                return Ok(());
9774            }
9775
9776            // Decode unknown envelopes for gaps in ordinals.
9777            while _next_ordinal_to_read < 2 {
9778                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
9779                _next_ordinal_to_read += 1;
9780                next_offset += envelope_size;
9781            }
9782
9783            let next_out_of_line = decoder.next_out_of_line();
9784            let handles_before = decoder.remaining_handles();
9785            if let Some((inlined, num_bytes, num_handles)) =
9786                fidl::encoding::decode_envelope_header(decoder, next_offset)?
9787            {
9788                let member_inline_size =
9789                    <Nat64TrafficCounters as fidl::encoding::TypeMarker>::inline_size(
9790                        decoder.context,
9791                    );
9792                if inlined != (member_inline_size <= 4) {
9793                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
9794                }
9795                let inner_offset;
9796                let mut inner_depth = depth.clone();
9797                if inlined {
9798                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
9799                    inner_offset = next_offset;
9800                } else {
9801                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
9802                    inner_depth.increment()?;
9803                }
9804                let val_ref =
9805                    self.udp.get_or_insert_with(|| fidl::new_empty!(Nat64TrafficCounters, D));
9806                fidl::decode!(
9807                    Nat64TrafficCounters,
9808                    D,
9809                    val_ref,
9810                    decoder,
9811                    inner_offset,
9812                    inner_depth
9813                )?;
9814                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
9815                {
9816                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
9817                }
9818                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
9819                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
9820                }
9821            }
9822
9823            next_offset += envelope_size;
9824            _next_ordinal_to_read += 1;
9825            if next_offset >= end_offset {
9826                return Ok(());
9827            }
9828
9829            // Decode unknown envelopes for gaps in ordinals.
9830            while _next_ordinal_to_read < 3 {
9831                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
9832                _next_ordinal_to_read += 1;
9833                next_offset += envelope_size;
9834            }
9835
9836            let next_out_of_line = decoder.next_out_of_line();
9837            let handles_before = decoder.remaining_handles();
9838            if let Some((inlined, num_bytes, num_handles)) =
9839                fidl::encoding::decode_envelope_header(decoder, next_offset)?
9840            {
9841                let member_inline_size =
9842                    <Nat64TrafficCounters as fidl::encoding::TypeMarker>::inline_size(
9843                        decoder.context,
9844                    );
9845                if inlined != (member_inline_size <= 4) {
9846                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
9847                }
9848                let inner_offset;
9849                let mut inner_depth = depth.clone();
9850                if inlined {
9851                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
9852                    inner_offset = next_offset;
9853                } else {
9854                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
9855                    inner_depth.increment()?;
9856                }
9857                let val_ref =
9858                    self.icmp.get_or_insert_with(|| fidl::new_empty!(Nat64TrafficCounters, D));
9859                fidl::decode!(
9860                    Nat64TrafficCounters,
9861                    D,
9862                    val_ref,
9863                    decoder,
9864                    inner_offset,
9865                    inner_depth
9866                )?;
9867                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
9868                {
9869                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
9870                }
9871                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
9872                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
9873                }
9874            }
9875
9876            next_offset += envelope_size;
9877            _next_ordinal_to_read += 1;
9878            if next_offset >= end_offset {
9879                return Ok(());
9880            }
9881
9882            // Decode unknown envelopes for gaps in ordinals.
9883            while _next_ordinal_to_read < 4 {
9884                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
9885                _next_ordinal_to_read += 1;
9886                next_offset += envelope_size;
9887            }
9888
9889            let next_out_of_line = decoder.next_out_of_line();
9890            let handles_before = decoder.remaining_handles();
9891            if let Some((inlined, num_bytes, num_handles)) =
9892                fidl::encoding::decode_envelope_header(decoder, next_offset)?
9893            {
9894                let member_inline_size =
9895                    <Nat64TrafficCounters as fidl::encoding::TypeMarker>::inline_size(
9896                        decoder.context,
9897                    );
9898                if inlined != (member_inline_size <= 4) {
9899                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
9900                }
9901                let inner_offset;
9902                let mut inner_depth = depth.clone();
9903                if inlined {
9904                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
9905                    inner_offset = next_offset;
9906                } else {
9907                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
9908                    inner_depth.increment()?;
9909                }
9910                let val_ref =
9911                    self.total.get_or_insert_with(|| fidl::new_empty!(Nat64TrafficCounters, D));
9912                fidl::decode!(
9913                    Nat64TrafficCounters,
9914                    D,
9915                    val_ref,
9916                    decoder,
9917                    inner_offset,
9918                    inner_depth
9919                )?;
9920                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
9921                {
9922                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
9923                }
9924                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
9925                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
9926                }
9927            }
9928
9929            next_offset += envelope_size;
9930
9931            // Decode the remaining unknown envelopes.
9932            while next_offset < end_offset {
9933                _next_ordinal_to_read += 1;
9934                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
9935                next_offset += envelope_size;
9936            }
9937
9938            Ok(())
9939        }
9940    }
9941
9942    impl Nat64TrafficCounters {
9943        #[inline(always)]
9944        fn max_ordinal_present(&self) -> u64 {
9945            if let Some(_) = self.ipv6_to_ipv4_bytes {
9946                return 4;
9947            }
9948            if let Some(_) = self.ipv6_to_ipv4_packets {
9949                return 3;
9950            }
9951            if let Some(_) = self.ipv4_to_ipv6_bytes {
9952                return 2;
9953            }
9954            if let Some(_) = self.ipv4_to_ipv6_packets {
9955                return 1;
9956            }
9957            0
9958        }
9959    }
9960
9961    impl fidl::encoding::ValueTypeMarker for Nat64TrafficCounters {
9962        type Borrowed<'a> = &'a Self;
9963        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
9964            value
9965        }
9966    }
9967
9968    unsafe impl fidl::encoding::TypeMarker for Nat64TrafficCounters {
9969        type Owned = Self;
9970
9971        #[inline(always)]
9972        fn inline_align(_context: fidl::encoding::Context) -> usize {
9973            8
9974        }
9975
9976        #[inline(always)]
9977        fn inline_size(_context: fidl::encoding::Context) -> usize {
9978            16
9979        }
9980    }
9981
9982    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Nat64TrafficCounters, D>
9983        for &Nat64TrafficCounters
9984    {
9985        unsafe fn encode(
9986            self,
9987            encoder: &mut fidl::encoding::Encoder<'_, D>,
9988            offset: usize,
9989            mut depth: fidl::encoding::Depth,
9990        ) -> fidl::Result<()> {
9991            encoder.debug_check_bounds::<Nat64TrafficCounters>(offset);
9992            // Vector header
9993            let max_ordinal: u64 = self.max_ordinal_present();
9994            encoder.write_num(max_ordinal, offset);
9995            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
9996            // Calling encoder.out_of_line_offset(0) is not allowed.
9997            if max_ordinal == 0 {
9998                return Ok(());
9999            }
10000            depth.increment()?;
10001            let envelope_size = 8;
10002            let bytes_len = max_ordinal as usize * envelope_size;
10003            #[allow(unused_variables)]
10004            let offset = encoder.out_of_line_offset(bytes_len);
10005            let mut _prev_end_offset: usize = 0;
10006            if 1 > max_ordinal {
10007                return Ok(());
10008            }
10009
10010            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
10011            // are envelope_size bytes.
10012            let cur_offset: usize = (1 - 1) * envelope_size;
10013
10014            // Zero reserved fields.
10015            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
10016
10017            // Safety:
10018            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
10019            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
10020            //   envelope_size bytes, there is always sufficient room.
10021            fidl::encoding::encode_in_envelope_optional::<u64, D>(
10022                self.ipv4_to_ipv6_packets
10023                    .as_ref()
10024                    .map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
10025                encoder,
10026                offset + cur_offset,
10027                depth,
10028            )?;
10029
10030            _prev_end_offset = cur_offset + envelope_size;
10031            if 2 > max_ordinal {
10032                return Ok(());
10033            }
10034
10035            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
10036            // are envelope_size bytes.
10037            let cur_offset: usize = (2 - 1) * envelope_size;
10038
10039            // Zero reserved fields.
10040            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
10041
10042            // Safety:
10043            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
10044            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
10045            //   envelope_size bytes, there is always sufficient room.
10046            fidl::encoding::encode_in_envelope_optional::<u64, D>(
10047                self.ipv4_to_ipv6_bytes
10048                    .as_ref()
10049                    .map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
10050                encoder,
10051                offset + cur_offset,
10052                depth,
10053            )?;
10054
10055            _prev_end_offset = cur_offset + envelope_size;
10056            if 3 > max_ordinal {
10057                return Ok(());
10058            }
10059
10060            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
10061            // are envelope_size bytes.
10062            let cur_offset: usize = (3 - 1) * envelope_size;
10063
10064            // Zero reserved fields.
10065            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
10066
10067            // Safety:
10068            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
10069            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
10070            //   envelope_size bytes, there is always sufficient room.
10071            fidl::encoding::encode_in_envelope_optional::<u64, D>(
10072                self.ipv6_to_ipv4_packets
10073                    .as_ref()
10074                    .map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
10075                encoder,
10076                offset + cur_offset,
10077                depth,
10078            )?;
10079
10080            _prev_end_offset = cur_offset + envelope_size;
10081            if 4 > max_ordinal {
10082                return Ok(());
10083            }
10084
10085            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
10086            // are envelope_size bytes.
10087            let cur_offset: usize = (4 - 1) * envelope_size;
10088
10089            // Zero reserved fields.
10090            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
10091
10092            // Safety:
10093            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
10094            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
10095            //   envelope_size bytes, there is always sufficient room.
10096            fidl::encoding::encode_in_envelope_optional::<u64, D>(
10097                self.ipv6_to_ipv4_bytes
10098                    .as_ref()
10099                    .map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
10100                encoder,
10101                offset + cur_offset,
10102                depth,
10103            )?;
10104
10105            _prev_end_offset = cur_offset + envelope_size;
10106
10107            Ok(())
10108        }
10109    }
10110
10111    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Nat64TrafficCounters {
10112        #[inline(always)]
10113        fn new_empty() -> Self {
10114            Self::default()
10115        }
10116
10117        unsafe fn decode(
10118            &mut self,
10119            decoder: &mut fidl::encoding::Decoder<'_, D>,
10120            offset: usize,
10121            mut depth: fidl::encoding::Depth,
10122        ) -> fidl::Result<()> {
10123            decoder.debug_check_bounds::<Self>(offset);
10124            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
10125                None => return Err(fidl::Error::NotNullable),
10126                Some(len) => len,
10127            };
10128            // Calling decoder.out_of_line_offset(0) is not allowed.
10129            if len == 0 {
10130                return Ok(());
10131            };
10132            depth.increment()?;
10133            let envelope_size = 8;
10134            let bytes_len = len * envelope_size;
10135            let offset = decoder.out_of_line_offset(bytes_len)?;
10136            // Decode the envelope for each type.
10137            let mut _next_ordinal_to_read = 0;
10138            let mut next_offset = offset;
10139            let end_offset = offset + bytes_len;
10140            _next_ordinal_to_read += 1;
10141            if next_offset >= end_offset {
10142                return Ok(());
10143            }
10144
10145            // Decode unknown envelopes for gaps in ordinals.
10146            while _next_ordinal_to_read < 1 {
10147                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10148                _next_ordinal_to_read += 1;
10149                next_offset += envelope_size;
10150            }
10151
10152            let next_out_of_line = decoder.next_out_of_line();
10153            let handles_before = decoder.remaining_handles();
10154            if let Some((inlined, num_bytes, num_handles)) =
10155                fidl::encoding::decode_envelope_header(decoder, next_offset)?
10156            {
10157                let member_inline_size =
10158                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
10159                if inlined != (member_inline_size <= 4) {
10160                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
10161                }
10162                let inner_offset;
10163                let mut inner_depth = depth.clone();
10164                if inlined {
10165                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
10166                    inner_offset = next_offset;
10167                } else {
10168                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
10169                    inner_depth.increment()?;
10170                }
10171                let val_ref =
10172                    self.ipv4_to_ipv6_packets.get_or_insert_with(|| fidl::new_empty!(u64, D));
10173                fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
10174                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
10175                {
10176                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
10177                }
10178                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
10179                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
10180                }
10181            }
10182
10183            next_offset += envelope_size;
10184            _next_ordinal_to_read += 1;
10185            if next_offset >= end_offset {
10186                return Ok(());
10187            }
10188
10189            // Decode unknown envelopes for gaps in ordinals.
10190            while _next_ordinal_to_read < 2 {
10191                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10192                _next_ordinal_to_read += 1;
10193                next_offset += envelope_size;
10194            }
10195
10196            let next_out_of_line = decoder.next_out_of_line();
10197            let handles_before = decoder.remaining_handles();
10198            if let Some((inlined, num_bytes, num_handles)) =
10199                fidl::encoding::decode_envelope_header(decoder, next_offset)?
10200            {
10201                let member_inline_size =
10202                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
10203                if inlined != (member_inline_size <= 4) {
10204                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
10205                }
10206                let inner_offset;
10207                let mut inner_depth = depth.clone();
10208                if inlined {
10209                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
10210                    inner_offset = next_offset;
10211                } else {
10212                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
10213                    inner_depth.increment()?;
10214                }
10215                let val_ref =
10216                    self.ipv4_to_ipv6_bytes.get_or_insert_with(|| fidl::new_empty!(u64, D));
10217                fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
10218                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
10219                {
10220                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
10221                }
10222                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
10223                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
10224                }
10225            }
10226
10227            next_offset += envelope_size;
10228            _next_ordinal_to_read += 1;
10229            if next_offset >= end_offset {
10230                return Ok(());
10231            }
10232
10233            // Decode unknown envelopes for gaps in ordinals.
10234            while _next_ordinal_to_read < 3 {
10235                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10236                _next_ordinal_to_read += 1;
10237                next_offset += envelope_size;
10238            }
10239
10240            let next_out_of_line = decoder.next_out_of_line();
10241            let handles_before = decoder.remaining_handles();
10242            if let Some((inlined, num_bytes, num_handles)) =
10243                fidl::encoding::decode_envelope_header(decoder, next_offset)?
10244            {
10245                let member_inline_size =
10246                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
10247                if inlined != (member_inline_size <= 4) {
10248                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
10249                }
10250                let inner_offset;
10251                let mut inner_depth = depth.clone();
10252                if inlined {
10253                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
10254                    inner_offset = next_offset;
10255                } else {
10256                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
10257                    inner_depth.increment()?;
10258                }
10259                let val_ref =
10260                    self.ipv6_to_ipv4_packets.get_or_insert_with(|| fidl::new_empty!(u64, D));
10261                fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
10262                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
10263                {
10264                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
10265                }
10266                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
10267                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
10268                }
10269            }
10270
10271            next_offset += envelope_size;
10272            _next_ordinal_to_read += 1;
10273            if next_offset >= end_offset {
10274                return Ok(());
10275            }
10276
10277            // Decode unknown envelopes for gaps in ordinals.
10278            while _next_ordinal_to_read < 4 {
10279                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10280                _next_ordinal_to_read += 1;
10281                next_offset += envelope_size;
10282            }
10283
10284            let next_out_of_line = decoder.next_out_of_line();
10285            let handles_before = decoder.remaining_handles();
10286            if let Some((inlined, num_bytes, num_handles)) =
10287                fidl::encoding::decode_envelope_header(decoder, next_offset)?
10288            {
10289                let member_inline_size =
10290                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
10291                if inlined != (member_inline_size <= 4) {
10292                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
10293                }
10294                let inner_offset;
10295                let mut inner_depth = depth.clone();
10296                if inlined {
10297                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
10298                    inner_offset = next_offset;
10299                } else {
10300                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
10301                    inner_depth.increment()?;
10302                }
10303                let val_ref =
10304                    self.ipv6_to_ipv4_bytes.get_or_insert_with(|| fidl::new_empty!(u64, D));
10305                fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
10306                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
10307                {
10308                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
10309                }
10310                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
10311                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
10312                }
10313            }
10314
10315            next_offset += envelope_size;
10316
10317            // Decode the remaining unknown envelopes.
10318            while next_offset < end_offset {
10319                _next_ordinal_to_read += 1;
10320                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10321                next_offset += envelope_size;
10322            }
10323
10324            Ok(())
10325        }
10326    }
10327
10328    impl NetworkScanParameters {
10329        #[inline(always)]
10330        fn max_ordinal_present(&self) -> u64 {
10331            if let Some(_) = self.tx_power_dbm {
10332                return 2;
10333            }
10334            if let Some(_) = self.channels {
10335                return 1;
10336            }
10337            0
10338        }
10339    }
10340
10341    impl fidl::encoding::ValueTypeMarker for NetworkScanParameters {
10342        type Borrowed<'a> = &'a Self;
10343        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
10344            value
10345        }
10346    }
10347
10348    unsafe impl fidl::encoding::TypeMarker for NetworkScanParameters {
10349        type Owned = Self;
10350
10351        #[inline(always)]
10352        fn inline_align(_context: fidl::encoding::Context) -> usize {
10353            8
10354        }
10355
10356        #[inline(always)]
10357        fn inline_size(_context: fidl::encoding::Context) -> usize {
10358            16
10359        }
10360    }
10361
10362    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<NetworkScanParameters, D>
10363        for &NetworkScanParameters
10364    {
10365        unsafe fn encode(
10366            self,
10367            encoder: &mut fidl::encoding::Encoder<'_, D>,
10368            offset: usize,
10369            mut depth: fidl::encoding::Depth,
10370        ) -> fidl::Result<()> {
10371            encoder.debug_check_bounds::<NetworkScanParameters>(offset);
10372            // Vector header
10373            let max_ordinal: u64 = self.max_ordinal_present();
10374            encoder.write_num(max_ordinal, offset);
10375            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
10376            // Calling encoder.out_of_line_offset(0) is not allowed.
10377            if max_ordinal == 0 {
10378                return Ok(());
10379            }
10380            depth.increment()?;
10381            let envelope_size = 8;
10382            let bytes_len = max_ordinal as usize * envelope_size;
10383            #[allow(unused_variables)]
10384            let offset = encoder.out_of_line_offset(bytes_len);
10385            let mut _prev_end_offset: usize = 0;
10386            if 1 > max_ordinal {
10387                return Ok(());
10388            }
10389
10390            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
10391            // are envelope_size bytes.
10392            let cur_offset: usize = (1 - 1) * envelope_size;
10393
10394            // Zero reserved fields.
10395            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
10396
10397            // Safety:
10398            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
10399            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
10400            //   envelope_size bytes, there is always sufficient room.
10401            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<u16, 200>, D>(
10402                self.channels.as_ref().map(
10403                    <fidl::encoding::Vector<u16, 200> as fidl::encoding::ValueTypeMarker>::borrow,
10404                ),
10405                encoder,
10406                offset + cur_offset,
10407                depth,
10408            )?;
10409
10410            _prev_end_offset = cur_offset + envelope_size;
10411            if 2 > max_ordinal {
10412                return Ok(());
10413            }
10414
10415            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
10416            // are envelope_size bytes.
10417            let cur_offset: usize = (2 - 1) * envelope_size;
10418
10419            // Zero reserved fields.
10420            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
10421
10422            // Safety:
10423            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
10424            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
10425            //   envelope_size bytes, there is always sufficient room.
10426            fidl::encoding::encode_in_envelope_optional::<i8, D>(
10427                self.tx_power_dbm.as_ref().map(<i8 as fidl::encoding::ValueTypeMarker>::borrow),
10428                encoder,
10429                offset + cur_offset,
10430                depth,
10431            )?;
10432
10433            _prev_end_offset = cur_offset + envelope_size;
10434
10435            Ok(())
10436        }
10437    }
10438
10439    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for NetworkScanParameters {
10440        #[inline(always)]
10441        fn new_empty() -> Self {
10442            Self::default()
10443        }
10444
10445        unsafe fn decode(
10446            &mut self,
10447            decoder: &mut fidl::encoding::Decoder<'_, D>,
10448            offset: usize,
10449            mut depth: fidl::encoding::Depth,
10450        ) -> fidl::Result<()> {
10451            decoder.debug_check_bounds::<Self>(offset);
10452            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
10453                None => return Err(fidl::Error::NotNullable),
10454                Some(len) => len,
10455            };
10456            // Calling decoder.out_of_line_offset(0) is not allowed.
10457            if len == 0 {
10458                return Ok(());
10459            };
10460            depth.increment()?;
10461            let envelope_size = 8;
10462            let bytes_len = len * envelope_size;
10463            let offset = decoder.out_of_line_offset(bytes_len)?;
10464            // Decode the envelope for each type.
10465            let mut _next_ordinal_to_read = 0;
10466            let mut next_offset = offset;
10467            let end_offset = offset + bytes_len;
10468            _next_ordinal_to_read += 1;
10469            if next_offset >= end_offset {
10470                return Ok(());
10471            }
10472
10473            // Decode unknown envelopes for gaps in ordinals.
10474            while _next_ordinal_to_read < 1 {
10475                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10476                _next_ordinal_to_read += 1;
10477                next_offset += envelope_size;
10478            }
10479
10480            let next_out_of_line = decoder.next_out_of_line();
10481            let handles_before = decoder.remaining_handles();
10482            if let Some((inlined, num_bytes, num_handles)) =
10483                fidl::encoding::decode_envelope_header(decoder, next_offset)?
10484            {
10485                let member_inline_size =
10486                    <fidl::encoding::Vector<u16, 200> as fidl::encoding::TypeMarker>::inline_size(
10487                        decoder.context,
10488                    );
10489                if inlined != (member_inline_size <= 4) {
10490                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
10491                }
10492                let inner_offset;
10493                let mut inner_depth = depth.clone();
10494                if inlined {
10495                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
10496                    inner_offset = next_offset;
10497                } else {
10498                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
10499                    inner_depth.increment()?;
10500                }
10501                let val_ref = self
10502                    .channels
10503                    .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<u16, 200>, D));
10504                fidl::decode!(fidl::encoding::Vector<u16, 200>, D, val_ref, decoder, inner_offset, inner_depth)?;
10505                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
10506                {
10507                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
10508                }
10509                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
10510                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
10511                }
10512            }
10513
10514            next_offset += envelope_size;
10515            _next_ordinal_to_read += 1;
10516            if next_offset >= end_offset {
10517                return Ok(());
10518            }
10519
10520            // Decode unknown envelopes for gaps in ordinals.
10521            while _next_ordinal_to_read < 2 {
10522                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10523                _next_ordinal_to_read += 1;
10524                next_offset += envelope_size;
10525            }
10526
10527            let next_out_of_line = decoder.next_out_of_line();
10528            let handles_before = decoder.remaining_handles();
10529            if let Some((inlined, num_bytes, num_handles)) =
10530                fidl::encoding::decode_envelope_header(decoder, next_offset)?
10531            {
10532                let member_inline_size =
10533                    <i8 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
10534                if inlined != (member_inline_size <= 4) {
10535                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
10536                }
10537                let inner_offset;
10538                let mut inner_depth = depth.clone();
10539                if inlined {
10540                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
10541                    inner_offset = next_offset;
10542                } else {
10543                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
10544                    inner_depth.increment()?;
10545                }
10546                let val_ref = self.tx_power_dbm.get_or_insert_with(|| fidl::new_empty!(i8, D));
10547                fidl::decode!(i8, D, val_ref, decoder, inner_offset, inner_depth)?;
10548                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
10549                {
10550                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
10551                }
10552                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
10553                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
10554                }
10555            }
10556
10557            next_offset += envelope_size;
10558
10559            // Decode the remaining unknown envelopes.
10560            while next_offset < end_offset {
10561                _next_ordinal_to_read += 1;
10562                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10563                next_offset += envelope_size;
10564            }
10565
10566            Ok(())
10567        }
10568    }
10569
10570    impl OnMeshPrefix {
10571        #[inline(always)]
10572        fn max_ordinal_present(&self) -> u64 {
10573            if let Some(_) = self.slaac_valid {
10574                return 5;
10575            }
10576            if let Some(_) = self.slaac_preferred {
10577                return 4;
10578            }
10579            if let Some(_) = self.stable {
10580                return 3;
10581            }
10582            if let Some(_) = self.default_route_preference {
10583                return 2;
10584            }
10585            if let Some(_) = self.subnet {
10586                return 1;
10587            }
10588            0
10589        }
10590    }
10591
10592    impl fidl::encoding::ValueTypeMarker for OnMeshPrefix {
10593        type Borrowed<'a> = &'a Self;
10594        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
10595            value
10596        }
10597    }
10598
10599    unsafe impl fidl::encoding::TypeMarker for OnMeshPrefix {
10600        type Owned = Self;
10601
10602        #[inline(always)]
10603        fn inline_align(_context: fidl::encoding::Context) -> usize {
10604            8
10605        }
10606
10607        #[inline(always)]
10608        fn inline_size(_context: fidl::encoding::Context) -> usize {
10609            16
10610        }
10611    }
10612
10613    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<OnMeshPrefix, D>
10614        for &OnMeshPrefix
10615    {
10616        unsafe fn encode(
10617            self,
10618            encoder: &mut fidl::encoding::Encoder<'_, D>,
10619            offset: usize,
10620            mut depth: fidl::encoding::Depth,
10621        ) -> fidl::Result<()> {
10622            encoder.debug_check_bounds::<OnMeshPrefix>(offset);
10623            // Vector header
10624            let max_ordinal: u64 = self.max_ordinal_present();
10625            encoder.write_num(max_ordinal, offset);
10626            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
10627            // Calling encoder.out_of_line_offset(0) is not allowed.
10628            if max_ordinal == 0 {
10629                return Ok(());
10630            }
10631            depth.increment()?;
10632            let envelope_size = 8;
10633            let bytes_len = max_ordinal as usize * envelope_size;
10634            #[allow(unused_variables)]
10635            let offset = encoder.out_of_line_offset(bytes_len);
10636            let mut _prev_end_offset: usize = 0;
10637            if 1 > max_ordinal {
10638                return Ok(());
10639            }
10640
10641            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
10642            // are envelope_size bytes.
10643            let cur_offset: usize = (1 - 1) * envelope_size;
10644
10645            // Zero reserved fields.
10646            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
10647
10648            // Safety:
10649            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
10650            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
10651            //   envelope_size bytes, there is always sufficient room.
10652            fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_net::Ipv6AddressWithPrefix, D>(
10653            self.subnet.as_ref().map(<fidl_fuchsia_net::Ipv6AddressWithPrefix as fidl::encoding::ValueTypeMarker>::borrow),
10654            encoder, offset + cur_offset, depth
10655        )?;
10656
10657            _prev_end_offset = cur_offset + envelope_size;
10658            if 2 > max_ordinal {
10659                return Ok(());
10660            }
10661
10662            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
10663            // are envelope_size bytes.
10664            let cur_offset: usize = (2 - 1) * envelope_size;
10665
10666            // Zero reserved fields.
10667            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
10668
10669            // Safety:
10670            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
10671            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
10672            //   envelope_size bytes, there is always sufficient room.
10673            fidl::encoding::encode_in_envelope_optional::<RoutePreference, D>(
10674                self.default_route_preference
10675                    .as_ref()
10676                    .map(<RoutePreference as fidl::encoding::ValueTypeMarker>::borrow),
10677                encoder,
10678                offset + cur_offset,
10679                depth,
10680            )?;
10681
10682            _prev_end_offset = cur_offset + envelope_size;
10683            if 3 > max_ordinal {
10684                return Ok(());
10685            }
10686
10687            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
10688            // are envelope_size bytes.
10689            let cur_offset: usize = (3 - 1) * envelope_size;
10690
10691            // Zero reserved fields.
10692            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
10693
10694            // Safety:
10695            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
10696            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
10697            //   envelope_size bytes, there is always sufficient room.
10698            fidl::encoding::encode_in_envelope_optional::<bool, D>(
10699                self.stable.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
10700                encoder,
10701                offset + cur_offset,
10702                depth,
10703            )?;
10704
10705            _prev_end_offset = cur_offset + envelope_size;
10706            if 4 > max_ordinal {
10707                return Ok(());
10708            }
10709
10710            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
10711            // are envelope_size bytes.
10712            let cur_offset: usize = (4 - 1) * envelope_size;
10713
10714            // Zero reserved fields.
10715            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
10716
10717            // Safety:
10718            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
10719            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
10720            //   envelope_size bytes, there is always sufficient room.
10721            fidl::encoding::encode_in_envelope_optional::<bool, D>(
10722                self.slaac_preferred
10723                    .as_ref()
10724                    .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
10725                encoder,
10726                offset + cur_offset,
10727                depth,
10728            )?;
10729
10730            _prev_end_offset = cur_offset + envelope_size;
10731            if 5 > max_ordinal {
10732                return Ok(());
10733            }
10734
10735            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
10736            // are envelope_size bytes.
10737            let cur_offset: usize = (5 - 1) * envelope_size;
10738
10739            // Zero reserved fields.
10740            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
10741
10742            // Safety:
10743            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
10744            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
10745            //   envelope_size bytes, there is always sufficient room.
10746            fidl::encoding::encode_in_envelope_optional::<bool, D>(
10747                self.slaac_valid.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
10748                encoder,
10749                offset + cur_offset,
10750                depth,
10751            )?;
10752
10753            _prev_end_offset = cur_offset + envelope_size;
10754
10755            Ok(())
10756        }
10757    }
10758
10759    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for OnMeshPrefix {
10760        #[inline(always)]
10761        fn new_empty() -> Self {
10762            Self::default()
10763        }
10764
10765        unsafe fn decode(
10766            &mut self,
10767            decoder: &mut fidl::encoding::Decoder<'_, D>,
10768            offset: usize,
10769            mut depth: fidl::encoding::Depth,
10770        ) -> fidl::Result<()> {
10771            decoder.debug_check_bounds::<Self>(offset);
10772            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
10773                None => return Err(fidl::Error::NotNullable),
10774                Some(len) => len,
10775            };
10776            // Calling decoder.out_of_line_offset(0) is not allowed.
10777            if len == 0 {
10778                return Ok(());
10779            };
10780            depth.increment()?;
10781            let envelope_size = 8;
10782            let bytes_len = len * envelope_size;
10783            let offset = decoder.out_of_line_offset(bytes_len)?;
10784            // Decode the envelope for each type.
10785            let mut _next_ordinal_to_read = 0;
10786            let mut next_offset = offset;
10787            let end_offset = offset + bytes_len;
10788            _next_ordinal_to_read += 1;
10789            if next_offset >= end_offset {
10790                return Ok(());
10791            }
10792
10793            // Decode unknown envelopes for gaps in ordinals.
10794            while _next_ordinal_to_read < 1 {
10795                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10796                _next_ordinal_to_read += 1;
10797                next_offset += envelope_size;
10798            }
10799
10800            let next_out_of_line = decoder.next_out_of_line();
10801            let handles_before = decoder.remaining_handles();
10802            if let Some((inlined, num_bytes, num_handles)) =
10803                fidl::encoding::decode_envelope_header(decoder, next_offset)?
10804            {
10805                let member_inline_size = <fidl_fuchsia_net::Ipv6AddressWithPrefix as fidl::encoding::TypeMarker>::inline_size(decoder.context);
10806                if inlined != (member_inline_size <= 4) {
10807                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
10808                }
10809                let inner_offset;
10810                let mut inner_depth = depth.clone();
10811                if inlined {
10812                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
10813                    inner_offset = next_offset;
10814                } else {
10815                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
10816                    inner_depth.increment()?;
10817                }
10818                let val_ref = self.subnet.get_or_insert_with(|| {
10819                    fidl::new_empty!(fidl_fuchsia_net::Ipv6AddressWithPrefix, D)
10820                });
10821                fidl::decode!(
10822                    fidl_fuchsia_net::Ipv6AddressWithPrefix,
10823                    D,
10824                    val_ref,
10825                    decoder,
10826                    inner_offset,
10827                    inner_depth
10828                )?;
10829                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
10830                {
10831                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
10832                }
10833                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
10834                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
10835                }
10836            }
10837
10838            next_offset += envelope_size;
10839            _next_ordinal_to_read += 1;
10840            if next_offset >= end_offset {
10841                return Ok(());
10842            }
10843
10844            // Decode unknown envelopes for gaps in ordinals.
10845            while _next_ordinal_to_read < 2 {
10846                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10847                _next_ordinal_to_read += 1;
10848                next_offset += envelope_size;
10849            }
10850
10851            let next_out_of_line = decoder.next_out_of_line();
10852            let handles_before = decoder.remaining_handles();
10853            if let Some((inlined, num_bytes, num_handles)) =
10854                fidl::encoding::decode_envelope_header(decoder, next_offset)?
10855            {
10856                let member_inline_size =
10857                    <RoutePreference as fidl::encoding::TypeMarker>::inline_size(decoder.context);
10858                if inlined != (member_inline_size <= 4) {
10859                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
10860                }
10861                let inner_offset;
10862                let mut inner_depth = depth.clone();
10863                if inlined {
10864                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
10865                    inner_offset = next_offset;
10866                } else {
10867                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
10868                    inner_depth.increment()?;
10869                }
10870                let val_ref = self
10871                    .default_route_preference
10872                    .get_or_insert_with(|| fidl::new_empty!(RoutePreference, D));
10873                fidl::decode!(RoutePreference, D, val_ref, decoder, inner_offset, inner_depth)?;
10874                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
10875                {
10876                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
10877                }
10878                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
10879                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
10880                }
10881            }
10882
10883            next_offset += envelope_size;
10884            _next_ordinal_to_read += 1;
10885            if next_offset >= end_offset {
10886                return Ok(());
10887            }
10888
10889            // Decode unknown envelopes for gaps in ordinals.
10890            while _next_ordinal_to_read < 3 {
10891                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10892                _next_ordinal_to_read += 1;
10893                next_offset += envelope_size;
10894            }
10895
10896            let next_out_of_line = decoder.next_out_of_line();
10897            let handles_before = decoder.remaining_handles();
10898            if let Some((inlined, num_bytes, num_handles)) =
10899                fidl::encoding::decode_envelope_header(decoder, next_offset)?
10900            {
10901                let member_inline_size =
10902                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
10903                if inlined != (member_inline_size <= 4) {
10904                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
10905                }
10906                let inner_offset;
10907                let mut inner_depth = depth.clone();
10908                if inlined {
10909                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
10910                    inner_offset = next_offset;
10911                } else {
10912                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
10913                    inner_depth.increment()?;
10914                }
10915                let val_ref = self.stable.get_or_insert_with(|| fidl::new_empty!(bool, D));
10916                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
10917                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
10918                {
10919                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
10920                }
10921                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
10922                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
10923                }
10924            }
10925
10926            next_offset += envelope_size;
10927            _next_ordinal_to_read += 1;
10928            if next_offset >= end_offset {
10929                return Ok(());
10930            }
10931
10932            // Decode unknown envelopes for gaps in ordinals.
10933            while _next_ordinal_to_read < 4 {
10934                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10935                _next_ordinal_to_read += 1;
10936                next_offset += envelope_size;
10937            }
10938
10939            let next_out_of_line = decoder.next_out_of_line();
10940            let handles_before = decoder.remaining_handles();
10941            if let Some((inlined, num_bytes, num_handles)) =
10942                fidl::encoding::decode_envelope_header(decoder, next_offset)?
10943            {
10944                let member_inline_size =
10945                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
10946                if inlined != (member_inline_size <= 4) {
10947                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
10948                }
10949                let inner_offset;
10950                let mut inner_depth = depth.clone();
10951                if inlined {
10952                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
10953                    inner_offset = next_offset;
10954                } else {
10955                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
10956                    inner_depth.increment()?;
10957                }
10958                let val_ref = self.slaac_preferred.get_or_insert_with(|| fidl::new_empty!(bool, D));
10959                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
10960                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
10961                {
10962                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
10963                }
10964                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
10965                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
10966                }
10967            }
10968
10969            next_offset += envelope_size;
10970            _next_ordinal_to_read += 1;
10971            if next_offset >= end_offset {
10972                return Ok(());
10973            }
10974
10975            // Decode unknown envelopes for gaps in ordinals.
10976            while _next_ordinal_to_read < 5 {
10977                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10978                _next_ordinal_to_read += 1;
10979                next_offset += envelope_size;
10980            }
10981
10982            let next_out_of_line = decoder.next_out_of_line();
10983            let handles_before = decoder.remaining_handles();
10984            if let Some((inlined, num_bytes, num_handles)) =
10985                fidl::encoding::decode_envelope_header(decoder, next_offset)?
10986            {
10987                let member_inline_size =
10988                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
10989                if inlined != (member_inline_size <= 4) {
10990                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
10991                }
10992                let inner_offset;
10993                let mut inner_depth = depth.clone();
10994                if inlined {
10995                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
10996                    inner_offset = next_offset;
10997                } else {
10998                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
10999                    inner_depth.increment()?;
11000                }
11001                let val_ref = self.slaac_valid.get_or_insert_with(|| fidl::new_empty!(bool, D));
11002                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
11003                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
11004                {
11005                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
11006                }
11007                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
11008                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
11009                }
11010            }
11011
11012            next_offset += envelope_size;
11013
11014            // Decode the remaining unknown envelopes.
11015            while next_offset < end_offset {
11016                _next_ordinal_to_read += 1;
11017                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11018                next_offset += envelope_size;
11019            }
11020
11021            Ok(())
11022        }
11023    }
11024
11025    impl PdProcessedRaInfo {
11026        #[inline(always)]
11027        fn max_ordinal_present(&self) -> u64 {
11028            if let Some(_) = self.last_platform_ra_msec {
11029                return 3;
11030            }
11031            if let Some(_) = self.num_platform_pio_processed {
11032                return 2;
11033            }
11034            if let Some(_) = self.num_platform_ra_received {
11035                return 1;
11036            }
11037            0
11038        }
11039    }
11040
11041    impl fidl::encoding::ValueTypeMarker for PdProcessedRaInfo {
11042        type Borrowed<'a> = &'a Self;
11043        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
11044            value
11045        }
11046    }
11047
11048    unsafe impl fidl::encoding::TypeMarker for PdProcessedRaInfo {
11049        type Owned = Self;
11050
11051        #[inline(always)]
11052        fn inline_align(_context: fidl::encoding::Context) -> usize {
11053            8
11054        }
11055
11056        #[inline(always)]
11057        fn inline_size(_context: fidl::encoding::Context) -> usize {
11058            16
11059        }
11060    }
11061
11062    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<PdProcessedRaInfo, D>
11063        for &PdProcessedRaInfo
11064    {
11065        unsafe fn encode(
11066            self,
11067            encoder: &mut fidl::encoding::Encoder<'_, D>,
11068            offset: usize,
11069            mut depth: fidl::encoding::Depth,
11070        ) -> fidl::Result<()> {
11071            encoder.debug_check_bounds::<PdProcessedRaInfo>(offset);
11072            // Vector header
11073            let max_ordinal: u64 = self.max_ordinal_present();
11074            encoder.write_num(max_ordinal, offset);
11075            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
11076            // Calling encoder.out_of_line_offset(0) is not allowed.
11077            if max_ordinal == 0 {
11078                return Ok(());
11079            }
11080            depth.increment()?;
11081            let envelope_size = 8;
11082            let bytes_len = max_ordinal as usize * envelope_size;
11083            #[allow(unused_variables)]
11084            let offset = encoder.out_of_line_offset(bytes_len);
11085            let mut _prev_end_offset: usize = 0;
11086            if 1 > max_ordinal {
11087                return Ok(());
11088            }
11089
11090            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
11091            // are envelope_size bytes.
11092            let cur_offset: usize = (1 - 1) * envelope_size;
11093
11094            // Zero reserved fields.
11095            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11096
11097            // Safety:
11098            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
11099            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
11100            //   envelope_size bytes, there is always sufficient room.
11101            fidl::encoding::encode_in_envelope_optional::<u32, D>(
11102                self.num_platform_ra_received
11103                    .as_ref()
11104                    .map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
11105                encoder,
11106                offset + cur_offset,
11107                depth,
11108            )?;
11109
11110            _prev_end_offset = cur_offset + envelope_size;
11111            if 2 > max_ordinal {
11112                return Ok(());
11113            }
11114
11115            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
11116            // are envelope_size bytes.
11117            let cur_offset: usize = (2 - 1) * envelope_size;
11118
11119            // Zero reserved fields.
11120            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11121
11122            // Safety:
11123            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
11124            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
11125            //   envelope_size bytes, there is always sufficient room.
11126            fidl::encoding::encode_in_envelope_optional::<u32, D>(
11127                self.num_platform_pio_processed
11128                    .as_ref()
11129                    .map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
11130                encoder,
11131                offset + cur_offset,
11132                depth,
11133            )?;
11134
11135            _prev_end_offset = cur_offset + envelope_size;
11136            if 3 > max_ordinal {
11137                return Ok(());
11138            }
11139
11140            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
11141            // are envelope_size bytes.
11142            let cur_offset: usize = (3 - 1) * envelope_size;
11143
11144            // Zero reserved fields.
11145            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11146
11147            // Safety:
11148            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
11149            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
11150            //   envelope_size bytes, there is always sufficient room.
11151            fidl::encoding::encode_in_envelope_optional::<u32, D>(
11152                self.last_platform_ra_msec
11153                    .as_ref()
11154                    .map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
11155                encoder,
11156                offset + cur_offset,
11157                depth,
11158            )?;
11159
11160            _prev_end_offset = cur_offset + envelope_size;
11161
11162            Ok(())
11163        }
11164    }
11165
11166    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for PdProcessedRaInfo {
11167        #[inline(always)]
11168        fn new_empty() -> Self {
11169            Self::default()
11170        }
11171
11172        unsafe fn decode(
11173            &mut self,
11174            decoder: &mut fidl::encoding::Decoder<'_, D>,
11175            offset: usize,
11176            mut depth: fidl::encoding::Depth,
11177        ) -> fidl::Result<()> {
11178            decoder.debug_check_bounds::<Self>(offset);
11179            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
11180                None => return Err(fidl::Error::NotNullable),
11181                Some(len) => len,
11182            };
11183            // Calling decoder.out_of_line_offset(0) is not allowed.
11184            if len == 0 {
11185                return Ok(());
11186            };
11187            depth.increment()?;
11188            let envelope_size = 8;
11189            let bytes_len = len * envelope_size;
11190            let offset = decoder.out_of_line_offset(bytes_len)?;
11191            // Decode the envelope for each type.
11192            let mut _next_ordinal_to_read = 0;
11193            let mut next_offset = offset;
11194            let end_offset = offset + bytes_len;
11195            _next_ordinal_to_read += 1;
11196            if next_offset >= end_offset {
11197                return Ok(());
11198            }
11199
11200            // Decode unknown envelopes for gaps in ordinals.
11201            while _next_ordinal_to_read < 1 {
11202                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11203                _next_ordinal_to_read += 1;
11204                next_offset += envelope_size;
11205            }
11206
11207            let next_out_of_line = decoder.next_out_of_line();
11208            let handles_before = decoder.remaining_handles();
11209            if let Some((inlined, num_bytes, num_handles)) =
11210                fidl::encoding::decode_envelope_header(decoder, next_offset)?
11211            {
11212                let member_inline_size =
11213                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
11214                if inlined != (member_inline_size <= 4) {
11215                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
11216                }
11217                let inner_offset;
11218                let mut inner_depth = depth.clone();
11219                if inlined {
11220                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
11221                    inner_offset = next_offset;
11222                } else {
11223                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11224                    inner_depth.increment()?;
11225                }
11226                let val_ref =
11227                    self.num_platform_ra_received.get_or_insert_with(|| fidl::new_empty!(u32, D));
11228                fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
11229                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
11230                {
11231                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
11232                }
11233                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
11234                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
11235                }
11236            }
11237
11238            next_offset += envelope_size;
11239            _next_ordinal_to_read += 1;
11240            if next_offset >= end_offset {
11241                return Ok(());
11242            }
11243
11244            // Decode unknown envelopes for gaps in ordinals.
11245            while _next_ordinal_to_read < 2 {
11246                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11247                _next_ordinal_to_read += 1;
11248                next_offset += envelope_size;
11249            }
11250
11251            let next_out_of_line = decoder.next_out_of_line();
11252            let handles_before = decoder.remaining_handles();
11253            if let Some((inlined, num_bytes, num_handles)) =
11254                fidl::encoding::decode_envelope_header(decoder, next_offset)?
11255            {
11256                let member_inline_size =
11257                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
11258                if inlined != (member_inline_size <= 4) {
11259                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
11260                }
11261                let inner_offset;
11262                let mut inner_depth = depth.clone();
11263                if inlined {
11264                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
11265                    inner_offset = next_offset;
11266                } else {
11267                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11268                    inner_depth.increment()?;
11269                }
11270                let val_ref =
11271                    self.num_platform_pio_processed.get_or_insert_with(|| fidl::new_empty!(u32, D));
11272                fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
11273                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
11274                {
11275                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
11276                }
11277                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
11278                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
11279                }
11280            }
11281
11282            next_offset += envelope_size;
11283            _next_ordinal_to_read += 1;
11284            if next_offset >= end_offset {
11285                return Ok(());
11286            }
11287
11288            // Decode unknown envelopes for gaps in ordinals.
11289            while _next_ordinal_to_read < 3 {
11290                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11291                _next_ordinal_to_read += 1;
11292                next_offset += envelope_size;
11293            }
11294
11295            let next_out_of_line = decoder.next_out_of_line();
11296            let handles_before = decoder.remaining_handles();
11297            if let Some((inlined, num_bytes, num_handles)) =
11298                fidl::encoding::decode_envelope_header(decoder, next_offset)?
11299            {
11300                let member_inline_size =
11301                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
11302                if inlined != (member_inline_size <= 4) {
11303                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
11304                }
11305                let inner_offset;
11306                let mut inner_depth = depth.clone();
11307                if inlined {
11308                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
11309                    inner_offset = next_offset;
11310                } else {
11311                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11312                    inner_depth.increment()?;
11313                }
11314                let val_ref =
11315                    self.last_platform_ra_msec.get_or_insert_with(|| fidl::new_empty!(u32, D));
11316                fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
11317                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
11318                {
11319                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
11320                }
11321                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
11322                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
11323                }
11324            }
11325
11326            next_offset += envelope_size;
11327
11328            // Decode the remaining unknown envelopes.
11329            while next_offset < end_offset {
11330                _next_ordinal_to_read += 1;
11331                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11332                next_offset += envelope_size;
11333            }
11334
11335            Ok(())
11336        }
11337    }
11338
11339    impl SrpServerInfo {
11340        #[inline(always)]
11341        fn max_ordinal_present(&self) -> u64 {
11342            if let Some(_) = self.services_registration {
11343                return 6;
11344            }
11345            if let Some(_) = self.hosts_registration {
11346                return 5;
11347            }
11348            if let Some(_) = self.response_counters {
11349                return 4;
11350            }
11351            if let Some(_) = self.address_mode {
11352                return 3;
11353            }
11354            if let Some(_) = self.port {
11355                return 2;
11356            }
11357            if let Some(_) = self.state {
11358                return 1;
11359            }
11360            0
11361        }
11362    }
11363
11364    impl fidl::encoding::ValueTypeMarker for SrpServerInfo {
11365        type Borrowed<'a> = &'a Self;
11366        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
11367            value
11368        }
11369    }
11370
11371    unsafe impl fidl::encoding::TypeMarker for SrpServerInfo {
11372        type Owned = Self;
11373
11374        #[inline(always)]
11375        fn inline_align(_context: fidl::encoding::Context) -> usize {
11376            8
11377        }
11378
11379        #[inline(always)]
11380        fn inline_size(_context: fidl::encoding::Context) -> usize {
11381            16
11382        }
11383    }
11384
11385    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<SrpServerInfo, D>
11386        for &SrpServerInfo
11387    {
11388        unsafe fn encode(
11389            self,
11390            encoder: &mut fidl::encoding::Encoder<'_, D>,
11391            offset: usize,
11392            mut depth: fidl::encoding::Depth,
11393        ) -> fidl::Result<()> {
11394            encoder.debug_check_bounds::<SrpServerInfo>(offset);
11395            // Vector header
11396            let max_ordinal: u64 = self.max_ordinal_present();
11397            encoder.write_num(max_ordinal, offset);
11398            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
11399            // Calling encoder.out_of_line_offset(0) is not allowed.
11400            if max_ordinal == 0 {
11401                return Ok(());
11402            }
11403            depth.increment()?;
11404            let envelope_size = 8;
11405            let bytes_len = max_ordinal as usize * envelope_size;
11406            #[allow(unused_variables)]
11407            let offset = encoder.out_of_line_offset(bytes_len);
11408            let mut _prev_end_offset: usize = 0;
11409            if 1 > max_ordinal {
11410                return Ok(());
11411            }
11412
11413            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
11414            // are envelope_size bytes.
11415            let cur_offset: usize = (1 - 1) * envelope_size;
11416
11417            // Zero reserved fields.
11418            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11419
11420            // Safety:
11421            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
11422            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
11423            //   envelope_size bytes, there is always sufficient room.
11424            fidl::encoding::encode_in_envelope_optional::<SrpServerState, D>(
11425                self.state
11426                    .as_ref()
11427                    .map(<SrpServerState as fidl::encoding::ValueTypeMarker>::borrow),
11428                encoder,
11429                offset + cur_offset,
11430                depth,
11431            )?;
11432
11433            _prev_end_offset = cur_offset + envelope_size;
11434            if 2 > max_ordinal {
11435                return Ok(());
11436            }
11437
11438            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
11439            // are envelope_size bytes.
11440            let cur_offset: usize = (2 - 1) * envelope_size;
11441
11442            // Zero reserved fields.
11443            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11444
11445            // Safety:
11446            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
11447            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
11448            //   envelope_size bytes, there is always sufficient room.
11449            fidl::encoding::encode_in_envelope_optional::<u16, D>(
11450                self.port.as_ref().map(<u16 as fidl::encoding::ValueTypeMarker>::borrow),
11451                encoder,
11452                offset + cur_offset,
11453                depth,
11454            )?;
11455
11456            _prev_end_offset = cur_offset + envelope_size;
11457            if 3 > max_ordinal {
11458                return Ok(());
11459            }
11460
11461            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
11462            // are envelope_size bytes.
11463            let cur_offset: usize = (3 - 1) * envelope_size;
11464
11465            // Zero reserved fields.
11466            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11467
11468            // Safety:
11469            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
11470            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
11471            //   envelope_size bytes, there is always sufficient room.
11472            fidl::encoding::encode_in_envelope_optional::<SrpServerAddressMode, D>(
11473                self.address_mode
11474                    .as_ref()
11475                    .map(<SrpServerAddressMode as fidl::encoding::ValueTypeMarker>::borrow),
11476                encoder,
11477                offset + cur_offset,
11478                depth,
11479            )?;
11480
11481            _prev_end_offset = cur_offset + envelope_size;
11482            if 4 > max_ordinal {
11483                return Ok(());
11484            }
11485
11486            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
11487            // are envelope_size bytes.
11488            let cur_offset: usize = (4 - 1) * envelope_size;
11489
11490            // Zero reserved fields.
11491            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11492
11493            // Safety:
11494            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
11495            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
11496            //   envelope_size bytes, there is always sufficient room.
11497            fidl::encoding::encode_in_envelope_optional::<SrpServerResponseCounters, D>(
11498                self.response_counters
11499                    .as_ref()
11500                    .map(<SrpServerResponseCounters as fidl::encoding::ValueTypeMarker>::borrow),
11501                encoder,
11502                offset + cur_offset,
11503                depth,
11504            )?;
11505
11506            _prev_end_offset = cur_offset + envelope_size;
11507            if 5 > max_ordinal {
11508                return Ok(());
11509            }
11510
11511            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
11512            // are envelope_size bytes.
11513            let cur_offset: usize = (5 - 1) * envelope_size;
11514
11515            // Zero reserved fields.
11516            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11517
11518            // Safety:
11519            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
11520            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
11521            //   envelope_size bytes, there is always sufficient room.
11522            fidl::encoding::encode_in_envelope_optional::<SrpServerRegistration, D>(
11523                self.hosts_registration
11524                    .as_ref()
11525                    .map(<SrpServerRegistration as fidl::encoding::ValueTypeMarker>::borrow),
11526                encoder,
11527                offset + cur_offset,
11528                depth,
11529            )?;
11530
11531            _prev_end_offset = cur_offset + envelope_size;
11532            if 6 > max_ordinal {
11533                return Ok(());
11534            }
11535
11536            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
11537            // are envelope_size bytes.
11538            let cur_offset: usize = (6 - 1) * envelope_size;
11539
11540            // Zero reserved fields.
11541            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11542
11543            // Safety:
11544            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
11545            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
11546            //   envelope_size bytes, there is always sufficient room.
11547            fidl::encoding::encode_in_envelope_optional::<SrpServerRegistration, D>(
11548                self.services_registration
11549                    .as_ref()
11550                    .map(<SrpServerRegistration as fidl::encoding::ValueTypeMarker>::borrow),
11551                encoder,
11552                offset + cur_offset,
11553                depth,
11554            )?;
11555
11556            _prev_end_offset = cur_offset + envelope_size;
11557
11558            Ok(())
11559        }
11560    }
11561
11562    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SrpServerInfo {
11563        #[inline(always)]
11564        fn new_empty() -> Self {
11565            Self::default()
11566        }
11567
11568        unsafe fn decode(
11569            &mut self,
11570            decoder: &mut fidl::encoding::Decoder<'_, D>,
11571            offset: usize,
11572            mut depth: fidl::encoding::Depth,
11573        ) -> fidl::Result<()> {
11574            decoder.debug_check_bounds::<Self>(offset);
11575            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
11576                None => return Err(fidl::Error::NotNullable),
11577                Some(len) => len,
11578            };
11579            // Calling decoder.out_of_line_offset(0) is not allowed.
11580            if len == 0 {
11581                return Ok(());
11582            };
11583            depth.increment()?;
11584            let envelope_size = 8;
11585            let bytes_len = len * envelope_size;
11586            let offset = decoder.out_of_line_offset(bytes_len)?;
11587            // Decode the envelope for each type.
11588            let mut _next_ordinal_to_read = 0;
11589            let mut next_offset = offset;
11590            let end_offset = offset + bytes_len;
11591            _next_ordinal_to_read += 1;
11592            if next_offset >= end_offset {
11593                return Ok(());
11594            }
11595
11596            // Decode unknown envelopes for gaps in ordinals.
11597            while _next_ordinal_to_read < 1 {
11598                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11599                _next_ordinal_to_read += 1;
11600                next_offset += envelope_size;
11601            }
11602
11603            let next_out_of_line = decoder.next_out_of_line();
11604            let handles_before = decoder.remaining_handles();
11605            if let Some((inlined, num_bytes, num_handles)) =
11606                fidl::encoding::decode_envelope_header(decoder, next_offset)?
11607            {
11608                let member_inline_size =
11609                    <SrpServerState as fidl::encoding::TypeMarker>::inline_size(decoder.context);
11610                if inlined != (member_inline_size <= 4) {
11611                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
11612                }
11613                let inner_offset;
11614                let mut inner_depth = depth.clone();
11615                if inlined {
11616                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
11617                    inner_offset = next_offset;
11618                } else {
11619                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11620                    inner_depth.increment()?;
11621                }
11622                let val_ref = self.state.get_or_insert_with(|| fidl::new_empty!(SrpServerState, D));
11623                fidl::decode!(SrpServerState, D, val_ref, decoder, inner_offset, inner_depth)?;
11624                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
11625                {
11626                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
11627                }
11628                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
11629                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
11630                }
11631            }
11632
11633            next_offset += envelope_size;
11634            _next_ordinal_to_read += 1;
11635            if next_offset >= end_offset {
11636                return Ok(());
11637            }
11638
11639            // Decode unknown envelopes for gaps in ordinals.
11640            while _next_ordinal_to_read < 2 {
11641                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11642                _next_ordinal_to_read += 1;
11643                next_offset += envelope_size;
11644            }
11645
11646            let next_out_of_line = decoder.next_out_of_line();
11647            let handles_before = decoder.remaining_handles();
11648            if let Some((inlined, num_bytes, num_handles)) =
11649                fidl::encoding::decode_envelope_header(decoder, next_offset)?
11650            {
11651                let member_inline_size =
11652                    <u16 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
11653                if inlined != (member_inline_size <= 4) {
11654                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
11655                }
11656                let inner_offset;
11657                let mut inner_depth = depth.clone();
11658                if inlined {
11659                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
11660                    inner_offset = next_offset;
11661                } else {
11662                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11663                    inner_depth.increment()?;
11664                }
11665                let val_ref = self.port.get_or_insert_with(|| fidl::new_empty!(u16, D));
11666                fidl::decode!(u16, D, val_ref, decoder, inner_offset, inner_depth)?;
11667                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
11668                {
11669                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
11670                }
11671                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
11672                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
11673                }
11674            }
11675
11676            next_offset += envelope_size;
11677            _next_ordinal_to_read += 1;
11678            if next_offset >= end_offset {
11679                return Ok(());
11680            }
11681
11682            // Decode unknown envelopes for gaps in ordinals.
11683            while _next_ordinal_to_read < 3 {
11684                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11685                _next_ordinal_to_read += 1;
11686                next_offset += envelope_size;
11687            }
11688
11689            let next_out_of_line = decoder.next_out_of_line();
11690            let handles_before = decoder.remaining_handles();
11691            if let Some((inlined, num_bytes, num_handles)) =
11692                fidl::encoding::decode_envelope_header(decoder, next_offset)?
11693            {
11694                let member_inline_size =
11695                    <SrpServerAddressMode as fidl::encoding::TypeMarker>::inline_size(
11696                        decoder.context,
11697                    );
11698                if inlined != (member_inline_size <= 4) {
11699                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
11700                }
11701                let inner_offset;
11702                let mut inner_depth = depth.clone();
11703                if inlined {
11704                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
11705                    inner_offset = next_offset;
11706                } else {
11707                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11708                    inner_depth.increment()?;
11709                }
11710                let val_ref = self
11711                    .address_mode
11712                    .get_or_insert_with(|| fidl::new_empty!(SrpServerAddressMode, D));
11713                fidl::decode!(
11714                    SrpServerAddressMode,
11715                    D,
11716                    val_ref,
11717                    decoder,
11718                    inner_offset,
11719                    inner_depth
11720                )?;
11721                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
11722                {
11723                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
11724                }
11725                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
11726                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
11727                }
11728            }
11729
11730            next_offset += envelope_size;
11731            _next_ordinal_to_read += 1;
11732            if next_offset >= end_offset {
11733                return Ok(());
11734            }
11735
11736            // Decode unknown envelopes for gaps in ordinals.
11737            while _next_ordinal_to_read < 4 {
11738                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11739                _next_ordinal_to_read += 1;
11740                next_offset += envelope_size;
11741            }
11742
11743            let next_out_of_line = decoder.next_out_of_line();
11744            let handles_before = decoder.remaining_handles();
11745            if let Some((inlined, num_bytes, num_handles)) =
11746                fidl::encoding::decode_envelope_header(decoder, next_offset)?
11747            {
11748                let member_inline_size =
11749                    <SrpServerResponseCounters as fidl::encoding::TypeMarker>::inline_size(
11750                        decoder.context,
11751                    );
11752                if inlined != (member_inline_size <= 4) {
11753                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
11754                }
11755                let inner_offset;
11756                let mut inner_depth = depth.clone();
11757                if inlined {
11758                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
11759                    inner_offset = next_offset;
11760                } else {
11761                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11762                    inner_depth.increment()?;
11763                }
11764                let val_ref = self
11765                    .response_counters
11766                    .get_or_insert_with(|| fidl::new_empty!(SrpServerResponseCounters, D));
11767                fidl::decode!(
11768                    SrpServerResponseCounters,
11769                    D,
11770                    val_ref,
11771                    decoder,
11772                    inner_offset,
11773                    inner_depth
11774                )?;
11775                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
11776                {
11777                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
11778                }
11779                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
11780                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
11781                }
11782            }
11783
11784            next_offset += envelope_size;
11785            _next_ordinal_to_read += 1;
11786            if next_offset >= end_offset {
11787                return Ok(());
11788            }
11789
11790            // Decode unknown envelopes for gaps in ordinals.
11791            while _next_ordinal_to_read < 5 {
11792                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11793                _next_ordinal_to_read += 1;
11794                next_offset += envelope_size;
11795            }
11796
11797            let next_out_of_line = decoder.next_out_of_line();
11798            let handles_before = decoder.remaining_handles();
11799            if let Some((inlined, num_bytes, num_handles)) =
11800                fidl::encoding::decode_envelope_header(decoder, next_offset)?
11801            {
11802                let member_inline_size =
11803                    <SrpServerRegistration as fidl::encoding::TypeMarker>::inline_size(
11804                        decoder.context,
11805                    );
11806                if inlined != (member_inline_size <= 4) {
11807                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
11808                }
11809                let inner_offset;
11810                let mut inner_depth = depth.clone();
11811                if inlined {
11812                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
11813                    inner_offset = next_offset;
11814                } else {
11815                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11816                    inner_depth.increment()?;
11817                }
11818                let val_ref = self
11819                    .hosts_registration
11820                    .get_or_insert_with(|| fidl::new_empty!(SrpServerRegistration, D));
11821                fidl::decode!(
11822                    SrpServerRegistration,
11823                    D,
11824                    val_ref,
11825                    decoder,
11826                    inner_offset,
11827                    inner_depth
11828                )?;
11829                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
11830                {
11831                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
11832                }
11833                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
11834                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
11835                }
11836            }
11837
11838            next_offset += envelope_size;
11839            _next_ordinal_to_read += 1;
11840            if next_offset >= end_offset {
11841                return Ok(());
11842            }
11843
11844            // Decode unknown envelopes for gaps in ordinals.
11845            while _next_ordinal_to_read < 6 {
11846                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11847                _next_ordinal_to_read += 1;
11848                next_offset += envelope_size;
11849            }
11850
11851            let next_out_of_line = decoder.next_out_of_line();
11852            let handles_before = decoder.remaining_handles();
11853            if let Some((inlined, num_bytes, num_handles)) =
11854                fidl::encoding::decode_envelope_header(decoder, next_offset)?
11855            {
11856                let member_inline_size =
11857                    <SrpServerRegistration as fidl::encoding::TypeMarker>::inline_size(
11858                        decoder.context,
11859                    );
11860                if inlined != (member_inline_size <= 4) {
11861                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
11862                }
11863                let inner_offset;
11864                let mut inner_depth = depth.clone();
11865                if inlined {
11866                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
11867                    inner_offset = next_offset;
11868                } else {
11869                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11870                    inner_depth.increment()?;
11871                }
11872                let val_ref = self
11873                    .services_registration
11874                    .get_or_insert_with(|| fidl::new_empty!(SrpServerRegistration, D));
11875                fidl::decode!(
11876                    SrpServerRegistration,
11877                    D,
11878                    val_ref,
11879                    decoder,
11880                    inner_offset,
11881                    inner_depth
11882                )?;
11883                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
11884                {
11885                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
11886                }
11887                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
11888                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
11889                }
11890            }
11891
11892            next_offset += envelope_size;
11893
11894            // Decode the remaining unknown envelopes.
11895            while next_offset < end_offset {
11896                _next_ordinal_to_read += 1;
11897                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11898                next_offset += envelope_size;
11899            }
11900
11901            Ok(())
11902        }
11903    }
11904
11905    impl SrpServerRegistration {
11906        #[inline(always)]
11907        fn max_ordinal_present(&self) -> u64 {
11908            if let Some(_) = self.remaining_key_lease_time_total {
11909                return 6;
11910            }
11911            if let Some(_) = self.remaining_lease_time_total {
11912                return 5;
11913            }
11914            if let Some(_) = self.key_lease_time_total {
11915                return 4;
11916            }
11917            if let Some(_) = self.lease_time_total {
11918                return 3;
11919            }
11920            if let Some(_) = self.deleted_count {
11921                return 2;
11922            }
11923            if let Some(_) = self.fresh_count {
11924                return 1;
11925            }
11926            0
11927        }
11928    }
11929
11930    impl fidl::encoding::ValueTypeMarker for SrpServerRegistration {
11931        type Borrowed<'a> = &'a Self;
11932        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
11933            value
11934        }
11935    }
11936
11937    unsafe impl fidl::encoding::TypeMarker for SrpServerRegistration {
11938        type Owned = Self;
11939
11940        #[inline(always)]
11941        fn inline_align(_context: fidl::encoding::Context) -> usize {
11942            8
11943        }
11944
11945        #[inline(always)]
11946        fn inline_size(_context: fidl::encoding::Context) -> usize {
11947            16
11948        }
11949    }
11950
11951    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<SrpServerRegistration, D>
11952        for &SrpServerRegistration
11953    {
11954        unsafe fn encode(
11955            self,
11956            encoder: &mut fidl::encoding::Encoder<'_, D>,
11957            offset: usize,
11958            mut depth: fidl::encoding::Depth,
11959        ) -> fidl::Result<()> {
11960            encoder.debug_check_bounds::<SrpServerRegistration>(offset);
11961            // Vector header
11962            let max_ordinal: u64 = self.max_ordinal_present();
11963            encoder.write_num(max_ordinal, offset);
11964            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
11965            // Calling encoder.out_of_line_offset(0) is not allowed.
11966            if max_ordinal == 0 {
11967                return Ok(());
11968            }
11969            depth.increment()?;
11970            let envelope_size = 8;
11971            let bytes_len = max_ordinal as usize * envelope_size;
11972            #[allow(unused_variables)]
11973            let offset = encoder.out_of_line_offset(bytes_len);
11974            let mut _prev_end_offset: usize = 0;
11975            if 1 > max_ordinal {
11976                return Ok(());
11977            }
11978
11979            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
11980            // are envelope_size bytes.
11981            let cur_offset: usize = (1 - 1) * envelope_size;
11982
11983            // Zero reserved fields.
11984            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11985
11986            // Safety:
11987            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
11988            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
11989            //   envelope_size bytes, there is always sufficient room.
11990            fidl::encoding::encode_in_envelope_optional::<u32, D>(
11991                self.fresh_count.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
11992                encoder,
11993                offset + cur_offset,
11994                depth,
11995            )?;
11996
11997            _prev_end_offset = cur_offset + envelope_size;
11998            if 2 > max_ordinal {
11999                return Ok(());
12000            }
12001
12002            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12003            // are envelope_size bytes.
12004            let cur_offset: usize = (2 - 1) * envelope_size;
12005
12006            // Zero reserved fields.
12007            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12008
12009            // Safety:
12010            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
12011            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
12012            //   envelope_size bytes, there is always sufficient room.
12013            fidl::encoding::encode_in_envelope_optional::<u32, D>(
12014                self.deleted_count.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
12015                encoder,
12016                offset + cur_offset,
12017                depth,
12018            )?;
12019
12020            _prev_end_offset = cur_offset + envelope_size;
12021            if 3 > max_ordinal {
12022                return Ok(());
12023            }
12024
12025            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12026            // are envelope_size bytes.
12027            let cur_offset: usize = (3 - 1) * envelope_size;
12028
12029            // Zero reserved fields.
12030            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12031
12032            // Safety:
12033            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
12034            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
12035            //   envelope_size bytes, there is always sufficient room.
12036            fidl::encoding::encode_in_envelope_optional::<i64, D>(
12037                self.lease_time_total
12038                    .as_ref()
12039                    .map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
12040                encoder,
12041                offset + cur_offset,
12042                depth,
12043            )?;
12044
12045            _prev_end_offset = cur_offset + envelope_size;
12046            if 4 > max_ordinal {
12047                return Ok(());
12048            }
12049
12050            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12051            // are envelope_size bytes.
12052            let cur_offset: usize = (4 - 1) * envelope_size;
12053
12054            // Zero reserved fields.
12055            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12056
12057            // Safety:
12058            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
12059            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
12060            //   envelope_size bytes, there is always sufficient room.
12061            fidl::encoding::encode_in_envelope_optional::<i64, D>(
12062                self.key_lease_time_total
12063                    .as_ref()
12064                    .map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
12065                encoder,
12066                offset + cur_offset,
12067                depth,
12068            )?;
12069
12070            _prev_end_offset = cur_offset + envelope_size;
12071            if 5 > max_ordinal {
12072                return Ok(());
12073            }
12074
12075            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12076            // are envelope_size bytes.
12077            let cur_offset: usize = (5 - 1) * envelope_size;
12078
12079            // Zero reserved fields.
12080            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12081
12082            // Safety:
12083            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
12084            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
12085            //   envelope_size bytes, there is always sufficient room.
12086            fidl::encoding::encode_in_envelope_optional::<i64, D>(
12087                self.remaining_lease_time_total
12088                    .as_ref()
12089                    .map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
12090                encoder,
12091                offset + cur_offset,
12092                depth,
12093            )?;
12094
12095            _prev_end_offset = cur_offset + envelope_size;
12096            if 6 > max_ordinal {
12097                return Ok(());
12098            }
12099
12100            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12101            // are envelope_size bytes.
12102            let cur_offset: usize = (6 - 1) * envelope_size;
12103
12104            // Zero reserved fields.
12105            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12106
12107            // Safety:
12108            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
12109            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
12110            //   envelope_size bytes, there is always sufficient room.
12111            fidl::encoding::encode_in_envelope_optional::<i64, D>(
12112                self.remaining_key_lease_time_total
12113                    .as_ref()
12114                    .map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
12115                encoder,
12116                offset + cur_offset,
12117                depth,
12118            )?;
12119
12120            _prev_end_offset = cur_offset + envelope_size;
12121
12122            Ok(())
12123        }
12124    }
12125
12126    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SrpServerRegistration {
12127        #[inline(always)]
12128        fn new_empty() -> Self {
12129            Self::default()
12130        }
12131
12132        unsafe fn decode(
12133            &mut self,
12134            decoder: &mut fidl::encoding::Decoder<'_, D>,
12135            offset: usize,
12136            mut depth: fidl::encoding::Depth,
12137        ) -> fidl::Result<()> {
12138            decoder.debug_check_bounds::<Self>(offset);
12139            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
12140                None => return Err(fidl::Error::NotNullable),
12141                Some(len) => len,
12142            };
12143            // Calling decoder.out_of_line_offset(0) is not allowed.
12144            if len == 0 {
12145                return Ok(());
12146            };
12147            depth.increment()?;
12148            let envelope_size = 8;
12149            let bytes_len = len * envelope_size;
12150            let offset = decoder.out_of_line_offset(bytes_len)?;
12151            // Decode the envelope for each type.
12152            let mut _next_ordinal_to_read = 0;
12153            let mut next_offset = offset;
12154            let end_offset = offset + bytes_len;
12155            _next_ordinal_to_read += 1;
12156            if next_offset >= end_offset {
12157                return Ok(());
12158            }
12159
12160            // Decode unknown envelopes for gaps in ordinals.
12161            while _next_ordinal_to_read < 1 {
12162                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12163                _next_ordinal_to_read += 1;
12164                next_offset += envelope_size;
12165            }
12166
12167            let next_out_of_line = decoder.next_out_of_line();
12168            let handles_before = decoder.remaining_handles();
12169            if let Some((inlined, num_bytes, num_handles)) =
12170                fidl::encoding::decode_envelope_header(decoder, next_offset)?
12171            {
12172                let member_inline_size =
12173                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
12174                if inlined != (member_inline_size <= 4) {
12175                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
12176                }
12177                let inner_offset;
12178                let mut inner_depth = depth.clone();
12179                if inlined {
12180                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12181                    inner_offset = next_offset;
12182                } else {
12183                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12184                    inner_depth.increment()?;
12185                }
12186                let val_ref = self.fresh_count.get_or_insert_with(|| fidl::new_empty!(u32, D));
12187                fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
12188                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12189                {
12190                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
12191                }
12192                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12193                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12194                }
12195            }
12196
12197            next_offset += envelope_size;
12198            _next_ordinal_to_read += 1;
12199            if next_offset >= end_offset {
12200                return Ok(());
12201            }
12202
12203            // Decode unknown envelopes for gaps in ordinals.
12204            while _next_ordinal_to_read < 2 {
12205                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12206                _next_ordinal_to_read += 1;
12207                next_offset += envelope_size;
12208            }
12209
12210            let next_out_of_line = decoder.next_out_of_line();
12211            let handles_before = decoder.remaining_handles();
12212            if let Some((inlined, num_bytes, num_handles)) =
12213                fidl::encoding::decode_envelope_header(decoder, next_offset)?
12214            {
12215                let member_inline_size =
12216                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
12217                if inlined != (member_inline_size <= 4) {
12218                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
12219                }
12220                let inner_offset;
12221                let mut inner_depth = depth.clone();
12222                if inlined {
12223                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12224                    inner_offset = next_offset;
12225                } else {
12226                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12227                    inner_depth.increment()?;
12228                }
12229                let val_ref = self.deleted_count.get_or_insert_with(|| fidl::new_empty!(u32, D));
12230                fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
12231                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12232                {
12233                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
12234                }
12235                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12236                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12237                }
12238            }
12239
12240            next_offset += envelope_size;
12241            _next_ordinal_to_read += 1;
12242            if next_offset >= end_offset {
12243                return Ok(());
12244            }
12245
12246            // Decode unknown envelopes for gaps in ordinals.
12247            while _next_ordinal_to_read < 3 {
12248                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12249                _next_ordinal_to_read += 1;
12250                next_offset += envelope_size;
12251            }
12252
12253            let next_out_of_line = decoder.next_out_of_line();
12254            let handles_before = decoder.remaining_handles();
12255            if let Some((inlined, num_bytes, num_handles)) =
12256                fidl::encoding::decode_envelope_header(decoder, next_offset)?
12257            {
12258                let member_inline_size =
12259                    <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
12260                if inlined != (member_inline_size <= 4) {
12261                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
12262                }
12263                let inner_offset;
12264                let mut inner_depth = depth.clone();
12265                if inlined {
12266                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12267                    inner_offset = next_offset;
12268                } else {
12269                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12270                    inner_depth.increment()?;
12271                }
12272                let val_ref = self.lease_time_total.get_or_insert_with(|| fidl::new_empty!(i64, D));
12273                fidl::decode!(i64, D, val_ref, decoder, inner_offset, inner_depth)?;
12274                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12275                {
12276                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
12277                }
12278                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12279                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12280                }
12281            }
12282
12283            next_offset += envelope_size;
12284            _next_ordinal_to_read += 1;
12285            if next_offset >= end_offset {
12286                return Ok(());
12287            }
12288
12289            // Decode unknown envelopes for gaps in ordinals.
12290            while _next_ordinal_to_read < 4 {
12291                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12292                _next_ordinal_to_read += 1;
12293                next_offset += envelope_size;
12294            }
12295
12296            let next_out_of_line = decoder.next_out_of_line();
12297            let handles_before = decoder.remaining_handles();
12298            if let Some((inlined, num_bytes, num_handles)) =
12299                fidl::encoding::decode_envelope_header(decoder, next_offset)?
12300            {
12301                let member_inline_size =
12302                    <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
12303                if inlined != (member_inline_size <= 4) {
12304                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
12305                }
12306                let inner_offset;
12307                let mut inner_depth = depth.clone();
12308                if inlined {
12309                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12310                    inner_offset = next_offset;
12311                } else {
12312                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12313                    inner_depth.increment()?;
12314                }
12315                let val_ref =
12316                    self.key_lease_time_total.get_or_insert_with(|| fidl::new_empty!(i64, D));
12317                fidl::decode!(i64, D, val_ref, decoder, inner_offset, inner_depth)?;
12318                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12319                {
12320                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
12321                }
12322                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12323                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12324                }
12325            }
12326
12327            next_offset += envelope_size;
12328            _next_ordinal_to_read += 1;
12329            if next_offset >= end_offset {
12330                return Ok(());
12331            }
12332
12333            // Decode unknown envelopes for gaps in ordinals.
12334            while _next_ordinal_to_read < 5 {
12335                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12336                _next_ordinal_to_read += 1;
12337                next_offset += envelope_size;
12338            }
12339
12340            let next_out_of_line = decoder.next_out_of_line();
12341            let handles_before = decoder.remaining_handles();
12342            if let Some((inlined, num_bytes, num_handles)) =
12343                fidl::encoding::decode_envelope_header(decoder, next_offset)?
12344            {
12345                let member_inline_size =
12346                    <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
12347                if inlined != (member_inline_size <= 4) {
12348                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
12349                }
12350                let inner_offset;
12351                let mut inner_depth = depth.clone();
12352                if inlined {
12353                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12354                    inner_offset = next_offset;
12355                } else {
12356                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12357                    inner_depth.increment()?;
12358                }
12359                let val_ref =
12360                    self.remaining_lease_time_total.get_or_insert_with(|| fidl::new_empty!(i64, D));
12361                fidl::decode!(i64, D, val_ref, decoder, inner_offset, inner_depth)?;
12362                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12363                {
12364                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
12365                }
12366                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12367                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12368                }
12369            }
12370
12371            next_offset += envelope_size;
12372            _next_ordinal_to_read += 1;
12373            if next_offset >= end_offset {
12374                return Ok(());
12375            }
12376
12377            // Decode unknown envelopes for gaps in ordinals.
12378            while _next_ordinal_to_read < 6 {
12379                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12380                _next_ordinal_to_read += 1;
12381                next_offset += envelope_size;
12382            }
12383
12384            let next_out_of_line = decoder.next_out_of_line();
12385            let handles_before = decoder.remaining_handles();
12386            if let Some((inlined, num_bytes, num_handles)) =
12387                fidl::encoding::decode_envelope_header(decoder, next_offset)?
12388            {
12389                let member_inline_size =
12390                    <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
12391                if inlined != (member_inline_size <= 4) {
12392                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
12393                }
12394                let inner_offset;
12395                let mut inner_depth = depth.clone();
12396                if inlined {
12397                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12398                    inner_offset = next_offset;
12399                } else {
12400                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12401                    inner_depth.increment()?;
12402                }
12403                let val_ref = self
12404                    .remaining_key_lease_time_total
12405                    .get_or_insert_with(|| fidl::new_empty!(i64, D));
12406                fidl::decode!(i64, D, val_ref, decoder, inner_offset, inner_depth)?;
12407                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12408                {
12409                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
12410                }
12411                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12412                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12413                }
12414            }
12415
12416            next_offset += envelope_size;
12417
12418            // Decode the remaining unknown envelopes.
12419            while next_offset < end_offset {
12420                _next_ordinal_to_read += 1;
12421                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12422                next_offset += envelope_size;
12423            }
12424
12425            Ok(())
12426        }
12427    }
12428
12429    impl SrpServerResponseCounters {
12430        #[inline(always)]
12431        fn max_ordinal_present(&self) -> u64 {
12432            if let Some(_) = self.other_response {
12433                return 6;
12434            }
12435            if let Some(_) = self.refused_response {
12436                return 5;
12437            }
12438            if let Some(_) = self.name_exists_response {
12439                return 4;
12440            }
12441            if let Some(_) = self.format_error_response {
12442                return 3;
12443            }
12444            if let Some(_) = self.server_failure_response {
12445                return 2;
12446            }
12447            if let Some(_) = self.success_response {
12448                return 1;
12449            }
12450            0
12451        }
12452    }
12453
12454    impl fidl::encoding::ValueTypeMarker for SrpServerResponseCounters {
12455        type Borrowed<'a> = &'a Self;
12456        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
12457            value
12458        }
12459    }
12460
12461    unsafe impl fidl::encoding::TypeMarker for SrpServerResponseCounters {
12462        type Owned = Self;
12463
12464        #[inline(always)]
12465        fn inline_align(_context: fidl::encoding::Context) -> usize {
12466            8
12467        }
12468
12469        #[inline(always)]
12470        fn inline_size(_context: fidl::encoding::Context) -> usize {
12471            16
12472        }
12473    }
12474
12475    unsafe impl<D: fidl::encoding::ResourceDialect>
12476        fidl::encoding::Encode<SrpServerResponseCounters, D> for &SrpServerResponseCounters
12477    {
12478        unsafe fn encode(
12479            self,
12480            encoder: &mut fidl::encoding::Encoder<'_, D>,
12481            offset: usize,
12482            mut depth: fidl::encoding::Depth,
12483        ) -> fidl::Result<()> {
12484            encoder.debug_check_bounds::<SrpServerResponseCounters>(offset);
12485            // Vector header
12486            let max_ordinal: u64 = self.max_ordinal_present();
12487            encoder.write_num(max_ordinal, offset);
12488            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
12489            // Calling encoder.out_of_line_offset(0) is not allowed.
12490            if max_ordinal == 0 {
12491                return Ok(());
12492            }
12493            depth.increment()?;
12494            let envelope_size = 8;
12495            let bytes_len = max_ordinal as usize * envelope_size;
12496            #[allow(unused_variables)]
12497            let offset = encoder.out_of_line_offset(bytes_len);
12498            let mut _prev_end_offset: usize = 0;
12499            if 1 > max_ordinal {
12500                return Ok(());
12501            }
12502
12503            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12504            // are envelope_size bytes.
12505            let cur_offset: usize = (1 - 1) * envelope_size;
12506
12507            // Zero reserved fields.
12508            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12509
12510            // Safety:
12511            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
12512            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
12513            //   envelope_size bytes, there is always sufficient room.
12514            fidl::encoding::encode_in_envelope_optional::<u32, D>(
12515                self.success_response
12516                    .as_ref()
12517                    .map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
12518                encoder,
12519                offset + cur_offset,
12520                depth,
12521            )?;
12522
12523            _prev_end_offset = cur_offset + envelope_size;
12524            if 2 > max_ordinal {
12525                return Ok(());
12526            }
12527
12528            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12529            // are envelope_size bytes.
12530            let cur_offset: usize = (2 - 1) * envelope_size;
12531
12532            // Zero reserved fields.
12533            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12534
12535            // Safety:
12536            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
12537            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
12538            //   envelope_size bytes, there is always sufficient room.
12539            fidl::encoding::encode_in_envelope_optional::<u32, D>(
12540                self.server_failure_response
12541                    .as_ref()
12542                    .map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
12543                encoder,
12544                offset + cur_offset,
12545                depth,
12546            )?;
12547
12548            _prev_end_offset = cur_offset + envelope_size;
12549            if 3 > max_ordinal {
12550                return Ok(());
12551            }
12552
12553            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12554            // are envelope_size bytes.
12555            let cur_offset: usize = (3 - 1) * envelope_size;
12556
12557            // Zero reserved fields.
12558            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12559
12560            // Safety:
12561            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
12562            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
12563            //   envelope_size bytes, there is always sufficient room.
12564            fidl::encoding::encode_in_envelope_optional::<u32, D>(
12565                self.format_error_response
12566                    .as_ref()
12567                    .map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
12568                encoder,
12569                offset + cur_offset,
12570                depth,
12571            )?;
12572
12573            _prev_end_offset = cur_offset + envelope_size;
12574            if 4 > max_ordinal {
12575                return Ok(());
12576            }
12577
12578            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12579            // are envelope_size bytes.
12580            let cur_offset: usize = (4 - 1) * envelope_size;
12581
12582            // Zero reserved fields.
12583            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12584
12585            // Safety:
12586            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
12587            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
12588            //   envelope_size bytes, there is always sufficient room.
12589            fidl::encoding::encode_in_envelope_optional::<u32, D>(
12590                self.name_exists_response
12591                    .as_ref()
12592                    .map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
12593                encoder,
12594                offset + cur_offset,
12595                depth,
12596            )?;
12597
12598            _prev_end_offset = cur_offset + envelope_size;
12599            if 5 > max_ordinal {
12600                return Ok(());
12601            }
12602
12603            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12604            // are envelope_size bytes.
12605            let cur_offset: usize = (5 - 1) * envelope_size;
12606
12607            // Zero reserved fields.
12608            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12609
12610            // Safety:
12611            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
12612            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
12613            //   envelope_size bytes, there is always sufficient room.
12614            fidl::encoding::encode_in_envelope_optional::<u32, D>(
12615                self.refused_response
12616                    .as_ref()
12617                    .map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
12618                encoder,
12619                offset + cur_offset,
12620                depth,
12621            )?;
12622
12623            _prev_end_offset = cur_offset + envelope_size;
12624            if 6 > max_ordinal {
12625                return Ok(());
12626            }
12627
12628            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12629            // are envelope_size bytes.
12630            let cur_offset: usize = (6 - 1) * envelope_size;
12631
12632            // Zero reserved fields.
12633            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12634
12635            // Safety:
12636            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
12637            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
12638            //   envelope_size bytes, there is always sufficient room.
12639            fidl::encoding::encode_in_envelope_optional::<u32, D>(
12640                self.other_response.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
12641                encoder,
12642                offset + cur_offset,
12643                depth,
12644            )?;
12645
12646            _prev_end_offset = cur_offset + envelope_size;
12647
12648            Ok(())
12649        }
12650    }
12651
12652    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
12653        for SrpServerResponseCounters
12654    {
12655        #[inline(always)]
12656        fn new_empty() -> Self {
12657            Self::default()
12658        }
12659
12660        unsafe fn decode(
12661            &mut self,
12662            decoder: &mut fidl::encoding::Decoder<'_, D>,
12663            offset: usize,
12664            mut depth: fidl::encoding::Depth,
12665        ) -> fidl::Result<()> {
12666            decoder.debug_check_bounds::<Self>(offset);
12667            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
12668                None => return Err(fidl::Error::NotNullable),
12669                Some(len) => len,
12670            };
12671            // Calling decoder.out_of_line_offset(0) is not allowed.
12672            if len == 0 {
12673                return Ok(());
12674            };
12675            depth.increment()?;
12676            let envelope_size = 8;
12677            let bytes_len = len * envelope_size;
12678            let offset = decoder.out_of_line_offset(bytes_len)?;
12679            // Decode the envelope for each type.
12680            let mut _next_ordinal_to_read = 0;
12681            let mut next_offset = offset;
12682            let end_offset = offset + bytes_len;
12683            _next_ordinal_to_read += 1;
12684            if next_offset >= end_offset {
12685                return Ok(());
12686            }
12687
12688            // Decode unknown envelopes for gaps in ordinals.
12689            while _next_ordinal_to_read < 1 {
12690                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12691                _next_ordinal_to_read += 1;
12692                next_offset += envelope_size;
12693            }
12694
12695            let next_out_of_line = decoder.next_out_of_line();
12696            let handles_before = decoder.remaining_handles();
12697            if let Some((inlined, num_bytes, num_handles)) =
12698                fidl::encoding::decode_envelope_header(decoder, next_offset)?
12699            {
12700                let member_inline_size =
12701                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
12702                if inlined != (member_inline_size <= 4) {
12703                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
12704                }
12705                let inner_offset;
12706                let mut inner_depth = depth.clone();
12707                if inlined {
12708                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12709                    inner_offset = next_offset;
12710                } else {
12711                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12712                    inner_depth.increment()?;
12713                }
12714                let val_ref = self.success_response.get_or_insert_with(|| fidl::new_empty!(u32, D));
12715                fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
12716                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12717                {
12718                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
12719                }
12720                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12721                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12722                }
12723            }
12724
12725            next_offset += envelope_size;
12726            _next_ordinal_to_read += 1;
12727            if next_offset >= end_offset {
12728                return Ok(());
12729            }
12730
12731            // Decode unknown envelopes for gaps in ordinals.
12732            while _next_ordinal_to_read < 2 {
12733                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12734                _next_ordinal_to_read += 1;
12735                next_offset += envelope_size;
12736            }
12737
12738            let next_out_of_line = decoder.next_out_of_line();
12739            let handles_before = decoder.remaining_handles();
12740            if let Some((inlined, num_bytes, num_handles)) =
12741                fidl::encoding::decode_envelope_header(decoder, next_offset)?
12742            {
12743                let member_inline_size =
12744                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
12745                if inlined != (member_inline_size <= 4) {
12746                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
12747                }
12748                let inner_offset;
12749                let mut inner_depth = depth.clone();
12750                if inlined {
12751                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12752                    inner_offset = next_offset;
12753                } else {
12754                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12755                    inner_depth.increment()?;
12756                }
12757                let val_ref =
12758                    self.server_failure_response.get_or_insert_with(|| fidl::new_empty!(u32, D));
12759                fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
12760                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12761                {
12762                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
12763                }
12764                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12765                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12766                }
12767            }
12768
12769            next_offset += envelope_size;
12770            _next_ordinal_to_read += 1;
12771            if next_offset >= end_offset {
12772                return Ok(());
12773            }
12774
12775            // Decode unknown envelopes for gaps in ordinals.
12776            while _next_ordinal_to_read < 3 {
12777                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12778                _next_ordinal_to_read += 1;
12779                next_offset += envelope_size;
12780            }
12781
12782            let next_out_of_line = decoder.next_out_of_line();
12783            let handles_before = decoder.remaining_handles();
12784            if let Some((inlined, num_bytes, num_handles)) =
12785                fidl::encoding::decode_envelope_header(decoder, next_offset)?
12786            {
12787                let member_inline_size =
12788                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
12789                if inlined != (member_inline_size <= 4) {
12790                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
12791                }
12792                let inner_offset;
12793                let mut inner_depth = depth.clone();
12794                if inlined {
12795                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12796                    inner_offset = next_offset;
12797                } else {
12798                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12799                    inner_depth.increment()?;
12800                }
12801                let val_ref =
12802                    self.format_error_response.get_or_insert_with(|| fidl::new_empty!(u32, D));
12803                fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
12804                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12805                {
12806                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
12807                }
12808                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12809                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12810                }
12811            }
12812
12813            next_offset += envelope_size;
12814            _next_ordinal_to_read += 1;
12815            if next_offset >= end_offset {
12816                return Ok(());
12817            }
12818
12819            // Decode unknown envelopes for gaps in ordinals.
12820            while _next_ordinal_to_read < 4 {
12821                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12822                _next_ordinal_to_read += 1;
12823                next_offset += envelope_size;
12824            }
12825
12826            let next_out_of_line = decoder.next_out_of_line();
12827            let handles_before = decoder.remaining_handles();
12828            if let Some((inlined, num_bytes, num_handles)) =
12829                fidl::encoding::decode_envelope_header(decoder, next_offset)?
12830            {
12831                let member_inline_size =
12832                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
12833                if inlined != (member_inline_size <= 4) {
12834                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
12835                }
12836                let inner_offset;
12837                let mut inner_depth = depth.clone();
12838                if inlined {
12839                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12840                    inner_offset = next_offset;
12841                } else {
12842                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12843                    inner_depth.increment()?;
12844                }
12845                let val_ref =
12846                    self.name_exists_response.get_or_insert_with(|| fidl::new_empty!(u32, D));
12847                fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
12848                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12849                {
12850                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
12851                }
12852                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12853                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12854                }
12855            }
12856
12857            next_offset += envelope_size;
12858            _next_ordinal_to_read += 1;
12859            if next_offset >= end_offset {
12860                return Ok(());
12861            }
12862
12863            // Decode unknown envelopes for gaps in ordinals.
12864            while _next_ordinal_to_read < 5 {
12865                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12866                _next_ordinal_to_read += 1;
12867                next_offset += envelope_size;
12868            }
12869
12870            let next_out_of_line = decoder.next_out_of_line();
12871            let handles_before = decoder.remaining_handles();
12872            if let Some((inlined, num_bytes, num_handles)) =
12873                fidl::encoding::decode_envelope_header(decoder, next_offset)?
12874            {
12875                let member_inline_size =
12876                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
12877                if inlined != (member_inline_size <= 4) {
12878                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
12879                }
12880                let inner_offset;
12881                let mut inner_depth = depth.clone();
12882                if inlined {
12883                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12884                    inner_offset = next_offset;
12885                } else {
12886                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12887                    inner_depth.increment()?;
12888                }
12889                let val_ref = self.refused_response.get_or_insert_with(|| fidl::new_empty!(u32, D));
12890                fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
12891                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12892                {
12893                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
12894                }
12895                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12896                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12897                }
12898            }
12899
12900            next_offset += envelope_size;
12901            _next_ordinal_to_read += 1;
12902            if next_offset >= end_offset {
12903                return Ok(());
12904            }
12905
12906            // Decode unknown envelopes for gaps in ordinals.
12907            while _next_ordinal_to_read < 6 {
12908                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12909                _next_ordinal_to_read += 1;
12910                next_offset += envelope_size;
12911            }
12912
12913            let next_out_of_line = decoder.next_out_of_line();
12914            let handles_before = decoder.remaining_handles();
12915            if let Some((inlined, num_bytes, num_handles)) =
12916                fidl::encoding::decode_envelope_header(decoder, next_offset)?
12917            {
12918                let member_inline_size =
12919                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
12920                if inlined != (member_inline_size <= 4) {
12921                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
12922                }
12923                let inner_offset;
12924                let mut inner_depth = depth.clone();
12925                if inlined {
12926                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12927                    inner_offset = next_offset;
12928                } else {
12929                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12930                    inner_depth.increment()?;
12931                }
12932                let val_ref = self.other_response.get_or_insert_with(|| fidl::new_empty!(u32, D));
12933                fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
12934                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12935                {
12936                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
12937                }
12938                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12939                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12940                }
12941            }
12942
12943            next_offset += envelope_size;
12944
12945            // Decode the remaining unknown envelopes.
12946            while next_offset < end_offset {
12947                _next_ordinal_to_read += 1;
12948                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12949                next_offset += envelope_size;
12950            }
12951
12952            Ok(())
12953        }
12954    }
12955
12956    impl Telemetry {
12957        #[inline(always)]
12958        fn max_ordinal_present(&self) -> u64 {
12959            if let Some(_) = self.link_metrics_entries {
12960                return 24;
12961            }
12962            if let Some(_) = self.dhcp6pd_info {
12963                return 23;
12964            }
12965            if let Some(_) = self.upstream_dns_info {
12966                return 22;
12967            }
12968            if let Some(_) = self.trel_peers_info {
12969                return 21;
12970            }
12971            if let Some(_) = self.trel_counters {
12972                return 20;
12973            }
12974            if let Some(_) = self.nat64_info {
12975                return 19;
12976            }
12977            if let Some(_) = self.uptime {
12978                return 18;
12979            }
12980            if let Some(_) = self.leader_data {
12981                return 17;
12982            }
12983            if let Some(_) = self.dnssd_counters {
12984                return 16;
12985            }
12986            if let Some(_) = self.srp_server_info {
12987                return 15;
12988            }
12989            if let Some(_) = self.thread_border_routing_counters {
12990                return 14;
12991            }
12992            if let Some(_) = self.thread_stable_network_data {
12993                return 13;
12994            }
12995            if let Some(_) = self.thread_network_data {
12996                return 12;
12997            }
12998            if let Some(_) = self.thread_stable_network_data_version {
12999                return 11;
13000            }
13001            if let Some(_) = self.thread_network_data_version {
13002                return 10;
13003            }
13004            if let Some(_) = self.thread_rloc {
13005                return 9;
13006            }
13007            if let Some(_) = self.thread_router_id {
13008                return 8;
13009            }
13010            if let Some(_) = self.thread_link_mode {
13011                return 7;
13012            }
13013            if let Some(_) = self.rcp_version {
13014                return 6;
13015            }
13016            if let Some(_) = self.stack_version {
13017                return 5;
13018            }
13019            if let Some(_) = self.partition_id {
13020                return 4;
13021            }
13022            if let Some(_) = self.channel_index {
13023                return 3;
13024            }
13025            if let Some(_) = self.tx_power {
13026                return 2;
13027            }
13028            if let Some(_) = self.rssi {
13029                return 1;
13030            }
13031            0
13032        }
13033    }
13034
13035    impl fidl::encoding::ValueTypeMarker for Telemetry {
13036        type Borrowed<'a> = &'a Self;
13037        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
13038            value
13039        }
13040    }
13041
13042    unsafe impl fidl::encoding::TypeMarker for Telemetry {
13043        type Owned = Self;
13044
13045        #[inline(always)]
13046        fn inline_align(_context: fidl::encoding::Context) -> usize {
13047            8
13048        }
13049
13050        #[inline(always)]
13051        fn inline_size(_context: fidl::encoding::Context) -> usize {
13052            16
13053        }
13054    }
13055
13056    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Telemetry, D>
13057        for &Telemetry
13058    {
13059        unsafe fn encode(
13060            self,
13061            encoder: &mut fidl::encoding::Encoder<'_, D>,
13062            offset: usize,
13063            mut depth: fidl::encoding::Depth,
13064        ) -> fidl::Result<()> {
13065            encoder.debug_check_bounds::<Telemetry>(offset);
13066            // Vector header
13067            let max_ordinal: u64 = self.max_ordinal_present();
13068            encoder.write_num(max_ordinal, offset);
13069            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
13070            // Calling encoder.out_of_line_offset(0) is not allowed.
13071            if max_ordinal == 0 {
13072                return Ok(());
13073            }
13074            depth.increment()?;
13075            let envelope_size = 8;
13076            let bytes_len = max_ordinal as usize * envelope_size;
13077            #[allow(unused_variables)]
13078            let offset = encoder.out_of_line_offset(bytes_len);
13079            let mut _prev_end_offset: usize = 0;
13080            if 1 > max_ordinal {
13081                return Ok(());
13082            }
13083
13084            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
13085            // are envelope_size bytes.
13086            let cur_offset: usize = (1 - 1) * envelope_size;
13087
13088            // Zero reserved fields.
13089            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
13090
13091            // Safety:
13092            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
13093            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
13094            //   envelope_size bytes, there is always sufficient room.
13095            fidl::encoding::encode_in_envelope_optional::<i8, D>(
13096                self.rssi.as_ref().map(<i8 as fidl::encoding::ValueTypeMarker>::borrow),
13097                encoder,
13098                offset + cur_offset,
13099                depth,
13100            )?;
13101
13102            _prev_end_offset = cur_offset + envelope_size;
13103            if 2 > max_ordinal {
13104                return Ok(());
13105            }
13106
13107            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
13108            // are envelope_size bytes.
13109            let cur_offset: usize = (2 - 1) * envelope_size;
13110
13111            // Zero reserved fields.
13112            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
13113
13114            // Safety:
13115            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
13116            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
13117            //   envelope_size bytes, there is always sufficient room.
13118            fidl::encoding::encode_in_envelope_optional::<i8, D>(
13119                self.tx_power.as_ref().map(<i8 as fidl::encoding::ValueTypeMarker>::borrow),
13120                encoder,
13121                offset + cur_offset,
13122                depth,
13123            )?;
13124
13125            _prev_end_offset = cur_offset + envelope_size;
13126            if 3 > max_ordinal {
13127                return Ok(());
13128            }
13129
13130            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
13131            // are envelope_size bytes.
13132            let cur_offset: usize = (3 - 1) * envelope_size;
13133
13134            // Zero reserved fields.
13135            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
13136
13137            // Safety:
13138            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
13139            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
13140            //   envelope_size bytes, there is always sufficient room.
13141            fidl::encoding::encode_in_envelope_optional::<u16, D>(
13142                self.channel_index.as_ref().map(<u16 as fidl::encoding::ValueTypeMarker>::borrow),
13143                encoder,
13144                offset + cur_offset,
13145                depth,
13146            )?;
13147
13148            _prev_end_offset = cur_offset + envelope_size;
13149            if 4 > max_ordinal {
13150                return Ok(());
13151            }
13152
13153            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
13154            // are envelope_size bytes.
13155            let cur_offset: usize = (4 - 1) * envelope_size;
13156
13157            // Zero reserved fields.
13158            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
13159
13160            // Safety:
13161            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
13162            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
13163            //   envelope_size bytes, there is always sufficient room.
13164            fidl::encoding::encode_in_envelope_optional::<u32, D>(
13165                self.partition_id.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
13166                encoder,
13167                offset + cur_offset,
13168                depth,
13169            )?;
13170
13171            _prev_end_offset = cur_offset + envelope_size;
13172            if 5 > max_ordinal {
13173                return Ok(());
13174            }
13175
13176            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
13177            // are envelope_size bytes.
13178            let cur_offset: usize = (5 - 1) * envelope_size;
13179
13180            // Zero reserved fields.
13181            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
13182
13183            // Safety:
13184            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
13185            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
13186            //   envelope_size bytes, there is always sufficient room.
13187            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<256>, D>(
13188                self.stack_version.as_ref().map(
13189                    <fidl::encoding::BoundedString<256> as fidl::encoding::ValueTypeMarker>::borrow,
13190                ),
13191                encoder,
13192                offset + cur_offset,
13193                depth,
13194            )?;
13195
13196            _prev_end_offset = cur_offset + envelope_size;
13197            if 6 > max_ordinal {
13198                return Ok(());
13199            }
13200
13201            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
13202            // are envelope_size bytes.
13203            let cur_offset: usize = (6 - 1) * envelope_size;
13204
13205            // Zero reserved fields.
13206            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
13207
13208            // Safety:
13209            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
13210            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
13211            //   envelope_size bytes, there is always sufficient room.
13212            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<256>, D>(
13213                self.rcp_version.as_ref().map(
13214                    <fidl::encoding::BoundedString<256> as fidl::encoding::ValueTypeMarker>::borrow,
13215                ),
13216                encoder,
13217                offset + cur_offset,
13218                depth,
13219            )?;
13220
13221            _prev_end_offset = cur_offset + envelope_size;
13222            if 7 > max_ordinal {
13223                return Ok(());
13224            }
13225
13226            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
13227            // are envelope_size bytes.
13228            let cur_offset: usize = (7 - 1) * envelope_size;
13229
13230            // Zero reserved fields.
13231            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
13232
13233            // Safety:
13234            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
13235            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
13236            //   envelope_size bytes, there is always sufficient room.
13237            fidl::encoding::encode_in_envelope_optional::<u8, D>(
13238                self.thread_link_mode.as_ref().map(<u8 as fidl::encoding::ValueTypeMarker>::borrow),
13239                encoder,
13240                offset + cur_offset,
13241                depth,
13242            )?;
13243
13244            _prev_end_offset = cur_offset + envelope_size;
13245            if 8 > max_ordinal {
13246                return Ok(());
13247            }
13248
13249            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
13250            // are envelope_size bytes.
13251            let cur_offset: usize = (8 - 1) * envelope_size;
13252
13253            // Zero reserved fields.
13254            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
13255
13256            // Safety:
13257            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
13258            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
13259            //   envelope_size bytes, there is always sufficient room.
13260            fidl::encoding::encode_in_envelope_optional::<u8, D>(
13261                self.thread_router_id.as_ref().map(<u8 as fidl::encoding::ValueTypeMarker>::borrow),
13262                encoder,
13263                offset + cur_offset,
13264                depth,
13265            )?;
13266
13267            _prev_end_offset = cur_offset + envelope_size;
13268            if 9 > max_ordinal {
13269                return Ok(());
13270            }
13271
13272            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
13273            // are envelope_size bytes.
13274            let cur_offset: usize = (9 - 1) * envelope_size;
13275
13276            // Zero reserved fields.
13277            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
13278
13279            // Safety:
13280            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
13281            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
13282            //   envelope_size bytes, there is always sufficient room.
13283            fidl::encoding::encode_in_envelope_optional::<u16, D>(
13284                self.thread_rloc.as_ref().map(<u16 as fidl::encoding::ValueTypeMarker>::borrow),
13285                encoder,
13286                offset + cur_offset,
13287                depth,
13288            )?;
13289
13290            _prev_end_offset = cur_offset + envelope_size;
13291            if 10 > max_ordinal {
13292                return Ok(());
13293            }
13294
13295            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
13296            // are envelope_size bytes.
13297            let cur_offset: usize = (10 - 1) * envelope_size;
13298
13299            // Zero reserved fields.
13300            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
13301
13302            // Safety:
13303            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
13304            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
13305            //   envelope_size bytes, there is always sufficient room.
13306            fidl::encoding::encode_in_envelope_optional::<u8, D>(
13307                self.thread_network_data_version
13308                    .as_ref()
13309                    .map(<u8 as fidl::encoding::ValueTypeMarker>::borrow),
13310                encoder,
13311                offset + cur_offset,
13312                depth,
13313            )?;
13314
13315            _prev_end_offset = cur_offset + envelope_size;
13316            if 11 > max_ordinal {
13317                return Ok(());
13318            }
13319
13320            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
13321            // are envelope_size bytes.
13322            let cur_offset: usize = (11 - 1) * envelope_size;
13323
13324            // Zero reserved fields.
13325            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
13326
13327            // Safety:
13328            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
13329            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
13330            //   envelope_size bytes, there is always sufficient room.
13331            fidl::encoding::encode_in_envelope_optional::<u8, D>(
13332                self.thread_stable_network_data_version
13333                    .as_ref()
13334                    .map(<u8 as fidl::encoding::ValueTypeMarker>::borrow),
13335                encoder,
13336                offset + cur_offset,
13337                depth,
13338            )?;
13339
13340            _prev_end_offset = cur_offset + envelope_size;
13341            if 12 > max_ordinal {
13342                return Ok(());
13343            }
13344
13345            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
13346            // are envelope_size bytes.
13347            let cur_offset: usize = (12 - 1) * envelope_size;
13348
13349            // Zero reserved fields.
13350            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
13351
13352            // Safety:
13353            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
13354            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
13355            //   envelope_size bytes, there is always sufficient room.
13356            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<u8, 255>, D>(
13357                self.thread_network_data.as_ref().map(
13358                    <fidl::encoding::Vector<u8, 255> as fidl::encoding::ValueTypeMarker>::borrow,
13359                ),
13360                encoder,
13361                offset + cur_offset,
13362                depth,
13363            )?;
13364
13365            _prev_end_offset = cur_offset + envelope_size;
13366            if 13 > max_ordinal {
13367                return Ok(());
13368            }
13369
13370            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
13371            // are envelope_size bytes.
13372            let cur_offset: usize = (13 - 1) * envelope_size;
13373
13374            // Zero reserved fields.
13375            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
13376
13377            // Safety:
13378            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
13379            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
13380            //   envelope_size bytes, there is always sufficient room.
13381            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<u8, 255>, D>(
13382                self.thread_stable_network_data.as_ref().map(
13383                    <fidl::encoding::Vector<u8, 255> as fidl::encoding::ValueTypeMarker>::borrow,
13384                ),
13385                encoder,
13386                offset + cur_offset,
13387                depth,
13388            )?;
13389
13390            _prev_end_offset = cur_offset + envelope_size;
13391            if 14 > max_ordinal {
13392                return Ok(());
13393            }
13394
13395            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
13396            // are envelope_size bytes.
13397            let cur_offset: usize = (14 - 1) * envelope_size;
13398
13399            // Zero reserved fields.
13400            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
13401
13402            // Safety:
13403            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
13404            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
13405            //   envelope_size bytes, there is always sufficient room.
13406            fidl::encoding::encode_in_envelope_optional::<BorderRoutingCounters, D>(
13407                self.thread_border_routing_counters
13408                    .as_ref()
13409                    .map(<BorderRoutingCounters as fidl::encoding::ValueTypeMarker>::borrow),
13410                encoder,
13411                offset + cur_offset,
13412                depth,
13413            )?;
13414
13415            _prev_end_offset = cur_offset + envelope_size;
13416            if 15 > max_ordinal {
13417                return Ok(());
13418            }
13419
13420            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
13421            // are envelope_size bytes.
13422            let cur_offset: usize = (15 - 1) * envelope_size;
13423
13424            // Zero reserved fields.
13425            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
13426
13427            // Safety:
13428            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
13429            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
13430            //   envelope_size bytes, there is always sufficient room.
13431            fidl::encoding::encode_in_envelope_optional::<SrpServerInfo, D>(
13432                self.srp_server_info
13433                    .as_ref()
13434                    .map(<SrpServerInfo as fidl::encoding::ValueTypeMarker>::borrow),
13435                encoder,
13436                offset + cur_offset,
13437                depth,
13438            )?;
13439
13440            _prev_end_offset = cur_offset + envelope_size;
13441            if 16 > max_ordinal {
13442                return Ok(());
13443            }
13444
13445            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
13446            // are envelope_size bytes.
13447            let cur_offset: usize = (16 - 1) * envelope_size;
13448
13449            // Zero reserved fields.
13450            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
13451
13452            // Safety:
13453            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
13454            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
13455            //   envelope_size bytes, there is always sufficient room.
13456            fidl::encoding::encode_in_envelope_optional::<DnssdCounters, D>(
13457                self.dnssd_counters
13458                    .as_ref()
13459                    .map(<DnssdCounters as fidl::encoding::ValueTypeMarker>::borrow),
13460                encoder,
13461                offset + cur_offset,
13462                depth,
13463            )?;
13464
13465            _prev_end_offset = cur_offset + envelope_size;
13466            if 17 > max_ordinal {
13467                return Ok(());
13468            }
13469
13470            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
13471            // are envelope_size bytes.
13472            let cur_offset: usize = (17 - 1) * envelope_size;
13473
13474            // Zero reserved fields.
13475            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
13476
13477            // Safety:
13478            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
13479            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
13480            //   envelope_size bytes, there is always sufficient room.
13481            fidl::encoding::encode_in_envelope_optional::<LeaderData, D>(
13482                self.leader_data
13483                    .as_ref()
13484                    .map(<LeaderData as fidl::encoding::ValueTypeMarker>::borrow),
13485                encoder,
13486                offset + cur_offset,
13487                depth,
13488            )?;
13489
13490            _prev_end_offset = cur_offset + envelope_size;
13491            if 18 > max_ordinal {
13492                return Ok(());
13493            }
13494
13495            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
13496            // are envelope_size bytes.
13497            let cur_offset: usize = (18 - 1) * envelope_size;
13498
13499            // Zero reserved fields.
13500            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
13501
13502            // Safety:
13503            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
13504            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
13505            //   envelope_size bytes, there is always sufficient room.
13506            fidl::encoding::encode_in_envelope_optional::<i64, D>(
13507                self.uptime.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
13508                encoder,
13509                offset + cur_offset,
13510                depth,
13511            )?;
13512
13513            _prev_end_offset = cur_offset + envelope_size;
13514            if 19 > max_ordinal {
13515                return Ok(());
13516            }
13517
13518            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
13519            // are envelope_size bytes.
13520            let cur_offset: usize = (19 - 1) * envelope_size;
13521
13522            // Zero reserved fields.
13523            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
13524
13525            // Safety:
13526            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
13527            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
13528            //   envelope_size bytes, there is always sufficient room.
13529            fidl::encoding::encode_in_envelope_optional::<Nat64Info, D>(
13530                self.nat64_info
13531                    .as_ref()
13532                    .map(<Nat64Info as fidl::encoding::ValueTypeMarker>::borrow),
13533                encoder,
13534                offset + cur_offset,
13535                depth,
13536            )?;
13537
13538            _prev_end_offset = cur_offset + envelope_size;
13539            if 20 > max_ordinal {
13540                return Ok(());
13541            }
13542
13543            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
13544            // are envelope_size bytes.
13545            let cur_offset: usize = (20 - 1) * envelope_size;
13546
13547            // Zero reserved fields.
13548            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
13549
13550            // Safety:
13551            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
13552            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
13553            //   envelope_size bytes, there is always sufficient room.
13554            fidl::encoding::encode_in_envelope_optional::<TrelCounters, D>(
13555                self.trel_counters
13556                    .as_ref()
13557                    .map(<TrelCounters as fidl::encoding::ValueTypeMarker>::borrow),
13558                encoder,
13559                offset + cur_offset,
13560                depth,
13561            )?;
13562
13563            _prev_end_offset = cur_offset + envelope_size;
13564            if 21 > max_ordinal {
13565                return Ok(());
13566            }
13567
13568            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
13569            // are envelope_size bytes.
13570            let cur_offset: usize = (21 - 1) * envelope_size;
13571
13572            // Zero reserved fields.
13573            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
13574
13575            // Safety:
13576            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
13577            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
13578            //   envelope_size bytes, there is always sufficient room.
13579            fidl::encoding::encode_in_envelope_optional::<TrelPeersInfo, D>(
13580                self.trel_peers_info
13581                    .as_ref()
13582                    .map(<TrelPeersInfo as fidl::encoding::ValueTypeMarker>::borrow),
13583                encoder,
13584                offset + cur_offset,
13585                depth,
13586            )?;
13587
13588            _prev_end_offset = cur_offset + envelope_size;
13589            if 22 > max_ordinal {
13590                return Ok(());
13591            }
13592
13593            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
13594            // are envelope_size bytes.
13595            let cur_offset: usize = (22 - 1) * envelope_size;
13596
13597            // Zero reserved fields.
13598            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
13599
13600            // Safety:
13601            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
13602            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
13603            //   envelope_size bytes, there is always sufficient room.
13604            fidl::encoding::encode_in_envelope_optional::<UpstreamDnsInfo, D>(
13605                self.upstream_dns_info
13606                    .as_ref()
13607                    .map(<UpstreamDnsInfo as fidl::encoding::ValueTypeMarker>::borrow),
13608                encoder,
13609                offset + cur_offset,
13610                depth,
13611            )?;
13612
13613            _prev_end_offset = cur_offset + envelope_size;
13614            if 23 > max_ordinal {
13615                return Ok(());
13616            }
13617
13618            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
13619            // are envelope_size bytes.
13620            let cur_offset: usize = (23 - 1) * envelope_size;
13621
13622            // Zero reserved fields.
13623            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
13624
13625            // Safety:
13626            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
13627            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
13628            //   envelope_size bytes, there is always sufficient room.
13629            fidl::encoding::encode_in_envelope_optional::<Dhcp6PdInfo, D>(
13630                self.dhcp6pd_info
13631                    .as_ref()
13632                    .map(<Dhcp6PdInfo as fidl::encoding::ValueTypeMarker>::borrow),
13633                encoder,
13634                offset + cur_offset,
13635                depth,
13636            )?;
13637
13638            _prev_end_offset = cur_offset + envelope_size;
13639            if 24 > max_ordinal {
13640                return Ok(());
13641            }
13642
13643            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
13644            // are envelope_size bytes.
13645            let cur_offset: usize = (24 - 1) * envelope_size;
13646
13647            // Zero reserved fields.
13648            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
13649
13650            // Safety:
13651            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
13652            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
13653            //   envelope_size bytes, there is always sufficient room.
13654            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<LinkMetricsEntry, 64>, D>(
13655            self.link_metrics_entries.as_ref().map(<fidl::encoding::Vector<LinkMetricsEntry, 64> as fidl::encoding::ValueTypeMarker>::borrow),
13656            encoder, offset + cur_offset, depth
13657        )?;
13658
13659            _prev_end_offset = cur_offset + envelope_size;
13660
13661            Ok(())
13662        }
13663    }
13664
13665    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Telemetry {
13666        #[inline(always)]
13667        fn new_empty() -> Self {
13668            Self::default()
13669        }
13670
13671        unsafe fn decode(
13672            &mut self,
13673            decoder: &mut fidl::encoding::Decoder<'_, D>,
13674            offset: usize,
13675            mut depth: fidl::encoding::Depth,
13676        ) -> fidl::Result<()> {
13677            decoder.debug_check_bounds::<Self>(offset);
13678            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
13679                None => return Err(fidl::Error::NotNullable),
13680                Some(len) => len,
13681            };
13682            // Calling decoder.out_of_line_offset(0) is not allowed.
13683            if len == 0 {
13684                return Ok(());
13685            };
13686            depth.increment()?;
13687            let envelope_size = 8;
13688            let bytes_len = len * envelope_size;
13689            let offset = decoder.out_of_line_offset(bytes_len)?;
13690            // Decode the envelope for each type.
13691            let mut _next_ordinal_to_read = 0;
13692            let mut next_offset = offset;
13693            let end_offset = offset + bytes_len;
13694            _next_ordinal_to_read += 1;
13695            if next_offset >= end_offset {
13696                return Ok(());
13697            }
13698
13699            // Decode unknown envelopes for gaps in ordinals.
13700            while _next_ordinal_to_read < 1 {
13701                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13702                _next_ordinal_to_read += 1;
13703                next_offset += envelope_size;
13704            }
13705
13706            let next_out_of_line = decoder.next_out_of_line();
13707            let handles_before = decoder.remaining_handles();
13708            if let Some((inlined, num_bytes, num_handles)) =
13709                fidl::encoding::decode_envelope_header(decoder, next_offset)?
13710            {
13711                let member_inline_size =
13712                    <i8 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
13713                if inlined != (member_inline_size <= 4) {
13714                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
13715                }
13716                let inner_offset;
13717                let mut inner_depth = depth.clone();
13718                if inlined {
13719                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
13720                    inner_offset = next_offset;
13721                } else {
13722                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
13723                    inner_depth.increment()?;
13724                }
13725                let val_ref = self.rssi.get_or_insert_with(|| fidl::new_empty!(i8, D));
13726                fidl::decode!(i8, D, val_ref, decoder, inner_offset, inner_depth)?;
13727                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
13728                {
13729                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
13730                }
13731                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
13732                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
13733                }
13734            }
13735
13736            next_offset += envelope_size;
13737            _next_ordinal_to_read += 1;
13738            if next_offset >= end_offset {
13739                return Ok(());
13740            }
13741
13742            // Decode unknown envelopes for gaps in ordinals.
13743            while _next_ordinal_to_read < 2 {
13744                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13745                _next_ordinal_to_read += 1;
13746                next_offset += envelope_size;
13747            }
13748
13749            let next_out_of_line = decoder.next_out_of_line();
13750            let handles_before = decoder.remaining_handles();
13751            if let Some((inlined, num_bytes, num_handles)) =
13752                fidl::encoding::decode_envelope_header(decoder, next_offset)?
13753            {
13754                let member_inline_size =
13755                    <i8 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
13756                if inlined != (member_inline_size <= 4) {
13757                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
13758                }
13759                let inner_offset;
13760                let mut inner_depth = depth.clone();
13761                if inlined {
13762                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
13763                    inner_offset = next_offset;
13764                } else {
13765                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
13766                    inner_depth.increment()?;
13767                }
13768                let val_ref = self.tx_power.get_or_insert_with(|| fidl::new_empty!(i8, D));
13769                fidl::decode!(i8, D, val_ref, decoder, inner_offset, inner_depth)?;
13770                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
13771                {
13772                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
13773                }
13774                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
13775                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
13776                }
13777            }
13778
13779            next_offset += envelope_size;
13780            _next_ordinal_to_read += 1;
13781            if next_offset >= end_offset {
13782                return Ok(());
13783            }
13784
13785            // Decode unknown envelopes for gaps in ordinals.
13786            while _next_ordinal_to_read < 3 {
13787                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13788                _next_ordinal_to_read += 1;
13789                next_offset += envelope_size;
13790            }
13791
13792            let next_out_of_line = decoder.next_out_of_line();
13793            let handles_before = decoder.remaining_handles();
13794            if let Some((inlined, num_bytes, num_handles)) =
13795                fidl::encoding::decode_envelope_header(decoder, next_offset)?
13796            {
13797                let member_inline_size =
13798                    <u16 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
13799                if inlined != (member_inline_size <= 4) {
13800                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
13801                }
13802                let inner_offset;
13803                let mut inner_depth = depth.clone();
13804                if inlined {
13805                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
13806                    inner_offset = next_offset;
13807                } else {
13808                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
13809                    inner_depth.increment()?;
13810                }
13811                let val_ref = self.channel_index.get_or_insert_with(|| fidl::new_empty!(u16, D));
13812                fidl::decode!(u16, D, val_ref, decoder, inner_offset, inner_depth)?;
13813                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
13814                {
13815                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
13816                }
13817                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
13818                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
13819                }
13820            }
13821
13822            next_offset += envelope_size;
13823            _next_ordinal_to_read += 1;
13824            if next_offset >= end_offset {
13825                return Ok(());
13826            }
13827
13828            // Decode unknown envelopes for gaps in ordinals.
13829            while _next_ordinal_to_read < 4 {
13830                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13831                _next_ordinal_to_read += 1;
13832                next_offset += envelope_size;
13833            }
13834
13835            let next_out_of_line = decoder.next_out_of_line();
13836            let handles_before = decoder.remaining_handles();
13837            if let Some((inlined, num_bytes, num_handles)) =
13838                fidl::encoding::decode_envelope_header(decoder, next_offset)?
13839            {
13840                let member_inline_size =
13841                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
13842                if inlined != (member_inline_size <= 4) {
13843                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
13844                }
13845                let inner_offset;
13846                let mut inner_depth = depth.clone();
13847                if inlined {
13848                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
13849                    inner_offset = next_offset;
13850                } else {
13851                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
13852                    inner_depth.increment()?;
13853                }
13854                let val_ref = self.partition_id.get_or_insert_with(|| fidl::new_empty!(u32, D));
13855                fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
13856                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
13857                {
13858                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
13859                }
13860                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
13861                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
13862                }
13863            }
13864
13865            next_offset += envelope_size;
13866            _next_ordinal_to_read += 1;
13867            if next_offset >= end_offset {
13868                return Ok(());
13869            }
13870
13871            // Decode unknown envelopes for gaps in ordinals.
13872            while _next_ordinal_to_read < 5 {
13873                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13874                _next_ordinal_to_read += 1;
13875                next_offset += envelope_size;
13876            }
13877
13878            let next_out_of_line = decoder.next_out_of_line();
13879            let handles_before = decoder.remaining_handles();
13880            if let Some((inlined, num_bytes, num_handles)) =
13881                fidl::encoding::decode_envelope_header(decoder, next_offset)?
13882            {
13883                let member_inline_size =
13884                    <fidl::encoding::BoundedString<256> as fidl::encoding::TypeMarker>::inline_size(
13885                        decoder.context,
13886                    );
13887                if inlined != (member_inline_size <= 4) {
13888                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
13889                }
13890                let inner_offset;
13891                let mut inner_depth = depth.clone();
13892                if inlined {
13893                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
13894                    inner_offset = next_offset;
13895                } else {
13896                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
13897                    inner_depth.increment()?;
13898                }
13899                let val_ref = self
13900                    .stack_version
13901                    .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::BoundedString<256>, D));
13902                fidl::decode!(
13903                    fidl::encoding::BoundedString<256>,
13904                    D,
13905                    val_ref,
13906                    decoder,
13907                    inner_offset,
13908                    inner_depth
13909                )?;
13910                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
13911                {
13912                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
13913                }
13914                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
13915                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
13916                }
13917            }
13918
13919            next_offset += envelope_size;
13920            _next_ordinal_to_read += 1;
13921            if next_offset >= end_offset {
13922                return Ok(());
13923            }
13924
13925            // Decode unknown envelopes for gaps in ordinals.
13926            while _next_ordinal_to_read < 6 {
13927                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13928                _next_ordinal_to_read += 1;
13929                next_offset += envelope_size;
13930            }
13931
13932            let next_out_of_line = decoder.next_out_of_line();
13933            let handles_before = decoder.remaining_handles();
13934            if let Some((inlined, num_bytes, num_handles)) =
13935                fidl::encoding::decode_envelope_header(decoder, next_offset)?
13936            {
13937                let member_inline_size =
13938                    <fidl::encoding::BoundedString<256> as fidl::encoding::TypeMarker>::inline_size(
13939                        decoder.context,
13940                    );
13941                if inlined != (member_inline_size <= 4) {
13942                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
13943                }
13944                let inner_offset;
13945                let mut inner_depth = depth.clone();
13946                if inlined {
13947                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
13948                    inner_offset = next_offset;
13949                } else {
13950                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
13951                    inner_depth.increment()?;
13952                }
13953                let val_ref = self
13954                    .rcp_version
13955                    .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::BoundedString<256>, D));
13956                fidl::decode!(
13957                    fidl::encoding::BoundedString<256>,
13958                    D,
13959                    val_ref,
13960                    decoder,
13961                    inner_offset,
13962                    inner_depth
13963                )?;
13964                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
13965                {
13966                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
13967                }
13968                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
13969                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
13970                }
13971            }
13972
13973            next_offset += envelope_size;
13974            _next_ordinal_to_read += 1;
13975            if next_offset >= end_offset {
13976                return Ok(());
13977            }
13978
13979            // Decode unknown envelopes for gaps in ordinals.
13980            while _next_ordinal_to_read < 7 {
13981                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13982                _next_ordinal_to_read += 1;
13983                next_offset += envelope_size;
13984            }
13985
13986            let next_out_of_line = decoder.next_out_of_line();
13987            let handles_before = decoder.remaining_handles();
13988            if let Some((inlined, num_bytes, num_handles)) =
13989                fidl::encoding::decode_envelope_header(decoder, next_offset)?
13990            {
13991                let member_inline_size =
13992                    <u8 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
13993                if inlined != (member_inline_size <= 4) {
13994                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
13995                }
13996                let inner_offset;
13997                let mut inner_depth = depth.clone();
13998                if inlined {
13999                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
14000                    inner_offset = next_offset;
14001                } else {
14002                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
14003                    inner_depth.increment()?;
14004                }
14005                let val_ref = self.thread_link_mode.get_or_insert_with(|| fidl::new_empty!(u8, D));
14006                fidl::decode!(u8, D, val_ref, decoder, inner_offset, inner_depth)?;
14007                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
14008                {
14009                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
14010                }
14011                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
14012                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
14013                }
14014            }
14015
14016            next_offset += envelope_size;
14017            _next_ordinal_to_read += 1;
14018            if next_offset >= end_offset {
14019                return Ok(());
14020            }
14021
14022            // Decode unknown envelopes for gaps in ordinals.
14023            while _next_ordinal_to_read < 8 {
14024                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
14025                _next_ordinal_to_read += 1;
14026                next_offset += envelope_size;
14027            }
14028
14029            let next_out_of_line = decoder.next_out_of_line();
14030            let handles_before = decoder.remaining_handles();
14031            if let Some((inlined, num_bytes, num_handles)) =
14032                fidl::encoding::decode_envelope_header(decoder, next_offset)?
14033            {
14034                let member_inline_size =
14035                    <u8 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
14036                if inlined != (member_inline_size <= 4) {
14037                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
14038                }
14039                let inner_offset;
14040                let mut inner_depth = depth.clone();
14041                if inlined {
14042                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
14043                    inner_offset = next_offset;
14044                } else {
14045                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
14046                    inner_depth.increment()?;
14047                }
14048                let val_ref = self.thread_router_id.get_or_insert_with(|| fidl::new_empty!(u8, D));
14049                fidl::decode!(u8, D, val_ref, decoder, inner_offset, inner_depth)?;
14050                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
14051                {
14052                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
14053                }
14054                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
14055                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
14056                }
14057            }
14058
14059            next_offset += envelope_size;
14060            _next_ordinal_to_read += 1;
14061            if next_offset >= end_offset {
14062                return Ok(());
14063            }
14064
14065            // Decode unknown envelopes for gaps in ordinals.
14066            while _next_ordinal_to_read < 9 {
14067                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
14068                _next_ordinal_to_read += 1;
14069                next_offset += envelope_size;
14070            }
14071
14072            let next_out_of_line = decoder.next_out_of_line();
14073            let handles_before = decoder.remaining_handles();
14074            if let Some((inlined, num_bytes, num_handles)) =
14075                fidl::encoding::decode_envelope_header(decoder, next_offset)?
14076            {
14077                let member_inline_size =
14078                    <u16 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
14079                if inlined != (member_inline_size <= 4) {
14080                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
14081                }
14082                let inner_offset;
14083                let mut inner_depth = depth.clone();
14084                if inlined {
14085                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
14086                    inner_offset = next_offset;
14087                } else {
14088                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
14089                    inner_depth.increment()?;
14090                }
14091                let val_ref = self.thread_rloc.get_or_insert_with(|| fidl::new_empty!(u16, D));
14092                fidl::decode!(u16, D, val_ref, decoder, inner_offset, inner_depth)?;
14093                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
14094                {
14095                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
14096                }
14097                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
14098                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
14099                }
14100            }
14101
14102            next_offset += envelope_size;
14103            _next_ordinal_to_read += 1;
14104            if next_offset >= end_offset {
14105                return Ok(());
14106            }
14107
14108            // Decode unknown envelopes for gaps in ordinals.
14109            while _next_ordinal_to_read < 10 {
14110                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
14111                _next_ordinal_to_read += 1;
14112                next_offset += envelope_size;
14113            }
14114
14115            let next_out_of_line = decoder.next_out_of_line();
14116            let handles_before = decoder.remaining_handles();
14117            if let Some((inlined, num_bytes, num_handles)) =
14118                fidl::encoding::decode_envelope_header(decoder, next_offset)?
14119            {
14120                let member_inline_size =
14121                    <u8 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
14122                if inlined != (member_inline_size <= 4) {
14123                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
14124                }
14125                let inner_offset;
14126                let mut inner_depth = depth.clone();
14127                if inlined {
14128                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
14129                    inner_offset = next_offset;
14130                } else {
14131                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
14132                    inner_depth.increment()?;
14133                }
14134                let val_ref =
14135                    self.thread_network_data_version.get_or_insert_with(|| fidl::new_empty!(u8, D));
14136                fidl::decode!(u8, D, val_ref, decoder, inner_offset, inner_depth)?;
14137                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
14138                {
14139                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
14140                }
14141                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
14142                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
14143                }
14144            }
14145
14146            next_offset += envelope_size;
14147            _next_ordinal_to_read += 1;
14148            if next_offset >= end_offset {
14149                return Ok(());
14150            }
14151
14152            // Decode unknown envelopes for gaps in ordinals.
14153            while _next_ordinal_to_read < 11 {
14154                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
14155                _next_ordinal_to_read += 1;
14156                next_offset += envelope_size;
14157            }
14158
14159            let next_out_of_line = decoder.next_out_of_line();
14160            let handles_before = decoder.remaining_handles();
14161            if let Some((inlined, num_bytes, num_handles)) =
14162                fidl::encoding::decode_envelope_header(decoder, next_offset)?
14163            {
14164                let member_inline_size =
14165                    <u8 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
14166                if inlined != (member_inline_size <= 4) {
14167                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
14168                }
14169                let inner_offset;
14170                let mut inner_depth = depth.clone();
14171                if inlined {
14172                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
14173                    inner_offset = next_offset;
14174                } else {
14175                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
14176                    inner_depth.increment()?;
14177                }
14178                let val_ref = self
14179                    .thread_stable_network_data_version
14180                    .get_or_insert_with(|| fidl::new_empty!(u8, D));
14181                fidl::decode!(u8, D, val_ref, decoder, inner_offset, inner_depth)?;
14182                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
14183                {
14184                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
14185                }
14186                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
14187                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
14188                }
14189            }
14190
14191            next_offset += envelope_size;
14192            _next_ordinal_to_read += 1;
14193            if next_offset >= end_offset {
14194                return Ok(());
14195            }
14196
14197            // Decode unknown envelopes for gaps in ordinals.
14198            while _next_ordinal_to_read < 12 {
14199                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
14200                _next_ordinal_to_read += 1;
14201                next_offset += envelope_size;
14202            }
14203
14204            let next_out_of_line = decoder.next_out_of_line();
14205            let handles_before = decoder.remaining_handles();
14206            if let Some((inlined, num_bytes, num_handles)) =
14207                fidl::encoding::decode_envelope_header(decoder, next_offset)?
14208            {
14209                let member_inline_size =
14210                    <fidl::encoding::Vector<u8, 255> as fidl::encoding::TypeMarker>::inline_size(
14211                        decoder.context,
14212                    );
14213                if inlined != (member_inline_size <= 4) {
14214                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
14215                }
14216                let inner_offset;
14217                let mut inner_depth = depth.clone();
14218                if inlined {
14219                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
14220                    inner_offset = next_offset;
14221                } else {
14222                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
14223                    inner_depth.increment()?;
14224                }
14225                let val_ref = self
14226                    .thread_network_data
14227                    .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<u8, 255>, D));
14228                fidl::decode!(fidl::encoding::Vector<u8, 255>, D, val_ref, decoder, inner_offset, inner_depth)?;
14229                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
14230                {
14231                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
14232                }
14233                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
14234                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
14235                }
14236            }
14237
14238            next_offset += envelope_size;
14239            _next_ordinal_to_read += 1;
14240            if next_offset >= end_offset {
14241                return Ok(());
14242            }
14243
14244            // Decode unknown envelopes for gaps in ordinals.
14245            while _next_ordinal_to_read < 13 {
14246                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
14247                _next_ordinal_to_read += 1;
14248                next_offset += envelope_size;
14249            }
14250
14251            let next_out_of_line = decoder.next_out_of_line();
14252            let handles_before = decoder.remaining_handles();
14253            if let Some((inlined, num_bytes, num_handles)) =
14254                fidl::encoding::decode_envelope_header(decoder, next_offset)?
14255            {
14256                let member_inline_size =
14257                    <fidl::encoding::Vector<u8, 255> as fidl::encoding::TypeMarker>::inline_size(
14258                        decoder.context,
14259                    );
14260                if inlined != (member_inline_size <= 4) {
14261                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
14262                }
14263                let inner_offset;
14264                let mut inner_depth = depth.clone();
14265                if inlined {
14266                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
14267                    inner_offset = next_offset;
14268                } else {
14269                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
14270                    inner_depth.increment()?;
14271                }
14272                let val_ref = self
14273                    .thread_stable_network_data
14274                    .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<u8, 255>, D));
14275                fidl::decode!(fidl::encoding::Vector<u8, 255>, D, val_ref, decoder, inner_offset, inner_depth)?;
14276                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
14277                {
14278                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
14279                }
14280                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
14281                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
14282                }
14283            }
14284
14285            next_offset += envelope_size;
14286            _next_ordinal_to_read += 1;
14287            if next_offset >= end_offset {
14288                return Ok(());
14289            }
14290
14291            // Decode unknown envelopes for gaps in ordinals.
14292            while _next_ordinal_to_read < 14 {
14293                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
14294                _next_ordinal_to_read += 1;
14295                next_offset += envelope_size;
14296            }
14297
14298            let next_out_of_line = decoder.next_out_of_line();
14299            let handles_before = decoder.remaining_handles();
14300            if let Some((inlined, num_bytes, num_handles)) =
14301                fidl::encoding::decode_envelope_header(decoder, next_offset)?
14302            {
14303                let member_inline_size =
14304                    <BorderRoutingCounters as fidl::encoding::TypeMarker>::inline_size(
14305                        decoder.context,
14306                    );
14307                if inlined != (member_inline_size <= 4) {
14308                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
14309                }
14310                let inner_offset;
14311                let mut inner_depth = depth.clone();
14312                if inlined {
14313                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
14314                    inner_offset = next_offset;
14315                } else {
14316                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
14317                    inner_depth.increment()?;
14318                }
14319                let val_ref = self
14320                    .thread_border_routing_counters
14321                    .get_or_insert_with(|| fidl::new_empty!(BorderRoutingCounters, D));
14322                fidl::decode!(
14323                    BorderRoutingCounters,
14324                    D,
14325                    val_ref,
14326                    decoder,
14327                    inner_offset,
14328                    inner_depth
14329                )?;
14330                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
14331                {
14332                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
14333                }
14334                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
14335                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
14336                }
14337            }
14338
14339            next_offset += envelope_size;
14340            _next_ordinal_to_read += 1;
14341            if next_offset >= end_offset {
14342                return Ok(());
14343            }
14344
14345            // Decode unknown envelopes for gaps in ordinals.
14346            while _next_ordinal_to_read < 15 {
14347                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
14348                _next_ordinal_to_read += 1;
14349                next_offset += envelope_size;
14350            }
14351
14352            let next_out_of_line = decoder.next_out_of_line();
14353            let handles_before = decoder.remaining_handles();
14354            if let Some((inlined, num_bytes, num_handles)) =
14355                fidl::encoding::decode_envelope_header(decoder, next_offset)?
14356            {
14357                let member_inline_size =
14358                    <SrpServerInfo as fidl::encoding::TypeMarker>::inline_size(decoder.context);
14359                if inlined != (member_inline_size <= 4) {
14360                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
14361                }
14362                let inner_offset;
14363                let mut inner_depth = depth.clone();
14364                if inlined {
14365                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
14366                    inner_offset = next_offset;
14367                } else {
14368                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
14369                    inner_depth.increment()?;
14370                }
14371                let val_ref =
14372                    self.srp_server_info.get_or_insert_with(|| fidl::new_empty!(SrpServerInfo, D));
14373                fidl::decode!(SrpServerInfo, D, val_ref, decoder, inner_offset, inner_depth)?;
14374                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
14375                {
14376                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
14377                }
14378                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
14379                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
14380                }
14381            }
14382
14383            next_offset += envelope_size;
14384            _next_ordinal_to_read += 1;
14385            if next_offset >= end_offset {
14386                return Ok(());
14387            }
14388
14389            // Decode unknown envelopes for gaps in ordinals.
14390            while _next_ordinal_to_read < 16 {
14391                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
14392                _next_ordinal_to_read += 1;
14393                next_offset += envelope_size;
14394            }
14395
14396            let next_out_of_line = decoder.next_out_of_line();
14397            let handles_before = decoder.remaining_handles();
14398            if let Some((inlined, num_bytes, num_handles)) =
14399                fidl::encoding::decode_envelope_header(decoder, next_offset)?
14400            {
14401                let member_inline_size =
14402                    <DnssdCounters as fidl::encoding::TypeMarker>::inline_size(decoder.context);
14403                if inlined != (member_inline_size <= 4) {
14404                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
14405                }
14406                let inner_offset;
14407                let mut inner_depth = depth.clone();
14408                if inlined {
14409                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
14410                    inner_offset = next_offset;
14411                } else {
14412                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
14413                    inner_depth.increment()?;
14414                }
14415                let val_ref =
14416                    self.dnssd_counters.get_or_insert_with(|| fidl::new_empty!(DnssdCounters, D));
14417                fidl::decode!(DnssdCounters, D, val_ref, decoder, inner_offset, inner_depth)?;
14418                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
14419                {
14420                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
14421                }
14422                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
14423                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
14424                }
14425            }
14426
14427            next_offset += envelope_size;
14428            _next_ordinal_to_read += 1;
14429            if next_offset >= end_offset {
14430                return Ok(());
14431            }
14432
14433            // Decode unknown envelopes for gaps in ordinals.
14434            while _next_ordinal_to_read < 17 {
14435                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
14436                _next_ordinal_to_read += 1;
14437                next_offset += envelope_size;
14438            }
14439
14440            let next_out_of_line = decoder.next_out_of_line();
14441            let handles_before = decoder.remaining_handles();
14442            if let Some((inlined, num_bytes, num_handles)) =
14443                fidl::encoding::decode_envelope_header(decoder, next_offset)?
14444            {
14445                let member_inline_size =
14446                    <LeaderData as fidl::encoding::TypeMarker>::inline_size(decoder.context);
14447                if inlined != (member_inline_size <= 4) {
14448                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
14449                }
14450                let inner_offset;
14451                let mut inner_depth = depth.clone();
14452                if inlined {
14453                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
14454                    inner_offset = next_offset;
14455                } else {
14456                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
14457                    inner_depth.increment()?;
14458                }
14459                let val_ref =
14460                    self.leader_data.get_or_insert_with(|| fidl::new_empty!(LeaderData, D));
14461                fidl::decode!(LeaderData, D, val_ref, decoder, inner_offset, inner_depth)?;
14462                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
14463                {
14464                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
14465                }
14466                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
14467                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
14468                }
14469            }
14470
14471            next_offset += envelope_size;
14472            _next_ordinal_to_read += 1;
14473            if next_offset >= end_offset {
14474                return Ok(());
14475            }
14476
14477            // Decode unknown envelopes for gaps in ordinals.
14478            while _next_ordinal_to_read < 18 {
14479                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
14480                _next_ordinal_to_read += 1;
14481                next_offset += envelope_size;
14482            }
14483
14484            let next_out_of_line = decoder.next_out_of_line();
14485            let handles_before = decoder.remaining_handles();
14486            if let Some((inlined, num_bytes, num_handles)) =
14487                fidl::encoding::decode_envelope_header(decoder, next_offset)?
14488            {
14489                let member_inline_size =
14490                    <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
14491                if inlined != (member_inline_size <= 4) {
14492                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
14493                }
14494                let inner_offset;
14495                let mut inner_depth = depth.clone();
14496                if inlined {
14497                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
14498                    inner_offset = next_offset;
14499                } else {
14500                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
14501                    inner_depth.increment()?;
14502                }
14503                let val_ref = self.uptime.get_or_insert_with(|| fidl::new_empty!(i64, D));
14504                fidl::decode!(i64, D, val_ref, decoder, inner_offset, inner_depth)?;
14505                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
14506                {
14507                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
14508                }
14509                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
14510                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
14511                }
14512            }
14513
14514            next_offset += envelope_size;
14515            _next_ordinal_to_read += 1;
14516            if next_offset >= end_offset {
14517                return Ok(());
14518            }
14519
14520            // Decode unknown envelopes for gaps in ordinals.
14521            while _next_ordinal_to_read < 19 {
14522                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
14523                _next_ordinal_to_read += 1;
14524                next_offset += envelope_size;
14525            }
14526
14527            let next_out_of_line = decoder.next_out_of_line();
14528            let handles_before = decoder.remaining_handles();
14529            if let Some((inlined, num_bytes, num_handles)) =
14530                fidl::encoding::decode_envelope_header(decoder, next_offset)?
14531            {
14532                let member_inline_size =
14533                    <Nat64Info as fidl::encoding::TypeMarker>::inline_size(decoder.context);
14534                if inlined != (member_inline_size <= 4) {
14535                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
14536                }
14537                let inner_offset;
14538                let mut inner_depth = depth.clone();
14539                if inlined {
14540                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
14541                    inner_offset = next_offset;
14542                } else {
14543                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
14544                    inner_depth.increment()?;
14545                }
14546                let val_ref = self.nat64_info.get_or_insert_with(|| fidl::new_empty!(Nat64Info, D));
14547                fidl::decode!(Nat64Info, D, val_ref, decoder, inner_offset, inner_depth)?;
14548                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
14549                {
14550                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
14551                }
14552                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
14553                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
14554                }
14555            }
14556
14557            next_offset += envelope_size;
14558            _next_ordinal_to_read += 1;
14559            if next_offset >= end_offset {
14560                return Ok(());
14561            }
14562
14563            // Decode unknown envelopes for gaps in ordinals.
14564            while _next_ordinal_to_read < 20 {
14565                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
14566                _next_ordinal_to_read += 1;
14567                next_offset += envelope_size;
14568            }
14569
14570            let next_out_of_line = decoder.next_out_of_line();
14571            let handles_before = decoder.remaining_handles();
14572            if let Some((inlined, num_bytes, num_handles)) =
14573                fidl::encoding::decode_envelope_header(decoder, next_offset)?
14574            {
14575                let member_inline_size =
14576                    <TrelCounters as fidl::encoding::TypeMarker>::inline_size(decoder.context);
14577                if inlined != (member_inline_size <= 4) {
14578                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
14579                }
14580                let inner_offset;
14581                let mut inner_depth = depth.clone();
14582                if inlined {
14583                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
14584                    inner_offset = next_offset;
14585                } else {
14586                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
14587                    inner_depth.increment()?;
14588                }
14589                let val_ref =
14590                    self.trel_counters.get_or_insert_with(|| fidl::new_empty!(TrelCounters, D));
14591                fidl::decode!(TrelCounters, D, val_ref, decoder, inner_offset, inner_depth)?;
14592                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
14593                {
14594                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
14595                }
14596                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
14597                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
14598                }
14599            }
14600
14601            next_offset += envelope_size;
14602            _next_ordinal_to_read += 1;
14603            if next_offset >= end_offset {
14604                return Ok(());
14605            }
14606
14607            // Decode unknown envelopes for gaps in ordinals.
14608            while _next_ordinal_to_read < 21 {
14609                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
14610                _next_ordinal_to_read += 1;
14611                next_offset += envelope_size;
14612            }
14613
14614            let next_out_of_line = decoder.next_out_of_line();
14615            let handles_before = decoder.remaining_handles();
14616            if let Some((inlined, num_bytes, num_handles)) =
14617                fidl::encoding::decode_envelope_header(decoder, next_offset)?
14618            {
14619                let member_inline_size =
14620                    <TrelPeersInfo as fidl::encoding::TypeMarker>::inline_size(decoder.context);
14621                if inlined != (member_inline_size <= 4) {
14622                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
14623                }
14624                let inner_offset;
14625                let mut inner_depth = depth.clone();
14626                if inlined {
14627                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
14628                    inner_offset = next_offset;
14629                } else {
14630                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
14631                    inner_depth.increment()?;
14632                }
14633                let val_ref =
14634                    self.trel_peers_info.get_or_insert_with(|| fidl::new_empty!(TrelPeersInfo, D));
14635                fidl::decode!(TrelPeersInfo, D, val_ref, decoder, inner_offset, inner_depth)?;
14636                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
14637                {
14638                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
14639                }
14640                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
14641                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
14642                }
14643            }
14644
14645            next_offset += envelope_size;
14646            _next_ordinal_to_read += 1;
14647            if next_offset >= end_offset {
14648                return Ok(());
14649            }
14650
14651            // Decode unknown envelopes for gaps in ordinals.
14652            while _next_ordinal_to_read < 22 {
14653                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
14654                _next_ordinal_to_read += 1;
14655                next_offset += envelope_size;
14656            }
14657
14658            let next_out_of_line = decoder.next_out_of_line();
14659            let handles_before = decoder.remaining_handles();
14660            if let Some((inlined, num_bytes, num_handles)) =
14661                fidl::encoding::decode_envelope_header(decoder, next_offset)?
14662            {
14663                let member_inline_size =
14664                    <UpstreamDnsInfo as fidl::encoding::TypeMarker>::inline_size(decoder.context);
14665                if inlined != (member_inline_size <= 4) {
14666                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
14667                }
14668                let inner_offset;
14669                let mut inner_depth = depth.clone();
14670                if inlined {
14671                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
14672                    inner_offset = next_offset;
14673                } else {
14674                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
14675                    inner_depth.increment()?;
14676                }
14677                let val_ref = self
14678                    .upstream_dns_info
14679                    .get_or_insert_with(|| fidl::new_empty!(UpstreamDnsInfo, D));
14680                fidl::decode!(UpstreamDnsInfo, D, val_ref, decoder, inner_offset, inner_depth)?;
14681                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
14682                {
14683                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
14684                }
14685                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
14686                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
14687                }
14688            }
14689
14690            next_offset += envelope_size;
14691            _next_ordinal_to_read += 1;
14692            if next_offset >= end_offset {
14693                return Ok(());
14694            }
14695
14696            // Decode unknown envelopes for gaps in ordinals.
14697            while _next_ordinal_to_read < 23 {
14698                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
14699                _next_ordinal_to_read += 1;
14700                next_offset += envelope_size;
14701            }
14702
14703            let next_out_of_line = decoder.next_out_of_line();
14704            let handles_before = decoder.remaining_handles();
14705            if let Some((inlined, num_bytes, num_handles)) =
14706                fidl::encoding::decode_envelope_header(decoder, next_offset)?
14707            {
14708                let member_inline_size =
14709                    <Dhcp6PdInfo as fidl::encoding::TypeMarker>::inline_size(decoder.context);
14710                if inlined != (member_inline_size <= 4) {
14711                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
14712                }
14713                let inner_offset;
14714                let mut inner_depth = depth.clone();
14715                if inlined {
14716                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
14717                    inner_offset = next_offset;
14718                } else {
14719                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
14720                    inner_depth.increment()?;
14721                }
14722                let val_ref =
14723                    self.dhcp6pd_info.get_or_insert_with(|| fidl::new_empty!(Dhcp6PdInfo, D));
14724                fidl::decode!(Dhcp6PdInfo, D, val_ref, decoder, inner_offset, inner_depth)?;
14725                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
14726                {
14727                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
14728                }
14729                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
14730                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
14731                }
14732            }
14733
14734            next_offset += envelope_size;
14735            _next_ordinal_to_read += 1;
14736            if next_offset >= end_offset {
14737                return Ok(());
14738            }
14739
14740            // Decode unknown envelopes for gaps in ordinals.
14741            while _next_ordinal_to_read < 24 {
14742                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
14743                _next_ordinal_to_read += 1;
14744                next_offset += envelope_size;
14745            }
14746
14747            let next_out_of_line = decoder.next_out_of_line();
14748            let handles_before = decoder.remaining_handles();
14749            if let Some((inlined, num_bytes, num_handles)) =
14750                fidl::encoding::decode_envelope_header(decoder, next_offset)?
14751            {
14752                let member_inline_size = <fidl::encoding::Vector<LinkMetricsEntry, 64> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
14753                if inlined != (member_inline_size <= 4) {
14754                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
14755                }
14756                let inner_offset;
14757                let mut inner_depth = depth.clone();
14758                if inlined {
14759                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
14760                    inner_offset = next_offset;
14761                } else {
14762                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
14763                    inner_depth.increment()?;
14764                }
14765                let val_ref = self.link_metrics_entries.get_or_insert_with(
14766                    || fidl::new_empty!(fidl::encoding::Vector<LinkMetricsEntry, 64>, D),
14767                );
14768                fidl::decode!(fidl::encoding::Vector<LinkMetricsEntry, 64>, D, val_ref, decoder, inner_offset, inner_depth)?;
14769                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
14770                {
14771                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
14772                }
14773                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
14774                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
14775                }
14776            }
14777
14778            next_offset += envelope_size;
14779
14780            // Decode the remaining unknown envelopes.
14781            while next_offset < end_offset {
14782                _next_ordinal_to_read += 1;
14783                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
14784                next_offset += envelope_size;
14785            }
14786
14787            Ok(())
14788        }
14789    }
14790
14791    impl TrelCounters {
14792        #[inline(always)]
14793        fn max_ordinal_present(&self) -> u64 {
14794            if let Some(_) = self.tx_packets {
14795                return 5;
14796            }
14797            if let Some(_) = self.tx_failure {
14798                return 4;
14799            }
14800            if let Some(_) = self.tx_bytes {
14801                return 3;
14802            }
14803            if let Some(_) = self.rx_packets {
14804                return 2;
14805            }
14806            if let Some(_) = self.rx_bytes {
14807                return 1;
14808            }
14809            0
14810        }
14811    }
14812
14813    impl fidl::encoding::ValueTypeMarker for TrelCounters {
14814        type Borrowed<'a> = &'a Self;
14815        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
14816            value
14817        }
14818    }
14819
14820    unsafe impl fidl::encoding::TypeMarker for TrelCounters {
14821        type Owned = Self;
14822
14823        #[inline(always)]
14824        fn inline_align(_context: fidl::encoding::Context) -> usize {
14825            8
14826        }
14827
14828        #[inline(always)]
14829        fn inline_size(_context: fidl::encoding::Context) -> usize {
14830            16
14831        }
14832    }
14833
14834    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<TrelCounters, D>
14835        for &TrelCounters
14836    {
14837        unsafe fn encode(
14838            self,
14839            encoder: &mut fidl::encoding::Encoder<'_, D>,
14840            offset: usize,
14841            mut depth: fidl::encoding::Depth,
14842        ) -> fidl::Result<()> {
14843            encoder.debug_check_bounds::<TrelCounters>(offset);
14844            // Vector header
14845            let max_ordinal: u64 = self.max_ordinal_present();
14846            encoder.write_num(max_ordinal, offset);
14847            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
14848            // Calling encoder.out_of_line_offset(0) is not allowed.
14849            if max_ordinal == 0 {
14850                return Ok(());
14851            }
14852            depth.increment()?;
14853            let envelope_size = 8;
14854            let bytes_len = max_ordinal as usize * envelope_size;
14855            #[allow(unused_variables)]
14856            let offset = encoder.out_of_line_offset(bytes_len);
14857            let mut _prev_end_offset: usize = 0;
14858            if 1 > max_ordinal {
14859                return Ok(());
14860            }
14861
14862            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
14863            // are envelope_size bytes.
14864            let cur_offset: usize = (1 - 1) * envelope_size;
14865
14866            // Zero reserved fields.
14867            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
14868
14869            // Safety:
14870            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
14871            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
14872            //   envelope_size bytes, there is always sufficient room.
14873            fidl::encoding::encode_in_envelope_optional::<u64, D>(
14874                self.rx_bytes.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
14875                encoder,
14876                offset + cur_offset,
14877                depth,
14878            )?;
14879
14880            _prev_end_offset = cur_offset + envelope_size;
14881            if 2 > max_ordinal {
14882                return Ok(());
14883            }
14884
14885            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
14886            // are envelope_size bytes.
14887            let cur_offset: usize = (2 - 1) * envelope_size;
14888
14889            // Zero reserved fields.
14890            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
14891
14892            // Safety:
14893            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
14894            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
14895            //   envelope_size bytes, there is always sufficient room.
14896            fidl::encoding::encode_in_envelope_optional::<u64, D>(
14897                self.rx_packets.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
14898                encoder,
14899                offset + cur_offset,
14900                depth,
14901            )?;
14902
14903            _prev_end_offset = cur_offset + envelope_size;
14904            if 3 > max_ordinal {
14905                return Ok(());
14906            }
14907
14908            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
14909            // are envelope_size bytes.
14910            let cur_offset: usize = (3 - 1) * envelope_size;
14911
14912            // Zero reserved fields.
14913            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
14914
14915            // Safety:
14916            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
14917            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
14918            //   envelope_size bytes, there is always sufficient room.
14919            fidl::encoding::encode_in_envelope_optional::<u64, D>(
14920                self.tx_bytes.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
14921                encoder,
14922                offset + cur_offset,
14923                depth,
14924            )?;
14925
14926            _prev_end_offset = cur_offset + envelope_size;
14927            if 4 > max_ordinal {
14928                return Ok(());
14929            }
14930
14931            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
14932            // are envelope_size bytes.
14933            let cur_offset: usize = (4 - 1) * envelope_size;
14934
14935            // Zero reserved fields.
14936            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
14937
14938            // Safety:
14939            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
14940            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
14941            //   envelope_size bytes, there is always sufficient room.
14942            fidl::encoding::encode_in_envelope_optional::<u64, D>(
14943                self.tx_failure.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
14944                encoder,
14945                offset + cur_offset,
14946                depth,
14947            )?;
14948
14949            _prev_end_offset = cur_offset + envelope_size;
14950            if 5 > max_ordinal {
14951                return Ok(());
14952            }
14953
14954            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
14955            // are envelope_size bytes.
14956            let cur_offset: usize = (5 - 1) * envelope_size;
14957
14958            // Zero reserved fields.
14959            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
14960
14961            // Safety:
14962            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
14963            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
14964            //   envelope_size bytes, there is always sufficient room.
14965            fidl::encoding::encode_in_envelope_optional::<u64, D>(
14966                self.tx_packets.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
14967                encoder,
14968                offset + cur_offset,
14969                depth,
14970            )?;
14971
14972            _prev_end_offset = cur_offset + envelope_size;
14973
14974            Ok(())
14975        }
14976    }
14977
14978    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for TrelCounters {
14979        #[inline(always)]
14980        fn new_empty() -> Self {
14981            Self::default()
14982        }
14983
14984        unsafe fn decode(
14985            &mut self,
14986            decoder: &mut fidl::encoding::Decoder<'_, D>,
14987            offset: usize,
14988            mut depth: fidl::encoding::Depth,
14989        ) -> fidl::Result<()> {
14990            decoder.debug_check_bounds::<Self>(offset);
14991            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
14992                None => return Err(fidl::Error::NotNullable),
14993                Some(len) => len,
14994            };
14995            // Calling decoder.out_of_line_offset(0) is not allowed.
14996            if len == 0 {
14997                return Ok(());
14998            };
14999            depth.increment()?;
15000            let envelope_size = 8;
15001            let bytes_len = len * envelope_size;
15002            let offset = decoder.out_of_line_offset(bytes_len)?;
15003            // Decode the envelope for each type.
15004            let mut _next_ordinal_to_read = 0;
15005            let mut next_offset = offset;
15006            let end_offset = offset + bytes_len;
15007            _next_ordinal_to_read += 1;
15008            if next_offset >= end_offset {
15009                return Ok(());
15010            }
15011
15012            // Decode unknown envelopes for gaps in ordinals.
15013            while _next_ordinal_to_read < 1 {
15014                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
15015                _next_ordinal_to_read += 1;
15016                next_offset += envelope_size;
15017            }
15018
15019            let next_out_of_line = decoder.next_out_of_line();
15020            let handles_before = decoder.remaining_handles();
15021            if let Some((inlined, num_bytes, num_handles)) =
15022                fidl::encoding::decode_envelope_header(decoder, next_offset)?
15023            {
15024                let member_inline_size =
15025                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
15026                if inlined != (member_inline_size <= 4) {
15027                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
15028                }
15029                let inner_offset;
15030                let mut inner_depth = depth.clone();
15031                if inlined {
15032                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
15033                    inner_offset = next_offset;
15034                } else {
15035                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
15036                    inner_depth.increment()?;
15037                }
15038                let val_ref = self.rx_bytes.get_or_insert_with(|| fidl::new_empty!(u64, D));
15039                fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
15040                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
15041                {
15042                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
15043                }
15044                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
15045                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
15046                }
15047            }
15048
15049            next_offset += envelope_size;
15050            _next_ordinal_to_read += 1;
15051            if next_offset >= end_offset {
15052                return Ok(());
15053            }
15054
15055            // Decode unknown envelopes for gaps in ordinals.
15056            while _next_ordinal_to_read < 2 {
15057                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
15058                _next_ordinal_to_read += 1;
15059                next_offset += envelope_size;
15060            }
15061
15062            let next_out_of_line = decoder.next_out_of_line();
15063            let handles_before = decoder.remaining_handles();
15064            if let Some((inlined, num_bytes, num_handles)) =
15065                fidl::encoding::decode_envelope_header(decoder, next_offset)?
15066            {
15067                let member_inline_size =
15068                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
15069                if inlined != (member_inline_size <= 4) {
15070                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
15071                }
15072                let inner_offset;
15073                let mut inner_depth = depth.clone();
15074                if inlined {
15075                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
15076                    inner_offset = next_offset;
15077                } else {
15078                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
15079                    inner_depth.increment()?;
15080                }
15081                let val_ref = self.rx_packets.get_or_insert_with(|| fidl::new_empty!(u64, D));
15082                fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
15083                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
15084                {
15085                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
15086                }
15087                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
15088                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
15089                }
15090            }
15091
15092            next_offset += envelope_size;
15093            _next_ordinal_to_read += 1;
15094            if next_offset >= end_offset {
15095                return Ok(());
15096            }
15097
15098            // Decode unknown envelopes for gaps in ordinals.
15099            while _next_ordinal_to_read < 3 {
15100                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
15101                _next_ordinal_to_read += 1;
15102                next_offset += envelope_size;
15103            }
15104
15105            let next_out_of_line = decoder.next_out_of_line();
15106            let handles_before = decoder.remaining_handles();
15107            if let Some((inlined, num_bytes, num_handles)) =
15108                fidl::encoding::decode_envelope_header(decoder, next_offset)?
15109            {
15110                let member_inline_size =
15111                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
15112                if inlined != (member_inline_size <= 4) {
15113                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
15114                }
15115                let inner_offset;
15116                let mut inner_depth = depth.clone();
15117                if inlined {
15118                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
15119                    inner_offset = next_offset;
15120                } else {
15121                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
15122                    inner_depth.increment()?;
15123                }
15124                let val_ref = self.tx_bytes.get_or_insert_with(|| fidl::new_empty!(u64, D));
15125                fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
15126                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
15127                {
15128                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
15129                }
15130                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
15131                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
15132                }
15133            }
15134
15135            next_offset += envelope_size;
15136            _next_ordinal_to_read += 1;
15137            if next_offset >= end_offset {
15138                return Ok(());
15139            }
15140
15141            // Decode unknown envelopes for gaps in ordinals.
15142            while _next_ordinal_to_read < 4 {
15143                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
15144                _next_ordinal_to_read += 1;
15145                next_offset += envelope_size;
15146            }
15147
15148            let next_out_of_line = decoder.next_out_of_line();
15149            let handles_before = decoder.remaining_handles();
15150            if let Some((inlined, num_bytes, num_handles)) =
15151                fidl::encoding::decode_envelope_header(decoder, next_offset)?
15152            {
15153                let member_inline_size =
15154                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
15155                if inlined != (member_inline_size <= 4) {
15156                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
15157                }
15158                let inner_offset;
15159                let mut inner_depth = depth.clone();
15160                if inlined {
15161                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
15162                    inner_offset = next_offset;
15163                } else {
15164                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
15165                    inner_depth.increment()?;
15166                }
15167                let val_ref = self.tx_failure.get_or_insert_with(|| fidl::new_empty!(u64, D));
15168                fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
15169                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
15170                {
15171                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
15172                }
15173                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
15174                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
15175                }
15176            }
15177
15178            next_offset += envelope_size;
15179            _next_ordinal_to_read += 1;
15180            if next_offset >= end_offset {
15181                return Ok(());
15182            }
15183
15184            // Decode unknown envelopes for gaps in ordinals.
15185            while _next_ordinal_to_read < 5 {
15186                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
15187                _next_ordinal_to_read += 1;
15188                next_offset += envelope_size;
15189            }
15190
15191            let next_out_of_line = decoder.next_out_of_line();
15192            let handles_before = decoder.remaining_handles();
15193            if let Some((inlined, num_bytes, num_handles)) =
15194                fidl::encoding::decode_envelope_header(decoder, next_offset)?
15195            {
15196                let member_inline_size =
15197                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
15198                if inlined != (member_inline_size <= 4) {
15199                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
15200                }
15201                let inner_offset;
15202                let mut inner_depth = depth.clone();
15203                if inlined {
15204                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
15205                    inner_offset = next_offset;
15206                } else {
15207                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
15208                    inner_depth.increment()?;
15209                }
15210                let val_ref = self.tx_packets.get_or_insert_with(|| fidl::new_empty!(u64, D));
15211                fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
15212                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
15213                {
15214                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
15215                }
15216                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
15217                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
15218                }
15219            }
15220
15221            next_offset += envelope_size;
15222
15223            // Decode the remaining unknown envelopes.
15224            while next_offset < end_offset {
15225                _next_ordinal_to_read += 1;
15226                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
15227                next_offset += envelope_size;
15228            }
15229
15230            Ok(())
15231        }
15232    }
15233
15234    impl TrelPeersInfo {
15235        #[inline(always)]
15236        fn max_ordinal_present(&self) -> u64 {
15237            if let Some(_) = self.num_trel_peers {
15238                return 1;
15239            }
15240            0
15241        }
15242    }
15243
15244    impl fidl::encoding::ValueTypeMarker for TrelPeersInfo {
15245        type Borrowed<'a> = &'a Self;
15246        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
15247            value
15248        }
15249    }
15250
15251    unsafe impl fidl::encoding::TypeMarker for TrelPeersInfo {
15252        type Owned = Self;
15253
15254        #[inline(always)]
15255        fn inline_align(_context: fidl::encoding::Context) -> usize {
15256            8
15257        }
15258
15259        #[inline(always)]
15260        fn inline_size(_context: fidl::encoding::Context) -> usize {
15261            16
15262        }
15263    }
15264
15265    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<TrelPeersInfo, D>
15266        for &TrelPeersInfo
15267    {
15268        unsafe fn encode(
15269            self,
15270            encoder: &mut fidl::encoding::Encoder<'_, D>,
15271            offset: usize,
15272            mut depth: fidl::encoding::Depth,
15273        ) -> fidl::Result<()> {
15274            encoder.debug_check_bounds::<TrelPeersInfo>(offset);
15275            // Vector header
15276            let max_ordinal: u64 = self.max_ordinal_present();
15277            encoder.write_num(max_ordinal, offset);
15278            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
15279            // Calling encoder.out_of_line_offset(0) is not allowed.
15280            if max_ordinal == 0 {
15281                return Ok(());
15282            }
15283            depth.increment()?;
15284            let envelope_size = 8;
15285            let bytes_len = max_ordinal as usize * envelope_size;
15286            #[allow(unused_variables)]
15287            let offset = encoder.out_of_line_offset(bytes_len);
15288            let mut _prev_end_offset: usize = 0;
15289            if 1 > max_ordinal {
15290                return Ok(());
15291            }
15292
15293            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
15294            // are envelope_size bytes.
15295            let cur_offset: usize = (1 - 1) * envelope_size;
15296
15297            // Zero reserved fields.
15298            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
15299
15300            // Safety:
15301            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
15302            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
15303            //   envelope_size bytes, there is always sufficient room.
15304            fidl::encoding::encode_in_envelope_optional::<u16, D>(
15305                self.num_trel_peers.as_ref().map(<u16 as fidl::encoding::ValueTypeMarker>::borrow),
15306                encoder,
15307                offset + cur_offset,
15308                depth,
15309            )?;
15310
15311            _prev_end_offset = cur_offset + envelope_size;
15312
15313            Ok(())
15314        }
15315    }
15316
15317    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for TrelPeersInfo {
15318        #[inline(always)]
15319        fn new_empty() -> Self {
15320            Self::default()
15321        }
15322
15323        unsafe fn decode(
15324            &mut self,
15325            decoder: &mut fidl::encoding::Decoder<'_, D>,
15326            offset: usize,
15327            mut depth: fidl::encoding::Depth,
15328        ) -> fidl::Result<()> {
15329            decoder.debug_check_bounds::<Self>(offset);
15330            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
15331                None => return Err(fidl::Error::NotNullable),
15332                Some(len) => len,
15333            };
15334            // Calling decoder.out_of_line_offset(0) is not allowed.
15335            if len == 0 {
15336                return Ok(());
15337            };
15338            depth.increment()?;
15339            let envelope_size = 8;
15340            let bytes_len = len * envelope_size;
15341            let offset = decoder.out_of_line_offset(bytes_len)?;
15342            // Decode the envelope for each type.
15343            let mut _next_ordinal_to_read = 0;
15344            let mut next_offset = offset;
15345            let end_offset = offset + bytes_len;
15346            _next_ordinal_to_read += 1;
15347            if next_offset >= end_offset {
15348                return Ok(());
15349            }
15350
15351            // Decode unknown envelopes for gaps in ordinals.
15352            while _next_ordinal_to_read < 1 {
15353                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
15354                _next_ordinal_to_read += 1;
15355                next_offset += envelope_size;
15356            }
15357
15358            let next_out_of_line = decoder.next_out_of_line();
15359            let handles_before = decoder.remaining_handles();
15360            if let Some((inlined, num_bytes, num_handles)) =
15361                fidl::encoding::decode_envelope_header(decoder, next_offset)?
15362            {
15363                let member_inline_size =
15364                    <u16 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
15365                if inlined != (member_inline_size <= 4) {
15366                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
15367                }
15368                let inner_offset;
15369                let mut inner_depth = depth.clone();
15370                if inlined {
15371                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
15372                    inner_offset = next_offset;
15373                } else {
15374                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
15375                    inner_depth.increment()?;
15376                }
15377                let val_ref = self.num_trel_peers.get_or_insert_with(|| fidl::new_empty!(u16, D));
15378                fidl::decode!(u16, D, val_ref, decoder, inner_offset, inner_depth)?;
15379                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
15380                {
15381                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
15382                }
15383                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
15384                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
15385                }
15386            }
15387
15388            next_offset += envelope_size;
15389
15390            // Decode the remaining unknown envelopes.
15391            while next_offset < end_offset {
15392                _next_ordinal_to_read += 1;
15393                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
15394                next_offset += envelope_size;
15395            }
15396
15397            Ok(())
15398        }
15399    }
15400
15401    impl UpstreamDnsCounters {
15402        #[inline(always)]
15403        fn max_ordinal_present(&self) -> u64 {
15404            if let Some(_) = self.failures {
15405                return 3;
15406            }
15407            if let Some(_) = self.responses {
15408                return 2;
15409            }
15410            if let Some(_) = self.queries {
15411                return 1;
15412            }
15413            0
15414        }
15415    }
15416
15417    impl fidl::encoding::ValueTypeMarker for UpstreamDnsCounters {
15418        type Borrowed<'a> = &'a Self;
15419        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
15420            value
15421        }
15422    }
15423
15424    unsafe impl fidl::encoding::TypeMarker for UpstreamDnsCounters {
15425        type Owned = Self;
15426
15427        #[inline(always)]
15428        fn inline_align(_context: fidl::encoding::Context) -> usize {
15429            8
15430        }
15431
15432        #[inline(always)]
15433        fn inline_size(_context: fidl::encoding::Context) -> usize {
15434            16
15435        }
15436    }
15437
15438    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<UpstreamDnsCounters, D>
15439        for &UpstreamDnsCounters
15440    {
15441        unsafe fn encode(
15442            self,
15443            encoder: &mut fidl::encoding::Encoder<'_, D>,
15444            offset: usize,
15445            mut depth: fidl::encoding::Depth,
15446        ) -> fidl::Result<()> {
15447            encoder.debug_check_bounds::<UpstreamDnsCounters>(offset);
15448            // Vector header
15449            let max_ordinal: u64 = self.max_ordinal_present();
15450            encoder.write_num(max_ordinal, offset);
15451            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
15452            // Calling encoder.out_of_line_offset(0) is not allowed.
15453            if max_ordinal == 0 {
15454                return Ok(());
15455            }
15456            depth.increment()?;
15457            let envelope_size = 8;
15458            let bytes_len = max_ordinal as usize * envelope_size;
15459            #[allow(unused_variables)]
15460            let offset = encoder.out_of_line_offset(bytes_len);
15461            let mut _prev_end_offset: usize = 0;
15462            if 1 > max_ordinal {
15463                return Ok(());
15464            }
15465
15466            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
15467            // are envelope_size bytes.
15468            let cur_offset: usize = (1 - 1) * envelope_size;
15469
15470            // Zero reserved fields.
15471            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
15472
15473            // Safety:
15474            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
15475            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
15476            //   envelope_size bytes, there is always sufficient room.
15477            fidl::encoding::encode_in_envelope_optional::<u32, D>(
15478                self.queries.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
15479                encoder,
15480                offset + cur_offset,
15481                depth,
15482            )?;
15483
15484            _prev_end_offset = cur_offset + envelope_size;
15485            if 2 > max_ordinal {
15486                return Ok(());
15487            }
15488
15489            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
15490            // are envelope_size bytes.
15491            let cur_offset: usize = (2 - 1) * envelope_size;
15492
15493            // Zero reserved fields.
15494            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
15495
15496            // Safety:
15497            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
15498            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
15499            //   envelope_size bytes, there is always sufficient room.
15500            fidl::encoding::encode_in_envelope_optional::<u32, D>(
15501                self.responses.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
15502                encoder,
15503                offset + cur_offset,
15504                depth,
15505            )?;
15506
15507            _prev_end_offset = cur_offset + envelope_size;
15508            if 3 > max_ordinal {
15509                return Ok(());
15510            }
15511
15512            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
15513            // are envelope_size bytes.
15514            let cur_offset: usize = (3 - 1) * envelope_size;
15515
15516            // Zero reserved fields.
15517            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
15518
15519            // Safety:
15520            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
15521            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
15522            //   envelope_size bytes, there is always sufficient room.
15523            fidl::encoding::encode_in_envelope_optional::<u32, D>(
15524                self.failures.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
15525                encoder,
15526                offset + cur_offset,
15527                depth,
15528            )?;
15529
15530            _prev_end_offset = cur_offset + envelope_size;
15531
15532            Ok(())
15533        }
15534    }
15535
15536    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for UpstreamDnsCounters {
15537        #[inline(always)]
15538        fn new_empty() -> Self {
15539            Self::default()
15540        }
15541
15542        unsafe fn decode(
15543            &mut self,
15544            decoder: &mut fidl::encoding::Decoder<'_, D>,
15545            offset: usize,
15546            mut depth: fidl::encoding::Depth,
15547        ) -> fidl::Result<()> {
15548            decoder.debug_check_bounds::<Self>(offset);
15549            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
15550                None => return Err(fidl::Error::NotNullable),
15551                Some(len) => len,
15552            };
15553            // Calling decoder.out_of_line_offset(0) is not allowed.
15554            if len == 0 {
15555                return Ok(());
15556            };
15557            depth.increment()?;
15558            let envelope_size = 8;
15559            let bytes_len = len * envelope_size;
15560            let offset = decoder.out_of_line_offset(bytes_len)?;
15561            // Decode the envelope for each type.
15562            let mut _next_ordinal_to_read = 0;
15563            let mut next_offset = offset;
15564            let end_offset = offset + bytes_len;
15565            _next_ordinal_to_read += 1;
15566            if next_offset >= end_offset {
15567                return Ok(());
15568            }
15569
15570            // Decode unknown envelopes for gaps in ordinals.
15571            while _next_ordinal_to_read < 1 {
15572                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
15573                _next_ordinal_to_read += 1;
15574                next_offset += envelope_size;
15575            }
15576
15577            let next_out_of_line = decoder.next_out_of_line();
15578            let handles_before = decoder.remaining_handles();
15579            if let Some((inlined, num_bytes, num_handles)) =
15580                fidl::encoding::decode_envelope_header(decoder, next_offset)?
15581            {
15582                let member_inline_size =
15583                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
15584                if inlined != (member_inline_size <= 4) {
15585                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
15586                }
15587                let inner_offset;
15588                let mut inner_depth = depth.clone();
15589                if inlined {
15590                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
15591                    inner_offset = next_offset;
15592                } else {
15593                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
15594                    inner_depth.increment()?;
15595                }
15596                let val_ref = self.queries.get_or_insert_with(|| fidl::new_empty!(u32, D));
15597                fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
15598                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
15599                {
15600                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
15601                }
15602                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
15603                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
15604                }
15605            }
15606
15607            next_offset += envelope_size;
15608            _next_ordinal_to_read += 1;
15609            if next_offset >= end_offset {
15610                return Ok(());
15611            }
15612
15613            // Decode unknown envelopes for gaps in ordinals.
15614            while _next_ordinal_to_read < 2 {
15615                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
15616                _next_ordinal_to_read += 1;
15617                next_offset += envelope_size;
15618            }
15619
15620            let next_out_of_line = decoder.next_out_of_line();
15621            let handles_before = decoder.remaining_handles();
15622            if let Some((inlined, num_bytes, num_handles)) =
15623                fidl::encoding::decode_envelope_header(decoder, next_offset)?
15624            {
15625                let member_inline_size =
15626                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
15627                if inlined != (member_inline_size <= 4) {
15628                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
15629                }
15630                let inner_offset;
15631                let mut inner_depth = depth.clone();
15632                if inlined {
15633                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
15634                    inner_offset = next_offset;
15635                } else {
15636                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
15637                    inner_depth.increment()?;
15638                }
15639                let val_ref = self.responses.get_or_insert_with(|| fidl::new_empty!(u32, D));
15640                fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
15641                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
15642                {
15643                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
15644                }
15645                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
15646                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
15647                }
15648            }
15649
15650            next_offset += envelope_size;
15651            _next_ordinal_to_read += 1;
15652            if next_offset >= end_offset {
15653                return Ok(());
15654            }
15655
15656            // Decode unknown envelopes for gaps in ordinals.
15657            while _next_ordinal_to_read < 3 {
15658                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
15659                _next_ordinal_to_read += 1;
15660                next_offset += envelope_size;
15661            }
15662
15663            let next_out_of_line = decoder.next_out_of_line();
15664            let handles_before = decoder.remaining_handles();
15665            if let Some((inlined, num_bytes, num_handles)) =
15666                fidl::encoding::decode_envelope_header(decoder, next_offset)?
15667            {
15668                let member_inline_size =
15669                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
15670                if inlined != (member_inline_size <= 4) {
15671                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
15672                }
15673                let inner_offset;
15674                let mut inner_depth = depth.clone();
15675                if inlined {
15676                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
15677                    inner_offset = next_offset;
15678                } else {
15679                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
15680                    inner_depth.increment()?;
15681                }
15682                let val_ref = self.failures.get_or_insert_with(|| fidl::new_empty!(u32, D));
15683                fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
15684                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
15685                {
15686                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
15687                }
15688                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
15689                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
15690                }
15691            }
15692
15693            next_offset += envelope_size;
15694
15695            // Decode the remaining unknown envelopes.
15696            while next_offset < end_offset {
15697                _next_ordinal_to_read += 1;
15698                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
15699                next_offset += envelope_size;
15700            }
15701
15702            Ok(())
15703        }
15704    }
15705
15706    impl UpstreamDnsInfo {
15707        #[inline(always)]
15708        fn max_ordinal_present(&self) -> u64 {
15709            if let Some(_) = self.upstream_dns_query_state {
15710                return 1;
15711            }
15712            0
15713        }
15714    }
15715
15716    impl fidl::encoding::ValueTypeMarker for UpstreamDnsInfo {
15717        type Borrowed<'a> = &'a Self;
15718        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
15719            value
15720        }
15721    }
15722
15723    unsafe impl fidl::encoding::TypeMarker for UpstreamDnsInfo {
15724        type Owned = Self;
15725
15726        #[inline(always)]
15727        fn inline_align(_context: fidl::encoding::Context) -> usize {
15728            8
15729        }
15730
15731        #[inline(always)]
15732        fn inline_size(_context: fidl::encoding::Context) -> usize {
15733            16
15734        }
15735    }
15736
15737    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<UpstreamDnsInfo, D>
15738        for &UpstreamDnsInfo
15739    {
15740        unsafe fn encode(
15741            self,
15742            encoder: &mut fidl::encoding::Encoder<'_, D>,
15743            offset: usize,
15744            mut depth: fidl::encoding::Depth,
15745        ) -> fidl::Result<()> {
15746            encoder.debug_check_bounds::<UpstreamDnsInfo>(offset);
15747            // Vector header
15748            let max_ordinal: u64 = self.max_ordinal_present();
15749            encoder.write_num(max_ordinal, offset);
15750            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
15751            // Calling encoder.out_of_line_offset(0) is not allowed.
15752            if max_ordinal == 0 {
15753                return Ok(());
15754            }
15755            depth.increment()?;
15756            let envelope_size = 8;
15757            let bytes_len = max_ordinal as usize * envelope_size;
15758            #[allow(unused_variables)]
15759            let offset = encoder.out_of_line_offset(bytes_len);
15760            let mut _prev_end_offset: usize = 0;
15761            if 1 > max_ordinal {
15762                return Ok(());
15763            }
15764
15765            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
15766            // are envelope_size bytes.
15767            let cur_offset: usize = (1 - 1) * envelope_size;
15768
15769            // Zero reserved fields.
15770            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
15771
15772            // Safety:
15773            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
15774            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
15775            //   envelope_size bytes, there is always sufficient room.
15776            fidl::encoding::encode_in_envelope_optional::<UpstreamDnsQueryState, D>(
15777                self.upstream_dns_query_state
15778                    .as_ref()
15779                    .map(<UpstreamDnsQueryState as fidl::encoding::ValueTypeMarker>::borrow),
15780                encoder,
15781                offset + cur_offset,
15782                depth,
15783            )?;
15784
15785            _prev_end_offset = cur_offset + envelope_size;
15786
15787            Ok(())
15788        }
15789    }
15790
15791    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for UpstreamDnsInfo {
15792        #[inline(always)]
15793        fn new_empty() -> Self {
15794            Self::default()
15795        }
15796
15797        unsafe fn decode(
15798            &mut self,
15799            decoder: &mut fidl::encoding::Decoder<'_, D>,
15800            offset: usize,
15801            mut depth: fidl::encoding::Depth,
15802        ) -> fidl::Result<()> {
15803            decoder.debug_check_bounds::<Self>(offset);
15804            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
15805                None => return Err(fidl::Error::NotNullable),
15806                Some(len) => len,
15807            };
15808            // Calling decoder.out_of_line_offset(0) is not allowed.
15809            if len == 0 {
15810                return Ok(());
15811            };
15812            depth.increment()?;
15813            let envelope_size = 8;
15814            let bytes_len = len * envelope_size;
15815            let offset = decoder.out_of_line_offset(bytes_len)?;
15816            // Decode the envelope for each type.
15817            let mut _next_ordinal_to_read = 0;
15818            let mut next_offset = offset;
15819            let end_offset = offset + bytes_len;
15820            _next_ordinal_to_read += 1;
15821            if next_offset >= end_offset {
15822                return Ok(());
15823            }
15824
15825            // Decode unknown envelopes for gaps in ordinals.
15826            while _next_ordinal_to_read < 1 {
15827                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
15828                _next_ordinal_to_read += 1;
15829                next_offset += envelope_size;
15830            }
15831
15832            let next_out_of_line = decoder.next_out_of_line();
15833            let handles_before = decoder.remaining_handles();
15834            if let Some((inlined, num_bytes, num_handles)) =
15835                fidl::encoding::decode_envelope_header(decoder, next_offset)?
15836            {
15837                let member_inline_size =
15838                    <UpstreamDnsQueryState as fidl::encoding::TypeMarker>::inline_size(
15839                        decoder.context,
15840                    );
15841                if inlined != (member_inline_size <= 4) {
15842                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
15843                }
15844                let inner_offset;
15845                let mut inner_depth = depth.clone();
15846                if inlined {
15847                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
15848                    inner_offset = next_offset;
15849                } else {
15850                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
15851                    inner_depth.increment()?;
15852                }
15853                let val_ref = self
15854                    .upstream_dns_query_state
15855                    .get_or_insert_with(|| fidl::new_empty!(UpstreamDnsQueryState, D));
15856                fidl::decode!(
15857                    UpstreamDnsQueryState,
15858                    D,
15859                    val_ref,
15860                    decoder,
15861                    inner_offset,
15862                    inner_depth
15863                )?;
15864                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
15865                {
15866                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
15867                }
15868                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
15869                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
15870                }
15871            }
15872
15873            next_offset += envelope_size;
15874
15875            // Decode the remaining unknown envelopes.
15876            while next_offset < end_offset {
15877                _next_ordinal_to_read += 1;
15878                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
15879                next_offset += envelope_size;
15880            }
15881
15882            Ok(())
15883        }
15884    }
15885
15886    impl fidl::encoding::ValueTypeMarker for JoinParams {
15887        type Borrowed<'a> = &'a Self;
15888        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
15889            value
15890        }
15891    }
15892
15893    unsafe impl fidl::encoding::TypeMarker for JoinParams {
15894        type Owned = Self;
15895
15896        #[inline(always)]
15897        fn inline_align(_context: fidl::encoding::Context) -> usize {
15898            8
15899        }
15900
15901        #[inline(always)]
15902        fn inline_size(_context: fidl::encoding::Context) -> usize {
15903            16
15904        }
15905    }
15906
15907    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<JoinParams, D>
15908        for &JoinParams
15909    {
15910        #[inline]
15911        unsafe fn encode(
15912            self,
15913            encoder: &mut fidl::encoding::Encoder<'_, D>,
15914            offset: usize,
15915            _depth: fidl::encoding::Depth,
15916        ) -> fidl::Result<()> {
15917            encoder.debug_check_bounds::<JoinParams>(offset);
15918            encoder.write_num::<u64>(self.ordinal(), offset);
15919            match self {
15920            JoinParams::ProvisioningParameter(ref val) => {
15921                fidl::encoding::encode_in_envelope::<fidl_fuchsia_lowpan_device::ProvisioningParams, D>(
15922                    <fidl_fuchsia_lowpan_device::ProvisioningParams as fidl::encoding::ValueTypeMarker>::borrow(val),
15923                    encoder, offset + 8, _depth
15924                )
15925            }
15926            JoinParams::JoinerParameter(ref val) => {
15927                fidl::encoding::encode_in_envelope::<JoinerCommissioningParams, D>(
15928                    <JoinerCommissioningParams as fidl::encoding::ValueTypeMarker>::borrow(val),
15929                    encoder, offset + 8, _depth
15930                )
15931            }
15932            JoinParams::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
15933        }
15934        }
15935    }
15936
15937    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for JoinParams {
15938        #[inline(always)]
15939        fn new_empty() -> Self {
15940            Self::__SourceBreaking { unknown_ordinal: 0 }
15941        }
15942
15943        #[inline]
15944        unsafe fn decode(
15945            &mut self,
15946            decoder: &mut fidl::encoding::Decoder<'_, D>,
15947            offset: usize,
15948            mut depth: fidl::encoding::Depth,
15949        ) -> fidl::Result<()> {
15950            decoder.debug_check_bounds::<Self>(offset);
15951            #[allow(unused_variables)]
15952            let next_out_of_line = decoder.next_out_of_line();
15953            let handles_before = decoder.remaining_handles();
15954            let (ordinal, inlined, num_bytes, num_handles) =
15955                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
15956
15957            let member_inline_size = match ordinal {
15958            1 => <fidl_fuchsia_lowpan_device::ProvisioningParams as fidl::encoding::TypeMarker>::inline_size(decoder.context),
15959            2 => <JoinerCommissioningParams as fidl::encoding::TypeMarker>::inline_size(decoder.context),
15960            0 => return Err(fidl::Error::UnknownUnionTag),
15961            _ => num_bytes as usize,
15962        };
15963
15964            if inlined != (member_inline_size <= 4) {
15965                return Err(fidl::Error::InvalidInlineBitInEnvelope);
15966            }
15967            let _inner_offset;
15968            if inlined {
15969                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
15970                _inner_offset = offset + 8;
15971            } else {
15972                depth.increment()?;
15973                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
15974            }
15975            match ordinal {
15976                1 => {
15977                    #[allow(irrefutable_let_patterns)]
15978                    if let JoinParams::ProvisioningParameter(_) = self {
15979                        // Do nothing, read the value into the object
15980                    } else {
15981                        // Initialize `self` to the right variant
15982                        *self = JoinParams::ProvisioningParameter(fidl::new_empty!(
15983                            fidl_fuchsia_lowpan_device::ProvisioningParams,
15984                            D
15985                        ));
15986                    }
15987                    #[allow(irrefutable_let_patterns)]
15988                    if let JoinParams::ProvisioningParameter(ref mut val) = self {
15989                        fidl::decode!(
15990                            fidl_fuchsia_lowpan_device::ProvisioningParams,
15991                            D,
15992                            val,
15993                            decoder,
15994                            _inner_offset,
15995                            depth
15996                        )?;
15997                    } else {
15998                        unreachable!()
15999                    }
16000                }
16001                2 => {
16002                    #[allow(irrefutable_let_patterns)]
16003                    if let JoinParams::JoinerParameter(_) = self {
16004                        // Do nothing, read the value into the object
16005                    } else {
16006                        // Initialize `self` to the right variant
16007                        *self = JoinParams::JoinerParameter(fidl::new_empty!(
16008                            JoinerCommissioningParams,
16009                            D
16010                        ));
16011                    }
16012                    #[allow(irrefutable_let_patterns)]
16013                    if let JoinParams::JoinerParameter(ref mut val) = self {
16014                        fidl::decode!(
16015                            JoinerCommissioningParams,
16016                            D,
16017                            val,
16018                            decoder,
16019                            _inner_offset,
16020                            depth
16021                        )?;
16022                    } else {
16023                        unreachable!()
16024                    }
16025                }
16026                #[allow(deprecated)]
16027                ordinal => {
16028                    for _ in 0..num_handles {
16029                        decoder.drop_next_handle()?;
16030                    }
16031                    *self = JoinParams::__SourceBreaking { unknown_ordinal: ordinal };
16032                }
16033            }
16034            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
16035                return Err(fidl::Error::InvalidNumBytesInEnvelope);
16036            }
16037            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
16038                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
16039            }
16040            Ok(())
16041        }
16042    }
16043
16044    impl fidl::encoding::ValueTypeMarker for ProvisioningProgress {
16045        type Borrowed<'a> = &'a Self;
16046        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
16047            value
16048        }
16049    }
16050
16051    unsafe impl fidl::encoding::TypeMarker for ProvisioningProgress {
16052        type Owned = Self;
16053
16054        #[inline(always)]
16055        fn inline_align(_context: fidl::encoding::Context) -> usize {
16056            8
16057        }
16058
16059        #[inline(always)]
16060        fn inline_size(_context: fidl::encoding::Context) -> usize {
16061            16
16062        }
16063    }
16064
16065    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<ProvisioningProgress, D>
16066        for &ProvisioningProgress
16067    {
16068        #[inline]
16069        unsafe fn encode(
16070            self,
16071            encoder: &mut fidl::encoding::Encoder<'_, D>,
16072            offset: usize,
16073            _depth: fidl::encoding::Depth,
16074        ) -> fidl::Result<()> {
16075            encoder.debug_check_bounds::<ProvisioningProgress>(offset);
16076            encoder.write_num::<u64>(self.ordinal(), offset);
16077            match self {
16078            ProvisioningProgress::Progress(ref val) => {
16079                fidl::encoding::encode_in_envelope::<f32, D>(
16080                    <f32 as fidl::encoding::ValueTypeMarker>::borrow(val),
16081                    encoder, offset + 8, _depth
16082                )
16083            }
16084            ProvisioningProgress::Identity(ref val) => {
16085                fidl::encoding::encode_in_envelope::<fidl_fuchsia_lowpan_device::Identity, D>(
16086                    <fidl_fuchsia_lowpan_device::Identity as fidl::encoding::ValueTypeMarker>::borrow(val),
16087                    encoder, offset + 8, _depth
16088                )
16089            }
16090            ProvisioningProgress::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
16091        }
16092        }
16093    }
16094
16095    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ProvisioningProgress {
16096        #[inline(always)]
16097        fn new_empty() -> Self {
16098            Self::__SourceBreaking { unknown_ordinal: 0 }
16099        }
16100
16101        #[inline]
16102        unsafe fn decode(
16103            &mut self,
16104            decoder: &mut fidl::encoding::Decoder<'_, D>,
16105            offset: usize,
16106            mut depth: fidl::encoding::Depth,
16107        ) -> fidl::Result<()> {
16108            decoder.debug_check_bounds::<Self>(offset);
16109            #[allow(unused_variables)]
16110            let next_out_of_line = decoder.next_out_of_line();
16111            let handles_before = decoder.remaining_handles();
16112            let (ordinal, inlined, num_bytes, num_handles) =
16113                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
16114
16115            let member_inline_size = match ordinal {
16116            1 => <f32 as fidl::encoding::TypeMarker>::inline_size(decoder.context),
16117            2 => <fidl_fuchsia_lowpan_device::Identity as fidl::encoding::TypeMarker>::inline_size(decoder.context),
16118            0 => return Err(fidl::Error::UnknownUnionTag),
16119            _ => num_bytes as usize,
16120        };
16121
16122            if inlined != (member_inline_size <= 4) {
16123                return Err(fidl::Error::InvalidInlineBitInEnvelope);
16124            }
16125            let _inner_offset;
16126            if inlined {
16127                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
16128                _inner_offset = offset + 8;
16129            } else {
16130                depth.increment()?;
16131                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
16132            }
16133            match ordinal {
16134                1 => {
16135                    #[allow(irrefutable_let_patterns)]
16136                    if let ProvisioningProgress::Progress(_) = self {
16137                        // Do nothing, read the value into the object
16138                    } else {
16139                        // Initialize `self` to the right variant
16140                        *self = ProvisioningProgress::Progress(fidl::new_empty!(f32, D));
16141                    }
16142                    #[allow(irrefutable_let_patterns)]
16143                    if let ProvisioningProgress::Progress(ref mut val) = self {
16144                        fidl::decode!(f32, D, val, decoder, _inner_offset, depth)?;
16145                    } else {
16146                        unreachable!()
16147                    }
16148                }
16149                2 => {
16150                    #[allow(irrefutable_let_patterns)]
16151                    if let ProvisioningProgress::Identity(_) = self {
16152                        // Do nothing, read the value into the object
16153                    } else {
16154                        // Initialize `self` to the right variant
16155                        *self = ProvisioningProgress::Identity(fidl::new_empty!(
16156                            fidl_fuchsia_lowpan_device::Identity,
16157                            D
16158                        ));
16159                    }
16160                    #[allow(irrefutable_let_patterns)]
16161                    if let ProvisioningProgress::Identity(ref mut val) = self {
16162                        fidl::decode!(
16163                            fidl_fuchsia_lowpan_device::Identity,
16164                            D,
16165                            val,
16166                            decoder,
16167                            _inner_offset,
16168                            depth
16169                        )?;
16170                    } else {
16171                        unreachable!()
16172                    }
16173                }
16174                #[allow(deprecated)]
16175                ordinal => {
16176                    for _ in 0..num_handles {
16177                        decoder.drop_next_handle()?;
16178                    }
16179                    *self = ProvisioningProgress::__SourceBreaking { unknown_ordinal: ordinal };
16180                }
16181            }
16182            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
16183                return Err(fidl::Error::InvalidNumBytesInEnvelope);
16184            }
16185            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
16186                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
16187            }
16188            Ok(())
16189        }
16190    }
16191}