fidl_fuchsia_lowpan_device_common/
fidl_fuchsia_lowpan_device_common.rs

1// WARNING: This file is machine generated by fidlgen.
2
3#![warn(clippy::all)]
4#![allow(unused_parens, unused_mut, unused_imports, nonstandard_style)]
5
6use bitflags::bitflags;
7use fidl::encoding::{MessageBufFor, ProxyChannelBox, ResourceDialect};
8use futures::future::{self, MaybeDone, TryFutureExt};
9use zx_status;
10
11/// String describing a network type.
12pub type NetworkType = String;
13
14/// Maximum number of channels that can be returned by
15/// [`Device.GetSupportedChannels`].
16///
17/// Value was chosen arbitrarily to be large enough to accommodate any
18/// reasonable future use case.
19pub const MAX_CHANNELS: u16 = 200;
20
21/// Maximum number of distinct network types that a LoWPAN
22/// device can support.
23///
24/// The choice of 16 is an arbitrary upper bound. Most devices will only support one,
25/// and maybe one day a device might support two. Sixteen was chosen because it's
26/// large enough to account for any failure of imagination, yet small enough to not
27/// cause system stability issues.
28pub const MAX_NETWORK_TYPES: u16 = 16;
29
30/// Maximum length of a network type string.
31///
32/// Chosen arbitrarily to be large enough to accommodate any reasonable future
33/// net types.
34pub const MAX_NET_TYPE_LEN: u16 = 64;
35
36/// The maximum number of items that can be returned at one
37/// time by a scan stream.
38pub const MAX_STREAM_SET_SIZE: u16 = 32;
39
40pub const NET_TYPE_RAW_6_LOWPAN: &str = "fuchsia.lowpan.net_type.6lowpan";
41
42pub const NET_TYPE_THREAD_1_X: &str = "org.threadgroup.std.thread.1";
43
44pub const NET_TYPE_UNKNOWN_802_15_4_PID: &str = "fuchsia.lowpan.net_type.802.15.4.pid";
45
46pub const NET_TYPE_ZIGBEE_IP_1_X: &str = "org.zigbee.std.zigbee-ip.1";
47
48/// LoWPAN Connectivity State
49///
50/// This enum describes the level of connectivity being provided
51/// by a device.
52#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
53pub enum ConnectivityState {
54    /// Inactive state.
55    ///
56    /// In this state the device is unprovisioned and administratively
57    /// disabled (inactive).
58    ///
59    /// This state can always be explicitly entered by calling `Leave`
60    /// followed by `SetActive(false)`.
61    Inactive,
62    /// Ready state.
63    ///
64    /// In this state the device is provisioned for a network, but is
65    /// administratively disabled (inactive).
66    ///
67    /// This state can be directly entered with the following actions
68    /// based on the current connectivity state:
69    ///
70    /// * `INACTIVE`: by calling `ProvisionNetwork(...)`.
71    /// * `ATTACHING`, `ATTACHED`, `ISOLATED`, `COMMISSIONING`: by calling `SetActive(false)`.
72    Ready,
73    /// Offline state.
74    ///
75    /// In this state the device is administratively enabled (active)
76    /// but is not provisioned and thus has no network to attach to.
77    ///
78    /// This state can be directly entered with the following actions
79    /// based on the current connectivity state:
80    ///
81    /// * `INACTIVE`: by calling `SetActive(true)`.
82    /// * `ATTACHING`, `ATTACHED`, `ISOLATED`, `COMMISSIONING`: by calling `Leave()`.
83    Offline,
84    /// Attaching state.
85    ///
86    /// In this state the device is administratively enabled
87    /// (active) and either provisioned for a network or shortly
88    /// about to become provisioned for a network.
89    ///
90    /// The interface enters this state when it starts the process
91    /// of trying to find other nodes so that it can attach to any
92    /// pre-existing network fragment, or when it is in the process
93    /// of calculating the optimal values for unspecified parameters
94    /// when forming a new network.
95    ///
96    /// This state can be directly entered with the following actions
97    /// based on the current connectivity state:
98    ///
99    /// * `READY`: by calling `SetActive(true)`
100    /// * `OFFLINE`, `ATTACHING`, `ATTACHED`, `ISOLATED`, `COMMISSIONING`:
101    ///    by calling `ProvisionNetwork(...)`, `FormNetwork(...)`, or `JoinNetwork(...)`
102    Attaching,
103    /// Attached state.
104    ///
105    /// In this state the device is both administratively enabled
106    /// (active) and provisioned for a network. The device is an
107    /// active participant on the network and can communicate with
108    /// peers.
109    ///
110    /// This state usually implies that peers are available, but that
111    /// may not actually be the case due to current network conditions
112    /// or privacy-protecting measures.
113    ///
114    /// This state cannot generally be entered directly, rather
115    /// the device will enter this state automatically from the
116    /// `ATTACHING` or `ISOLATED` states once connectivity has been
117    /// (re)established.
118    Attached,
119    /// Isolated state.
120    ///
121    /// In this state the device is both administratively enabled
122    /// (active) and provisioned for a network. However, the device
123    /// has no connectivity because there are no peers in range on
124    /// the provisioned network.
125    ///
126    /// Once peer devices on the same network come into range
127    /// the connectivity state will eventually switch back to
128    /// `ATTACHED`, indicating restored connectivity with at least
129    /// one peer.
130    ///
131    /// This state cannot generally be entered directly, rather
132    /// the device may enter this state automatically from the
133    /// `ATTACHING` or `ATTACHED` states.
134    Isolated,
135    /// Commissioning state.
136    ///
137    /// Currently unused, but will later be used to
138    /// support in-band commissioning. It is usually appropriate
139    /// to consider this as a synonym for the `ATTACHING` state
140    /// except that the device remains unprovisioned.
141    Commissioning,
142    #[doc(hidden)]
143    __SourceBreaking { unknown_ordinal: i32 },
144}
145
146/// Pattern that matches an unknown `ConnectivityState` member.
147#[macro_export]
148macro_rules! ConnectivityStateUnknown {
149    () => {
150        _
151    };
152}
153
154impl ConnectivityState {
155    #[inline]
156    pub fn from_primitive(prim: i32) -> Option<Self> {
157        match prim {
158            1 => Some(Self::Inactive),
159            2 => Some(Self::Ready),
160            3 => Some(Self::Offline),
161            4 => Some(Self::Attaching),
162            5 => Some(Self::Attached),
163            6 => Some(Self::Isolated),
164            7 => Some(Self::Commissioning),
165            _ => None,
166        }
167    }
168
169    #[inline]
170    pub fn from_primitive_allow_unknown(prim: i32) -> Self {
171        match prim {
172            1 => Self::Inactive,
173            2 => Self::Ready,
174            3 => Self::Offline,
175            4 => Self::Attaching,
176            5 => Self::Attached,
177            6 => Self::Isolated,
178            7 => Self::Commissioning,
179            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
180        }
181    }
182
183    #[inline]
184    pub fn unknown() -> Self {
185        Self::__SourceBreaking { unknown_ordinal: 0x7fffffff }
186    }
187
188    #[inline]
189    pub const fn into_primitive(self) -> i32 {
190        match self {
191            Self::Inactive => 1,
192            Self::Ready => 2,
193            Self::Offline => 3,
194            Self::Attaching => 4,
195            Self::Attached => 5,
196            Self::Isolated => 6,
197            Self::Commissioning => 7,
198            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
199        }
200    }
201
202    #[inline]
203    pub fn is_unknown(&self) -> bool {
204        match self {
205            Self::__SourceBreaking { unknown_ordinal: _ } => true,
206            _ => false,
207        }
208    }
209}
210
211/// LoWPAN Role Type.
212///
213/// This type describes the role a device can assume on a network.
214#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
215pub enum Role {
216    /// Detached role. The interface is not
217    /// currently participating on the network,
218    /// either because it cannot find a parent
219    Detached,
220    /// End-device role. End devices do not route
221    /// traffic on behalf of other nodes.
222    EndDevice,
223    /// Router role. Routers help route traffic
224    /// around the mesh network.
225    ///
226    /// Note that this role is independent of the
227    /// device being a "border router".
228    ///
229    /// Not all network types support this role.
230    Router,
231    /// Sleepy End-Device role.
232    ///
233    /// End devices with this role are nominally asleep,
234    /// waking up periodically to check in with their
235    /// parent to see if there are packets destined for
236    /// them. Such devices are capable of extraordinarily
237    /// low power consumption, but packet latency can be
238    /// on the order of dozens of seconds(depending on how
239    /// the node is configured). Not all network types
240    /// support this role.
241    ///
242    /// Not all network types support this role.
243    SleepyEndDevice,
244    /// Sleepy-router role.
245    ///
246    /// Routers with this role are nominally asleep,
247    /// waking up periodically to check in with
248    /// other routers and their children.
249    ///
250    /// Not all network types support this role.
251    SleepyRouter,
252    /// Leader role.
253    ///
254    /// On Thread networks, for each partition/fragment
255    /// one router is designated as the "leader", which
256    /// means that it is considered authoritative for
257    /// all network data. In most cases this role can be
258    /// considered as a synonym to Role::ROUTER.
259    ///
260    /// Not all network types support this role.
261    Leader,
262    /// Coordinator role.
263    ///
264    /// Not all network types support this role.
265    Coordinator,
266    #[doc(hidden)]
267    __SourceBreaking { unknown_ordinal: i32 },
268}
269
270/// Pattern that matches an unknown `Role` member.
271#[macro_export]
272macro_rules! RoleUnknown {
273    () => {
274        _
275    };
276}
277
278impl Role {
279    #[inline]
280    pub fn from_primitive(prim: i32) -> Option<Self> {
281        match prim {
282            1 => Some(Self::Detached),
283            2 => Some(Self::EndDevice),
284            3 => Some(Self::Router),
285            4 => Some(Self::SleepyEndDevice),
286            5 => Some(Self::SleepyRouter),
287            6 => Some(Self::Leader),
288            7 => Some(Self::Coordinator),
289            _ => None,
290        }
291    }
292
293    #[inline]
294    pub fn from_primitive_allow_unknown(prim: i32) -> Self {
295        match prim {
296            1 => Self::Detached,
297            2 => Self::EndDevice,
298            3 => Self::Router,
299            4 => Self::SleepyEndDevice,
300            5 => Self::SleepyRouter,
301            6 => Self::Leader,
302            7 => Self::Coordinator,
303            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
304        }
305    }
306
307    #[inline]
308    pub fn unknown() -> Self {
309        Self::__SourceBreaking { unknown_ordinal: 0x7fffffff }
310    }
311
312    #[inline]
313    pub const fn into_primitive(self) -> i32 {
314        match self {
315            Self::Detached => 1,
316            Self::EndDevice => 2,
317            Self::Router => 3,
318            Self::SleepyEndDevice => 4,
319            Self::SleepyRouter => 5,
320            Self::Leader => 6,
321            Self::Coordinator => 7,
322            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
323        }
324    }
325
326    #[inline]
327    pub fn is_unknown(&self) -> bool {
328        match self {
329            Self::__SourceBreaking { unknown_ordinal: _ } => true,
330            _ => false,
331        }
332    }
333}
334
335#[derive(Clone, Debug, PartialEq)]
336pub struct CountersGetResponse {
337    pub counters: AllCounters,
338}
339
340impl fidl::Persistable for CountersGetResponse {}
341
342#[derive(Clone, Debug, PartialEq)]
343pub struct CountersResetResponse {
344    pub counters: AllCounters,
345}
346
347impl fidl::Persistable for CountersResetResponse {}
348
349#[derive(Clone, Debug, PartialEq)]
350pub struct DeviceExtraGetCredentialResponse {
351    pub credential: Option<Box<Credential>>,
352}
353
354impl fidl::Persistable for DeviceExtraGetCredentialResponse {}
355
356#[derive(Clone, Debug, PartialEq)]
357pub struct DeviceExtraGetCurrentMacAddressResponse {
358    pub address: fidl_fuchsia_lowpan::MacAddress,
359}
360
361impl fidl::Persistable for DeviceExtraGetCurrentMacAddressResponse {}
362
363#[derive(Clone, Debug, PartialEq)]
364pub struct DeviceExtraWatchIdentityResponse {
365    pub identity: Identity,
366}
367
368impl fidl::Persistable for DeviceExtraWatchIdentityResponse {}
369
370#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
371pub struct DeviceGetSupportedNetworkTypesResponse {
372    pub network_types: Vec<String>,
373}
374
375impl fidl::Persistable for DeviceGetSupportedNetworkTypesResponse {}
376
377#[derive(Clone, Debug, PartialEq)]
378pub struct DeviceProvisionNetworkRequest {
379    pub params: ProvisioningParams,
380}
381
382impl fidl::Persistable for DeviceProvisionNetworkRequest {}
383
384#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
385pub struct DeviceSetActiveRequest {
386    pub active: bool,
387}
388
389impl fidl::Persistable for DeviceSetActiveRequest {}
390
391#[derive(Clone, Debug, PartialEq)]
392pub struct DeviceWatchDeviceStateResponse {
393    pub device_combined_state: DeviceState,
394}
395
396impl fidl::Persistable for DeviceWatchDeviceStateResponse {}
397
398#[derive(Clone, Debug, PartialEq)]
399pub struct EnergyScanResultStreamNextResponse {
400    pub results: Vec<EnergyScanResult>,
401}
402
403impl fidl::Persistable for EnergyScanResultStreamNextResponse {}
404
405#[derive(Clone, Debug, PartialEq)]
406pub struct ProvisioningParams {
407    /// The identity of the network.
408    pub identity: Identity,
409    /// The credential used to authenticate to
410    /// the network.
411    pub credential: Option<Box<Credential>>,
412}
413
414impl fidl::Persistable for ProvisioningParams {}
415
416/// Describes all counters.
417///
418/// May be empty if no counters are supported.
419#[derive(Clone, Debug, Default, PartialEq)]
420pub struct AllCounters {
421    /// MAC Counters for TX
422    pub mac_tx: Option<MacCounters>,
423    /// MAC Counters for RX
424    pub mac_rx: Option<MacCounters>,
425    /// Coex Counters for TX
426    pub coex_tx: Option<CoexCounters>,
427    /// Coex Counters for RX
428    pub coex_rx: Option<CoexCounters>,
429    /// Coex stats may be incorrect due to internal counter overflow.
430    ///
431    /// Reset the counters to clear this flag.
432    pub coex_saturated: Option<bool>,
433    /// IP Counters for TX.
434    pub ip_tx: Option<IpCounters>,
435    /// IP Counters for RX.
436    pub ip_rx: Option<IpCounters>,
437    #[doc(hidden)]
438    pub __source_breaking: fidl::marker::SourceBreaking,
439}
440
441impl fidl::Persistable for AllCounters {}
442
443/// Counters associated with RF Coexistance.
444///
445/// Some counters are only valid for RX or TX. See [this][1] for more info.
446///
447/// [1]: https://github.com/openthread/wpantund/blob/4ae4619/third_party/openthread/src/ncp/spinel.h#L1738-L1775
448#[derive(Clone, Debug, Default, PartialEq)]
449pub struct CoexCounters {
450    /// The number of requests
451    pub requests: Option<u64>,
452    /// The number of requests while grant was active
453    pub grant_immediate: Option<u64>,
454    /// The number of requests while grant was inactive
455    pub grant_wait: Option<u64>,
456    /// The number of requests while grant was inactive that were
457    /// ultimately granted
458    pub grant_wait_activated: Option<u64>,
459    /// The number of requests while grant was inactive that timed out
460    pub grant_wait_timeout: Option<u64>,
461    /// The number of requests that were in progress when grant was
462    /// deactivated
463    pub grant_deactivated_during_request: Option<u64>,
464    /// The number of requests that were not granted within 50µs
465    pub delayed_grant: Option<u64>,
466    /// The average time in µsec from request to grant
467    pub avg_delay_request_to_grant_usec: Option<u32>,
468    /// The number of requests that completed without receiving grant.
469    ///
470    /// Receive only.
471    pub grant_none: Option<u64>,
472    #[doc(hidden)]
473    pub __source_breaking: fidl::marker::SourceBreaking,
474}
475
476impl fidl::Persistable for CoexCounters {}
477
478/// Combined State for LoWPAN Devices
479///
480/// Contains the various properties of a LoWPAN device
481/// that define its current operational state.
482///
483/// You will get a snapshot of the current state upon the first
484/// invocation of `WatchDeviceState()`, after which future
485/// invocations of that method will return deltas.
486#[derive(Clone, Debug, Default, PartialEq)]
487pub struct DeviceState {
488    /// LoWPAN Connectivity State
489    ///
490    /// This field describes the current level of connectivity being
491    /// provided by this device.
492    pub connectivity_state: Option<ConnectivityState>,
493    /// LoWPAN Role
494    ///
495    /// This field describes the current role this device is taking
496    /// on the current network.
497    pub role: Option<Role>,
498    #[doc(hidden)]
499    pub __source_breaking: fidl::marker::SourceBreaking,
500}
501
502impl fidl::Persistable for DeviceState {}
503
504/// Describes the parameters of an energy scan.
505#[derive(Clone, Debug, Default, PartialEq)]
506pub struct EnergyScanParameters {
507    /// Subset of channels to scan.
508    ///
509    /// If unspecified, all channels will be scanned.
510    pub channels: Option<Vec<u16>>,
511    /// Desired dwell time per-channel for the energy scan,
512    /// measured in milliseconds.
513    ///
514    /// Note that firmware limitations may prevent the
515    /// exact dwell time from being used. In such cases
516    /// an approximation will be used.
517    ///
518    /// Implementations must be able to support dwell times of at least
519    /// 5000ms (5 seconds). The exact supported dwell-time range is
520    /// device/driver dependent.
521    ///
522    /// Setting a value outside of the supported range of
523    /// values for this device will result in the value being
524    /// clamped to the closest valid value, so setting a value of zero
525    /// will always request the smallest energy scan duration the
526    /// device is capable of.
527    ///
528    /// If unspecified, a dwell time of approximately 500ms will be used.
529    pub dwell_time_ms: Option<u32>,
530    #[doc(hidden)]
531    pub __source_breaking: fidl::marker::SourceBreaking,
532}
533
534impl fidl::Persistable for EnergyScanParameters {}
535
536/// Describes the result from one channel of an energy scan.
537#[derive(Clone, Debug, Default, PartialEq)]
538pub struct EnergyScanResult {
539    /// The channel index for this energy scan result.
540    pub channel_index: Option<u16>,
541    /// The maximum RSSI detected on this channel.
542    pub max_rssi: Option<i32>,
543    /// The minimum RSSI detected on this channel.
544    pub min_rssi: Option<i32>,
545    #[doc(hidden)]
546    pub __source_breaking: fidl::marker::SourceBreaking,
547}
548
549impl fidl::Persistable for EnergyScanResult {}
550
551#[derive(Clone, Debug, Default, PartialEq)]
552pub struct Identity {
553    /// The raw bytes for the network name.
554    /// This is typically a [StringPrep'd][1] UTF8 encoding.
555    ///
556    /// Note that extra care must be taken when displaying
557    /// this value to users, since there are many ways
558    /// to make visually similar UTF8 strings that
559    /// have differing bytecode representations.
560    ///
561    /// [1]: https://tools.ietf.org/html/rfc3454
562    pub raw_name: Option<Vec<u8>>,
563    /// String identifying the type of network.
564    ///
565    /// Well-known protocol ids are associated with
566    /// specific string values (like "org.threadgroup.std.thread"
567    /// or "org.zigbee.std.zigbee-ip"). For unknown protocol ids,
568    /// the string will map to something like
569    /// `fuchsia.lowpan.net_type.802.15.4.pid.XX`, where `XX` is
570    /// the value of the protocol id from a 802.14.5 beacon.
571    /// This field is optional when joining, forming, or provisioning.
572    pub net_type: Option<String>,
573    /// Channel Index.
574    pub channel: Option<u16>,
575    /// PANID for 802.14.5-based networks (or the equivalent).
576    pub panid: Option<u16>,
577    /// IPv6 Mesh-local prefix.
578    ///
579    /// This parameter allows you to determine the mesh-local
580    /// IPv6 prefix for the current network, or to specify one
581    /// when provisioning the interface for a network or forming
582    /// a new network.
583    ///
584    /// The prefix length is always 64 bits, so only the upper
585    /// 64 bits of the value are used: the least significant bits
586    /// must be ignored when read and zero when set.
587    ///
588    /// This field is ignored when supplied to `JoinNetwork()`.
589    pub mesh_local_prefix: Option<fidl_fuchsia_net::Ipv6AddressWithPrefix>,
590    /// Extended PANID.
591    pub xpanid: Option<[u8; 8]>,
592    #[doc(hidden)]
593    pub __source_breaking: fidl::marker::SourceBreaking,
594}
595
596impl fidl::Persistable for Identity {}
597
598/// Counters associated with the IP layer.
599#[derive(Clone, Debug, Default, PartialEq)]
600pub struct IpCounters {
601    /// The number of IPv6 packets successfully transmitted/received.
602    pub success: Option<u32>,
603    /// The number of IPv6 packets failed to transmit/receive.
604    pub failure: Option<u32>,
605    #[doc(hidden)]
606    pub __source_breaking: fidl::marker::SourceBreaking,
607}
608
609impl fidl::Persistable for IpCounters {}
610
611/// Counters associated with the MAC layer.
612///
613/// Some counters are only valid for RX or TX.
614#[derive(Clone, Debug, Default, PartialEq)]
615pub struct MacCounters {
616    /// The total number of frames
617    pub total: Option<u32>,
618    /// The total number of unicast frames
619    pub unicast: Option<u32>,
620    /// The total number of broadcast frames
621    pub broadcast: Option<u32>,
622    /// The number of frames with ack request
623    pub ack_requested: Option<u32>,
624    /// The number of frames that were acked
625    pub acked: Option<u32>,
626    /// The number of frames without ack request
627    pub no_ack_requested: Option<u32>,
628    /// The number of data frames
629    pub data: Option<u32>,
630    /// The number of data poll frames
631    pub data_poll: Option<u32>,
632    /// The number of beacon frames
633    pub beacon: Option<u32>,
634    /// The number of beacon request frames
635    pub beacon_request: Option<u32>,
636    /// The number of other types of frames
637    pub other: Option<u32>,
638    /// The number of frames filtered by address filter (allowlist
639    /// or denylist).
640    pub address_filtered: Option<u32>,
641    /// The number of retransmission attempts.
642    /// TX only.
643    pub retries: Option<u32>,
644    /// The number of expired retransmission retries for direct message.
645    /// TX only.
646    pub direct_max_retry_expiry: Option<u32>,
647    /// The number of expired retransmission retries for indirect message
648    /// TX only.
649    pub indirect_max_retry_expiry: Option<u32>,
650    /// The number of received frames filtered by destination check.
651    /// RX only.
652    pub dest_addr_filtered: Option<u32>,
653    /// The number of received duplicated frames.
654    /// RX only.
655    pub duplicated: Option<u32>,
656    /// The number of received frames with no or malformed content.
657    /// RX only.
658    pub err_no_frame: Option<u32>,
659    /// The number of received frames from unknown neighbor.
660    /// RX only.
661    pub err_unknown_neighbor: Option<u32>,
662    /// The number of received frames whose source address is invalid.
663    /// RX only.
664    pub err_invalid_src_addr: Option<u32>,
665    /// The number of received frames with security error.
666    /// RX only.
667    pub err_sec: Option<u32>,
668    /// The number of received frames with FCS error.
669    /// RX only.
670    pub err_fcs: Option<u32>,
671    /// The number of CCA failures.
672    /// TX only.
673    pub err_cca: Option<u32>,
674    /// The number of frame transmission failures due to abort error.
675    /// TX only.
676    pub err_abort: Option<u32>,
677    /// The number of frames that were dropped due to a busy channel.
678    /// TX only.
679    pub err_busy_channel: Option<u32>,
680    /// The number of frames that encountered some other error.
681    pub err_other: Option<u32>,
682    #[doc(hidden)]
683    pub __source_breaking: fidl::marker::SourceBreaking,
684}
685
686impl fidl::Persistable for MacCounters {}
687
688/// Describes a LoWPAN credential.
689///
690/// Currently only supports a symmetric network key,
691/// but may be extended in the future to support other
692/// types of credentials, such as passwords, PAKE
693/// secrets, or a reference to a certificate/private-key
694/// pair.
695#[derive(Clone, Debug)]
696pub enum Credential {
697    /// Describes a symmetric key credential.
698    ///
699    /// The size of the symmetric key is defined by the
700    /// underlying network technology. For Thread this
701    /// is a 16-byte value.
702    ///
703    /// Note that this value is not a password.
704    NetworkKey(Vec<u8>),
705    #[doc(hidden)]
706    __SourceBreaking { unknown_ordinal: u64 },
707}
708
709/// Pattern that matches an unknown `Credential` member.
710#[macro_export]
711macro_rules! CredentialUnknown {
712    () => {
713        _
714    };
715}
716
717// Custom PartialEq so that unknown variants are not equal to themselves.
718impl PartialEq for Credential {
719    fn eq(&self, other: &Self) -> bool {
720        match (self, other) {
721            (Self::NetworkKey(x), Self::NetworkKey(y)) => *x == *y,
722            _ => false,
723        }
724    }
725}
726
727impl Credential {
728    #[inline]
729    pub fn ordinal(&self) -> u64 {
730        match *self {
731            Self::NetworkKey(_) => 1,
732            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
733        }
734    }
735
736    #[inline]
737    pub fn unknown_variant_for_testing() -> Self {
738        Self::__SourceBreaking { unknown_ordinal: 0 }
739    }
740
741    #[inline]
742    pub fn is_unknown(&self) -> bool {
743        match self {
744            Self::__SourceBreaking { .. } => true,
745            _ => false,
746        }
747    }
748}
749
750impl fidl::Persistable for Credential {}
751
752mod internal {
753    use super::*;
754    unsafe impl fidl::encoding::TypeMarker for ConnectivityState {
755        type Owned = Self;
756
757        #[inline(always)]
758        fn inline_align(_context: fidl::encoding::Context) -> usize {
759            std::mem::align_of::<i32>()
760        }
761
762        #[inline(always)]
763        fn inline_size(_context: fidl::encoding::Context) -> usize {
764            std::mem::size_of::<i32>()
765        }
766
767        #[inline(always)]
768        fn encode_is_copy() -> bool {
769            false
770        }
771
772        #[inline(always)]
773        fn decode_is_copy() -> bool {
774            false
775        }
776    }
777
778    impl fidl::encoding::ValueTypeMarker for ConnectivityState {
779        type Borrowed<'a> = Self;
780        #[inline(always)]
781        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
782            *value
783        }
784    }
785
786    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
787        for ConnectivityState
788    {
789        #[inline]
790        unsafe fn encode(
791            self,
792            encoder: &mut fidl::encoding::Encoder<'_, D>,
793            offset: usize,
794            _depth: fidl::encoding::Depth,
795        ) -> fidl::Result<()> {
796            encoder.debug_check_bounds::<Self>(offset);
797            encoder.write_num(self.into_primitive(), offset);
798            Ok(())
799        }
800    }
801
802    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ConnectivityState {
803        #[inline(always)]
804        fn new_empty() -> Self {
805            Self::unknown()
806        }
807
808        #[inline]
809        unsafe fn decode(
810            &mut self,
811            decoder: &mut fidl::encoding::Decoder<'_, D>,
812            offset: usize,
813            _depth: fidl::encoding::Depth,
814        ) -> fidl::Result<()> {
815            decoder.debug_check_bounds::<Self>(offset);
816            let prim = decoder.read_num::<i32>(offset);
817
818            *self = Self::from_primitive_allow_unknown(prim);
819            Ok(())
820        }
821    }
822    unsafe impl fidl::encoding::TypeMarker for Role {
823        type Owned = Self;
824
825        #[inline(always)]
826        fn inline_align(_context: fidl::encoding::Context) -> usize {
827            std::mem::align_of::<i32>()
828        }
829
830        #[inline(always)]
831        fn inline_size(_context: fidl::encoding::Context) -> usize {
832            std::mem::size_of::<i32>()
833        }
834
835        #[inline(always)]
836        fn encode_is_copy() -> bool {
837            false
838        }
839
840        #[inline(always)]
841        fn decode_is_copy() -> bool {
842            false
843        }
844    }
845
846    impl fidl::encoding::ValueTypeMarker for Role {
847        type Borrowed<'a> = Self;
848        #[inline(always)]
849        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
850            *value
851        }
852    }
853
854    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for Role {
855        #[inline]
856        unsafe fn encode(
857            self,
858            encoder: &mut fidl::encoding::Encoder<'_, D>,
859            offset: usize,
860            _depth: fidl::encoding::Depth,
861        ) -> fidl::Result<()> {
862            encoder.debug_check_bounds::<Self>(offset);
863            encoder.write_num(self.into_primitive(), offset);
864            Ok(())
865        }
866    }
867
868    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Role {
869        #[inline(always)]
870        fn new_empty() -> Self {
871            Self::unknown()
872        }
873
874        #[inline]
875        unsafe fn decode(
876            &mut self,
877            decoder: &mut fidl::encoding::Decoder<'_, D>,
878            offset: usize,
879            _depth: fidl::encoding::Depth,
880        ) -> fidl::Result<()> {
881            decoder.debug_check_bounds::<Self>(offset);
882            let prim = decoder.read_num::<i32>(offset);
883
884            *self = Self::from_primitive_allow_unknown(prim);
885            Ok(())
886        }
887    }
888
889    impl fidl::encoding::ValueTypeMarker for CountersGetResponse {
890        type Borrowed<'a> = &'a Self;
891        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
892            value
893        }
894    }
895
896    unsafe impl fidl::encoding::TypeMarker for CountersGetResponse {
897        type Owned = Self;
898
899        #[inline(always)]
900        fn inline_align(_context: fidl::encoding::Context) -> usize {
901            8
902        }
903
904        #[inline(always)]
905        fn inline_size(_context: fidl::encoding::Context) -> usize {
906            16
907        }
908    }
909
910    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<CountersGetResponse, D>
911        for &CountersGetResponse
912    {
913        #[inline]
914        unsafe fn encode(
915            self,
916            encoder: &mut fidl::encoding::Encoder<'_, D>,
917            offset: usize,
918            _depth: fidl::encoding::Depth,
919        ) -> fidl::Result<()> {
920            encoder.debug_check_bounds::<CountersGetResponse>(offset);
921            // Delegate to tuple encoding.
922            fidl::encoding::Encode::<CountersGetResponse, D>::encode(
923                (<AllCounters as fidl::encoding::ValueTypeMarker>::borrow(&self.counters),),
924                encoder,
925                offset,
926                _depth,
927            )
928        }
929    }
930    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<AllCounters, D>>
931        fidl::encoding::Encode<CountersGetResponse, D> for (T0,)
932    {
933        #[inline]
934        unsafe fn encode(
935            self,
936            encoder: &mut fidl::encoding::Encoder<'_, D>,
937            offset: usize,
938            depth: fidl::encoding::Depth,
939        ) -> fidl::Result<()> {
940            encoder.debug_check_bounds::<CountersGetResponse>(offset);
941            // Zero out padding regions. There's no need to apply masks
942            // because the unmasked parts will be overwritten by fields.
943            // Write the fields.
944            self.0.encode(encoder, offset + 0, depth)?;
945            Ok(())
946        }
947    }
948
949    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for CountersGetResponse {
950        #[inline(always)]
951        fn new_empty() -> Self {
952            Self { counters: fidl::new_empty!(AllCounters, D) }
953        }
954
955        #[inline]
956        unsafe fn decode(
957            &mut self,
958            decoder: &mut fidl::encoding::Decoder<'_, D>,
959            offset: usize,
960            _depth: fidl::encoding::Depth,
961        ) -> fidl::Result<()> {
962            decoder.debug_check_bounds::<Self>(offset);
963            // Verify that padding bytes are zero.
964            fidl::decode!(AllCounters, D, &mut self.counters, decoder, offset + 0, _depth)?;
965            Ok(())
966        }
967    }
968
969    impl fidl::encoding::ValueTypeMarker for CountersResetResponse {
970        type Borrowed<'a> = &'a Self;
971        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
972            value
973        }
974    }
975
976    unsafe impl fidl::encoding::TypeMarker for CountersResetResponse {
977        type Owned = Self;
978
979        #[inline(always)]
980        fn inline_align(_context: fidl::encoding::Context) -> usize {
981            8
982        }
983
984        #[inline(always)]
985        fn inline_size(_context: fidl::encoding::Context) -> usize {
986            16
987        }
988    }
989
990    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<CountersResetResponse, D>
991        for &CountersResetResponse
992    {
993        #[inline]
994        unsafe fn encode(
995            self,
996            encoder: &mut fidl::encoding::Encoder<'_, D>,
997            offset: usize,
998            _depth: fidl::encoding::Depth,
999        ) -> fidl::Result<()> {
1000            encoder.debug_check_bounds::<CountersResetResponse>(offset);
1001            // Delegate to tuple encoding.
1002            fidl::encoding::Encode::<CountersResetResponse, D>::encode(
1003                (<AllCounters as fidl::encoding::ValueTypeMarker>::borrow(&self.counters),),
1004                encoder,
1005                offset,
1006                _depth,
1007            )
1008        }
1009    }
1010    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<AllCounters, D>>
1011        fidl::encoding::Encode<CountersResetResponse, D> for (T0,)
1012    {
1013        #[inline]
1014        unsafe fn encode(
1015            self,
1016            encoder: &mut fidl::encoding::Encoder<'_, D>,
1017            offset: usize,
1018            depth: fidl::encoding::Depth,
1019        ) -> fidl::Result<()> {
1020            encoder.debug_check_bounds::<CountersResetResponse>(offset);
1021            // Zero out padding regions. There's no need to apply masks
1022            // because the unmasked parts will be overwritten by fields.
1023            // Write the fields.
1024            self.0.encode(encoder, offset + 0, depth)?;
1025            Ok(())
1026        }
1027    }
1028
1029    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for CountersResetResponse {
1030        #[inline(always)]
1031        fn new_empty() -> Self {
1032            Self { counters: fidl::new_empty!(AllCounters, D) }
1033        }
1034
1035        #[inline]
1036        unsafe fn decode(
1037            &mut self,
1038            decoder: &mut fidl::encoding::Decoder<'_, D>,
1039            offset: usize,
1040            _depth: fidl::encoding::Depth,
1041        ) -> fidl::Result<()> {
1042            decoder.debug_check_bounds::<Self>(offset);
1043            // Verify that padding bytes are zero.
1044            fidl::decode!(AllCounters, D, &mut self.counters, decoder, offset + 0, _depth)?;
1045            Ok(())
1046        }
1047    }
1048
1049    impl fidl::encoding::ValueTypeMarker for DeviceExtraGetCredentialResponse {
1050        type Borrowed<'a> = &'a Self;
1051        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1052            value
1053        }
1054    }
1055
1056    unsafe impl fidl::encoding::TypeMarker for DeviceExtraGetCredentialResponse {
1057        type Owned = Self;
1058
1059        #[inline(always)]
1060        fn inline_align(_context: fidl::encoding::Context) -> usize {
1061            8
1062        }
1063
1064        #[inline(always)]
1065        fn inline_size(_context: fidl::encoding::Context) -> usize {
1066            16
1067        }
1068    }
1069
1070    unsafe impl<D: fidl::encoding::ResourceDialect>
1071        fidl::encoding::Encode<DeviceExtraGetCredentialResponse, D>
1072        for &DeviceExtraGetCredentialResponse
1073    {
1074        #[inline]
1075        unsafe fn encode(
1076            self,
1077            encoder: &mut fidl::encoding::Encoder<'_, D>,
1078            offset: usize,
1079            _depth: fidl::encoding::Depth,
1080        ) -> fidl::Result<()> {
1081            encoder.debug_check_bounds::<DeviceExtraGetCredentialResponse>(offset);
1082            // Delegate to tuple encoding.
1083            fidl::encoding::Encode::<DeviceExtraGetCredentialResponse, D>::encode(
1084                (
1085                    <fidl::encoding::OptionalUnion<Credential> as fidl::encoding::ValueTypeMarker>::borrow(&self.credential),
1086                ),
1087                encoder, offset, _depth
1088            )
1089        }
1090    }
1091    unsafe impl<
1092            D: fidl::encoding::ResourceDialect,
1093            T0: fidl::encoding::Encode<fidl::encoding::OptionalUnion<Credential>, D>,
1094        > fidl::encoding::Encode<DeviceExtraGetCredentialResponse, D> for (T0,)
1095    {
1096        #[inline]
1097        unsafe fn encode(
1098            self,
1099            encoder: &mut fidl::encoding::Encoder<'_, D>,
1100            offset: usize,
1101            depth: fidl::encoding::Depth,
1102        ) -> fidl::Result<()> {
1103            encoder.debug_check_bounds::<DeviceExtraGetCredentialResponse>(offset);
1104            // Zero out padding regions. There's no need to apply masks
1105            // because the unmasked parts will be overwritten by fields.
1106            // Write the fields.
1107            self.0.encode(encoder, offset + 0, depth)?;
1108            Ok(())
1109        }
1110    }
1111
1112    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1113        for DeviceExtraGetCredentialResponse
1114    {
1115        #[inline(always)]
1116        fn new_empty() -> Self {
1117            Self { credential: fidl::new_empty!(fidl::encoding::OptionalUnion<Credential>, D) }
1118        }
1119
1120        #[inline]
1121        unsafe fn decode(
1122            &mut self,
1123            decoder: &mut fidl::encoding::Decoder<'_, D>,
1124            offset: usize,
1125            _depth: fidl::encoding::Depth,
1126        ) -> fidl::Result<()> {
1127            decoder.debug_check_bounds::<Self>(offset);
1128            // Verify that padding bytes are zero.
1129            fidl::decode!(
1130                fidl::encoding::OptionalUnion<Credential>,
1131                D,
1132                &mut self.credential,
1133                decoder,
1134                offset + 0,
1135                _depth
1136            )?;
1137            Ok(())
1138        }
1139    }
1140
1141    impl fidl::encoding::ValueTypeMarker for DeviceExtraGetCurrentMacAddressResponse {
1142        type Borrowed<'a> = &'a Self;
1143        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1144            value
1145        }
1146    }
1147
1148    unsafe impl fidl::encoding::TypeMarker for DeviceExtraGetCurrentMacAddressResponse {
1149        type Owned = Self;
1150
1151        #[inline(always)]
1152        fn inline_align(_context: fidl::encoding::Context) -> usize {
1153            1
1154        }
1155
1156        #[inline(always)]
1157        fn inline_size(_context: fidl::encoding::Context) -> usize {
1158            8
1159        }
1160    }
1161
1162    unsafe impl<D: fidl::encoding::ResourceDialect>
1163        fidl::encoding::Encode<DeviceExtraGetCurrentMacAddressResponse, D>
1164        for &DeviceExtraGetCurrentMacAddressResponse
1165    {
1166        #[inline]
1167        unsafe fn encode(
1168            self,
1169            encoder: &mut fidl::encoding::Encoder<'_, D>,
1170            offset: usize,
1171            _depth: fidl::encoding::Depth,
1172        ) -> fidl::Result<()> {
1173            encoder.debug_check_bounds::<DeviceExtraGetCurrentMacAddressResponse>(offset);
1174            // Delegate to tuple encoding.
1175            fidl::encoding::Encode::<DeviceExtraGetCurrentMacAddressResponse, D>::encode(
1176                (<fidl_fuchsia_lowpan::MacAddress as fidl::encoding::ValueTypeMarker>::borrow(
1177                    &self.address,
1178                ),),
1179                encoder,
1180                offset,
1181                _depth,
1182            )
1183        }
1184    }
1185    unsafe impl<
1186            D: fidl::encoding::ResourceDialect,
1187            T0: fidl::encoding::Encode<fidl_fuchsia_lowpan::MacAddress, D>,
1188        > fidl::encoding::Encode<DeviceExtraGetCurrentMacAddressResponse, D> for (T0,)
1189    {
1190        #[inline]
1191        unsafe fn encode(
1192            self,
1193            encoder: &mut fidl::encoding::Encoder<'_, D>,
1194            offset: usize,
1195            depth: fidl::encoding::Depth,
1196        ) -> fidl::Result<()> {
1197            encoder.debug_check_bounds::<DeviceExtraGetCurrentMacAddressResponse>(offset);
1198            // Zero out padding regions. There's no need to apply masks
1199            // because the unmasked parts will be overwritten by fields.
1200            // Write the fields.
1201            self.0.encode(encoder, offset + 0, depth)?;
1202            Ok(())
1203        }
1204    }
1205
1206    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1207        for DeviceExtraGetCurrentMacAddressResponse
1208    {
1209        #[inline(always)]
1210        fn new_empty() -> Self {
1211            Self { address: fidl::new_empty!(fidl_fuchsia_lowpan::MacAddress, D) }
1212        }
1213
1214        #[inline]
1215        unsafe fn decode(
1216            &mut self,
1217            decoder: &mut fidl::encoding::Decoder<'_, D>,
1218            offset: usize,
1219            _depth: fidl::encoding::Depth,
1220        ) -> fidl::Result<()> {
1221            decoder.debug_check_bounds::<Self>(offset);
1222            // Verify that padding bytes are zero.
1223            fidl::decode!(
1224                fidl_fuchsia_lowpan::MacAddress,
1225                D,
1226                &mut self.address,
1227                decoder,
1228                offset + 0,
1229                _depth
1230            )?;
1231            Ok(())
1232        }
1233    }
1234
1235    impl fidl::encoding::ValueTypeMarker for DeviceExtraWatchIdentityResponse {
1236        type Borrowed<'a> = &'a Self;
1237        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1238            value
1239        }
1240    }
1241
1242    unsafe impl fidl::encoding::TypeMarker for DeviceExtraWatchIdentityResponse {
1243        type Owned = Self;
1244
1245        #[inline(always)]
1246        fn inline_align(_context: fidl::encoding::Context) -> usize {
1247            8
1248        }
1249
1250        #[inline(always)]
1251        fn inline_size(_context: fidl::encoding::Context) -> usize {
1252            16
1253        }
1254    }
1255
1256    unsafe impl<D: fidl::encoding::ResourceDialect>
1257        fidl::encoding::Encode<DeviceExtraWatchIdentityResponse, D>
1258        for &DeviceExtraWatchIdentityResponse
1259    {
1260        #[inline]
1261        unsafe fn encode(
1262            self,
1263            encoder: &mut fidl::encoding::Encoder<'_, D>,
1264            offset: usize,
1265            _depth: fidl::encoding::Depth,
1266        ) -> fidl::Result<()> {
1267            encoder.debug_check_bounds::<DeviceExtraWatchIdentityResponse>(offset);
1268            // Delegate to tuple encoding.
1269            fidl::encoding::Encode::<DeviceExtraWatchIdentityResponse, D>::encode(
1270                (<Identity as fidl::encoding::ValueTypeMarker>::borrow(&self.identity),),
1271                encoder,
1272                offset,
1273                _depth,
1274            )
1275        }
1276    }
1277    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<Identity, D>>
1278        fidl::encoding::Encode<DeviceExtraWatchIdentityResponse, D> for (T0,)
1279    {
1280        #[inline]
1281        unsafe fn encode(
1282            self,
1283            encoder: &mut fidl::encoding::Encoder<'_, D>,
1284            offset: usize,
1285            depth: fidl::encoding::Depth,
1286        ) -> fidl::Result<()> {
1287            encoder.debug_check_bounds::<DeviceExtraWatchIdentityResponse>(offset);
1288            // Zero out padding regions. There's no need to apply masks
1289            // because the unmasked parts will be overwritten by fields.
1290            // Write the fields.
1291            self.0.encode(encoder, offset + 0, depth)?;
1292            Ok(())
1293        }
1294    }
1295
1296    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1297        for DeviceExtraWatchIdentityResponse
1298    {
1299        #[inline(always)]
1300        fn new_empty() -> Self {
1301            Self { identity: fidl::new_empty!(Identity, D) }
1302        }
1303
1304        #[inline]
1305        unsafe fn decode(
1306            &mut self,
1307            decoder: &mut fidl::encoding::Decoder<'_, D>,
1308            offset: usize,
1309            _depth: fidl::encoding::Depth,
1310        ) -> fidl::Result<()> {
1311            decoder.debug_check_bounds::<Self>(offset);
1312            // Verify that padding bytes are zero.
1313            fidl::decode!(Identity, D, &mut self.identity, decoder, offset + 0, _depth)?;
1314            Ok(())
1315        }
1316    }
1317
1318    impl fidl::encoding::ValueTypeMarker for DeviceGetSupportedNetworkTypesResponse {
1319        type Borrowed<'a> = &'a Self;
1320        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1321            value
1322        }
1323    }
1324
1325    unsafe impl fidl::encoding::TypeMarker for DeviceGetSupportedNetworkTypesResponse {
1326        type Owned = Self;
1327
1328        #[inline(always)]
1329        fn inline_align(_context: fidl::encoding::Context) -> usize {
1330            8
1331        }
1332
1333        #[inline(always)]
1334        fn inline_size(_context: fidl::encoding::Context) -> usize {
1335            16
1336        }
1337    }
1338
1339    unsafe impl<D: fidl::encoding::ResourceDialect>
1340        fidl::encoding::Encode<DeviceGetSupportedNetworkTypesResponse, D>
1341        for &DeviceGetSupportedNetworkTypesResponse
1342    {
1343        #[inline]
1344        unsafe fn encode(
1345            self,
1346            encoder: &mut fidl::encoding::Encoder<'_, D>,
1347            offset: usize,
1348            _depth: fidl::encoding::Depth,
1349        ) -> fidl::Result<()> {
1350            encoder.debug_check_bounds::<DeviceGetSupportedNetworkTypesResponse>(offset);
1351            // Delegate to tuple encoding.
1352            fidl::encoding::Encode::<DeviceGetSupportedNetworkTypesResponse, D>::encode(
1353                (
1354                    <fidl::encoding::Vector<fidl::encoding::BoundedString<64>, 16> as fidl::encoding::ValueTypeMarker>::borrow(&self.network_types),
1355                ),
1356                encoder, offset, _depth
1357            )
1358        }
1359    }
1360    unsafe impl<
1361            D: fidl::encoding::ResourceDialect,
1362            T0: fidl::encoding::Encode<
1363                fidl::encoding::Vector<fidl::encoding::BoundedString<64>, 16>,
1364                D,
1365            >,
1366        > fidl::encoding::Encode<DeviceGetSupportedNetworkTypesResponse, D> for (T0,)
1367    {
1368        #[inline]
1369        unsafe fn encode(
1370            self,
1371            encoder: &mut fidl::encoding::Encoder<'_, D>,
1372            offset: usize,
1373            depth: fidl::encoding::Depth,
1374        ) -> fidl::Result<()> {
1375            encoder.debug_check_bounds::<DeviceGetSupportedNetworkTypesResponse>(offset);
1376            // Zero out padding regions. There's no need to apply masks
1377            // because the unmasked parts will be overwritten by fields.
1378            // Write the fields.
1379            self.0.encode(encoder, offset + 0, depth)?;
1380            Ok(())
1381        }
1382    }
1383
1384    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1385        for DeviceGetSupportedNetworkTypesResponse
1386    {
1387        #[inline(always)]
1388        fn new_empty() -> Self {
1389            Self {
1390                network_types: fidl::new_empty!(
1391                    fidl::encoding::Vector<fidl::encoding::BoundedString<64>, 16>,
1392                    D
1393                ),
1394            }
1395        }
1396
1397        #[inline]
1398        unsafe fn decode(
1399            &mut self,
1400            decoder: &mut fidl::encoding::Decoder<'_, D>,
1401            offset: usize,
1402            _depth: fidl::encoding::Depth,
1403        ) -> fidl::Result<()> {
1404            decoder.debug_check_bounds::<Self>(offset);
1405            // Verify that padding bytes are zero.
1406            fidl::decode!(
1407                fidl::encoding::Vector<fidl::encoding::BoundedString<64>, 16>,
1408                D,
1409                &mut self.network_types,
1410                decoder,
1411                offset + 0,
1412                _depth
1413            )?;
1414            Ok(())
1415        }
1416    }
1417
1418    impl fidl::encoding::ValueTypeMarker for DeviceProvisionNetworkRequest {
1419        type Borrowed<'a> = &'a Self;
1420        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1421            value
1422        }
1423    }
1424
1425    unsafe impl fidl::encoding::TypeMarker for DeviceProvisionNetworkRequest {
1426        type Owned = Self;
1427
1428        #[inline(always)]
1429        fn inline_align(_context: fidl::encoding::Context) -> usize {
1430            8
1431        }
1432
1433        #[inline(always)]
1434        fn inline_size(_context: fidl::encoding::Context) -> usize {
1435            32
1436        }
1437    }
1438
1439    unsafe impl<D: fidl::encoding::ResourceDialect>
1440        fidl::encoding::Encode<DeviceProvisionNetworkRequest, D>
1441        for &DeviceProvisionNetworkRequest
1442    {
1443        #[inline]
1444        unsafe fn encode(
1445            self,
1446            encoder: &mut fidl::encoding::Encoder<'_, D>,
1447            offset: usize,
1448            _depth: fidl::encoding::Depth,
1449        ) -> fidl::Result<()> {
1450            encoder.debug_check_bounds::<DeviceProvisionNetworkRequest>(offset);
1451            // Delegate to tuple encoding.
1452            fidl::encoding::Encode::<DeviceProvisionNetworkRequest, D>::encode(
1453                (<ProvisioningParams as fidl::encoding::ValueTypeMarker>::borrow(&self.params),),
1454                encoder,
1455                offset,
1456                _depth,
1457            )
1458        }
1459    }
1460    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<ProvisioningParams, D>>
1461        fidl::encoding::Encode<DeviceProvisionNetworkRequest, D> for (T0,)
1462    {
1463        #[inline]
1464        unsafe fn encode(
1465            self,
1466            encoder: &mut fidl::encoding::Encoder<'_, D>,
1467            offset: usize,
1468            depth: fidl::encoding::Depth,
1469        ) -> fidl::Result<()> {
1470            encoder.debug_check_bounds::<DeviceProvisionNetworkRequest>(offset);
1471            // Zero out padding regions. There's no need to apply masks
1472            // because the unmasked parts will be overwritten by fields.
1473            // Write the fields.
1474            self.0.encode(encoder, offset + 0, depth)?;
1475            Ok(())
1476        }
1477    }
1478
1479    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1480        for DeviceProvisionNetworkRequest
1481    {
1482        #[inline(always)]
1483        fn new_empty() -> Self {
1484            Self { params: fidl::new_empty!(ProvisioningParams, D) }
1485        }
1486
1487        #[inline]
1488        unsafe fn decode(
1489            &mut self,
1490            decoder: &mut fidl::encoding::Decoder<'_, D>,
1491            offset: usize,
1492            _depth: fidl::encoding::Depth,
1493        ) -> fidl::Result<()> {
1494            decoder.debug_check_bounds::<Self>(offset);
1495            // Verify that padding bytes are zero.
1496            fidl::decode!(ProvisioningParams, D, &mut self.params, decoder, offset + 0, _depth)?;
1497            Ok(())
1498        }
1499    }
1500
1501    impl fidl::encoding::ValueTypeMarker for DeviceSetActiveRequest {
1502        type Borrowed<'a> = &'a Self;
1503        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1504            value
1505        }
1506    }
1507
1508    unsafe impl fidl::encoding::TypeMarker for DeviceSetActiveRequest {
1509        type Owned = Self;
1510
1511        #[inline(always)]
1512        fn inline_align(_context: fidl::encoding::Context) -> usize {
1513            1
1514        }
1515
1516        #[inline(always)]
1517        fn inline_size(_context: fidl::encoding::Context) -> usize {
1518            1
1519        }
1520    }
1521
1522    unsafe impl<D: fidl::encoding::ResourceDialect>
1523        fidl::encoding::Encode<DeviceSetActiveRequest, D> for &DeviceSetActiveRequest
1524    {
1525        #[inline]
1526        unsafe fn encode(
1527            self,
1528            encoder: &mut fidl::encoding::Encoder<'_, D>,
1529            offset: usize,
1530            _depth: fidl::encoding::Depth,
1531        ) -> fidl::Result<()> {
1532            encoder.debug_check_bounds::<DeviceSetActiveRequest>(offset);
1533            // Delegate to tuple encoding.
1534            fidl::encoding::Encode::<DeviceSetActiveRequest, D>::encode(
1535                (<bool as fidl::encoding::ValueTypeMarker>::borrow(&self.active),),
1536                encoder,
1537                offset,
1538                _depth,
1539            )
1540        }
1541    }
1542    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<bool, D>>
1543        fidl::encoding::Encode<DeviceSetActiveRequest, D> for (T0,)
1544    {
1545        #[inline]
1546        unsafe fn encode(
1547            self,
1548            encoder: &mut fidl::encoding::Encoder<'_, D>,
1549            offset: usize,
1550            depth: fidl::encoding::Depth,
1551        ) -> fidl::Result<()> {
1552            encoder.debug_check_bounds::<DeviceSetActiveRequest>(offset);
1553            // Zero out padding regions. There's no need to apply masks
1554            // because the unmasked parts will be overwritten by fields.
1555            // Write the fields.
1556            self.0.encode(encoder, offset + 0, depth)?;
1557            Ok(())
1558        }
1559    }
1560
1561    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1562        for DeviceSetActiveRequest
1563    {
1564        #[inline(always)]
1565        fn new_empty() -> Self {
1566            Self { active: fidl::new_empty!(bool, D) }
1567        }
1568
1569        #[inline]
1570        unsafe fn decode(
1571            &mut self,
1572            decoder: &mut fidl::encoding::Decoder<'_, D>,
1573            offset: usize,
1574            _depth: fidl::encoding::Depth,
1575        ) -> fidl::Result<()> {
1576            decoder.debug_check_bounds::<Self>(offset);
1577            // Verify that padding bytes are zero.
1578            fidl::decode!(bool, D, &mut self.active, decoder, offset + 0, _depth)?;
1579            Ok(())
1580        }
1581    }
1582
1583    impl fidl::encoding::ValueTypeMarker for DeviceWatchDeviceStateResponse {
1584        type Borrowed<'a> = &'a Self;
1585        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1586            value
1587        }
1588    }
1589
1590    unsafe impl fidl::encoding::TypeMarker for DeviceWatchDeviceStateResponse {
1591        type Owned = Self;
1592
1593        #[inline(always)]
1594        fn inline_align(_context: fidl::encoding::Context) -> usize {
1595            8
1596        }
1597
1598        #[inline(always)]
1599        fn inline_size(_context: fidl::encoding::Context) -> usize {
1600            16
1601        }
1602    }
1603
1604    unsafe impl<D: fidl::encoding::ResourceDialect>
1605        fidl::encoding::Encode<DeviceWatchDeviceStateResponse, D>
1606        for &DeviceWatchDeviceStateResponse
1607    {
1608        #[inline]
1609        unsafe fn encode(
1610            self,
1611            encoder: &mut fidl::encoding::Encoder<'_, D>,
1612            offset: usize,
1613            _depth: fidl::encoding::Depth,
1614        ) -> fidl::Result<()> {
1615            encoder.debug_check_bounds::<DeviceWatchDeviceStateResponse>(offset);
1616            // Delegate to tuple encoding.
1617            fidl::encoding::Encode::<DeviceWatchDeviceStateResponse, D>::encode(
1618                (<DeviceState as fidl::encoding::ValueTypeMarker>::borrow(
1619                    &self.device_combined_state,
1620                ),),
1621                encoder,
1622                offset,
1623                _depth,
1624            )
1625        }
1626    }
1627    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<DeviceState, D>>
1628        fidl::encoding::Encode<DeviceWatchDeviceStateResponse, D> for (T0,)
1629    {
1630        #[inline]
1631        unsafe fn encode(
1632            self,
1633            encoder: &mut fidl::encoding::Encoder<'_, D>,
1634            offset: usize,
1635            depth: fidl::encoding::Depth,
1636        ) -> fidl::Result<()> {
1637            encoder.debug_check_bounds::<DeviceWatchDeviceStateResponse>(offset);
1638            // Zero out padding regions. There's no need to apply masks
1639            // because the unmasked parts will be overwritten by fields.
1640            // Write the fields.
1641            self.0.encode(encoder, offset + 0, depth)?;
1642            Ok(())
1643        }
1644    }
1645
1646    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1647        for DeviceWatchDeviceStateResponse
1648    {
1649        #[inline(always)]
1650        fn new_empty() -> Self {
1651            Self { device_combined_state: fidl::new_empty!(DeviceState, D) }
1652        }
1653
1654        #[inline]
1655        unsafe fn decode(
1656            &mut self,
1657            decoder: &mut fidl::encoding::Decoder<'_, D>,
1658            offset: usize,
1659            _depth: fidl::encoding::Depth,
1660        ) -> fidl::Result<()> {
1661            decoder.debug_check_bounds::<Self>(offset);
1662            // Verify that padding bytes are zero.
1663            fidl::decode!(
1664                DeviceState,
1665                D,
1666                &mut self.device_combined_state,
1667                decoder,
1668                offset + 0,
1669                _depth
1670            )?;
1671            Ok(())
1672        }
1673    }
1674
1675    impl fidl::encoding::ValueTypeMarker for EnergyScanResultStreamNextResponse {
1676        type Borrowed<'a> = &'a Self;
1677        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1678            value
1679        }
1680    }
1681
1682    unsafe impl fidl::encoding::TypeMarker for EnergyScanResultStreamNextResponse {
1683        type Owned = Self;
1684
1685        #[inline(always)]
1686        fn inline_align(_context: fidl::encoding::Context) -> usize {
1687            8
1688        }
1689
1690        #[inline(always)]
1691        fn inline_size(_context: fidl::encoding::Context) -> usize {
1692            16
1693        }
1694    }
1695
1696    unsafe impl<D: fidl::encoding::ResourceDialect>
1697        fidl::encoding::Encode<EnergyScanResultStreamNextResponse, D>
1698        for &EnergyScanResultStreamNextResponse
1699    {
1700        #[inline]
1701        unsafe fn encode(
1702            self,
1703            encoder: &mut fidl::encoding::Encoder<'_, D>,
1704            offset: usize,
1705            _depth: fidl::encoding::Depth,
1706        ) -> fidl::Result<()> {
1707            encoder.debug_check_bounds::<EnergyScanResultStreamNextResponse>(offset);
1708            // Delegate to tuple encoding.
1709            fidl::encoding::Encode::<EnergyScanResultStreamNextResponse, D>::encode(
1710                (
1711                    <fidl::encoding::Vector<EnergyScanResult, 32> as fidl::encoding::ValueTypeMarker>::borrow(&self.results),
1712                ),
1713                encoder, offset, _depth
1714            )
1715        }
1716    }
1717    unsafe impl<
1718            D: fidl::encoding::ResourceDialect,
1719            T0: fidl::encoding::Encode<fidl::encoding::Vector<EnergyScanResult, 32>, D>,
1720        > fidl::encoding::Encode<EnergyScanResultStreamNextResponse, D> for (T0,)
1721    {
1722        #[inline]
1723        unsafe fn encode(
1724            self,
1725            encoder: &mut fidl::encoding::Encoder<'_, D>,
1726            offset: usize,
1727            depth: fidl::encoding::Depth,
1728        ) -> fidl::Result<()> {
1729            encoder.debug_check_bounds::<EnergyScanResultStreamNextResponse>(offset);
1730            // Zero out padding regions. There's no need to apply masks
1731            // because the unmasked parts will be overwritten by fields.
1732            // Write the fields.
1733            self.0.encode(encoder, offset + 0, depth)?;
1734            Ok(())
1735        }
1736    }
1737
1738    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1739        for EnergyScanResultStreamNextResponse
1740    {
1741        #[inline(always)]
1742        fn new_empty() -> Self {
1743            Self { results: fidl::new_empty!(fidl::encoding::Vector<EnergyScanResult, 32>, D) }
1744        }
1745
1746        #[inline]
1747        unsafe fn decode(
1748            &mut self,
1749            decoder: &mut fidl::encoding::Decoder<'_, D>,
1750            offset: usize,
1751            _depth: fidl::encoding::Depth,
1752        ) -> fidl::Result<()> {
1753            decoder.debug_check_bounds::<Self>(offset);
1754            // Verify that padding bytes are zero.
1755            fidl::decode!(fidl::encoding::Vector<EnergyScanResult, 32>, D, &mut self.results, decoder, offset + 0, _depth)?;
1756            Ok(())
1757        }
1758    }
1759
1760    impl fidl::encoding::ValueTypeMarker for ProvisioningParams {
1761        type Borrowed<'a> = &'a Self;
1762        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1763            value
1764        }
1765    }
1766
1767    unsafe impl fidl::encoding::TypeMarker for ProvisioningParams {
1768        type Owned = Self;
1769
1770        #[inline(always)]
1771        fn inline_align(_context: fidl::encoding::Context) -> usize {
1772            8
1773        }
1774
1775        #[inline(always)]
1776        fn inline_size(_context: fidl::encoding::Context) -> usize {
1777            32
1778        }
1779    }
1780
1781    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<ProvisioningParams, D>
1782        for &ProvisioningParams
1783    {
1784        #[inline]
1785        unsafe fn encode(
1786            self,
1787            encoder: &mut fidl::encoding::Encoder<'_, D>,
1788            offset: usize,
1789            _depth: fidl::encoding::Depth,
1790        ) -> fidl::Result<()> {
1791            encoder.debug_check_bounds::<ProvisioningParams>(offset);
1792            // Delegate to tuple encoding.
1793            fidl::encoding::Encode::<ProvisioningParams, D>::encode(
1794                (
1795                    <Identity as fidl::encoding::ValueTypeMarker>::borrow(&self.identity),
1796                    <fidl::encoding::OptionalUnion<Credential> as fidl::encoding::ValueTypeMarker>::borrow(&self.credential),
1797                ),
1798                encoder, offset, _depth
1799            )
1800        }
1801    }
1802    unsafe impl<
1803            D: fidl::encoding::ResourceDialect,
1804            T0: fidl::encoding::Encode<Identity, D>,
1805            T1: fidl::encoding::Encode<fidl::encoding::OptionalUnion<Credential>, D>,
1806        > fidl::encoding::Encode<ProvisioningParams, D> for (T0, T1)
1807    {
1808        #[inline]
1809        unsafe fn encode(
1810            self,
1811            encoder: &mut fidl::encoding::Encoder<'_, D>,
1812            offset: usize,
1813            depth: fidl::encoding::Depth,
1814        ) -> fidl::Result<()> {
1815            encoder.debug_check_bounds::<ProvisioningParams>(offset);
1816            // Zero out padding regions. There's no need to apply masks
1817            // because the unmasked parts will be overwritten by fields.
1818            // Write the fields.
1819            self.0.encode(encoder, offset + 0, depth)?;
1820            self.1.encode(encoder, offset + 16, depth)?;
1821            Ok(())
1822        }
1823    }
1824
1825    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ProvisioningParams {
1826        #[inline(always)]
1827        fn new_empty() -> Self {
1828            Self {
1829                identity: fidl::new_empty!(Identity, D),
1830                credential: fidl::new_empty!(fidl::encoding::OptionalUnion<Credential>, D),
1831            }
1832        }
1833
1834        #[inline]
1835        unsafe fn decode(
1836            &mut self,
1837            decoder: &mut fidl::encoding::Decoder<'_, D>,
1838            offset: usize,
1839            _depth: fidl::encoding::Depth,
1840        ) -> fidl::Result<()> {
1841            decoder.debug_check_bounds::<Self>(offset);
1842            // Verify that padding bytes are zero.
1843            fidl::decode!(Identity, D, &mut self.identity, decoder, offset + 0, _depth)?;
1844            fidl::decode!(
1845                fidl::encoding::OptionalUnion<Credential>,
1846                D,
1847                &mut self.credential,
1848                decoder,
1849                offset + 16,
1850                _depth
1851            )?;
1852            Ok(())
1853        }
1854    }
1855
1856    impl AllCounters {
1857        #[inline(always)]
1858        fn max_ordinal_present(&self) -> u64 {
1859            if let Some(_) = self.ip_rx {
1860                return 7;
1861            }
1862            if let Some(_) = self.ip_tx {
1863                return 6;
1864            }
1865            if let Some(_) = self.coex_saturated {
1866                return 5;
1867            }
1868            if let Some(_) = self.coex_rx {
1869                return 4;
1870            }
1871            if let Some(_) = self.coex_tx {
1872                return 3;
1873            }
1874            if let Some(_) = self.mac_rx {
1875                return 2;
1876            }
1877            if let Some(_) = self.mac_tx {
1878                return 1;
1879            }
1880            0
1881        }
1882    }
1883
1884    impl fidl::encoding::ValueTypeMarker for AllCounters {
1885        type Borrowed<'a> = &'a Self;
1886        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1887            value
1888        }
1889    }
1890
1891    unsafe impl fidl::encoding::TypeMarker for AllCounters {
1892        type Owned = Self;
1893
1894        #[inline(always)]
1895        fn inline_align(_context: fidl::encoding::Context) -> usize {
1896            8
1897        }
1898
1899        #[inline(always)]
1900        fn inline_size(_context: fidl::encoding::Context) -> usize {
1901            16
1902        }
1903    }
1904
1905    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<AllCounters, D>
1906        for &AllCounters
1907    {
1908        unsafe fn encode(
1909            self,
1910            encoder: &mut fidl::encoding::Encoder<'_, D>,
1911            offset: usize,
1912            mut depth: fidl::encoding::Depth,
1913        ) -> fidl::Result<()> {
1914            encoder.debug_check_bounds::<AllCounters>(offset);
1915            // Vector header
1916            let max_ordinal: u64 = self.max_ordinal_present();
1917            encoder.write_num(max_ordinal, offset);
1918            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
1919            // Calling encoder.out_of_line_offset(0) is not allowed.
1920            if max_ordinal == 0 {
1921                return Ok(());
1922            }
1923            depth.increment()?;
1924            let envelope_size = 8;
1925            let bytes_len = max_ordinal as usize * envelope_size;
1926            #[allow(unused_variables)]
1927            let offset = encoder.out_of_line_offset(bytes_len);
1928            let mut _prev_end_offset: usize = 0;
1929            if 1 > max_ordinal {
1930                return Ok(());
1931            }
1932
1933            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1934            // are envelope_size bytes.
1935            let cur_offset: usize = (1 - 1) * envelope_size;
1936
1937            // Zero reserved fields.
1938            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1939
1940            // Safety:
1941            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1942            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1943            //   envelope_size bytes, there is always sufficient room.
1944            fidl::encoding::encode_in_envelope_optional::<MacCounters, D>(
1945                self.mac_tx.as_ref().map(<MacCounters as fidl::encoding::ValueTypeMarker>::borrow),
1946                encoder,
1947                offset + cur_offset,
1948                depth,
1949            )?;
1950
1951            _prev_end_offset = cur_offset + envelope_size;
1952            if 2 > max_ordinal {
1953                return Ok(());
1954            }
1955
1956            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1957            // are envelope_size bytes.
1958            let cur_offset: usize = (2 - 1) * envelope_size;
1959
1960            // Zero reserved fields.
1961            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1962
1963            // Safety:
1964            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1965            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1966            //   envelope_size bytes, there is always sufficient room.
1967            fidl::encoding::encode_in_envelope_optional::<MacCounters, D>(
1968                self.mac_rx.as_ref().map(<MacCounters as fidl::encoding::ValueTypeMarker>::borrow),
1969                encoder,
1970                offset + cur_offset,
1971                depth,
1972            )?;
1973
1974            _prev_end_offset = cur_offset + envelope_size;
1975            if 3 > max_ordinal {
1976                return Ok(());
1977            }
1978
1979            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1980            // are envelope_size bytes.
1981            let cur_offset: usize = (3 - 1) * envelope_size;
1982
1983            // Zero reserved fields.
1984            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1985
1986            // Safety:
1987            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1988            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1989            //   envelope_size bytes, there is always sufficient room.
1990            fidl::encoding::encode_in_envelope_optional::<CoexCounters, D>(
1991                self.coex_tx
1992                    .as_ref()
1993                    .map(<CoexCounters as fidl::encoding::ValueTypeMarker>::borrow),
1994                encoder,
1995                offset + cur_offset,
1996                depth,
1997            )?;
1998
1999            _prev_end_offset = cur_offset + envelope_size;
2000            if 4 > max_ordinal {
2001                return Ok(());
2002            }
2003
2004            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2005            // are envelope_size bytes.
2006            let cur_offset: usize = (4 - 1) * envelope_size;
2007
2008            // Zero reserved fields.
2009            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2010
2011            // Safety:
2012            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2013            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2014            //   envelope_size bytes, there is always sufficient room.
2015            fidl::encoding::encode_in_envelope_optional::<CoexCounters, D>(
2016                self.coex_rx
2017                    .as_ref()
2018                    .map(<CoexCounters as fidl::encoding::ValueTypeMarker>::borrow),
2019                encoder,
2020                offset + cur_offset,
2021                depth,
2022            )?;
2023
2024            _prev_end_offset = cur_offset + envelope_size;
2025            if 5 > max_ordinal {
2026                return Ok(());
2027            }
2028
2029            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2030            // are envelope_size bytes.
2031            let cur_offset: usize = (5 - 1) * envelope_size;
2032
2033            // Zero reserved fields.
2034            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2035
2036            // Safety:
2037            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2038            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2039            //   envelope_size bytes, there is always sufficient room.
2040            fidl::encoding::encode_in_envelope_optional::<bool, D>(
2041                self.coex_saturated.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
2042                encoder,
2043                offset + cur_offset,
2044                depth,
2045            )?;
2046
2047            _prev_end_offset = cur_offset + envelope_size;
2048            if 6 > max_ordinal {
2049                return Ok(());
2050            }
2051
2052            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2053            // are envelope_size bytes.
2054            let cur_offset: usize = (6 - 1) * envelope_size;
2055
2056            // Zero reserved fields.
2057            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2058
2059            // Safety:
2060            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2061            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2062            //   envelope_size bytes, there is always sufficient room.
2063            fidl::encoding::encode_in_envelope_optional::<IpCounters, D>(
2064                self.ip_tx.as_ref().map(<IpCounters as fidl::encoding::ValueTypeMarker>::borrow),
2065                encoder,
2066                offset + cur_offset,
2067                depth,
2068            )?;
2069
2070            _prev_end_offset = cur_offset + envelope_size;
2071            if 7 > max_ordinal {
2072                return Ok(());
2073            }
2074
2075            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2076            // are envelope_size bytes.
2077            let cur_offset: usize = (7 - 1) * envelope_size;
2078
2079            // Zero reserved fields.
2080            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2081
2082            // Safety:
2083            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2084            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2085            //   envelope_size bytes, there is always sufficient room.
2086            fidl::encoding::encode_in_envelope_optional::<IpCounters, D>(
2087                self.ip_rx.as_ref().map(<IpCounters as fidl::encoding::ValueTypeMarker>::borrow),
2088                encoder,
2089                offset + cur_offset,
2090                depth,
2091            )?;
2092
2093            _prev_end_offset = cur_offset + envelope_size;
2094
2095            Ok(())
2096        }
2097    }
2098
2099    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for AllCounters {
2100        #[inline(always)]
2101        fn new_empty() -> Self {
2102            Self::default()
2103        }
2104
2105        unsafe fn decode(
2106            &mut self,
2107            decoder: &mut fidl::encoding::Decoder<'_, D>,
2108            offset: usize,
2109            mut depth: fidl::encoding::Depth,
2110        ) -> fidl::Result<()> {
2111            decoder.debug_check_bounds::<Self>(offset);
2112            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
2113                None => return Err(fidl::Error::NotNullable),
2114                Some(len) => len,
2115            };
2116            // Calling decoder.out_of_line_offset(0) is not allowed.
2117            if len == 0 {
2118                return Ok(());
2119            };
2120            depth.increment()?;
2121            let envelope_size = 8;
2122            let bytes_len = len * envelope_size;
2123            let offset = decoder.out_of_line_offset(bytes_len)?;
2124            // Decode the envelope for each type.
2125            let mut _next_ordinal_to_read = 0;
2126            let mut next_offset = offset;
2127            let end_offset = offset + bytes_len;
2128            _next_ordinal_to_read += 1;
2129            if next_offset >= end_offset {
2130                return Ok(());
2131            }
2132
2133            // Decode unknown envelopes for gaps in ordinals.
2134            while _next_ordinal_to_read < 1 {
2135                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2136                _next_ordinal_to_read += 1;
2137                next_offset += envelope_size;
2138            }
2139
2140            let next_out_of_line = decoder.next_out_of_line();
2141            let handles_before = decoder.remaining_handles();
2142            if let Some((inlined, num_bytes, num_handles)) =
2143                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2144            {
2145                let member_inline_size =
2146                    <MacCounters as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2147                if inlined != (member_inline_size <= 4) {
2148                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2149                }
2150                let inner_offset;
2151                let mut inner_depth = depth.clone();
2152                if inlined {
2153                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2154                    inner_offset = next_offset;
2155                } else {
2156                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2157                    inner_depth.increment()?;
2158                }
2159                let val_ref = self.mac_tx.get_or_insert_with(|| fidl::new_empty!(MacCounters, D));
2160                fidl::decode!(MacCounters, D, val_ref, decoder, inner_offset, inner_depth)?;
2161                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2162                {
2163                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2164                }
2165                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2166                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2167                }
2168            }
2169
2170            next_offset += envelope_size;
2171            _next_ordinal_to_read += 1;
2172            if next_offset >= end_offset {
2173                return Ok(());
2174            }
2175
2176            // Decode unknown envelopes for gaps in ordinals.
2177            while _next_ordinal_to_read < 2 {
2178                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2179                _next_ordinal_to_read += 1;
2180                next_offset += envelope_size;
2181            }
2182
2183            let next_out_of_line = decoder.next_out_of_line();
2184            let handles_before = decoder.remaining_handles();
2185            if let Some((inlined, num_bytes, num_handles)) =
2186                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2187            {
2188                let member_inline_size =
2189                    <MacCounters as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2190                if inlined != (member_inline_size <= 4) {
2191                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2192                }
2193                let inner_offset;
2194                let mut inner_depth = depth.clone();
2195                if inlined {
2196                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2197                    inner_offset = next_offset;
2198                } else {
2199                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2200                    inner_depth.increment()?;
2201                }
2202                let val_ref = self.mac_rx.get_or_insert_with(|| fidl::new_empty!(MacCounters, D));
2203                fidl::decode!(MacCounters, D, val_ref, decoder, inner_offset, inner_depth)?;
2204                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2205                {
2206                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2207                }
2208                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2209                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2210                }
2211            }
2212
2213            next_offset += envelope_size;
2214            _next_ordinal_to_read += 1;
2215            if next_offset >= end_offset {
2216                return Ok(());
2217            }
2218
2219            // Decode unknown envelopes for gaps in ordinals.
2220            while _next_ordinal_to_read < 3 {
2221                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2222                _next_ordinal_to_read += 1;
2223                next_offset += envelope_size;
2224            }
2225
2226            let next_out_of_line = decoder.next_out_of_line();
2227            let handles_before = decoder.remaining_handles();
2228            if let Some((inlined, num_bytes, num_handles)) =
2229                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2230            {
2231                let member_inline_size =
2232                    <CoexCounters as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2233                if inlined != (member_inline_size <= 4) {
2234                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2235                }
2236                let inner_offset;
2237                let mut inner_depth = depth.clone();
2238                if inlined {
2239                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2240                    inner_offset = next_offset;
2241                } else {
2242                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2243                    inner_depth.increment()?;
2244                }
2245                let val_ref = self.coex_tx.get_or_insert_with(|| fidl::new_empty!(CoexCounters, D));
2246                fidl::decode!(CoexCounters, D, val_ref, decoder, inner_offset, inner_depth)?;
2247                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2248                {
2249                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2250                }
2251                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2252                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2253                }
2254            }
2255
2256            next_offset += envelope_size;
2257            _next_ordinal_to_read += 1;
2258            if next_offset >= end_offset {
2259                return Ok(());
2260            }
2261
2262            // Decode unknown envelopes for gaps in ordinals.
2263            while _next_ordinal_to_read < 4 {
2264                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2265                _next_ordinal_to_read += 1;
2266                next_offset += envelope_size;
2267            }
2268
2269            let next_out_of_line = decoder.next_out_of_line();
2270            let handles_before = decoder.remaining_handles();
2271            if let Some((inlined, num_bytes, num_handles)) =
2272                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2273            {
2274                let member_inline_size =
2275                    <CoexCounters as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2276                if inlined != (member_inline_size <= 4) {
2277                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2278                }
2279                let inner_offset;
2280                let mut inner_depth = depth.clone();
2281                if inlined {
2282                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2283                    inner_offset = next_offset;
2284                } else {
2285                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2286                    inner_depth.increment()?;
2287                }
2288                let val_ref = self.coex_rx.get_or_insert_with(|| fidl::new_empty!(CoexCounters, D));
2289                fidl::decode!(CoexCounters, D, val_ref, decoder, inner_offset, inner_depth)?;
2290                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2291                {
2292                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2293                }
2294                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2295                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2296                }
2297            }
2298
2299            next_offset += envelope_size;
2300            _next_ordinal_to_read += 1;
2301            if next_offset >= end_offset {
2302                return Ok(());
2303            }
2304
2305            // Decode unknown envelopes for gaps in ordinals.
2306            while _next_ordinal_to_read < 5 {
2307                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2308                _next_ordinal_to_read += 1;
2309                next_offset += envelope_size;
2310            }
2311
2312            let next_out_of_line = decoder.next_out_of_line();
2313            let handles_before = decoder.remaining_handles();
2314            if let Some((inlined, num_bytes, num_handles)) =
2315                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2316            {
2317                let member_inline_size =
2318                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2319                if inlined != (member_inline_size <= 4) {
2320                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2321                }
2322                let inner_offset;
2323                let mut inner_depth = depth.clone();
2324                if inlined {
2325                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2326                    inner_offset = next_offset;
2327                } else {
2328                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2329                    inner_depth.increment()?;
2330                }
2331                let val_ref = self.coex_saturated.get_or_insert_with(|| fidl::new_empty!(bool, D));
2332                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
2333                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2334                {
2335                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2336                }
2337                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2338                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2339                }
2340            }
2341
2342            next_offset += envelope_size;
2343            _next_ordinal_to_read += 1;
2344            if next_offset >= end_offset {
2345                return Ok(());
2346            }
2347
2348            // Decode unknown envelopes for gaps in ordinals.
2349            while _next_ordinal_to_read < 6 {
2350                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2351                _next_ordinal_to_read += 1;
2352                next_offset += envelope_size;
2353            }
2354
2355            let next_out_of_line = decoder.next_out_of_line();
2356            let handles_before = decoder.remaining_handles();
2357            if let Some((inlined, num_bytes, num_handles)) =
2358                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2359            {
2360                let member_inline_size =
2361                    <IpCounters as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2362                if inlined != (member_inline_size <= 4) {
2363                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2364                }
2365                let inner_offset;
2366                let mut inner_depth = depth.clone();
2367                if inlined {
2368                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2369                    inner_offset = next_offset;
2370                } else {
2371                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2372                    inner_depth.increment()?;
2373                }
2374                let val_ref = self.ip_tx.get_or_insert_with(|| fidl::new_empty!(IpCounters, D));
2375                fidl::decode!(IpCounters, D, val_ref, decoder, inner_offset, inner_depth)?;
2376                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2377                {
2378                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2379                }
2380                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2381                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2382                }
2383            }
2384
2385            next_offset += envelope_size;
2386            _next_ordinal_to_read += 1;
2387            if next_offset >= end_offset {
2388                return Ok(());
2389            }
2390
2391            // Decode unknown envelopes for gaps in ordinals.
2392            while _next_ordinal_to_read < 7 {
2393                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2394                _next_ordinal_to_read += 1;
2395                next_offset += envelope_size;
2396            }
2397
2398            let next_out_of_line = decoder.next_out_of_line();
2399            let handles_before = decoder.remaining_handles();
2400            if let Some((inlined, num_bytes, num_handles)) =
2401                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2402            {
2403                let member_inline_size =
2404                    <IpCounters as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2405                if inlined != (member_inline_size <= 4) {
2406                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2407                }
2408                let inner_offset;
2409                let mut inner_depth = depth.clone();
2410                if inlined {
2411                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2412                    inner_offset = next_offset;
2413                } else {
2414                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2415                    inner_depth.increment()?;
2416                }
2417                let val_ref = self.ip_rx.get_or_insert_with(|| fidl::new_empty!(IpCounters, D));
2418                fidl::decode!(IpCounters, D, val_ref, decoder, inner_offset, inner_depth)?;
2419                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2420                {
2421                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2422                }
2423                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2424                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2425                }
2426            }
2427
2428            next_offset += envelope_size;
2429
2430            // Decode the remaining unknown envelopes.
2431            while next_offset < end_offset {
2432                _next_ordinal_to_read += 1;
2433                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2434                next_offset += envelope_size;
2435            }
2436
2437            Ok(())
2438        }
2439    }
2440
2441    impl CoexCounters {
2442        #[inline(always)]
2443        fn max_ordinal_present(&self) -> u64 {
2444            if let Some(_) = self.grant_none {
2445                return 9;
2446            }
2447            if let Some(_) = self.avg_delay_request_to_grant_usec {
2448                return 8;
2449            }
2450            if let Some(_) = self.delayed_grant {
2451                return 7;
2452            }
2453            if let Some(_) = self.grant_deactivated_during_request {
2454                return 6;
2455            }
2456            if let Some(_) = self.grant_wait_timeout {
2457                return 5;
2458            }
2459            if let Some(_) = self.grant_wait_activated {
2460                return 4;
2461            }
2462            if let Some(_) = self.grant_wait {
2463                return 3;
2464            }
2465            if let Some(_) = self.grant_immediate {
2466                return 2;
2467            }
2468            if let Some(_) = self.requests {
2469                return 1;
2470            }
2471            0
2472        }
2473    }
2474
2475    impl fidl::encoding::ValueTypeMarker for CoexCounters {
2476        type Borrowed<'a> = &'a Self;
2477        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2478            value
2479        }
2480    }
2481
2482    unsafe impl fidl::encoding::TypeMarker for CoexCounters {
2483        type Owned = Self;
2484
2485        #[inline(always)]
2486        fn inline_align(_context: fidl::encoding::Context) -> usize {
2487            8
2488        }
2489
2490        #[inline(always)]
2491        fn inline_size(_context: fidl::encoding::Context) -> usize {
2492            16
2493        }
2494    }
2495
2496    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<CoexCounters, D>
2497        for &CoexCounters
2498    {
2499        unsafe fn encode(
2500            self,
2501            encoder: &mut fidl::encoding::Encoder<'_, D>,
2502            offset: usize,
2503            mut depth: fidl::encoding::Depth,
2504        ) -> fidl::Result<()> {
2505            encoder.debug_check_bounds::<CoexCounters>(offset);
2506            // Vector header
2507            let max_ordinal: u64 = self.max_ordinal_present();
2508            encoder.write_num(max_ordinal, offset);
2509            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
2510            // Calling encoder.out_of_line_offset(0) is not allowed.
2511            if max_ordinal == 0 {
2512                return Ok(());
2513            }
2514            depth.increment()?;
2515            let envelope_size = 8;
2516            let bytes_len = max_ordinal as usize * envelope_size;
2517            #[allow(unused_variables)]
2518            let offset = encoder.out_of_line_offset(bytes_len);
2519            let mut _prev_end_offset: usize = 0;
2520            if 1 > max_ordinal {
2521                return Ok(());
2522            }
2523
2524            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2525            // are envelope_size bytes.
2526            let cur_offset: usize = (1 - 1) * envelope_size;
2527
2528            // Zero reserved fields.
2529            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2530
2531            // Safety:
2532            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2533            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2534            //   envelope_size bytes, there is always sufficient room.
2535            fidl::encoding::encode_in_envelope_optional::<u64, D>(
2536                self.requests.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
2537                encoder,
2538                offset + cur_offset,
2539                depth,
2540            )?;
2541
2542            _prev_end_offset = cur_offset + envelope_size;
2543            if 2 > max_ordinal {
2544                return Ok(());
2545            }
2546
2547            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2548            // are envelope_size bytes.
2549            let cur_offset: usize = (2 - 1) * envelope_size;
2550
2551            // Zero reserved fields.
2552            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2553
2554            // Safety:
2555            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2556            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2557            //   envelope_size bytes, there is always sufficient room.
2558            fidl::encoding::encode_in_envelope_optional::<u64, D>(
2559                self.grant_immediate.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
2560                encoder,
2561                offset + cur_offset,
2562                depth,
2563            )?;
2564
2565            _prev_end_offset = cur_offset + envelope_size;
2566            if 3 > max_ordinal {
2567                return Ok(());
2568            }
2569
2570            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2571            // are envelope_size bytes.
2572            let cur_offset: usize = (3 - 1) * envelope_size;
2573
2574            // Zero reserved fields.
2575            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2576
2577            // Safety:
2578            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2579            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2580            //   envelope_size bytes, there is always sufficient room.
2581            fidl::encoding::encode_in_envelope_optional::<u64, D>(
2582                self.grant_wait.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
2583                encoder,
2584                offset + cur_offset,
2585                depth,
2586            )?;
2587
2588            _prev_end_offset = cur_offset + envelope_size;
2589            if 4 > max_ordinal {
2590                return Ok(());
2591            }
2592
2593            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2594            // are envelope_size bytes.
2595            let cur_offset: usize = (4 - 1) * envelope_size;
2596
2597            // Zero reserved fields.
2598            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2599
2600            // Safety:
2601            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2602            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2603            //   envelope_size bytes, there is always sufficient room.
2604            fidl::encoding::encode_in_envelope_optional::<u64, D>(
2605                self.grant_wait_activated
2606                    .as_ref()
2607                    .map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
2608                encoder,
2609                offset + cur_offset,
2610                depth,
2611            )?;
2612
2613            _prev_end_offset = cur_offset + envelope_size;
2614            if 5 > max_ordinal {
2615                return Ok(());
2616            }
2617
2618            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2619            // are envelope_size bytes.
2620            let cur_offset: usize = (5 - 1) * envelope_size;
2621
2622            // Zero reserved fields.
2623            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2624
2625            // Safety:
2626            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2627            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2628            //   envelope_size bytes, there is always sufficient room.
2629            fidl::encoding::encode_in_envelope_optional::<u64, D>(
2630                self.grant_wait_timeout
2631                    .as_ref()
2632                    .map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
2633                encoder,
2634                offset + cur_offset,
2635                depth,
2636            )?;
2637
2638            _prev_end_offset = cur_offset + envelope_size;
2639            if 6 > max_ordinal {
2640                return Ok(());
2641            }
2642
2643            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2644            // are envelope_size bytes.
2645            let cur_offset: usize = (6 - 1) * envelope_size;
2646
2647            // Zero reserved fields.
2648            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2649
2650            // Safety:
2651            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2652            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2653            //   envelope_size bytes, there is always sufficient room.
2654            fidl::encoding::encode_in_envelope_optional::<u64, D>(
2655                self.grant_deactivated_during_request
2656                    .as_ref()
2657                    .map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
2658                encoder,
2659                offset + cur_offset,
2660                depth,
2661            )?;
2662
2663            _prev_end_offset = cur_offset + envelope_size;
2664            if 7 > max_ordinal {
2665                return Ok(());
2666            }
2667
2668            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2669            // are envelope_size bytes.
2670            let cur_offset: usize = (7 - 1) * envelope_size;
2671
2672            // Zero reserved fields.
2673            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2674
2675            // Safety:
2676            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2677            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2678            //   envelope_size bytes, there is always sufficient room.
2679            fidl::encoding::encode_in_envelope_optional::<u64, D>(
2680                self.delayed_grant.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
2681                encoder,
2682                offset + cur_offset,
2683                depth,
2684            )?;
2685
2686            _prev_end_offset = cur_offset + envelope_size;
2687            if 8 > max_ordinal {
2688                return Ok(());
2689            }
2690
2691            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2692            // are envelope_size bytes.
2693            let cur_offset: usize = (8 - 1) * envelope_size;
2694
2695            // Zero reserved fields.
2696            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2697
2698            // Safety:
2699            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2700            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2701            //   envelope_size bytes, there is always sufficient room.
2702            fidl::encoding::encode_in_envelope_optional::<u32, D>(
2703                self.avg_delay_request_to_grant_usec
2704                    .as_ref()
2705                    .map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
2706                encoder,
2707                offset + cur_offset,
2708                depth,
2709            )?;
2710
2711            _prev_end_offset = cur_offset + envelope_size;
2712            if 9 > max_ordinal {
2713                return Ok(());
2714            }
2715
2716            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2717            // are envelope_size bytes.
2718            let cur_offset: usize = (9 - 1) * envelope_size;
2719
2720            // Zero reserved fields.
2721            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2722
2723            // Safety:
2724            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2725            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2726            //   envelope_size bytes, there is always sufficient room.
2727            fidl::encoding::encode_in_envelope_optional::<u64, D>(
2728                self.grant_none.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
2729                encoder,
2730                offset + cur_offset,
2731                depth,
2732            )?;
2733
2734            _prev_end_offset = cur_offset + envelope_size;
2735
2736            Ok(())
2737        }
2738    }
2739
2740    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for CoexCounters {
2741        #[inline(always)]
2742        fn new_empty() -> Self {
2743            Self::default()
2744        }
2745
2746        unsafe fn decode(
2747            &mut self,
2748            decoder: &mut fidl::encoding::Decoder<'_, D>,
2749            offset: usize,
2750            mut depth: fidl::encoding::Depth,
2751        ) -> fidl::Result<()> {
2752            decoder.debug_check_bounds::<Self>(offset);
2753            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
2754                None => return Err(fidl::Error::NotNullable),
2755                Some(len) => len,
2756            };
2757            // Calling decoder.out_of_line_offset(0) is not allowed.
2758            if len == 0 {
2759                return Ok(());
2760            };
2761            depth.increment()?;
2762            let envelope_size = 8;
2763            let bytes_len = len * envelope_size;
2764            let offset = decoder.out_of_line_offset(bytes_len)?;
2765            // Decode the envelope for each type.
2766            let mut _next_ordinal_to_read = 0;
2767            let mut next_offset = offset;
2768            let end_offset = offset + bytes_len;
2769            _next_ordinal_to_read += 1;
2770            if next_offset >= end_offset {
2771                return Ok(());
2772            }
2773
2774            // Decode unknown envelopes for gaps in ordinals.
2775            while _next_ordinal_to_read < 1 {
2776                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2777                _next_ordinal_to_read += 1;
2778                next_offset += envelope_size;
2779            }
2780
2781            let next_out_of_line = decoder.next_out_of_line();
2782            let handles_before = decoder.remaining_handles();
2783            if let Some((inlined, num_bytes, num_handles)) =
2784                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2785            {
2786                let member_inline_size =
2787                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2788                if inlined != (member_inline_size <= 4) {
2789                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2790                }
2791                let inner_offset;
2792                let mut inner_depth = depth.clone();
2793                if inlined {
2794                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2795                    inner_offset = next_offset;
2796                } else {
2797                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2798                    inner_depth.increment()?;
2799                }
2800                let val_ref = self.requests.get_or_insert_with(|| fidl::new_empty!(u64, D));
2801                fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
2802                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2803                {
2804                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2805                }
2806                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2807                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2808                }
2809            }
2810
2811            next_offset += envelope_size;
2812            _next_ordinal_to_read += 1;
2813            if next_offset >= end_offset {
2814                return Ok(());
2815            }
2816
2817            // Decode unknown envelopes for gaps in ordinals.
2818            while _next_ordinal_to_read < 2 {
2819                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2820                _next_ordinal_to_read += 1;
2821                next_offset += envelope_size;
2822            }
2823
2824            let next_out_of_line = decoder.next_out_of_line();
2825            let handles_before = decoder.remaining_handles();
2826            if let Some((inlined, num_bytes, num_handles)) =
2827                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2828            {
2829                let member_inline_size =
2830                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2831                if inlined != (member_inline_size <= 4) {
2832                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2833                }
2834                let inner_offset;
2835                let mut inner_depth = depth.clone();
2836                if inlined {
2837                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2838                    inner_offset = next_offset;
2839                } else {
2840                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2841                    inner_depth.increment()?;
2842                }
2843                let val_ref = self.grant_immediate.get_or_insert_with(|| fidl::new_empty!(u64, D));
2844                fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
2845                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2846                {
2847                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2848                }
2849                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2850                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2851                }
2852            }
2853
2854            next_offset += envelope_size;
2855            _next_ordinal_to_read += 1;
2856            if next_offset >= end_offset {
2857                return Ok(());
2858            }
2859
2860            // Decode unknown envelopes for gaps in ordinals.
2861            while _next_ordinal_to_read < 3 {
2862                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2863                _next_ordinal_to_read += 1;
2864                next_offset += envelope_size;
2865            }
2866
2867            let next_out_of_line = decoder.next_out_of_line();
2868            let handles_before = decoder.remaining_handles();
2869            if let Some((inlined, num_bytes, num_handles)) =
2870                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2871            {
2872                let member_inline_size =
2873                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2874                if inlined != (member_inline_size <= 4) {
2875                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2876                }
2877                let inner_offset;
2878                let mut inner_depth = depth.clone();
2879                if inlined {
2880                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2881                    inner_offset = next_offset;
2882                } else {
2883                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2884                    inner_depth.increment()?;
2885                }
2886                let val_ref = self.grant_wait.get_or_insert_with(|| fidl::new_empty!(u64, D));
2887                fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
2888                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2889                {
2890                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2891                }
2892                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2893                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2894                }
2895            }
2896
2897            next_offset += envelope_size;
2898            _next_ordinal_to_read += 1;
2899            if next_offset >= end_offset {
2900                return Ok(());
2901            }
2902
2903            // Decode unknown envelopes for gaps in ordinals.
2904            while _next_ordinal_to_read < 4 {
2905                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2906                _next_ordinal_to_read += 1;
2907                next_offset += envelope_size;
2908            }
2909
2910            let next_out_of_line = decoder.next_out_of_line();
2911            let handles_before = decoder.remaining_handles();
2912            if let Some((inlined, num_bytes, num_handles)) =
2913                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2914            {
2915                let member_inline_size =
2916                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2917                if inlined != (member_inline_size <= 4) {
2918                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2919                }
2920                let inner_offset;
2921                let mut inner_depth = depth.clone();
2922                if inlined {
2923                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2924                    inner_offset = next_offset;
2925                } else {
2926                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2927                    inner_depth.increment()?;
2928                }
2929                let val_ref =
2930                    self.grant_wait_activated.get_or_insert_with(|| fidl::new_empty!(u64, D));
2931                fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
2932                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2933                {
2934                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2935                }
2936                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2937                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2938                }
2939            }
2940
2941            next_offset += envelope_size;
2942            _next_ordinal_to_read += 1;
2943            if next_offset >= end_offset {
2944                return Ok(());
2945            }
2946
2947            // Decode unknown envelopes for gaps in ordinals.
2948            while _next_ordinal_to_read < 5 {
2949                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2950                _next_ordinal_to_read += 1;
2951                next_offset += envelope_size;
2952            }
2953
2954            let next_out_of_line = decoder.next_out_of_line();
2955            let handles_before = decoder.remaining_handles();
2956            if let Some((inlined, num_bytes, num_handles)) =
2957                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2958            {
2959                let member_inline_size =
2960                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2961                if inlined != (member_inline_size <= 4) {
2962                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2963                }
2964                let inner_offset;
2965                let mut inner_depth = depth.clone();
2966                if inlined {
2967                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2968                    inner_offset = next_offset;
2969                } else {
2970                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2971                    inner_depth.increment()?;
2972                }
2973                let val_ref =
2974                    self.grant_wait_timeout.get_or_insert_with(|| fidl::new_empty!(u64, D));
2975                fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
2976                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2977                {
2978                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2979                }
2980                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2981                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2982                }
2983            }
2984
2985            next_offset += envelope_size;
2986            _next_ordinal_to_read += 1;
2987            if next_offset >= end_offset {
2988                return Ok(());
2989            }
2990
2991            // Decode unknown envelopes for gaps in ordinals.
2992            while _next_ordinal_to_read < 6 {
2993                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2994                _next_ordinal_to_read += 1;
2995                next_offset += envelope_size;
2996            }
2997
2998            let next_out_of_line = decoder.next_out_of_line();
2999            let handles_before = decoder.remaining_handles();
3000            if let Some((inlined, num_bytes, num_handles)) =
3001                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3002            {
3003                let member_inline_size =
3004                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3005                if inlined != (member_inline_size <= 4) {
3006                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3007                }
3008                let inner_offset;
3009                let mut inner_depth = depth.clone();
3010                if inlined {
3011                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3012                    inner_offset = next_offset;
3013                } else {
3014                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3015                    inner_depth.increment()?;
3016                }
3017                let val_ref = self
3018                    .grant_deactivated_during_request
3019                    .get_or_insert_with(|| fidl::new_empty!(u64, D));
3020                fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
3021                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3022                {
3023                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3024                }
3025                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3026                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3027                }
3028            }
3029
3030            next_offset += envelope_size;
3031            _next_ordinal_to_read += 1;
3032            if next_offset >= end_offset {
3033                return Ok(());
3034            }
3035
3036            // Decode unknown envelopes for gaps in ordinals.
3037            while _next_ordinal_to_read < 7 {
3038                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3039                _next_ordinal_to_read += 1;
3040                next_offset += envelope_size;
3041            }
3042
3043            let next_out_of_line = decoder.next_out_of_line();
3044            let handles_before = decoder.remaining_handles();
3045            if let Some((inlined, num_bytes, num_handles)) =
3046                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3047            {
3048                let member_inline_size =
3049                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3050                if inlined != (member_inline_size <= 4) {
3051                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3052                }
3053                let inner_offset;
3054                let mut inner_depth = depth.clone();
3055                if inlined {
3056                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3057                    inner_offset = next_offset;
3058                } else {
3059                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3060                    inner_depth.increment()?;
3061                }
3062                let val_ref = self.delayed_grant.get_or_insert_with(|| fidl::new_empty!(u64, D));
3063                fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
3064                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3065                {
3066                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3067                }
3068                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3069                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3070                }
3071            }
3072
3073            next_offset += envelope_size;
3074            _next_ordinal_to_read += 1;
3075            if next_offset >= end_offset {
3076                return Ok(());
3077            }
3078
3079            // Decode unknown envelopes for gaps in ordinals.
3080            while _next_ordinal_to_read < 8 {
3081                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3082                _next_ordinal_to_read += 1;
3083                next_offset += envelope_size;
3084            }
3085
3086            let next_out_of_line = decoder.next_out_of_line();
3087            let handles_before = decoder.remaining_handles();
3088            if let Some((inlined, num_bytes, num_handles)) =
3089                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3090            {
3091                let member_inline_size =
3092                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3093                if inlined != (member_inline_size <= 4) {
3094                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3095                }
3096                let inner_offset;
3097                let mut inner_depth = depth.clone();
3098                if inlined {
3099                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3100                    inner_offset = next_offset;
3101                } else {
3102                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3103                    inner_depth.increment()?;
3104                }
3105                let val_ref = self
3106                    .avg_delay_request_to_grant_usec
3107                    .get_or_insert_with(|| fidl::new_empty!(u32, D));
3108                fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
3109                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3110                {
3111                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3112                }
3113                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3114                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3115                }
3116            }
3117
3118            next_offset += envelope_size;
3119            _next_ordinal_to_read += 1;
3120            if next_offset >= end_offset {
3121                return Ok(());
3122            }
3123
3124            // Decode unknown envelopes for gaps in ordinals.
3125            while _next_ordinal_to_read < 9 {
3126                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3127                _next_ordinal_to_read += 1;
3128                next_offset += envelope_size;
3129            }
3130
3131            let next_out_of_line = decoder.next_out_of_line();
3132            let handles_before = decoder.remaining_handles();
3133            if let Some((inlined, num_bytes, num_handles)) =
3134                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3135            {
3136                let member_inline_size =
3137                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3138                if inlined != (member_inline_size <= 4) {
3139                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3140                }
3141                let inner_offset;
3142                let mut inner_depth = depth.clone();
3143                if inlined {
3144                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3145                    inner_offset = next_offset;
3146                } else {
3147                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3148                    inner_depth.increment()?;
3149                }
3150                let val_ref = self.grant_none.get_or_insert_with(|| fidl::new_empty!(u64, D));
3151                fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
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
3163            // Decode the remaining unknown envelopes.
3164            while next_offset < end_offset {
3165                _next_ordinal_to_read += 1;
3166                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3167                next_offset += envelope_size;
3168            }
3169
3170            Ok(())
3171        }
3172    }
3173
3174    impl DeviceState {
3175        #[inline(always)]
3176        fn max_ordinal_present(&self) -> u64 {
3177            if let Some(_) = self.role {
3178                return 2;
3179            }
3180            if let Some(_) = self.connectivity_state {
3181                return 1;
3182            }
3183            0
3184        }
3185    }
3186
3187    impl fidl::encoding::ValueTypeMarker for DeviceState {
3188        type Borrowed<'a> = &'a Self;
3189        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3190            value
3191        }
3192    }
3193
3194    unsafe impl fidl::encoding::TypeMarker for DeviceState {
3195        type Owned = Self;
3196
3197        #[inline(always)]
3198        fn inline_align(_context: fidl::encoding::Context) -> usize {
3199            8
3200        }
3201
3202        #[inline(always)]
3203        fn inline_size(_context: fidl::encoding::Context) -> usize {
3204            16
3205        }
3206    }
3207
3208    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<DeviceState, D>
3209        for &DeviceState
3210    {
3211        unsafe fn encode(
3212            self,
3213            encoder: &mut fidl::encoding::Encoder<'_, D>,
3214            offset: usize,
3215            mut depth: fidl::encoding::Depth,
3216        ) -> fidl::Result<()> {
3217            encoder.debug_check_bounds::<DeviceState>(offset);
3218            // Vector header
3219            let max_ordinal: u64 = self.max_ordinal_present();
3220            encoder.write_num(max_ordinal, offset);
3221            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
3222            // Calling encoder.out_of_line_offset(0) is not allowed.
3223            if max_ordinal == 0 {
3224                return Ok(());
3225            }
3226            depth.increment()?;
3227            let envelope_size = 8;
3228            let bytes_len = max_ordinal as usize * envelope_size;
3229            #[allow(unused_variables)]
3230            let offset = encoder.out_of_line_offset(bytes_len);
3231            let mut _prev_end_offset: usize = 0;
3232            if 1 > max_ordinal {
3233                return Ok(());
3234            }
3235
3236            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3237            // are envelope_size bytes.
3238            let cur_offset: usize = (1 - 1) * envelope_size;
3239
3240            // Zero reserved fields.
3241            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3242
3243            // Safety:
3244            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3245            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3246            //   envelope_size bytes, there is always sufficient room.
3247            fidl::encoding::encode_in_envelope_optional::<ConnectivityState, D>(
3248                self.connectivity_state
3249                    .as_ref()
3250                    .map(<ConnectivityState as fidl::encoding::ValueTypeMarker>::borrow),
3251                encoder,
3252                offset + cur_offset,
3253                depth,
3254            )?;
3255
3256            _prev_end_offset = cur_offset + envelope_size;
3257            if 2 > max_ordinal {
3258                return Ok(());
3259            }
3260
3261            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3262            // are envelope_size bytes.
3263            let cur_offset: usize = (2 - 1) * envelope_size;
3264
3265            // Zero reserved fields.
3266            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3267
3268            // Safety:
3269            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3270            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3271            //   envelope_size bytes, there is always sufficient room.
3272            fidl::encoding::encode_in_envelope_optional::<Role, D>(
3273                self.role.as_ref().map(<Role as fidl::encoding::ValueTypeMarker>::borrow),
3274                encoder,
3275                offset + cur_offset,
3276                depth,
3277            )?;
3278
3279            _prev_end_offset = cur_offset + envelope_size;
3280
3281            Ok(())
3282        }
3283    }
3284
3285    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for DeviceState {
3286        #[inline(always)]
3287        fn new_empty() -> Self {
3288            Self::default()
3289        }
3290
3291        unsafe fn decode(
3292            &mut self,
3293            decoder: &mut fidl::encoding::Decoder<'_, D>,
3294            offset: usize,
3295            mut depth: fidl::encoding::Depth,
3296        ) -> fidl::Result<()> {
3297            decoder.debug_check_bounds::<Self>(offset);
3298            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
3299                None => return Err(fidl::Error::NotNullable),
3300                Some(len) => len,
3301            };
3302            // Calling decoder.out_of_line_offset(0) is not allowed.
3303            if len == 0 {
3304                return Ok(());
3305            };
3306            depth.increment()?;
3307            let envelope_size = 8;
3308            let bytes_len = len * envelope_size;
3309            let offset = decoder.out_of_line_offset(bytes_len)?;
3310            // Decode the envelope for each type.
3311            let mut _next_ordinal_to_read = 0;
3312            let mut next_offset = offset;
3313            let end_offset = offset + bytes_len;
3314            _next_ordinal_to_read += 1;
3315            if next_offset >= end_offset {
3316                return Ok(());
3317            }
3318
3319            // Decode unknown envelopes for gaps in ordinals.
3320            while _next_ordinal_to_read < 1 {
3321                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3322                _next_ordinal_to_read += 1;
3323                next_offset += envelope_size;
3324            }
3325
3326            let next_out_of_line = decoder.next_out_of_line();
3327            let handles_before = decoder.remaining_handles();
3328            if let Some((inlined, num_bytes, num_handles)) =
3329                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3330            {
3331                let member_inline_size =
3332                    <ConnectivityState as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3333                if inlined != (member_inline_size <= 4) {
3334                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3335                }
3336                let inner_offset;
3337                let mut inner_depth = depth.clone();
3338                if inlined {
3339                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3340                    inner_offset = next_offset;
3341                } else {
3342                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3343                    inner_depth.increment()?;
3344                }
3345                let val_ref = self
3346                    .connectivity_state
3347                    .get_or_insert_with(|| fidl::new_empty!(ConnectivityState, D));
3348                fidl::decode!(ConnectivityState, D, val_ref, decoder, inner_offset, inner_depth)?;
3349                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3350                {
3351                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3352                }
3353                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3354                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3355                }
3356            }
3357
3358            next_offset += envelope_size;
3359            _next_ordinal_to_read += 1;
3360            if next_offset >= end_offset {
3361                return Ok(());
3362            }
3363
3364            // Decode unknown envelopes for gaps in ordinals.
3365            while _next_ordinal_to_read < 2 {
3366                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3367                _next_ordinal_to_read += 1;
3368                next_offset += envelope_size;
3369            }
3370
3371            let next_out_of_line = decoder.next_out_of_line();
3372            let handles_before = decoder.remaining_handles();
3373            if let Some((inlined, num_bytes, num_handles)) =
3374                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3375            {
3376                let member_inline_size =
3377                    <Role as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3378                if inlined != (member_inline_size <= 4) {
3379                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3380                }
3381                let inner_offset;
3382                let mut inner_depth = depth.clone();
3383                if inlined {
3384                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3385                    inner_offset = next_offset;
3386                } else {
3387                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3388                    inner_depth.increment()?;
3389                }
3390                let val_ref = self.role.get_or_insert_with(|| fidl::new_empty!(Role, D));
3391                fidl::decode!(Role, D, val_ref, decoder, inner_offset, inner_depth)?;
3392                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3393                {
3394                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3395                }
3396                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3397                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3398                }
3399            }
3400
3401            next_offset += envelope_size;
3402
3403            // Decode the remaining unknown envelopes.
3404            while next_offset < end_offset {
3405                _next_ordinal_to_read += 1;
3406                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3407                next_offset += envelope_size;
3408            }
3409
3410            Ok(())
3411        }
3412    }
3413
3414    impl EnergyScanParameters {
3415        #[inline(always)]
3416        fn max_ordinal_present(&self) -> u64 {
3417            if let Some(_) = self.dwell_time_ms {
3418                return 2;
3419            }
3420            if let Some(_) = self.channels {
3421                return 1;
3422            }
3423            0
3424        }
3425    }
3426
3427    impl fidl::encoding::ValueTypeMarker for EnergyScanParameters {
3428        type Borrowed<'a> = &'a Self;
3429        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3430            value
3431        }
3432    }
3433
3434    unsafe impl fidl::encoding::TypeMarker for EnergyScanParameters {
3435        type Owned = Self;
3436
3437        #[inline(always)]
3438        fn inline_align(_context: fidl::encoding::Context) -> usize {
3439            8
3440        }
3441
3442        #[inline(always)]
3443        fn inline_size(_context: fidl::encoding::Context) -> usize {
3444            16
3445        }
3446    }
3447
3448    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<EnergyScanParameters, D>
3449        for &EnergyScanParameters
3450    {
3451        unsafe fn encode(
3452            self,
3453            encoder: &mut fidl::encoding::Encoder<'_, D>,
3454            offset: usize,
3455            mut depth: fidl::encoding::Depth,
3456        ) -> fidl::Result<()> {
3457            encoder.debug_check_bounds::<EnergyScanParameters>(offset);
3458            // Vector header
3459            let max_ordinal: u64 = self.max_ordinal_present();
3460            encoder.write_num(max_ordinal, offset);
3461            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
3462            // Calling encoder.out_of_line_offset(0) is not allowed.
3463            if max_ordinal == 0 {
3464                return Ok(());
3465            }
3466            depth.increment()?;
3467            let envelope_size = 8;
3468            let bytes_len = max_ordinal as usize * envelope_size;
3469            #[allow(unused_variables)]
3470            let offset = encoder.out_of_line_offset(bytes_len);
3471            let mut _prev_end_offset: usize = 0;
3472            if 1 > max_ordinal {
3473                return Ok(());
3474            }
3475
3476            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3477            // are envelope_size bytes.
3478            let cur_offset: usize = (1 - 1) * envelope_size;
3479
3480            // Zero reserved fields.
3481            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3482
3483            // Safety:
3484            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3485            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3486            //   envelope_size bytes, there is always sufficient room.
3487            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<u16, 200>, D>(
3488                self.channels.as_ref().map(
3489                    <fidl::encoding::Vector<u16, 200> as fidl::encoding::ValueTypeMarker>::borrow,
3490                ),
3491                encoder,
3492                offset + cur_offset,
3493                depth,
3494            )?;
3495
3496            _prev_end_offset = cur_offset + envelope_size;
3497            if 2 > max_ordinal {
3498                return Ok(());
3499            }
3500
3501            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3502            // are envelope_size bytes.
3503            let cur_offset: usize = (2 - 1) * envelope_size;
3504
3505            // Zero reserved fields.
3506            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3507
3508            // Safety:
3509            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3510            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3511            //   envelope_size bytes, there is always sufficient room.
3512            fidl::encoding::encode_in_envelope_optional::<u32, D>(
3513                self.dwell_time_ms.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
3514                encoder,
3515                offset + cur_offset,
3516                depth,
3517            )?;
3518
3519            _prev_end_offset = cur_offset + envelope_size;
3520
3521            Ok(())
3522        }
3523    }
3524
3525    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for EnergyScanParameters {
3526        #[inline(always)]
3527        fn new_empty() -> Self {
3528            Self::default()
3529        }
3530
3531        unsafe fn decode(
3532            &mut self,
3533            decoder: &mut fidl::encoding::Decoder<'_, D>,
3534            offset: usize,
3535            mut depth: fidl::encoding::Depth,
3536        ) -> fidl::Result<()> {
3537            decoder.debug_check_bounds::<Self>(offset);
3538            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
3539                None => return Err(fidl::Error::NotNullable),
3540                Some(len) => len,
3541            };
3542            // Calling decoder.out_of_line_offset(0) is not allowed.
3543            if len == 0 {
3544                return Ok(());
3545            };
3546            depth.increment()?;
3547            let envelope_size = 8;
3548            let bytes_len = len * envelope_size;
3549            let offset = decoder.out_of_line_offset(bytes_len)?;
3550            // Decode the envelope for each type.
3551            let mut _next_ordinal_to_read = 0;
3552            let mut next_offset = offset;
3553            let end_offset = offset + bytes_len;
3554            _next_ordinal_to_read += 1;
3555            if next_offset >= end_offset {
3556                return Ok(());
3557            }
3558
3559            // Decode unknown envelopes for gaps in ordinals.
3560            while _next_ordinal_to_read < 1 {
3561                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3562                _next_ordinal_to_read += 1;
3563                next_offset += envelope_size;
3564            }
3565
3566            let next_out_of_line = decoder.next_out_of_line();
3567            let handles_before = decoder.remaining_handles();
3568            if let Some((inlined, num_bytes, num_handles)) =
3569                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3570            {
3571                let member_inline_size =
3572                    <fidl::encoding::Vector<u16, 200> as fidl::encoding::TypeMarker>::inline_size(
3573                        decoder.context,
3574                    );
3575                if inlined != (member_inline_size <= 4) {
3576                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3577                }
3578                let inner_offset;
3579                let mut inner_depth = depth.clone();
3580                if inlined {
3581                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3582                    inner_offset = next_offset;
3583                } else {
3584                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3585                    inner_depth.increment()?;
3586                }
3587                let val_ref = self
3588                    .channels
3589                    .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<u16, 200>, D));
3590                fidl::decode!(fidl::encoding::Vector<u16, 200>, D, val_ref, decoder, inner_offset, inner_depth)?;
3591                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3592                {
3593                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3594                }
3595                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3596                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3597                }
3598            }
3599
3600            next_offset += envelope_size;
3601            _next_ordinal_to_read += 1;
3602            if next_offset >= end_offset {
3603                return Ok(());
3604            }
3605
3606            // Decode unknown envelopes for gaps in ordinals.
3607            while _next_ordinal_to_read < 2 {
3608                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3609                _next_ordinal_to_read += 1;
3610                next_offset += envelope_size;
3611            }
3612
3613            let next_out_of_line = decoder.next_out_of_line();
3614            let handles_before = decoder.remaining_handles();
3615            if let Some((inlined, num_bytes, num_handles)) =
3616                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3617            {
3618                let member_inline_size =
3619                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3620                if inlined != (member_inline_size <= 4) {
3621                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3622                }
3623                let inner_offset;
3624                let mut inner_depth = depth.clone();
3625                if inlined {
3626                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3627                    inner_offset = next_offset;
3628                } else {
3629                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3630                    inner_depth.increment()?;
3631                }
3632                let val_ref = self.dwell_time_ms.get_or_insert_with(|| fidl::new_empty!(u32, D));
3633                fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
3634                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3635                {
3636                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3637                }
3638                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3639                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3640                }
3641            }
3642
3643            next_offset += envelope_size;
3644
3645            // Decode the remaining unknown envelopes.
3646            while next_offset < end_offset {
3647                _next_ordinal_to_read += 1;
3648                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3649                next_offset += envelope_size;
3650            }
3651
3652            Ok(())
3653        }
3654    }
3655
3656    impl EnergyScanResult {
3657        #[inline(always)]
3658        fn max_ordinal_present(&self) -> u64 {
3659            if let Some(_) = self.min_rssi {
3660                return 3;
3661            }
3662            if let Some(_) = self.max_rssi {
3663                return 2;
3664            }
3665            if let Some(_) = self.channel_index {
3666                return 1;
3667            }
3668            0
3669        }
3670    }
3671
3672    impl fidl::encoding::ValueTypeMarker for EnergyScanResult {
3673        type Borrowed<'a> = &'a Self;
3674        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3675            value
3676        }
3677    }
3678
3679    unsafe impl fidl::encoding::TypeMarker for EnergyScanResult {
3680        type Owned = Self;
3681
3682        #[inline(always)]
3683        fn inline_align(_context: fidl::encoding::Context) -> usize {
3684            8
3685        }
3686
3687        #[inline(always)]
3688        fn inline_size(_context: fidl::encoding::Context) -> usize {
3689            16
3690        }
3691    }
3692
3693    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<EnergyScanResult, D>
3694        for &EnergyScanResult
3695    {
3696        unsafe fn encode(
3697            self,
3698            encoder: &mut fidl::encoding::Encoder<'_, D>,
3699            offset: usize,
3700            mut depth: fidl::encoding::Depth,
3701        ) -> fidl::Result<()> {
3702            encoder.debug_check_bounds::<EnergyScanResult>(offset);
3703            // Vector header
3704            let max_ordinal: u64 = self.max_ordinal_present();
3705            encoder.write_num(max_ordinal, offset);
3706            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
3707            // Calling encoder.out_of_line_offset(0) is not allowed.
3708            if max_ordinal == 0 {
3709                return Ok(());
3710            }
3711            depth.increment()?;
3712            let envelope_size = 8;
3713            let bytes_len = max_ordinal as usize * envelope_size;
3714            #[allow(unused_variables)]
3715            let offset = encoder.out_of_line_offset(bytes_len);
3716            let mut _prev_end_offset: usize = 0;
3717            if 1 > max_ordinal {
3718                return Ok(());
3719            }
3720
3721            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3722            // are envelope_size bytes.
3723            let cur_offset: usize = (1 - 1) * envelope_size;
3724
3725            // Zero reserved fields.
3726            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3727
3728            // Safety:
3729            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3730            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3731            //   envelope_size bytes, there is always sufficient room.
3732            fidl::encoding::encode_in_envelope_optional::<u16, D>(
3733                self.channel_index.as_ref().map(<u16 as fidl::encoding::ValueTypeMarker>::borrow),
3734                encoder,
3735                offset + cur_offset,
3736                depth,
3737            )?;
3738
3739            _prev_end_offset = cur_offset + envelope_size;
3740            if 2 > max_ordinal {
3741                return Ok(());
3742            }
3743
3744            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3745            // are envelope_size bytes.
3746            let cur_offset: usize = (2 - 1) * envelope_size;
3747
3748            // Zero reserved fields.
3749            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3750
3751            // Safety:
3752            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3753            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3754            //   envelope_size bytes, there is always sufficient room.
3755            fidl::encoding::encode_in_envelope_optional::<i32, D>(
3756                self.max_rssi.as_ref().map(<i32 as fidl::encoding::ValueTypeMarker>::borrow),
3757                encoder,
3758                offset + cur_offset,
3759                depth,
3760            )?;
3761
3762            _prev_end_offset = cur_offset + envelope_size;
3763            if 3 > max_ordinal {
3764                return Ok(());
3765            }
3766
3767            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3768            // are envelope_size bytes.
3769            let cur_offset: usize = (3 - 1) * envelope_size;
3770
3771            // Zero reserved fields.
3772            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3773
3774            // Safety:
3775            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3776            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3777            //   envelope_size bytes, there is always sufficient room.
3778            fidl::encoding::encode_in_envelope_optional::<i32, D>(
3779                self.min_rssi.as_ref().map(<i32 as fidl::encoding::ValueTypeMarker>::borrow),
3780                encoder,
3781                offset + cur_offset,
3782                depth,
3783            )?;
3784
3785            _prev_end_offset = cur_offset + envelope_size;
3786
3787            Ok(())
3788        }
3789    }
3790
3791    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for EnergyScanResult {
3792        #[inline(always)]
3793        fn new_empty() -> Self {
3794            Self::default()
3795        }
3796
3797        unsafe fn decode(
3798            &mut self,
3799            decoder: &mut fidl::encoding::Decoder<'_, D>,
3800            offset: usize,
3801            mut depth: fidl::encoding::Depth,
3802        ) -> fidl::Result<()> {
3803            decoder.debug_check_bounds::<Self>(offset);
3804            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
3805                None => return Err(fidl::Error::NotNullable),
3806                Some(len) => len,
3807            };
3808            // Calling decoder.out_of_line_offset(0) is not allowed.
3809            if len == 0 {
3810                return Ok(());
3811            };
3812            depth.increment()?;
3813            let envelope_size = 8;
3814            let bytes_len = len * envelope_size;
3815            let offset = decoder.out_of_line_offset(bytes_len)?;
3816            // Decode the envelope for each type.
3817            let mut _next_ordinal_to_read = 0;
3818            let mut next_offset = offset;
3819            let end_offset = offset + bytes_len;
3820            _next_ordinal_to_read += 1;
3821            if next_offset >= end_offset {
3822                return Ok(());
3823            }
3824
3825            // Decode unknown envelopes for gaps in ordinals.
3826            while _next_ordinal_to_read < 1 {
3827                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3828                _next_ordinal_to_read += 1;
3829                next_offset += envelope_size;
3830            }
3831
3832            let next_out_of_line = decoder.next_out_of_line();
3833            let handles_before = decoder.remaining_handles();
3834            if let Some((inlined, num_bytes, num_handles)) =
3835                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3836            {
3837                let member_inline_size =
3838                    <u16 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3839                if inlined != (member_inline_size <= 4) {
3840                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3841                }
3842                let inner_offset;
3843                let mut inner_depth = depth.clone();
3844                if inlined {
3845                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3846                    inner_offset = next_offset;
3847                } else {
3848                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3849                    inner_depth.increment()?;
3850                }
3851                let val_ref = self.channel_index.get_or_insert_with(|| fidl::new_empty!(u16, D));
3852                fidl::decode!(u16, D, val_ref, decoder, inner_offset, inner_depth)?;
3853                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3854                {
3855                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3856                }
3857                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3858                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3859                }
3860            }
3861
3862            next_offset += envelope_size;
3863            _next_ordinal_to_read += 1;
3864            if next_offset >= end_offset {
3865                return Ok(());
3866            }
3867
3868            // Decode unknown envelopes for gaps in ordinals.
3869            while _next_ordinal_to_read < 2 {
3870                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3871                _next_ordinal_to_read += 1;
3872                next_offset += envelope_size;
3873            }
3874
3875            let next_out_of_line = decoder.next_out_of_line();
3876            let handles_before = decoder.remaining_handles();
3877            if let Some((inlined, num_bytes, num_handles)) =
3878                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3879            {
3880                let member_inline_size =
3881                    <i32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3882                if inlined != (member_inline_size <= 4) {
3883                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3884                }
3885                let inner_offset;
3886                let mut inner_depth = depth.clone();
3887                if inlined {
3888                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3889                    inner_offset = next_offset;
3890                } else {
3891                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3892                    inner_depth.increment()?;
3893                }
3894                let val_ref = self.max_rssi.get_or_insert_with(|| fidl::new_empty!(i32, D));
3895                fidl::decode!(i32, D, val_ref, decoder, inner_offset, inner_depth)?;
3896                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3897                {
3898                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3899                }
3900                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3901                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3902                }
3903            }
3904
3905            next_offset += envelope_size;
3906            _next_ordinal_to_read += 1;
3907            if next_offset >= end_offset {
3908                return Ok(());
3909            }
3910
3911            // Decode unknown envelopes for gaps in ordinals.
3912            while _next_ordinal_to_read < 3 {
3913                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3914                _next_ordinal_to_read += 1;
3915                next_offset += envelope_size;
3916            }
3917
3918            let next_out_of_line = decoder.next_out_of_line();
3919            let handles_before = decoder.remaining_handles();
3920            if let Some((inlined, num_bytes, num_handles)) =
3921                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3922            {
3923                let member_inline_size =
3924                    <i32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3925                if inlined != (member_inline_size <= 4) {
3926                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3927                }
3928                let inner_offset;
3929                let mut inner_depth = depth.clone();
3930                if inlined {
3931                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3932                    inner_offset = next_offset;
3933                } else {
3934                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3935                    inner_depth.increment()?;
3936                }
3937                let val_ref = self.min_rssi.get_or_insert_with(|| fidl::new_empty!(i32, D));
3938                fidl::decode!(i32, D, val_ref, decoder, inner_offset, inner_depth)?;
3939                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3940                {
3941                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3942                }
3943                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3944                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3945                }
3946            }
3947
3948            next_offset += envelope_size;
3949
3950            // Decode the remaining unknown envelopes.
3951            while next_offset < end_offset {
3952                _next_ordinal_to_read += 1;
3953                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3954                next_offset += envelope_size;
3955            }
3956
3957            Ok(())
3958        }
3959    }
3960
3961    impl Identity {
3962        #[inline(always)]
3963        fn max_ordinal_present(&self) -> u64 {
3964            if let Some(_) = self.xpanid {
3965                return 7;
3966            }
3967            if let Some(_) = self.mesh_local_prefix {
3968                return 6;
3969            }
3970            if let Some(_) = self.panid {
3971                return 5;
3972            }
3973            if let Some(_) = self.channel {
3974                return 4;
3975            }
3976            if let Some(_) = self.net_type {
3977                return 3;
3978            }
3979            if let Some(_) = self.raw_name {
3980                return 1;
3981            }
3982            0
3983        }
3984    }
3985
3986    impl fidl::encoding::ValueTypeMarker for Identity {
3987        type Borrowed<'a> = &'a Self;
3988        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3989            value
3990        }
3991    }
3992
3993    unsafe impl fidl::encoding::TypeMarker for Identity {
3994        type Owned = Self;
3995
3996        #[inline(always)]
3997        fn inline_align(_context: fidl::encoding::Context) -> usize {
3998            8
3999        }
4000
4001        #[inline(always)]
4002        fn inline_size(_context: fidl::encoding::Context) -> usize {
4003            16
4004        }
4005    }
4006
4007    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Identity, D> for &Identity {
4008        unsafe fn encode(
4009            self,
4010            encoder: &mut fidl::encoding::Encoder<'_, D>,
4011            offset: usize,
4012            mut depth: fidl::encoding::Depth,
4013        ) -> fidl::Result<()> {
4014            encoder.debug_check_bounds::<Identity>(offset);
4015            // Vector header
4016            let max_ordinal: u64 = self.max_ordinal_present();
4017            encoder.write_num(max_ordinal, offset);
4018            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
4019            // Calling encoder.out_of_line_offset(0) is not allowed.
4020            if max_ordinal == 0 {
4021                return Ok(());
4022            }
4023            depth.increment()?;
4024            let envelope_size = 8;
4025            let bytes_len = max_ordinal as usize * envelope_size;
4026            #[allow(unused_variables)]
4027            let offset = encoder.out_of_line_offset(bytes_len);
4028            let mut _prev_end_offset: usize = 0;
4029            if 1 > max_ordinal {
4030                return Ok(());
4031            }
4032
4033            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4034            // are envelope_size bytes.
4035            let cur_offset: usize = (1 - 1) * envelope_size;
4036
4037            // Zero reserved fields.
4038            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4039
4040            // Safety:
4041            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4042            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4043            //   envelope_size bytes, there is always sufficient room.
4044            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<u8, 63>, D>(
4045                self.raw_name.as_ref().map(
4046                    <fidl::encoding::Vector<u8, 63> as fidl::encoding::ValueTypeMarker>::borrow,
4047                ),
4048                encoder,
4049                offset + cur_offset,
4050                depth,
4051            )?;
4052
4053            _prev_end_offset = cur_offset + envelope_size;
4054            if 3 > max_ordinal {
4055                return Ok(());
4056            }
4057
4058            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4059            // are envelope_size bytes.
4060            let cur_offset: usize = (3 - 1) * envelope_size;
4061
4062            // Zero reserved fields.
4063            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4064
4065            // Safety:
4066            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4067            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4068            //   envelope_size bytes, there is always sufficient room.
4069            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<64>, D>(
4070                self.net_type.as_ref().map(
4071                    <fidl::encoding::BoundedString<64> as fidl::encoding::ValueTypeMarker>::borrow,
4072                ),
4073                encoder,
4074                offset + cur_offset,
4075                depth,
4076            )?;
4077
4078            _prev_end_offset = cur_offset + envelope_size;
4079            if 4 > max_ordinal {
4080                return Ok(());
4081            }
4082
4083            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4084            // are envelope_size bytes.
4085            let cur_offset: usize = (4 - 1) * envelope_size;
4086
4087            // Zero reserved fields.
4088            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4089
4090            // Safety:
4091            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4092            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4093            //   envelope_size bytes, there is always sufficient room.
4094            fidl::encoding::encode_in_envelope_optional::<u16, D>(
4095                self.channel.as_ref().map(<u16 as fidl::encoding::ValueTypeMarker>::borrow),
4096                encoder,
4097                offset + cur_offset,
4098                depth,
4099            )?;
4100
4101            _prev_end_offset = cur_offset + envelope_size;
4102            if 5 > max_ordinal {
4103                return Ok(());
4104            }
4105
4106            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4107            // are envelope_size bytes.
4108            let cur_offset: usize = (5 - 1) * envelope_size;
4109
4110            // Zero reserved fields.
4111            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4112
4113            // Safety:
4114            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4115            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4116            //   envelope_size bytes, there is always sufficient room.
4117            fidl::encoding::encode_in_envelope_optional::<u16, D>(
4118                self.panid.as_ref().map(<u16 as fidl::encoding::ValueTypeMarker>::borrow),
4119                encoder,
4120                offset + cur_offset,
4121                depth,
4122            )?;
4123
4124            _prev_end_offset = cur_offset + envelope_size;
4125            if 6 > max_ordinal {
4126                return Ok(());
4127            }
4128
4129            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4130            // are envelope_size bytes.
4131            let cur_offset: usize = (6 - 1) * envelope_size;
4132
4133            // Zero reserved fields.
4134            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4135
4136            // Safety:
4137            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4138            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4139            //   envelope_size bytes, there is always sufficient room.
4140            fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_net::Ipv6AddressWithPrefix, D>(
4141            self.mesh_local_prefix.as_ref().map(<fidl_fuchsia_net::Ipv6AddressWithPrefix as fidl::encoding::ValueTypeMarker>::borrow),
4142            encoder, offset + cur_offset, depth
4143        )?;
4144
4145            _prev_end_offset = cur_offset + envelope_size;
4146            if 7 > max_ordinal {
4147                return Ok(());
4148            }
4149
4150            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4151            // are envelope_size bytes.
4152            let cur_offset: usize = (7 - 1) * envelope_size;
4153
4154            // Zero reserved fields.
4155            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4156
4157            // Safety:
4158            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4159            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4160            //   envelope_size bytes, there is always sufficient room.
4161            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Array<u8, 8>, D>(
4162                self.xpanid
4163                    .as_ref()
4164                    .map(<fidl::encoding::Array<u8, 8> as fidl::encoding::ValueTypeMarker>::borrow),
4165                encoder,
4166                offset + cur_offset,
4167                depth,
4168            )?;
4169
4170            _prev_end_offset = cur_offset + envelope_size;
4171
4172            Ok(())
4173        }
4174    }
4175
4176    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Identity {
4177        #[inline(always)]
4178        fn new_empty() -> Self {
4179            Self::default()
4180        }
4181
4182        unsafe fn decode(
4183            &mut self,
4184            decoder: &mut fidl::encoding::Decoder<'_, D>,
4185            offset: usize,
4186            mut depth: fidl::encoding::Depth,
4187        ) -> fidl::Result<()> {
4188            decoder.debug_check_bounds::<Self>(offset);
4189            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
4190                None => return Err(fidl::Error::NotNullable),
4191                Some(len) => len,
4192            };
4193            // Calling decoder.out_of_line_offset(0) is not allowed.
4194            if len == 0 {
4195                return Ok(());
4196            };
4197            depth.increment()?;
4198            let envelope_size = 8;
4199            let bytes_len = len * envelope_size;
4200            let offset = decoder.out_of_line_offset(bytes_len)?;
4201            // Decode the envelope for each type.
4202            let mut _next_ordinal_to_read = 0;
4203            let mut next_offset = offset;
4204            let end_offset = offset + bytes_len;
4205            _next_ordinal_to_read += 1;
4206            if next_offset >= end_offset {
4207                return Ok(());
4208            }
4209
4210            // Decode unknown envelopes for gaps in ordinals.
4211            while _next_ordinal_to_read < 1 {
4212                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4213                _next_ordinal_to_read += 1;
4214                next_offset += envelope_size;
4215            }
4216
4217            let next_out_of_line = decoder.next_out_of_line();
4218            let handles_before = decoder.remaining_handles();
4219            if let Some((inlined, num_bytes, num_handles)) =
4220                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4221            {
4222                let member_inline_size =
4223                    <fidl::encoding::Vector<u8, 63> as fidl::encoding::TypeMarker>::inline_size(
4224                        decoder.context,
4225                    );
4226                if inlined != (member_inline_size <= 4) {
4227                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4228                }
4229                let inner_offset;
4230                let mut inner_depth = depth.clone();
4231                if inlined {
4232                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4233                    inner_offset = next_offset;
4234                } else {
4235                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4236                    inner_depth.increment()?;
4237                }
4238                let val_ref = self
4239                    .raw_name
4240                    .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<u8, 63>, D));
4241                fidl::decode!(fidl::encoding::Vector<u8, 63>, D, val_ref, decoder, inner_offset, inner_depth)?;
4242                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4243                {
4244                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4245                }
4246                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4247                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4248                }
4249            }
4250
4251            next_offset += envelope_size;
4252            _next_ordinal_to_read += 1;
4253            if next_offset >= end_offset {
4254                return Ok(());
4255            }
4256
4257            // Decode unknown envelopes for gaps in ordinals.
4258            while _next_ordinal_to_read < 3 {
4259                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4260                _next_ordinal_to_read += 1;
4261                next_offset += envelope_size;
4262            }
4263
4264            let next_out_of_line = decoder.next_out_of_line();
4265            let handles_before = decoder.remaining_handles();
4266            if let Some((inlined, num_bytes, num_handles)) =
4267                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4268            {
4269                let member_inline_size =
4270                    <fidl::encoding::BoundedString<64> as fidl::encoding::TypeMarker>::inline_size(
4271                        decoder.context,
4272                    );
4273                if inlined != (member_inline_size <= 4) {
4274                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4275                }
4276                let inner_offset;
4277                let mut inner_depth = depth.clone();
4278                if inlined {
4279                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4280                    inner_offset = next_offset;
4281                } else {
4282                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4283                    inner_depth.increment()?;
4284                }
4285                let val_ref = self
4286                    .net_type
4287                    .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::BoundedString<64>, D));
4288                fidl::decode!(
4289                    fidl::encoding::BoundedString<64>,
4290                    D,
4291                    val_ref,
4292                    decoder,
4293                    inner_offset,
4294                    inner_depth
4295                )?;
4296                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4297                {
4298                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4299                }
4300                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4301                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4302                }
4303            }
4304
4305            next_offset += envelope_size;
4306            _next_ordinal_to_read += 1;
4307            if next_offset >= end_offset {
4308                return Ok(());
4309            }
4310
4311            // Decode unknown envelopes for gaps in ordinals.
4312            while _next_ordinal_to_read < 4 {
4313                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4314                _next_ordinal_to_read += 1;
4315                next_offset += envelope_size;
4316            }
4317
4318            let next_out_of_line = decoder.next_out_of_line();
4319            let handles_before = decoder.remaining_handles();
4320            if let Some((inlined, num_bytes, num_handles)) =
4321                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4322            {
4323                let member_inline_size =
4324                    <u16 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4325                if inlined != (member_inline_size <= 4) {
4326                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4327                }
4328                let inner_offset;
4329                let mut inner_depth = depth.clone();
4330                if inlined {
4331                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4332                    inner_offset = next_offset;
4333                } else {
4334                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4335                    inner_depth.increment()?;
4336                }
4337                let val_ref = self.channel.get_or_insert_with(|| fidl::new_empty!(u16, D));
4338                fidl::decode!(u16, D, val_ref, decoder, inner_offset, inner_depth)?;
4339                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4340                {
4341                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4342                }
4343                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4344                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4345                }
4346            }
4347
4348            next_offset += envelope_size;
4349            _next_ordinal_to_read += 1;
4350            if next_offset >= end_offset {
4351                return Ok(());
4352            }
4353
4354            // Decode unknown envelopes for gaps in ordinals.
4355            while _next_ordinal_to_read < 5 {
4356                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4357                _next_ordinal_to_read += 1;
4358                next_offset += envelope_size;
4359            }
4360
4361            let next_out_of_line = decoder.next_out_of_line();
4362            let handles_before = decoder.remaining_handles();
4363            if let Some((inlined, num_bytes, num_handles)) =
4364                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4365            {
4366                let member_inline_size =
4367                    <u16 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4368                if inlined != (member_inline_size <= 4) {
4369                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4370                }
4371                let inner_offset;
4372                let mut inner_depth = depth.clone();
4373                if inlined {
4374                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4375                    inner_offset = next_offset;
4376                } else {
4377                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4378                    inner_depth.increment()?;
4379                }
4380                let val_ref = self.panid.get_or_insert_with(|| fidl::new_empty!(u16, D));
4381                fidl::decode!(u16, D, val_ref, decoder, inner_offset, inner_depth)?;
4382                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4383                {
4384                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4385                }
4386                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4387                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4388                }
4389            }
4390
4391            next_offset += envelope_size;
4392            _next_ordinal_to_read += 1;
4393            if next_offset >= end_offset {
4394                return Ok(());
4395            }
4396
4397            // Decode unknown envelopes for gaps in ordinals.
4398            while _next_ordinal_to_read < 6 {
4399                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4400                _next_ordinal_to_read += 1;
4401                next_offset += envelope_size;
4402            }
4403
4404            let next_out_of_line = decoder.next_out_of_line();
4405            let handles_before = decoder.remaining_handles();
4406            if let Some((inlined, num_bytes, num_handles)) =
4407                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4408            {
4409                let member_inline_size = <fidl_fuchsia_net::Ipv6AddressWithPrefix as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4410                if inlined != (member_inline_size <= 4) {
4411                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4412                }
4413                let inner_offset;
4414                let mut inner_depth = depth.clone();
4415                if inlined {
4416                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4417                    inner_offset = next_offset;
4418                } else {
4419                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4420                    inner_depth.increment()?;
4421                }
4422                let val_ref = self.mesh_local_prefix.get_or_insert_with(|| {
4423                    fidl::new_empty!(fidl_fuchsia_net::Ipv6AddressWithPrefix, D)
4424                });
4425                fidl::decode!(
4426                    fidl_fuchsia_net::Ipv6AddressWithPrefix,
4427                    D,
4428                    val_ref,
4429                    decoder,
4430                    inner_offset,
4431                    inner_depth
4432                )?;
4433                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4434                {
4435                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4436                }
4437                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4438                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4439                }
4440            }
4441
4442            next_offset += envelope_size;
4443            _next_ordinal_to_read += 1;
4444            if next_offset >= end_offset {
4445                return Ok(());
4446            }
4447
4448            // Decode unknown envelopes for gaps in ordinals.
4449            while _next_ordinal_to_read < 7 {
4450                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4451                _next_ordinal_to_read += 1;
4452                next_offset += envelope_size;
4453            }
4454
4455            let next_out_of_line = decoder.next_out_of_line();
4456            let handles_before = decoder.remaining_handles();
4457            if let Some((inlined, num_bytes, num_handles)) =
4458                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4459            {
4460                let member_inline_size =
4461                    <fidl::encoding::Array<u8, 8> as fidl::encoding::TypeMarker>::inline_size(
4462                        decoder.context,
4463                    );
4464                if inlined != (member_inline_size <= 4) {
4465                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4466                }
4467                let inner_offset;
4468                let mut inner_depth = depth.clone();
4469                if inlined {
4470                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4471                    inner_offset = next_offset;
4472                } else {
4473                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4474                    inner_depth.increment()?;
4475                }
4476                let val_ref = self
4477                    .xpanid
4478                    .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Array<u8, 8>, D));
4479                fidl::decode!(fidl::encoding::Array<u8, 8>, D, val_ref, decoder, inner_offset, inner_depth)?;
4480                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4481                {
4482                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4483                }
4484                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4485                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4486                }
4487            }
4488
4489            next_offset += envelope_size;
4490
4491            // Decode the remaining unknown envelopes.
4492            while next_offset < end_offset {
4493                _next_ordinal_to_read += 1;
4494                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4495                next_offset += envelope_size;
4496            }
4497
4498            Ok(())
4499        }
4500    }
4501
4502    impl IpCounters {
4503        #[inline(always)]
4504        fn max_ordinal_present(&self) -> u64 {
4505            if let Some(_) = self.failure {
4506                return 2;
4507            }
4508            if let Some(_) = self.success {
4509                return 1;
4510            }
4511            0
4512        }
4513    }
4514
4515    impl fidl::encoding::ValueTypeMarker for IpCounters {
4516        type Borrowed<'a> = &'a Self;
4517        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4518            value
4519        }
4520    }
4521
4522    unsafe impl fidl::encoding::TypeMarker for IpCounters {
4523        type Owned = Self;
4524
4525        #[inline(always)]
4526        fn inline_align(_context: fidl::encoding::Context) -> usize {
4527            8
4528        }
4529
4530        #[inline(always)]
4531        fn inline_size(_context: fidl::encoding::Context) -> usize {
4532            16
4533        }
4534    }
4535
4536    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<IpCounters, D>
4537        for &IpCounters
4538    {
4539        unsafe fn encode(
4540            self,
4541            encoder: &mut fidl::encoding::Encoder<'_, D>,
4542            offset: usize,
4543            mut depth: fidl::encoding::Depth,
4544        ) -> fidl::Result<()> {
4545            encoder.debug_check_bounds::<IpCounters>(offset);
4546            // Vector header
4547            let max_ordinal: u64 = self.max_ordinal_present();
4548            encoder.write_num(max_ordinal, offset);
4549            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
4550            // Calling encoder.out_of_line_offset(0) is not allowed.
4551            if max_ordinal == 0 {
4552                return Ok(());
4553            }
4554            depth.increment()?;
4555            let envelope_size = 8;
4556            let bytes_len = max_ordinal as usize * envelope_size;
4557            #[allow(unused_variables)]
4558            let offset = encoder.out_of_line_offset(bytes_len);
4559            let mut _prev_end_offset: usize = 0;
4560            if 1 > max_ordinal {
4561                return Ok(());
4562            }
4563
4564            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4565            // are envelope_size bytes.
4566            let cur_offset: usize = (1 - 1) * envelope_size;
4567
4568            // Zero reserved fields.
4569            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4570
4571            // Safety:
4572            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4573            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4574            //   envelope_size bytes, there is always sufficient room.
4575            fidl::encoding::encode_in_envelope_optional::<u32, D>(
4576                self.success.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
4577                encoder,
4578                offset + cur_offset,
4579                depth,
4580            )?;
4581
4582            _prev_end_offset = cur_offset + envelope_size;
4583            if 2 > max_ordinal {
4584                return Ok(());
4585            }
4586
4587            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4588            // are envelope_size bytes.
4589            let cur_offset: usize = (2 - 1) * envelope_size;
4590
4591            // Zero reserved fields.
4592            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4593
4594            // Safety:
4595            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4596            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4597            //   envelope_size bytes, there is always sufficient room.
4598            fidl::encoding::encode_in_envelope_optional::<u32, D>(
4599                self.failure.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
4600                encoder,
4601                offset + cur_offset,
4602                depth,
4603            )?;
4604
4605            _prev_end_offset = cur_offset + envelope_size;
4606
4607            Ok(())
4608        }
4609    }
4610
4611    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for IpCounters {
4612        #[inline(always)]
4613        fn new_empty() -> Self {
4614            Self::default()
4615        }
4616
4617        unsafe fn decode(
4618            &mut self,
4619            decoder: &mut fidl::encoding::Decoder<'_, D>,
4620            offset: usize,
4621            mut depth: fidl::encoding::Depth,
4622        ) -> fidl::Result<()> {
4623            decoder.debug_check_bounds::<Self>(offset);
4624            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
4625                None => return Err(fidl::Error::NotNullable),
4626                Some(len) => len,
4627            };
4628            // Calling decoder.out_of_line_offset(0) is not allowed.
4629            if len == 0 {
4630                return Ok(());
4631            };
4632            depth.increment()?;
4633            let envelope_size = 8;
4634            let bytes_len = len * envelope_size;
4635            let offset = decoder.out_of_line_offset(bytes_len)?;
4636            // Decode the envelope for each type.
4637            let mut _next_ordinal_to_read = 0;
4638            let mut next_offset = offset;
4639            let end_offset = offset + bytes_len;
4640            _next_ordinal_to_read += 1;
4641            if next_offset >= end_offset {
4642                return Ok(());
4643            }
4644
4645            // Decode unknown envelopes for gaps in ordinals.
4646            while _next_ordinal_to_read < 1 {
4647                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4648                _next_ordinal_to_read += 1;
4649                next_offset += envelope_size;
4650            }
4651
4652            let next_out_of_line = decoder.next_out_of_line();
4653            let handles_before = decoder.remaining_handles();
4654            if let Some((inlined, num_bytes, num_handles)) =
4655                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4656            {
4657                let member_inline_size =
4658                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4659                if inlined != (member_inline_size <= 4) {
4660                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4661                }
4662                let inner_offset;
4663                let mut inner_depth = depth.clone();
4664                if inlined {
4665                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4666                    inner_offset = next_offset;
4667                } else {
4668                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4669                    inner_depth.increment()?;
4670                }
4671                let val_ref = self.success.get_or_insert_with(|| fidl::new_empty!(u32, D));
4672                fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
4673                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4674                {
4675                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4676                }
4677                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4678                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4679                }
4680            }
4681
4682            next_offset += envelope_size;
4683            _next_ordinal_to_read += 1;
4684            if next_offset >= end_offset {
4685                return Ok(());
4686            }
4687
4688            // Decode unknown envelopes for gaps in ordinals.
4689            while _next_ordinal_to_read < 2 {
4690                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4691                _next_ordinal_to_read += 1;
4692                next_offset += envelope_size;
4693            }
4694
4695            let next_out_of_line = decoder.next_out_of_line();
4696            let handles_before = decoder.remaining_handles();
4697            if let Some((inlined, num_bytes, num_handles)) =
4698                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4699            {
4700                let member_inline_size =
4701                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4702                if inlined != (member_inline_size <= 4) {
4703                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4704                }
4705                let inner_offset;
4706                let mut inner_depth = depth.clone();
4707                if inlined {
4708                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4709                    inner_offset = next_offset;
4710                } else {
4711                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4712                    inner_depth.increment()?;
4713                }
4714                let val_ref = self.failure.get_or_insert_with(|| fidl::new_empty!(u32, D));
4715                fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
4716                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4717                {
4718                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4719                }
4720                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4721                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4722                }
4723            }
4724
4725            next_offset += envelope_size;
4726
4727            // Decode the remaining unknown envelopes.
4728            while next_offset < end_offset {
4729                _next_ordinal_to_read += 1;
4730                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4731                next_offset += envelope_size;
4732            }
4733
4734            Ok(())
4735        }
4736    }
4737
4738    impl MacCounters {
4739        #[inline(always)]
4740        fn max_ordinal_present(&self) -> u64 {
4741            if let Some(_) = self.err_other {
4742                return 26;
4743            }
4744            if let Some(_) = self.err_busy_channel {
4745                return 25;
4746            }
4747            if let Some(_) = self.err_abort {
4748                return 24;
4749            }
4750            if let Some(_) = self.err_cca {
4751                return 23;
4752            }
4753            if let Some(_) = self.err_fcs {
4754                return 22;
4755            }
4756            if let Some(_) = self.err_sec {
4757                return 21;
4758            }
4759            if let Some(_) = self.err_invalid_src_addr {
4760                return 20;
4761            }
4762            if let Some(_) = self.err_unknown_neighbor {
4763                return 19;
4764            }
4765            if let Some(_) = self.err_no_frame {
4766                return 18;
4767            }
4768            if let Some(_) = self.duplicated {
4769                return 17;
4770            }
4771            if let Some(_) = self.dest_addr_filtered {
4772                return 16;
4773            }
4774            if let Some(_) = self.indirect_max_retry_expiry {
4775                return 15;
4776            }
4777            if let Some(_) = self.direct_max_retry_expiry {
4778                return 14;
4779            }
4780            if let Some(_) = self.retries {
4781                return 13;
4782            }
4783            if let Some(_) = self.address_filtered {
4784                return 12;
4785            }
4786            if let Some(_) = self.other {
4787                return 11;
4788            }
4789            if let Some(_) = self.beacon_request {
4790                return 10;
4791            }
4792            if let Some(_) = self.beacon {
4793                return 9;
4794            }
4795            if let Some(_) = self.data_poll {
4796                return 8;
4797            }
4798            if let Some(_) = self.data {
4799                return 7;
4800            }
4801            if let Some(_) = self.no_ack_requested {
4802                return 6;
4803            }
4804            if let Some(_) = self.acked {
4805                return 5;
4806            }
4807            if let Some(_) = self.ack_requested {
4808                return 4;
4809            }
4810            if let Some(_) = self.broadcast {
4811                return 3;
4812            }
4813            if let Some(_) = self.unicast {
4814                return 2;
4815            }
4816            if let Some(_) = self.total {
4817                return 1;
4818            }
4819            0
4820        }
4821    }
4822
4823    impl fidl::encoding::ValueTypeMarker for MacCounters {
4824        type Borrowed<'a> = &'a Self;
4825        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4826            value
4827        }
4828    }
4829
4830    unsafe impl fidl::encoding::TypeMarker for MacCounters {
4831        type Owned = Self;
4832
4833        #[inline(always)]
4834        fn inline_align(_context: fidl::encoding::Context) -> usize {
4835            8
4836        }
4837
4838        #[inline(always)]
4839        fn inline_size(_context: fidl::encoding::Context) -> usize {
4840            16
4841        }
4842    }
4843
4844    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<MacCounters, D>
4845        for &MacCounters
4846    {
4847        unsafe fn encode(
4848            self,
4849            encoder: &mut fidl::encoding::Encoder<'_, D>,
4850            offset: usize,
4851            mut depth: fidl::encoding::Depth,
4852        ) -> fidl::Result<()> {
4853            encoder.debug_check_bounds::<MacCounters>(offset);
4854            // Vector header
4855            let max_ordinal: u64 = self.max_ordinal_present();
4856            encoder.write_num(max_ordinal, offset);
4857            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
4858            // Calling encoder.out_of_line_offset(0) is not allowed.
4859            if max_ordinal == 0 {
4860                return Ok(());
4861            }
4862            depth.increment()?;
4863            let envelope_size = 8;
4864            let bytes_len = max_ordinal as usize * envelope_size;
4865            #[allow(unused_variables)]
4866            let offset = encoder.out_of_line_offset(bytes_len);
4867            let mut _prev_end_offset: usize = 0;
4868            if 1 > max_ordinal {
4869                return Ok(());
4870            }
4871
4872            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4873            // are envelope_size bytes.
4874            let cur_offset: usize = (1 - 1) * envelope_size;
4875
4876            // Zero reserved fields.
4877            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4878
4879            // Safety:
4880            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4881            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4882            //   envelope_size bytes, there is always sufficient room.
4883            fidl::encoding::encode_in_envelope_optional::<u32, D>(
4884                self.total.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
4885                encoder,
4886                offset + cur_offset,
4887                depth,
4888            )?;
4889
4890            _prev_end_offset = cur_offset + envelope_size;
4891            if 2 > max_ordinal {
4892                return Ok(());
4893            }
4894
4895            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4896            // are envelope_size bytes.
4897            let cur_offset: usize = (2 - 1) * envelope_size;
4898
4899            // Zero reserved fields.
4900            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4901
4902            // Safety:
4903            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4904            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4905            //   envelope_size bytes, there is always sufficient room.
4906            fidl::encoding::encode_in_envelope_optional::<u32, D>(
4907                self.unicast.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
4908                encoder,
4909                offset + cur_offset,
4910                depth,
4911            )?;
4912
4913            _prev_end_offset = cur_offset + envelope_size;
4914            if 3 > max_ordinal {
4915                return Ok(());
4916            }
4917
4918            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4919            // are envelope_size bytes.
4920            let cur_offset: usize = (3 - 1) * envelope_size;
4921
4922            // Zero reserved fields.
4923            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4924
4925            // Safety:
4926            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4927            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4928            //   envelope_size bytes, there is always sufficient room.
4929            fidl::encoding::encode_in_envelope_optional::<u32, D>(
4930                self.broadcast.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
4931                encoder,
4932                offset + cur_offset,
4933                depth,
4934            )?;
4935
4936            _prev_end_offset = cur_offset + envelope_size;
4937            if 4 > max_ordinal {
4938                return Ok(());
4939            }
4940
4941            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4942            // are envelope_size bytes.
4943            let cur_offset: usize = (4 - 1) * envelope_size;
4944
4945            // Zero reserved fields.
4946            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4947
4948            // Safety:
4949            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4950            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4951            //   envelope_size bytes, there is always sufficient room.
4952            fidl::encoding::encode_in_envelope_optional::<u32, D>(
4953                self.ack_requested.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
4954                encoder,
4955                offset + cur_offset,
4956                depth,
4957            )?;
4958
4959            _prev_end_offset = cur_offset + envelope_size;
4960            if 5 > max_ordinal {
4961                return Ok(());
4962            }
4963
4964            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4965            // are envelope_size bytes.
4966            let cur_offset: usize = (5 - 1) * envelope_size;
4967
4968            // Zero reserved fields.
4969            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4970
4971            // Safety:
4972            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4973            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4974            //   envelope_size bytes, there is always sufficient room.
4975            fidl::encoding::encode_in_envelope_optional::<u32, D>(
4976                self.acked.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
4977                encoder,
4978                offset + cur_offset,
4979                depth,
4980            )?;
4981
4982            _prev_end_offset = cur_offset + envelope_size;
4983            if 6 > max_ordinal {
4984                return Ok(());
4985            }
4986
4987            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4988            // are envelope_size bytes.
4989            let cur_offset: usize = (6 - 1) * envelope_size;
4990
4991            // Zero reserved fields.
4992            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4993
4994            // Safety:
4995            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4996            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4997            //   envelope_size bytes, there is always sufficient room.
4998            fidl::encoding::encode_in_envelope_optional::<u32, D>(
4999                self.no_ack_requested
5000                    .as_ref()
5001                    .map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
5002                encoder,
5003                offset + cur_offset,
5004                depth,
5005            )?;
5006
5007            _prev_end_offset = cur_offset + envelope_size;
5008            if 7 > max_ordinal {
5009                return Ok(());
5010            }
5011
5012            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5013            // are envelope_size bytes.
5014            let cur_offset: usize = (7 - 1) * envelope_size;
5015
5016            // Zero reserved fields.
5017            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5018
5019            // Safety:
5020            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5021            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5022            //   envelope_size bytes, there is always sufficient room.
5023            fidl::encoding::encode_in_envelope_optional::<u32, D>(
5024                self.data.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
5025                encoder,
5026                offset + cur_offset,
5027                depth,
5028            )?;
5029
5030            _prev_end_offset = cur_offset + envelope_size;
5031            if 8 > max_ordinal {
5032                return Ok(());
5033            }
5034
5035            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5036            // are envelope_size bytes.
5037            let cur_offset: usize = (8 - 1) * envelope_size;
5038
5039            // Zero reserved fields.
5040            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5041
5042            // Safety:
5043            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5044            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5045            //   envelope_size bytes, there is always sufficient room.
5046            fidl::encoding::encode_in_envelope_optional::<u32, D>(
5047                self.data_poll.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
5048                encoder,
5049                offset + cur_offset,
5050                depth,
5051            )?;
5052
5053            _prev_end_offset = cur_offset + envelope_size;
5054            if 9 > max_ordinal {
5055                return Ok(());
5056            }
5057
5058            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5059            // are envelope_size bytes.
5060            let cur_offset: usize = (9 - 1) * envelope_size;
5061
5062            // Zero reserved fields.
5063            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5064
5065            // Safety:
5066            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5067            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5068            //   envelope_size bytes, there is always sufficient room.
5069            fidl::encoding::encode_in_envelope_optional::<u32, D>(
5070                self.beacon.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
5071                encoder,
5072                offset + cur_offset,
5073                depth,
5074            )?;
5075
5076            _prev_end_offset = cur_offset + envelope_size;
5077            if 10 > max_ordinal {
5078                return Ok(());
5079            }
5080
5081            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5082            // are envelope_size bytes.
5083            let cur_offset: usize = (10 - 1) * envelope_size;
5084
5085            // Zero reserved fields.
5086            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5087
5088            // Safety:
5089            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5090            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5091            //   envelope_size bytes, there is always sufficient room.
5092            fidl::encoding::encode_in_envelope_optional::<u32, D>(
5093                self.beacon_request.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
5094                encoder,
5095                offset + cur_offset,
5096                depth,
5097            )?;
5098
5099            _prev_end_offset = cur_offset + envelope_size;
5100            if 11 > max_ordinal {
5101                return Ok(());
5102            }
5103
5104            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5105            // are envelope_size bytes.
5106            let cur_offset: usize = (11 - 1) * envelope_size;
5107
5108            // Zero reserved fields.
5109            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5110
5111            // Safety:
5112            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5113            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5114            //   envelope_size bytes, there is always sufficient room.
5115            fidl::encoding::encode_in_envelope_optional::<u32, D>(
5116                self.other.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
5117                encoder,
5118                offset + cur_offset,
5119                depth,
5120            )?;
5121
5122            _prev_end_offset = cur_offset + envelope_size;
5123            if 12 > max_ordinal {
5124                return Ok(());
5125            }
5126
5127            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5128            // are envelope_size bytes.
5129            let cur_offset: usize = (12 - 1) * envelope_size;
5130
5131            // Zero reserved fields.
5132            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5133
5134            // Safety:
5135            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5136            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5137            //   envelope_size bytes, there is always sufficient room.
5138            fidl::encoding::encode_in_envelope_optional::<u32, D>(
5139                self.address_filtered
5140                    .as_ref()
5141                    .map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
5142                encoder,
5143                offset + cur_offset,
5144                depth,
5145            )?;
5146
5147            _prev_end_offset = cur_offset + envelope_size;
5148            if 13 > max_ordinal {
5149                return Ok(());
5150            }
5151
5152            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5153            // are envelope_size bytes.
5154            let cur_offset: usize = (13 - 1) * envelope_size;
5155
5156            // Zero reserved fields.
5157            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5158
5159            // Safety:
5160            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5161            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5162            //   envelope_size bytes, there is always sufficient room.
5163            fidl::encoding::encode_in_envelope_optional::<u32, D>(
5164                self.retries.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
5165                encoder,
5166                offset + cur_offset,
5167                depth,
5168            )?;
5169
5170            _prev_end_offset = cur_offset + envelope_size;
5171            if 14 > max_ordinal {
5172                return Ok(());
5173            }
5174
5175            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5176            // are envelope_size bytes.
5177            let cur_offset: usize = (14 - 1) * envelope_size;
5178
5179            // Zero reserved fields.
5180            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5181
5182            // Safety:
5183            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5184            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5185            //   envelope_size bytes, there is always sufficient room.
5186            fidl::encoding::encode_in_envelope_optional::<u32, D>(
5187                self.direct_max_retry_expiry
5188                    .as_ref()
5189                    .map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
5190                encoder,
5191                offset + cur_offset,
5192                depth,
5193            )?;
5194
5195            _prev_end_offset = cur_offset + envelope_size;
5196            if 15 > max_ordinal {
5197                return Ok(());
5198            }
5199
5200            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5201            // are envelope_size bytes.
5202            let cur_offset: usize = (15 - 1) * envelope_size;
5203
5204            // Zero reserved fields.
5205            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5206
5207            // Safety:
5208            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5209            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5210            //   envelope_size bytes, there is always sufficient room.
5211            fidl::encoding::encode_in_envelope_optional::<u32, D>(
5212                self.indirect_max_retry_expiry
5213                    .as_ref()
5214                    .map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
5215                encoder,
5216                offset + cur_offset,
5217                depth,
5218            )?;
5219
5220            _prev_end_offset = cur_offset + envelope_size;
5221            if 16 > max_ordinal {
5222                return Ok(());
5223            }
5224
5225            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5226            // are envelope_size bytes.
5227            let cur_offset: usize = (16 - 1) * envelope_size;
5228
5229            // Zero reserved fields.
5230            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5231
5232            // Safety:
5233            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5234            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5235            //   envelope_size bytes, there is always sufficient room.
5236            fidl::encoding::encode_in_envelope_optional::<u32, D>(
5237                self.dest_addr_filtered
5238                    .as_ref()
5239                    .map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
5240                encoder,
5241                offset + cur_offset,
5242                depth,
5243            )?;
5244
5245            _prev_end_offset = cur_offset + envelope_size;
5246            if 17 > max_ordinal {
5247                return Ok(());
5248            }
5249
5250            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5251            // are envelope_size bytes.
5252            let cur_offset: usize = (17 - 1) * envelope_size;
5253
5254            // Zero reserved fields.
5255            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5256
5257            // Safety:
5258            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5259            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5260            //   envelope_size bytes, there is always sufficient room.
5261            fidl::encoding::encode_in_envelope_optional::<u32, D>(
5262                self.duplicated.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
5263                encoder,
5264                offset + cur_offset,
5265                depth,
5266            )?;
5267
5268            _prev_end_offset = cur_offset + envelope_size;
5269            if 18 > max_ordinal {
5270                return Ok(());
5271            }
5272
5273            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5274            // are envelope_size bytes.
5275            let cur_offset: usize = (18 - 1) * envelope_size;
5276
5277            // Zero reserved fields.
5278            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5279
5280            // Safety:
5281            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5282            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5283            //   envelope_size bytes, there is always sufficient room.
5284            fidl::encoding::encode_in_envelope_optional::<u32, D>(
5285                self.err_no_frame.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
5286                encoder,
5287                offset + cur_offset,
5288                depth,
5289            )?;
5290
5291            _prev_end_offset = cur_offset + envelope_size;
5292            if 19 > max_ordinal {
5293                return Ok(());
5294            }
5295
5296            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5297            // are envelope_size bytes.
5298            let cur_offset: usize = (19 - 1) * envelope_size;
5299
5300            // Zero reserved fields.
5301            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5302
5303            // Safety:
5304            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5305            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5306            //   envelope_size bytes, there is always sufficient room.
5307            fidl::encoding::encode_in_envelope_optional::<u32, D>(
5308                self.err_unknown_neighbor
5309                    .as_ref()
5310                    .map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
5311                encoder,
5312                offset + cur_offset,
5313                depth,
5314            )?;
5315
5316            _prev_end_offset = cur_offset + envelope_size;
5317            if 20 > max_ordinal {
5318                return Ok(());
5319            }
5320
5321            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5322            // are envelope_size bytes.
5323            let cur_offset: usize = (20 - 1) * envelope_size;
5324
5325            // Zero reserved fields.
5326            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5327
5328            // Safety:
5329            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5330            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5331            //   envelope_size bytes, there is always sufficient room.
5332            fidl::encoding::encode_in_envelope_optional::<u32, D>(
5333                self.err_invalid_src_addr
5334                    .as_ref()
5335                    .map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
5336                encoder,
5337                offset + cur_offset,
5338                depth,
5339            )?;
5340
5341            _prev_end_offset = cur_offset + envelope_size;
5342            if 21 > max_ordinal {
5343                return Ok(());
5344            }
5345
5346            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5347            // are envelope_size bytes.
5348            let cur_offset: usize = (21 - 1) * envelope_size;
5349
5350            // Zero reserved fields.
5351            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5352
5353            // Safety:
5354            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5355            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5356            //   envelope_size bytes, there is always sufficient room.
5357            fidl::encoding::encode_in_envelope_optional::<u32, D>(
5358                self.err_sec.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
5359                encoder,
5360                offset + cur_offset,
5361                depth,
5362            )?;
5363
5364            _prev_end_offset = cur_offset + envelope_size;
5365            if 22 > max_ordinal {
5366                return Ok(());
5367            }
5368
5369            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5370            // are envelope_size bytes.
5371            let cur_offset: usize = (22 - 1) * envelope_size;
5372
5373            // Zero reserved fields.
5374            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5375
5376            // Safety:
5377            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5378            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5379            //   envelope_size bytes, there is always sufficient room.
5380            fidl::encoding::encode_in_envelope_optional::<u32, D>(
5381                self.err_fcs.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
5382                encoder,
5383                offset + cur_offset,
5384                depth,
5385            )?;
5386
5387            _prev_end_offset = cur_offset + envelope_size;
5388            if 23 > max_ordinal {
5389                return Ok(());
5390            }
5391
5392            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5393            // are envelope_size bytes.
5394            let cur_offset: usize = (23 - 1) * envelope_size;
5395
5396            // Zero reserved fields.
5397            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5398
5399            // Safety:
5400            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5401            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5402            //   envelope_size bytes, there is always sufficient room.
5403            fidl::encoding::encode_in_envelope_optional::<u32, D>(
5404                self.err_cca.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
5405                encoder,
5406                offset + cur_offset,
5407                depth,
5408            )?;
5409
5410            _prev_end_offset = cur_offset + envelope_size;
5411            if 24 > max_ordinal {
5412                return Ok(());
5413            }
5414
5415            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5416            // are envelope_size bytes.
5417            let cur_offset: usize = (24 - 1) * envelope_size;
5418
5419            // Zero reserved fields.
5420            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5421
5422            // Safety:
5423            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5424            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5425            //   envelope_size bytes, there is always sufficient room.
5426            fidl::encoding::encode_in_envelope_optional::<u32, D>(
5427                self.err_abort.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
5428                encoder,
5429                offset + cur_offset,
5430                depth,
5431            )?;
5432
5433            _prev_end_offset = cur_offset + envelope_size;
5434            if 25 > max_ordinal {
5435                return Ok(());
5436            }
5437
5438            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5439            // are envelope_size bytes.
5440            let cur_offset: usize = (25 - 1) * envelope_size;
5441
5442            // Zero reserved fields.
5443            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5444
5445            // Safety:
5446            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5447            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5448            //   envelope_size bytes, there is always sufficient room.
5449            fidl::encoding::encode_in_envelope_optional::<u32, D>(
5450                self.err_busy_channel
5451                    .as_ref()
5452                    .map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
5453                encoder,
5454                offset + cur_offset,
5455                depth,
5456            )?;
5457
5458            _prev_end_offset = cur_offset + envelope_size;
5459            if 26 > max_ordinal {
5460                return Ok(());
5461            }
5462
5463            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5464            // are envelope_size bytes.
5465            let cur_offset: usize = (26 - 1) * envelope_size;
5466
5467            // Zero reserved fields.
5468            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5469
5470            // Safety:
5471            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5472            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5473            //   envelope_size bytes, there is always sufficient room.
5474            fidl::encoding::encode_in_envelope_optional::<u32, D>(
5475                self.err_other.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
5476                encoder,
5477                offset + cur_offset,
5478                depth,
5479            )?;
5480
5481            _prev_end_offset = cur_offset + envelope_size;
5482
5483            Ok(())
5484        }
5485    }
5486
5487    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for MacCounters {
5488        #[inline(always)]
5489        fn new_empty() -> Self {
5490            Self::default()
5491        }
5492
5493        unsafe fn decode(
5494            &mut self,
5495            decoder: &mut fidl::encoding::Decoder<'_, D>,
5496            offset: usize,
5497            mut depth: fidl::encoding::Depth,
5498        ) -> fidl::Result<()> {
5499            decoder.debug_check_bounds::<Self>(offset);
5500            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
5501                None => return Err(fidl::Error::NotNullable),
5502                Some(len) => len,
5503            };
5504            // Calling decoder.out_of_line_offset(0) is not allowed.
5505            if len == 0 {
5506                return Ok(());
5507            };
5508            depth.increment()?;
5509            let envelope_size = 8;
5510            let bytes_len = len * envelope_size;
5511            let offset = decoder.out_of_line_offset(bytes_len)?;
5512            // Decode the envelope for each type.
5513            let mut _next_ordinal_to_read = 0;
5514            let mut next_offset = offset;
5515            let end_offset = offset + bytes_len;
5516            _next_ordinal_to_read += 1;
5517            if next_offset >= end_offset {
5518                return Ok(());
5519            }
5520
5521            // Decode unknown envelopes for gaps in ordinals.
5522            while _next_ordinal_to_read < 1 {
5523                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5524                _next_ordinal_to_read += 1;
5525                next_offset += envelope_size;
5526            }
5527
5528            let next_out_of_line = decoder.next_out_of_line();
5529            let handles_before = decoder.remaining_handles();
5530            if let Some((inlined, num_bytes, num_handles)) =
5531                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5532            {
5533                let member_inline_size =
5534                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5535                if inlined != (member_inline_size <= 4) {
5536                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5537                }
5538                let inner_offset;
5539                let mut inner_depth = depth.clone();
5540                if inlined {
5541                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5542                    inner_offset = next_offset;
5543                } else {
5544                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5545                    inner_depth.increment()?;
5546                }
5547                let val_ref = self.total.get_or_insert_with(|| fidl::new_empty!(u32, D));
5548                fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
5549                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5550                {
5551                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5552                }
5553                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5554                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5555                }
5556            }
5557
5558            next_offset += envelope_size;
5559            _next_ordinal_to_read += 1;
5560            if next_offset >= end_offset {
5561                return Ok(());
5562            }
5563
5564            // Decode unknown envelopes for gaps in ordinals.
5565            while _next_ordinal_to_read < 2 {
5566                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5567                _next_ordinal_to_read += 1;
5568                next_offset += envelope_size;
5569            }
5570
5571            let next_out_of_line = decoder.next_out_of_line();
5572            let handles_before = decoder.remaining_handles();
5573            if let Some((inlined, num_bytes, num_handles)) =
5574                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5575            {
5576                let member_inline_size =
5577                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5578                if inlined != (member_inline_size <= 4) {
5579                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5580                }
5581                let inner_offset;
5582                let mut inner_depth = depth.clone();
5583                if inlined {
5584                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5585                    inner_offset = next_offset;
5586                } else {
5587                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5588                    inner_depth.increment()?;
5589                }
5590                let val_ref = self.unicast.get_or_insert_with(|| fidl::new_empty!(u32, D));
5591                fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
5592                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5593                {
5594                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5595                }
5596                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5597                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5598                }
5599            }
5600
5601            next_offset += envelope_size;
5602            _next_ordinal_to_read += 1;
5603            if next_offset >= end_offset {
5604                return Ok(());
5605            }
5606
5607            // Decode unknown envelopes for gaps in ordinals.
5608            while _next_ordinal_to_read < 3 {
5609                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5610                _next_ordinal_to_read += 1;
5611                next_offset += envelope_size;
5612            }
5613
5614            let next_out_of_line = decoder.next_out_of_line();
5615            let handles_before = decoder.remaining_handles();
5616            if let Some((inlined, num_bytes, num_handles)) =
5617                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5618            {
5619                let member_inline_size =
5620                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5621                if inlined != (member_inline_size <= 4) {
5622                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5623                }
5624                let inner_offset;
5625                let mut inner_depth = depth.clone();
5626                if inlined {
5627                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5628                    inner_offset = next_offset;
5629                } else {
5630                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5631                    inner_depth.increment()?;
5632                }
5633                let val_ref = self.broadcast.get_or_insert_with(|| fidl::new_empty!(u32, D));
5634                fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
5635                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5636                {
5637                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5638                }
5639                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5640                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5641                }
5642            }
5643
5644            next_offset += envelope_size;
5645            _next_ordinal_to_read += 1;
5646            if next_offset >= end_offset {
5647                return Ok(());
5648            }
5649
5650            // Decode unknown envelopes for gaps in ordinals.
5651            while _next_ordinal_to_read < 4 {
5652                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5653                _next_ordinal_to_read += 1;
5654                next_offset += envelope_size;
5655            }
5656
5657            let next_out_of_line = decoder.next_out_of_line();
5658            let handles_before = decoder.remaining_handles();
5659            if let Some((inlined, num_bytes, num_handles)) =
5660                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5661            {
5662                let member_inline_size =
5663                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5664                if inlined != (member_inline_size <= 4) {
5665                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5666                }
5667                let inner_offset;
5668                let mut inner_depth = depth.clone();
5669                if inlined {
5670                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5671                    inner_offset = next_offset;
5672                } else {
5673                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5674                    inner_depth.increment()?;
5675                }
5676                let val_ref = self.ack_requested.get_or_insert_with(|| fidl::new_empty!(u32, D));
5677                fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
5678                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5679                {
5680                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5681                }
5682                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5683                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5684                }
5685            }
5686
5687            next_offset += envelope_size;
5688            _next_ordinal_to_read += 1;
5689            if next_offset >= end_offset {
5690                return Ok(());
5691            }
5692
5693            // Decode unknown envelopes for gaps in ordinals.
5694            while _next_ordinal_to_read < 5 {
5695                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5696                _next_ordinal_to_read += 1;
5697                next_offset += envelope_size;
5698            }
5699
5700            let next_out_of_line = decoder.next_out_of_line();
5701            let handles_before = decoder.remaining_handles();
5702            if let Some((inlined, num_bytes, num_handles)) =
5703                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5704            {
5705                let member_inline_size =
5706                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5707                if inlined != (member_inline_size <= 4) {
5708                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5709                }
5710                let inner_offset;
5711                let mut inner_depth = depth.clone();
5712                if inlined {
5713                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5714                    inner_offset = next_offset;
5715                } else {
5716                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5717                    inner_depth.increment()?;
5718                }
5719                let val_ref = self.acked.get_or_insert_with(|| fidl::new_empty!(u32, D));
5720                fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
5721                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5722                {
5723                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5724                }
5725                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5726                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5727                }
5728            }
5729
5730            next_offset += envelope_size;
5731            _next_ordinal_to_read += 1;
5732            if next_offset >= end_offset {
5733                return Ok(());
5734            }
5735
5736            // Decode unknown envelopes for gaps in ordinals.
5737            while _next_ordinal_to_read < 6 {
5738                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5739                _next_ordinal_to_read += 1;
5740                next_offset += envelope_size;
5741            }
5742
5743            let next_out_of_line = decoder.next_out_of_line();
5744            let handles_before = decoder.remaining_handles();
5745            if let Some((inlined, num_bytes, num_handles)) =
5746                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5747            {
5748                let member_inline_size =
5749                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5750                if inlined != (member_inline_size <= 4) {
5751                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5752                }
5753                let inner_offset;
5754                let mut inner_depth = depth.clone();
5755                if inlined {
5756                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5757                    inner_offset = next_offset;
5758                } else {
5759                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5760                    inner_depth.increment()?;
5761                }
5762                let val_ref = self.no_ack_requested.get_or_insert_with(|| fidl::new_empty!(u32, D));
5763                fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
5764                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5765                {
5766                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5767                }
5768                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5769                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5770                }
5771            }
5772
5773            next_offset += envelope_size;
5774            _next_ordinal_to_read += 1;
5775            if next_offset >= end_offset {
5776                return Ok(());
5777            }
5778
5779            // Decode unknown envelopes for gaps in ordinals.
5780            while _next_ordinal_to_read < 7 {
5781                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5782                _next_ordinal_to_read += 1;
5783                next_offset += envelope_size;
5784            }
5785
5786            let next_out_of_line = decoder.next_out_of_line();
5787            let handles_before = decoder.remaining_handles();
5788            if let Some((inlined, num_bytes, num_handles)) =
5789                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5790            {
5791                let member_inline_size =
5792                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5793                if inlined != (member_inline_size <= 4) {
5794                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5795                }
5796                let inner_offset;
5797                let mut inner_depth = depth.clone();
5798                if inlined {
5799                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5800                    inner_offset = next_offset;
5801                } else {
5802                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5803                    inner_depth.increment()?;
5804                }
5805                let val_ref = self.data.get_or_insert_with(|| fidl::new_empty!(u32, D));
5806                fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
5807                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5808                {
5809                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5810                }
5811                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5812                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5813                }
5814            }
5815
5816            next_offset += envelope_size;
5817            _next_ordinal_to_read += 1;
5818            if next_offset >= end_offset {
5819                return Ok(());
5820            }
5821
5822            // Decode unknown envelopes for gaps in ordinals.
5823            while _next_ordinal_to_read < 8 {
5824                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5825                _next_ordinal_to_read += 1;
5826                next_offset += envelope_size;
5827            }
5828
5829            let next_out_of_line = decoder.next_out_of_line();
5830            let handles_before = decoder.remaining_handles();
5831            if let Some((inlined, num_bytes, num_handles)) =
5832                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5833            {
5834                let member_inline_size =
5835                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5836                if inlined != (member_inline_size <= 4) {
5837                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5838                }
5839                let inner_offset;
5840                let mut inner_depth = depth.clone();
5841                if inlined {
5842                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5843                    inner_offset = next_offset;
5844                } else {
5845                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5846                    inner_depth.increment()?;
5847                }
5848                let val_ref = self.data_poll.get_or_insert_with(|| fidl::new_empty!(u32, D));
5849                fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
5850                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5851                {
5852                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5853                }
5854                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5855                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5856                }
5857            }
5858
5859            next_offset += envelope_size;
5860            _next_ordinal_to_read += 1;
5861            if next_offset >= end_offset {
5862                return Ok(());
5863            }
5864
5865            // Decode unknown envelopes for gaps in ordinals.
5866            while _next_ordinal_to_read < 9 {
5867                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5868                _next_ordinal_to_read += 1;
5869                next_offset += envelope_size;
5870            }
5871
5872            let next_out_of_line = decoder.next_out_of_line();
5873            let handles_before = decoder.remaining_handles();
5874            if let Some((inlined, num_bytes, num_handles)) =
5875                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5876            {
5877                let member_inline_size =
5878                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5879                if inlined != (member_inline_size <= 4) {
5880                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5881                }
5882                let inner_offset;
5883                let mut inner_depth = depth.clone();
5884                if inlined {
5885                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5886                    inner_offset = next_offset;
5887                } else {
5888                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5889                    inner_depth.increment()?;
5890                }
5891                let val_ref = self.beacon.get_or_insert_with(|| fidl::new_empty!(u32, D));
5892                fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
5893                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5894                {
5895                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5896                }
5897                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5898                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5899                }
5900            }
5901
5902            next_offset += envelope_size;
5903            _next_ordinal_to_read += 1;
5904            if next_offset >= end_offset {
5905                return Ok(());
5906            }
5907
5908            // Decode unknown envelopes for gaps in ordinals.
5909            while _next_ordinal_to_read < 10 {
5910                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5911                _next_ordinal_to_read += 1;
5912                next_offset += envelope_size;
5913            }
5914
5915            let next_out_of_line = decoder.next_out_of_line();
5916            let handles_before = decoder.remaining_handles();
5917            if let Some((inlined, num_bytes, num_handles)) =
5918                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5919            {
5920                let member_inline_size =
5921                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5922                if inlined != (member_inline_size <= 4) {
5923                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5924                }
5925                let inner_offset;
5926                let mut inner_depth = depth.clone();
5927                if inlined {
5928                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5929                    inner_offset = next_offset;
5930                } else {
5931                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5932                    inner_depth.increment()?;
5933                }
5934                let val_ref = self.beacon_request.get_or_insert_with(|| fidl::new_empty!(u32, D));
5935                fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
5936                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5937                {
5938                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5939                }
5940                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5941                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5942                }
5943            }
5944
5945            next_offset += envelope_size;
5946            _next_ordinal_to_read += 1;
5947            if next_offset >= end_offset {
5948                return Ok(());
5949            }
5950
5951            // Decode unknown envelopes for gaps in ordinals.
5952            while _next_ordinal_to_read < 11 {
5953                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5954                _next_ordinal_to_read += 1;
5955                next_offset += envelope_size;
5956            }
5957
5958            let next_out_of_line = decoder.next_out_of_line();
5959            let handles_before = decoder.remaining_handles();
5960            if let Some((inlined, num_bytes, num_handles)) =
5961                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5962            {
5963                let member_inline_size =
5964                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5965                if inlined != (member_inline_size <= 4) {
5966                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5967                }
5968                let inner_offset;
5969                let mut inner_depth = depth.clone();
5970                if inlined {
5971                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5972                    inner_offset = next_offset;
5973                } else {
5974                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5975                    inner_depth.increment()?;
5976                }
5977                let val_ref = self.other.get_or_insert_with(|| fidl::new_empty!(u32, D));
5978                fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
5979                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5980                {
5981                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5982                }
5983                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5984                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5985                }
5986            }
5987
5988            next_offset += envelope_size;
5989            _next_ordinal_to_read += 1;
5990            if next_offset >= end_offset {
5991                return Ok(());
5992            }
5993
5994            // Decode unknown envelopes for gaps in ordinals.
5995            while _next_ordinal_to_read < 12 {
5996                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5997                _next_ordinal_to_read += 1;
5998                next_offset += envelope_size;
5999            }
6000
6001            let next_out_of_line = decoder.next_out_of_line();
6002            let handles_before = decoder.remaining_handles();
6003            if let Some((inlined, num_bytes, num_handles)) =
6004                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6005            {
6006                let member_inline_size =
6007                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
6008                if inlined != (member_inline_size <= 4) {
6009                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6010                }
6011                let inner_offset;
6012                let mut inner_depth = depth.clone();
6013                if inlined {
6014                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6015                    inner_offset = next_offset;
6016                } else {
6017                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6018                    inner_depth.increment()?;
6019                }
6020                let val_ref = self.address_filtered.get_or_insert_with(|| fidl::new_empty!(u32, D));
6021                fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
6022                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6023                {
6024                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6025                }
6026                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6027                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6028                }
6029            }
6030
6031            next_offset += envelope_size;
6032            _next_ordinal_to_read += 1;
6033            if next_offset >= end_offset {
6034                return Ok(());
6035            }
6036
6037            // Decode unknown envelopes for gaps in ordinals.
6038            while _next_ordinal_to_read < 13 {
6039                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6040                _next_ordinal_to_read += 1;
6041                next_offset += envelope_size;
6042            }
6043
6044            let next_out_of_line = decoder.next_out_of_line();
6045            let handles_before = decoder.remaining_handles();
6046            if let Some((inlined, num_bytes, num_handles)) =
6047                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6048            {
6049                let member_inline_size =
6050                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
6051                if inlined != (member_inline_size <= 4) {
6052                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6053                }
6054                let inner_offset;
6055                let mut inner_depth = depth.clone();
6056                if inlined {
6057                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6058                    inner_offset = next_offset;
6059                } else {
6060                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6061                    inner_depth.increment()?;
6062                }
6063                let val_ref = self.retries.get_or_insert_with(|| fidl::new_empty!(u32, D));
6064                fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
6065                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6066                {
6067                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6068                }
6069                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6070                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6071                }
6072            }
6073
6074            next_offset += envelope_size;
6075            _next_ordinal_to_read += 1;
6076            if next_offset >= end_offset {
6077                return Ok(());
6078            }
6079
6080            // Decode unknown envelopes for gaps in ordinals.
6081            while _next_ordinal_to_read < 14 {
6082                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6083                _next_ordinal_to_read += 1;
6084                next_offset += envelope_size;
6085            }
6086
6087            let next_out_of_line = decoder.next_out_of_line();
6088            let handles_before = decoder.remaining_handles();
6089            if let Some((inlined, num_bytes, num_handles)) =
6090                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6091            {
6092                let member_inline_size =
6093                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
6094                if inlined != (member_inline_size <= 4) {
6095                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6096                }
6097                let inner_offset;
6098                let mut inner_depth = depth.clone();
6099                if inlined {
6100                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6101                    inner_offset = next_offset;
6102                } else {
6103                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6104                    inner_depth.increment()?;
6105                }
6106                let val_ref =
6107                    self.direct_max_retry_expiry.get_or_insert_with(|| fidl::new_empty!(u32, D));
6108                fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
6109                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6110                {
6111                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6112                }
6113                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6114                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6115                }
6116            }
6117
6118            next_offset += envelope_size;
6119            _next_ordinal_to_read += 1;
6120            if next_offset >= end_offset {
6121                return Ok(());
6122            }
6123
6124            // Decode unknown envelopes for gaps in ordinals.
6125            while _next_ordinal_to_read < 15 {
6126                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6127                _next_ordinal_to_read += 1;
6128                next_offset += envelope_size;
6129            }
6130
6131            let next_out_of_line = decoder.next_out_of_line();
6132            let handles_before = decoder.remaining_handles();
6133            if let Some((inlined, num_bytes, num_handles)) =
6134                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6135            {
6136                let member_inline_size =
6137                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
6138                if inlined != (member_inline_size <= 4) {
6139                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6140                }
6141                let inner_offset;
6142                let mut inner_depth = depth.clone();
6143                if inlined {
6144                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6145                    inner_offset = next_offset;
6146                } else {
6147                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6148                    inner_depth.increment()?;
6149                }
6150                let val_ref =
6151                    self.indirect_max_retry_expiry.get_or_insert_with(|| fidl::new_empty!(u32, D));
6152                fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
6153                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6154                {
6155                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6156                }
6157                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6158                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6159                }
6160            }
6161
6162            next_offset += envelope_size;
6163            _next_ordinal_to_read += 1;
6164            if next_offset >= end_offset {
6165                return Ok(());
6166            }
6167
6168            // Decode unknown envelopes for gaps in ordinals.
6169            while _next_ordinal_to_read < 16 {
6170                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6171                _next_ordinal_to_read += 1;
6172                next_offset += envelope_size;
6173            }
6174
6175            let next_out_of_line = decoder.next_out_of_line();
6176            let handles_before = decoder.remaining_handles();
6177            if let Some((inlined, num_bytes, num_handles)) =
6178                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6179            {
6180                let member_inline_size =
6181                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
6182                if inlined != (member_inline_size <= 4) {
6183                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6184                }
6185                let inner_offset;
6186                let mut inner_depth = depth.clone();
6187                if inlined {
6188                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6189                    inner_offset = next_offset;
6190                } else {
6191                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6192                    inner_depth.increment()?;
6193                }
6194                let val_ref =
6195                    self.dest_addr_filtered.get_or_insert_with(|| fidl::new_empty!(u32, D));
6196                fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
6197                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6198                {
6199                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6200                }
6201                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6202                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6203                }
6204            }
6205
6206            next_offset += envelope_size;
6207            _next_ordinal_to_read += 1;
6208            if next_offset >= end_offset {
6209                return Ok(());
6210            }
6211
6212            // Decode unknown envelopes for gaps in ordinals.
6213            while _next_ordinal_to_read < 17 {
6214                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6215                _next_ordinal_to_read += 1;
6216                next_offset += envelope_size;
6217            }
6218
6219            let next_out_of_line = decoder.next_out_of_line();
6220            let handles_before = decoder.remaining_handles();
6221            if let Some((inlined, num_bytes, num_handles)) =
6222                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6223            {
6224                let member_inline_size =
6225                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
6226                if inlined != (member_inline_size <= 4) {
6227                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6228                }
6229                let inner_offset;
6230                let mut inner_depth = depth.clone();
6231                if inlined {
6232                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6233                    inner_offset = next_offset;
6234                } else {
6235                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6236                    inner_depth.increment()?;
6237                }
6238                let val_ref = self.duplicated.get_or_insert_with(|| fidl::new_empty!(u32, D));
6239                fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
6240                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6241                {
6242                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6243                }
6244                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6245                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6246                }
6247            }
6248
6249            next_offset += envelope_size;
6250            _next_ordinal_to_read += 1;
6251            if next_offset >= end_offset {
6252                return Ok(());
6253            }
6254
6255            // Decode unknown envelopes for gaps in ordinals.
6256            while _next_ordinal_to_read < 18 {
6257                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6258                _next_ordinal_to_read += 1;
6259                next_offset += envelope_size;
6260            }
6261
6262            let next_out_of_line = decoder.next_out_of_line();
6263            let handles_before = decoder.remaining_handles();
6264            if let Some((inlined, num_bytes, num_handles)) =
6265                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6266            {
6267                let member_inline_size =
6268                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
6269                if inlined != (member_inline_size <= 4) {
6270                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6271                }
6272                let inner_offset;
6273                let mut inner_depth = depth.clone();
6274                if inlined {
6275                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6276                    inner_offset = next_offset;
6277                } else {
6278                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6279                    inner_depth.increment()?;
6280                }
6281                let val_ref = self.err_no_frame.get_or_insert_with(|| fidl::new_empty!(u32, D));
6282                fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
6283                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6284                {
6285                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6286                }
6287                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6288                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6289                }
6290            }
6291
6292            next_offset += envelope_size;
6293            _next_ordinal_to_read += 1;
6294            if next_offset >= end_offset {
6295                return Ok(());
6296            }
6297
6298            // Decode unknown envelopes for gaps in ordinals.
6299            while _next_ordinal_to_read < 19 {
6300                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6301                _next_ordinal_to_read += 1;
6302                next_offset += envelope_size;
6303            }
6304
6305            let next_out_of_line = decoder.next_out_of_line();
6306            let handles_before = decoder.remaining_handles();
6307            if let Some((inlined, num_bytes, num_handles)) =
6308                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6309            {
6310                let member_inline_size =
6311                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
6312                if inlined != (member_inline_size <= 4) {
6313                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6314                }
6315                let inner_offset;
6316                let mut inner_depth = depth.clone();
6317                if inlined {
6318                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6319                    inner_offset = next_offset;
6320                } else {
6321                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6322                    inner_depth.increment()?;
6323                }
6324                let val_ref =
6325                    self.err_unknown_neighbor.get_or_insert_with(|| fidl::new_empty!(u32, D));
6326                fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
6327                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6328                {
6329                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6330                }
6331                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6332                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6333                }
6334            }
6335
6336            next_offset += envelope_size;
6337            _next_ordinal_to_read += 1;
6338            if next_offset >= end_offset {
6339                return Ok(());
6340            }
6341
6342            // Decode unknown envelopes for gaps in ordinals.
6343            while _next_ordinal_to_read < 20 {
6344                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6345                _next_ordinal_to_read += 1;
6346                next_offset += envelope_size;
6347            }
6348
6349            let next_out_of_line = decoder.next_out_of_line();
6350            let handles_before = decoder.remaining_handles();
6351            if let Some((inlined, num_bytes, num_handles)) =
6352                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6353            {
6354                let member_inline_size =
6355                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
6356                if inlined != (member_inline_size <= 4) {
6357                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6358                }
6359                let inner_offset;
6360                let mut inner_depth = depth.clone();
6361                if inlined {
6362                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6363                    inner_offset = next_offset;
6364                } else {
6365                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6366                    inner_depth.increment()?;
6367                }
6368                let val_ref =
6369                    self.err_invalid_src_addr.get_or_insert_with(|| fidl::new_empty!(u32, D));
6370                fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
6371                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6372                {
6373                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6374                }
6375                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6376                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6377                }
6378            }
6379
6380            next_offset += envelope_size;
6381            _next_ordinal_to_read += 1;
6382            if next_offset >= end_offset {
6383                return Ok(());
6384            }
6385
6386            // Decode unknown envelopes for gaps in ordinals.
6387            while _next_ordinal_to_read < 21 {
6388                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6389                _next_ordinal_to_read += 1;
6390                next_offset += envelope_size;
6391            }
6392
6393            let next_out_of_line = decoder.next_out_of_line();
6394            let handles_before = decoder.remaining_handles();
6395            if let Some((inlined, num_bytes, num_handles)) =
6396                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6397            {
6398                let member_inline_size =
6399                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
6400                if inlined != (member_inline_size <= 4) {
6401                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6402                }
6403                let inner_offset;
6404                let mut inner_depth = depth.clone();
6405                if inlined {
6406                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6407                    inner_offset = next_offset;
6408                } else {
6409                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6410                    inner_depth.increment()?;
6411                }
6412                let val_ref = self.err_sec.get_or_insert_with(|| fidl::new_empty!(u32, D));
6413                fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
6414                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6415                {
6416                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6417                }
6418                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6419                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6420                }
6421            }
6422
6423            next_offset += envelope_size;
6424            _next_ordinal_to_read += 1;
6425            if next_offset >= end_offset {
6426                return Ok(());
6427            }
6428
6429            // Decode unknown envelopes for gaps in ordinals.
6430            while _next_ordinal_to_read < 22 {
6431                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6432                _next_ordinal_to_read += 1;
6433                next_offset += envelope_size;
6434            }
6435
6436            let next_out_of_line = decoder.next_out_of_line();
6437            let handles_before = decoder.remaining_handles();
6438            if let Some((inlined, num_bytes, num_handles)) =
6439                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6440            {
6441                let member_inline_size =
6442                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
6443                if inlined != (member_inline_size <= 4) {
6444                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6445                }
6446                let inner_offset;
6447                let mut inner_depth = depth.clone();
6448                if inlined {
6449                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6450                    inner_offset = next_offset;
6451                } else {
6452                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6453                    inner_depth.increment()?;
6454                }
6455                let val_ref = self.err_fcs.get_or_insert_with(|| fidl::new_empty!(u32, D));
6456                fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
6457                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6458                {
6459                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6460                }
6461                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6462                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6463                }
6464            }
6465
6466            next_offset += envelope_size;
6467            _next_ordinal_to_read += 1;
6468            if next_offset >= end_offset {
6469                return Ok(());
6470            }
6471
6472            // Decode unknown envelopes for gaps in ordinals.
6473            while _next_ordinal_to_read < 23 {
6474                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6475                _next_ordinal_to_read += 1;
6476                next_offset += envelope_size;
6477            }
6478
6479            let next_out_of_line = decoder.next_out_of_line();
6480            let handles_before = decoder.remaining_handles();
6481            if let Some((inlined, num_bytes, num_handles)) =
6482                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6483            {
6484                let member_inline_size =
6485                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
6486                if inlined != (member_inline_size <= 4) {
6487                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6488                }
6489                let inner_offset;
6490                let mut inner_depth = depth.clone();
6491                if inlined {
6492                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6493                    inner_offset = next_offset;
6494                } else {
6495                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6496                    inner_depth.increment()?;
6497                }
6498                let val_ref = self.err_cca.get_or_insert_with(|| fidl::new_empty!(u32, D));
6499                fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
6500                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6501                {
6502                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6503                }
6504                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6505                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6506                }
6507            }
6508
6509            next_offset += envelope_size;
6510            _next_ordinal_to_read += 1;
6511            if next_offset >= end_offset {
6512                return Ok(());
6513            }
6514
6515            // Decode unknown envelopes for gaps in ordinals.
6516            while _next_ordinal_to_read < 24 {
6517                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6518                _next_ordinal_to_read += 1;
6519                next_offset += envelope_size;
6520            }
6521
6522            let next_out_of_line = decoder.next_out_of_line();
6523            let handles_before = decoder.remaining_handles();
6524            if let Some((inlined, num_bytes, num_handles)) =
6525                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6526            {
6527                let member_inline_size =
6528                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
6529                if inlined != (member_inline_size <= 4) {
6530                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6531                }
6532                let inner_offset;
6533                let mut inner_depth = depth.clone();
6534                if inlined {
6535                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6536                    inner_offset = next_offset;
6537                } else {
6538                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6539                    inner_depth.increment()?;
6540                }
6541                let val_ref = self.err_abort.get_or_insert_with(|| fidl::new_empty!(u32, D));
6542                fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
6543                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6544                {
6545                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6546                }
6547                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6548                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6549                }
6550            }
6551
6552            next_offset += envelope_size;
6553            _next_ordinal_to_read += 1;
6554            if next_offset >= end_offset {
6555                return Ok(());
6556            }
6557
6558            // Decode unknown envelopes for gaps in ordinals.
6559            while _next_ordinal_to_read < 25 {
6560                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6561                _next_ordinal_to_read += 1;
6562                next_offset += envelope_size;
6563            }
6564
6565            let next_out_of_line = decoder.next_out_of_line();
6566            let handles_before = decoder.remaining_handles();
6567            if let Some((inlined, num_bytes, num_handles)) =
6568                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6569            {
6570                let member_inline_size =
6571                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
6572                if inlined != (member_inline_size <= 4) {
6573                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6574                }
6575                let inner_offset;
6576                let mut inner_depth = depth.clone();
6577                if inlined {
6578                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6579                    inner_offset = next_offset;
6580                } else {
6581                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6582                    inner_depth.increment()?;
6583                }
6584                let val_ref = self.err_busy_channel.get_or_insert_with(|| fidl::new_empty!(u32, D));
6585                fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
6586                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6587                {
6588                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6589                }
6590                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6591                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6592                }
6593            }
6594
6595            next_offset += envelope_size;
6596            _next_ordinal_to_read += 1;
6597            if next_offset >= end_offset {
6598                return Ok(());
6599            }
6600
6601            // Decode unknown envelopes for gaps in ordinals.
6602            while _next_ordinal_to_read < 26 {
6603                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6604                _next_ordinal_to_read += 1;
6605                next_offset += envelope_size;
6606            }
6607
6608            let next_out_of_line = decoder.next_out_of_line();
6609            let handles_before = decoder.remaining_handles();
6610            if let Some((inlined, num_bytes, num_handles)) =
6611                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6612            {
6613                let member_inline_size =
6614                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
6615                if inlined != (member_inline_size <= 4) {
6616                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6617                }
6618                let inner_offset;
6619                let mut inner_depth = depth.clone();
6620                if inlined {
6621                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6622                    inner_offset = next_offset;
6623                } else {
6624                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6625                    inner_depth.increment()?;
6626                }
6627                let val_ref = self.err_other.get_or_insert_with(|| fidl::new_empty!(u32, D));
6628                fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
6629                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6630                {
6631                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6632                }
6633                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6634                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6635                }
6636            }
6637
6638            next_offset += envelope_size;
6639
6640            // Decode the remaining unknown envelopes.
6641            while next_offset < end_offset {
6642                _next_ordinal_to_read += 1;
6643                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6644                next_offset += envelope_size;
6645            }
6646
6647            Ok(())
6648        }
6649    }
6650
6651    impl fidl::encoding::ValueTypeMarker for Credential {
6652        type Borrowed<'a> = &'a Self;
6653        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
6654            value
6655        }
6656    }
6657
6658    unsafe impl fidl::encoding::TypeMarker for Credential {
6659        type Owned = Self;
6660
6661        #[inline(always)]
6662        fn inline_align(_context: fidl::encoding::Context) -> usize {
6663            8
6664        }
6665
6666        #[inline(always)]
6667        fn inline_size(_context: fidl::encoding::Context) -> usize {
6668            16
6669        }
6670    }
6671
6672    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Credential, D>
6673        for &Credential
6674    {
6675        #[inline]
6676        unsafe fn encode(
6677            self,
6678            encoder: &mut fidl::encoding::Encoder<'_, D>,
6679            offset: usize,
6680            _depth: fidl::encoding::Depth,
6681        ) -> fidl::Result<()> {
6682            encoder.debug_check_bounds::<Credential>(offset);
6683            encoder.write_num::<u64>(self.ordinal(), offset);
6684            match self {
6685                Credential::NetworkKey(ref val) => {
6686                    fidl::encoding::encode_in_envelope::<fidl::encoding::Vector<u8, 32>, D>(
6687                        <fidl::encoding::Vector<u8, 32> as fidl::encoding::ValueTypeMarker>::borrow(
6688                            val,
6689                        ),
6690                        encoder,
6691                        offset + 8,
6692                        _depth,
6693                    )
6694                }
6695                Credential::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
6696            }
6697        }
6698    }
6699
6700    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Credential {
6701        #[inline(always)]
6702        fn new_empty() -> Self {
6703            Self::__SourceBreaking { unknown_ordinal: 0 }
6704        }
6705
6706        #[inline]
6707        unsafe fn decode(
6708            &mut self,
6709            decoder: &mut fidl::encoding::Decoder<'_, D>,
6710            offset: usize,
6711            mut depth: fidl::encoding::Depth,
6712        ) -> fidl::Result<()> {
6713            decoder.debug_check_bounds::<Self>(offset);
6714            #[allow(unused_variables)]
6715            let next_out_of_line = decoder.next_out_of_line();
6716            let handles_before = decoder.remaining_handles();
6717            let (ordinal, inlined, num_bytes, num_handles) =
6718                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
6719
6720            let member_inline_size = match ordinal {
6721                1 => <fidl::encoding::Vector<u8, 32> as fidl::encoding::TypeMarker>::inline_size(
6722                    decoder.context,
6723                ),
6724                0 => return Err(fidl::Error::UnknownUnionTag),
6725                _ => num_bytes as usize,
6726            };
6727
6728            if inlined != (member_inline_size <= 4) {
6729                return Err(fidl::Error::InvalidInlineBitInEnvelope);
6730            }
6731            let _inner_offset;
6732            if inlined {
6733                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
6734                _inner_offset = offset + 8;
6735            } else {
6736                depth.increment()?;
6737                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6738            }
6739            match ordinal {
6740                1 => {
6741                    #[allow(irrefutable_let_patterns)]
6742                    if let Credential::NetworkKey(_) = self {
6743                        // Do nothing, read the value into the object
6744                    } else {
6745                        // Initialize `self` to the right variant
6746                        *self = Credential::NetworkKey(
6747                            fidl::new_empty!(fidl::encoding::Vector<u8, 32>, D),
6748                        );
6749                    }
6750                    #[allow(irrefutable_let_patterns)]
6751                    if let Credential::NetworkKey(ref mut val) = self {
6752                        fidl::decode!(fidl::encoding::Vector<u8, 32>, D, val, decoder, _inner_offset, depth)?;
6753                    } else {
6754                        unreachable!()
6755                    }
6756                }
6757                #[allow(deprecated)]
6758                ordinal => {
6759                    for _ in 0..num_handles {
6760                        decoder.drop_next_handle()?;
6761                    }
6762                    *self = Credential::__SourceBreaking { unknown_ordinal: ordinal };
6763                }
6764            }
6765            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
6766                return Err(fidl::Error::InvalidNumBytesInEnvelope);
6767            }
6768            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6769                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6770            }
6771            Ok(())
6772        }
6773    }
6774}