fidl_fuchsia_bluetooth_sys_common/
fidl_fuchsia_bluetooth_sys_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/// Represents a locally generated key that is distributed across one or more bonds.
12pub type LocalKey = Key;
13
14/// Maximum number of discovered services for each transport. Currently set to the number of valid
15/// 16-bit handles or PSMs used to access services.
16pub const MAX_PEER_SERVICES: u16 = 65535;
17
18/// Whether or not the device should form a bluetooth bond during the pairing prodecure.
19/// As described in Core Spec v5.2 | Vol 3, Part C, Sec 4.3
20#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
21#[repr(u32)]
22pub enum BondableMode {
23    /// The device will form a bond during pairing with peers
24    Bondable = 1,
25    /// The device will not form a bond during pairing with peers
26    NonBondable = 2,
27}
28
29impl BondableMode {
30    #[inline]
31    pub fn from_primitive(prim: u32) -> Option<Self> {
32        match prim {
33            1 => Some(Self::Bondable),
34            2 => Some(Self::NonBondable),
35            _ => None,
36        }
37    }
38
39    #[inline]
40    pub const fn into_primitive(self) -> u32 {
41        self as u32
42    }
43}
44
45#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
46#[repr(u32)]
47pub enum BootstrapError {
48    InvalidHostIdentity = 1,
49    WriteFailure = 2,
50}
51
52impl BootstrapError {
53    #[inline]
54    pub fn from_primitive(prim: u32) -> Option<Self> {
55        match prim {
56            1 => Some(Self::InvalidHostIdentity),
57            2 => Some(Self::WriteFailure),
58            _ => None,
59        }
60    }
61
62    #[inline]
63    pub const fn into_primitive(self) -> u32 {
64        self as u32
65    }
66}
67
68/// The BR/EDR Security Mode of a BT device determines the possible security properties of the
69/// device. The security mode does not make specific guarantees about the current security
70/// properties of a device's connections; it sets restrictions on the allowable security
71/// properties. See Core Spec v5.4 Vol. 3, Part C 5.2.2 for more details.
72#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
73#[repr(u32)]
74pub enum BrEdrSecurityMode {
75    /// In BR/EDR Security Mode 4, communication will be authenticated and encrypted using the
76    /// lowest common denominator algorithm between the pairing devices. Note that this means key
77    /// generation, authentication, and encryption algorithms used may be weaker than Secure
78    /// Connections if SC is not supported.
79    Mode4 = 1,
80    /// In Secure Connections Only mode, the device will reject connections that do not support
81    /// Secure Connections, and longer key lengths will be enforced.
82    ///
83    /// SC Only mode also attempts to enforce user confirmation of the expected peer. Devices that
84    /// do not have a display (e.g. headsets) do not typically support SC for this reason.
85    SecureConnectionsOnly = 2,
86}
87
88impl BrEdrSecurityMode {
89    #[inline]
90    pub fn from_primitive(prim: u32) -> Option<Self> {
91        match prim {
92            1 => Some(Self::Mode4),
93            2 => Some(Self::SecureConnectionsOnly),
94            _ => None,
95        }
96    }
97
98    #[inline]
99    pub const fn into_primitive(self) -> u32 {
100        self as u32
101    }
102}
103
104#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
105#[repr(u32)]
106pub enum Error {
107    /// Operation could not be performed.
108    Failed = 1,
109    /// The peer designated for the operation was not found.
110    PeerNotFound = 2,
111    /// The time limit for the operation has expired.
112    TimedOut = 3,
113    /// The operation was canceled.
114    Canceled = 4,
115    /// Operation already in progress.
116    InProgress = 5,
117    /// Operation not supported.
118    NotSupported = 6,
119    /// The operation was given an invalid set of arguments.
120    InvalidArguments = 7,
121}
122
123impl Error {
124    #[inline]
125    pub fn from_primitive(prim: u32) -> Option<Self> {
126        match prim {
127            1 => Some(Self::Failed),
128            2 => Some(Self::PeerNotFound),
129            3 => Some(Self::TimedOut),
130            4 => Some(Self::Canceled),
131            5 => Some(Self::InProgress),
132            6 => Some(Self::NotSupported),
133            7 => Some(Self::InvalidArguments),
134            _ => None,
135        }
136    }
137
138    #[inline]
139    pub const fn into_primitive(self) -> u32 {
140        self as u32
141    }
142}
143
144/// Input Capabilities for pairing exchanges.
145/// These should be set based on the ability of the local system to enter
146/// responses to pairing requests.
147/// See Volume 3, Part C, Table 5.3 for more information.
148#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
149#[repr(u32)]
150pub enum InputCapability {
151    /// There is no user input method available for responding 'yes' or 'no' to
152    /// a pairing request.
153    /// Note: setting this setting will mean most pairings are considered
154    /// unauthenticated and vulnerable to machine-in-the-middle attacks.
155    None = 1,
156    /// The user can respond yes or no to a request.
157    Confirmation = 2,
158    /// The user has a keyboard (or other UI) where they can type a numerical code
159    /// and signal they have finished or cancel.
160    Keyboard = 3,
161}
162
163impl InputCapability {
164    #[inline]
165    pub fn from_primitive(prim: u32) -> Option<Self> {
166        match prim {
167            1 => Some(Self::None),
168            2 => Some(Self::Confirmation),
169            3 => Some(Self::Keyboard),
170            _ => None,
171        }
172    }
173
174    #[inline]
175    pub const fn into_primitive(self) -> u32 {
176        self as u32
177    }
178}
179
180/// The LE Security Mode of a BLE device determines the possible security properties of the device.
181/// The security mode does not make specific guarantees about the current security properties of a
182/// device's connections; it sets restrictions on the allowable security properties. See Core Spec
183/// v5.2 Vol. 3, Part C 10.2 for more details.
184#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
185#[repr(u32)]
186pub enum LeSecurityMode {
187    /// In LE Security Mode 1, communication is secured by encryption, and BLE-based services may
188    /// specify varying requirements for authentication, key size, or Secure Connections protection
189    /// on the encryption keys.
190    Mode1 = 1,
191    /// In Secure Connections Only mode, all secure communication must use 128 bit, authenticated,
192    /// and LE Secure Connections-generated encryption keys. If these encryption key properties
193    /// cannot be satisfied by a device due to system constraints, any connection involving such
194    /// a device will not be able to secure the link at all. This mode does not prevent unencrypted
195    /// communication; it merely enforces stricter policies on all encrypted communication.
196    SecureConnectionsOnly = 2,
197}
198
199impl LeSecurityMode {
200    #[inline]
201    pub fn from_primitive(prim: u32) -> Option<Self> {
202        match prim {
203            1 => Some(Self::Mode1),
204            2 => Some(Self::SecureConnectionsOnly),
205            _ => None,
206        }
207    }
208
209    #[inline]
210    pub const fn into_primitive(self) -> u32 {
211        self as u32
212    }
213}
214
215/// Output Capabilities for pairing excanges.
216/// These should be set based on the ability of the local system to display
217/// information to the user initiating or accepting a Bluetooth pairing.
218/// See Volume 3, Part C, Table 5.4 for more information.
219#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
220#[repr(u32)]
221pub enum OutputCapability {
222    /// There is no display available for pairing.
223    None = 1,
224    /// There is a display that can show at least a six-digit decimal number.
225    Display = 2,
226}
227
228impl OutputCapability {
229    #[inline]
230    pub fn from_primitive(prim: u32) -> Option<Self> {
231        match prim {
232            1 => Some(Self::None),
233            2 => Some(Self::Display),
234            _ => None,
235        }
236    }
237
238    #[inline]
239    pub const fn into_primitive(self) -> u32 {
240        self as u32
241    }
242}
243
244/// Used to convey information to the peer on progress typing a passkey. The
245/// various types of keypresses can be used to customize what is communicated to
246/// the user requesting a pairing.
247#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
248#[repr(u32)]
249pub enum PairingKeypress {
250    /// The user has entered a single digit.
251    DigitEntered = 1,
252    /// The user has erased a single digit.
253    DigitErased = 2,
254    /// The user has cleared the entire passkey.
255    PasskeyCleared = 3,
256    /// The user has finished entering the passkey.
257    PasskeyEntered = 4,
258}
259
260impl PairingKeypress {
261    #[inline]
262    pub fn from_primitive(prim: u32) -> Option<Self> {
263        match prim {
264            1 => Some(Self::DigitEntered),
265            2 => Some(Self::DigitErased),
266            3 => Some(Self::PasskeyCleared),
267            4 => Some(Self::PasskeyEntered),
268            _ => None,
269        }
270    }
271
272    #[inline]
273    pub const fn into_primitive(self) -> u32 {
274        self as u32
275    }
276}
277
278/// Different types required by the Security Manager for pairing methods.
279/// Bluetooth SIG has different requirements for different device capabilities.
280#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
281#[repr(u32)]
282pub enum PairingMethod {
283    /// The user is asked to accept or reject pairing.
284    /// This is the minimum method - even when both devices do not support
285    /// input or output, the delegate will be asked to confirm any pairing
286    /// not initiated with user intent.
287    Consent = 1,
288    /// The user is shown a 6-digit numerical passkey on this device which they
289    /// must enter on the peer device.
290    PasskeyDisplay = 2,
291    /// The user is shown a 6-digit numerical passkey on this device which will
292    /// also shown on the peer device. The user must compare the passkeys and
293    /// accept the pairing if the passkeys match.
294    PasskeyComparison = 3,
295    /// The user is asked to enter a 6-digit passkey on this device which is
296    /// communicated via the peer device.
297    PasskeyEntry = 4,
298}
299
300impl PairingMethod {
301    #[inline]
302    pub fn from_primitive(prim: u32) -> Option<Self> {
303        match prim {
304            1 => Some(Self::Consent),
305            2 => Some(Self::PasskeyDisplay),
306            3 => Some(Self::PasskeyComparison),
307            4 => Some(Self::PasskeyEntry),
308            _ => None,
309        }
310    }
311
312    #[inline]
313    pub const fn into_primitive(self) -> u32 {
314        self as u32
315    }
316}
317
318/// The security level required for this pairing - corresponds to the security
319/// levels defined in the Security Manager Protocol in Vol 3, Part H, Section 2.3.1
320#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
321#[repr(u32)]
322pub enum PairingSecurityLevel {
323    /// Encrypted without MITM protection (unauthenticated)
324    Encrypted = 1,
325    /// Encrypted with MITM protection (authenticated), although this level of security does not
326    /// fully protect against passive eavesdroppers
327    Authenticated = 2,
328}
329
330impl PairingSecurityLevel {
331    #[inline]
332    pub fn from_primitive(prim: u32) -> Option<Self> {
333        match prim {
334            1 => Some(Self::Encrypted),
335            2 => Some(Self::Authenticated),
336            _ => None,
337        }
338    }
339
340    #[inline]
341    pub const fn into_primitive(self) -> u32 {
342        self as u32
343    }
344}
345
346#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
347#[repr(u32)]
348pub enum TechnologyType {
349    LowEnergy = 1,
350    Classic = 2,
351    DualMode = 3,
352}
353
354impl TechnologyType {
355    #[inline]
356    pub fn from_primitive(prim: u32) -> Option<Self> {
357        match prim {
358            1 => Some(Self::LowEnergy),
359            2 => Some(Self::Classic),
360            3 => Some(Self::DualMode),
361            _ => None,
362        }
363    }
364
365    #[inline]
366    pub const fn into_primitive(self) -> u32 {
367        self as u32
368    }
369}
370
371#[derive(Clone, Debug, PartialEq)]
372pub struct AccessConnectRequest {
373    pub id: fidl_fuchsia_bluetooth::PeerId,
374}
375
376impl fidl::Persistable for AccessConnectRequest {}
377
378#[derive(Clone, Debug, PartialEq)]
379pub struct AccessDisconnectRequest {
380    pub id: fidl_fuchsia_bluetooth::PeerId,
381}
382
383impl fidl::Persistable for AccessDisconnectRequest {}
384
385#[derive(Clone, Debug, PartialEq)]
386pub struct AccessForgetRequest {
387    pub id: fidl_fuchsia_bluetooth::PeerId,
388}
389
390impl fidl::Persistable for AccessForgetRequest {}
391
392#[derive(Clone, Debug, PartialEq)]
393pub struct AccessPairRequest {
394    pub id: fidl_fuchsia_bluetooth::PeerId,
395    pub options: PairingOptions,
396}
397
398impl fidl::Persistable for AccessPairRequest {}
399
400#[derive(Clone, Debug, PartialEq)]
401pub struct AccessSetDeviceClassRequest {
402    pub device_class: fidl_fuchsia_bluetooth::DeviceClass,
403}
404
405impl fidl::Persistable for AccessSetDeviceClassRequest {}
406
407#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
408pub struct AccessSetLocalNameRequest {
409    pub name: String,
410}
411
412impl fidl::Persistable for AccessSetLocalNameRequest {}
413
414#[derive(Clone, Debug, PartialEq)]
415pub struct AccessWatchPeersResponse {
416    pub updated: Vec<Peer>,
417    pub removed: Vec<fidl_fuchsia_bluetooth::PeerId>,
418}
419
420impl fidl::Persistable for AccessWatchPeersResponse {}
421
422#[derive(Clone, Debug, PartialEq)]
423pub struct BootstrapAddIdentitiesRequest {
424    pub identities: Vec<Identity>,
425}
426
427impl fidl::Persistable for BootstrapAddIdentitiesRequest {}
428
429#[derive(Clone, Debug, PartialEq)]
430pub struct ConfigurationUpdateRequest {
431    pub settings: Settings,
432}
433
434impl fidl::Persistable for ConfigurationUpdateRequest {}
435
436#[derive(Clone, Debug, PartialEq)]
437pub struct ConfigurationUpdateResponse {
438    pub result: Settings,
439}
440
441impl fidl::Persistable for ConfigurationUpdateResponse {}
442
443#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
444pub struct Consent;
445
446impl fidl::Persistable for Consent {}
447
448#[derive(Clone, Debug, PartialEq)]
449pub struct HostWatcherSetActiveRequest {
450    pub id: fidl_fuchsia_bluetooth::HostId,
451}
452
453impl fidl::Persistable for HostWatcherSetActiveRequest {}
454
455#[derive(Clone, Debug, PartialEq)]
456pub struct HostWatcherWatchResponse {
457    pub hosts: Vec<HostInfo>,
458}
459
460impl fidl::Persistable for HostWatcherWatchResponse {}
461
462/// Represents a 128-bit secret key.
463#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
464#[repr(C)]
465pub struct Key {
466    pub value: [u8; 16],
467}
468
469impl fidl::Persistable for Key {}
470
471/// The preferred LE connection parameters of the peer.
472#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
473#[repr(C)]
474pub struct LeConnectionParameters {
475    pub connection_interval: u16,
476    pub connection_latency: u16,
477    pub supervision_timeout: u16,
478}
479
480impl fidl::Persistable for LeConnectionParameters {}
481
482/// Represents a LE Long-Term peer key used for link encyrption. The `ediv` and `rand`
483/// fields are zero if distributed using LE Secure Connections pairing.
484#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
485pub struct Ltk {
486    pub key: PeerKey,
487    pub ediv: u16,
488    pub rand: u64,
489}
490
491impl fidl::Persistable for Ltk {}
492
493#[derive(Clone, Debug, PartialEq)]
494pub struct PairingDelegate2RequestCompleteRequest {
495    pub id: fidl_fuchsia_bluetooth::PeerId,
496    pub success: bool,
497}
498
499impl fidl::Persistable for PairingDelegate2RequestCompleteRequest {}
500
501#[derive(Clone, Debug, PartialEq)]
502pub struct PairingDelegateOnLocalKeypressRequest {
503    pub id: fidl_fuchsia_bluetooth::PeerId,
504    pub keypress: PairingKeypress,
505}
506
507impl fidl::Persistable for PairingDelegateOnLocalKeypressRequest {}
508
509#[derive(Clone, Debug, PartialEq)]
510pub struct PairingDelegateOnPairingCompleteRequest {
511    pub id: fidl_fuchsia_bluetooth::PeerId,
512    pub success: bool,
513}
514
515impl fidl::Persistable for PairingDelegateOnPairingCompleteRequest {}
516
517#[derive(Clone, Debug, PartialEq)]
518pub struct PairingDelegateOnPairingRequestRequest {
519    pub peer: Peer,
520    pub method: PairingMethod,
521    pub displayed_passkey: u32,
522}
523
524impl fidl::Persistable for PairingDelegateOnPairingRequestRequest {}
525
526#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
527pub struct PairingDelegateOnPairingRequestResponse {
528    pub accept: bool,
529    pub entered_passkey: u32,
530}
531
532impl fidl::Persistable for PairingDelegateOnPairingRequestResponse {}
533
534#[derive(Clone, Debug, PartialEq)]
535pub struct PairingDelegateOnRemoteKeypressRequest {
536    pub id: fidl_fuchsia_bluetooth::PeerId,
537    pub keypress: PairingKeypress,
538}
539
540impl fidl::Persistable for PairingDelegateOnRemoteKeypressRequest {}
541
542#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
543pub struct PairingRequestKeypressRequest {
544    pub keypress: PairingKeypress,
545}
546
547impl fidl::Persistable for PairingRequestKeypressRequest {}
548
549#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
550pub struct PairingRequestOnCompleteRequest {
551    pub success: bool,
552}
553
554impl fidl::Persistable for PairingRequestOnCompleteRequest {}
555
556#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
557pub struct PairingRequestOnKeypressRequest {
558    pub keypress: PairingKeypress,
559}
560
561impl fidl::Persistable for PairingRequestOnKeypressRequest {}
562
563#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
564pub struct PasskeyEntry;
565
566impl fidl::Persistable for PasskeyEntry {}
567
568/// Represents a key that was received from a peer.
569#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
570pub struct PeerKey {
571    /// The security properties of this link under which this key was received.
572    pub security: SecurityProperties,
573    /// The contents of the key.
574    pub data: Key,
575}
576
577impl fidl::Persistable for PeerKey {}
578
579#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
580pub struct SecurityProperties {
581    pub authenticated: bool,
582    pub secure_connections: bool,
583    pub encryption_key_size: u8,
584}
585
586impl fidl::Persistable for SecurityProperties {}
587
588/// Represents the bonding data for a single peer.
589#[derive(Clone, Debug, Default, PartialEq)]
590pub struct BondingData {
591    /// The identifier that uniquely identifies this peer.
592    pub identifier: Option<fidl_fuchsia_bluetooth::PeerId>,
593    /// The local Bluetooth identity address that this bond is associated with.
594    pub local_address: Option<fidl_fuchsia_bluetooth::Address>,
595    /// The name of the peer, if known.
596    pub name: Option<String>,
597    /// The identity address of the peer.
598    pub address: Option<fidl_fuchsia_bluetooth::Address>,
599    /// Bonding data that is present when this peer is paired on the LE transport.
600    pub le_bond: Option<LeBondData>,
601    /// Bonding data that is present when this peer is paired on the BR/EDR transport.
602    pub bredr_bond: Option<BredrBondData>,
603    #[doc(hidden)]
604    pub __source_breaking: fidl::marker::SourceBreaking,
605}
606
607impl fidl::Persistable for BondingData {}
608
609#[derive(Clone, Debug, Default, PartialEq)]
610pub struct BredrBondData {
611    /// The peer's preferred piconet role. This is determined by role switch procedures. Paging and
612    /// connecting from a peer does not automatically set this flag. If absent, the peer has not
613    /// expressed a preference.
614    pub role_preference: Option<fidl_fuchsia_bluetooth::ConnectionRole>,
615    /// Known service UUIDs obtained from EIR data or SDP.
616    pub services: Option<Vec<fidl_fuchsia_bluetooth::Uuid>>,
617    /// The semi-permanent BR/EDR key. Present if link was paired with Secure Simple Pairing or
618    /// stronger.
619    pub link_key: Option<PeerKey>,
620    #[doc(hidden)]
621    pub __source_breaking: fidl::marker::SourceBreaking,
622}
623
624impl fidl::Persistable for BredrBondData {}
625
626/// Represents persistent local host data.
627#[derive(Clone, Debug, Default, PartialEq)]
628pub struct HostData {
629    /// The local Identity Resolving Key used by a bt-host device to generate Resolvable Private
630    /// Addresses when privacy is enabled.
631    ///
632    /// May be absent for hosts that do not use LE privacy, or that only use Non-Resolvable Private
633    /// Addresses.
634    ///
635    /// NOTE: This key is distributed to LE peers during pairing procedures. The client must take
636    /// care to assign an IRK that consistent with the local bt-host identity.
637    pub irk: Option<Key>,
638    #[doc(hidden)]
639    pub __source_breaking: fidl::marker::SourceBreaking,
640}
641
642impl fidl::Persistable for HostData {}
643
644/// Information about a Bluetooth controller and its associated host-subsystem state.
645#[derive(Clone, Debug, Default, PartialEq)]
646pub struct HostInfo {
647    /// Uniquely identifies a host on the current system.
648    ///
649    /// This field is always present.
650    pub id: Option<fidl_fuchsia_bluetooth::HostId>,
651    /// The Bluetooth technologies that are supported by this adapter.
652    ///
653    /// This field is always present.
654    pub technology: Option<TechnologyType>,
655    /// Indicates whether or not this is the active host. The system has one active host which
656    /// handles all Bluetooth procedures.
657    pub active: Option<bool>,
658    /// The local name of this host. This is the name that is visible to other devices when this
659    /// host is in the discoverable mode.
660    pub local_name: Option<String>,
661    /// Whether or not the local adapter is currently discoverable over BR/EDR and
662    /// LE physical channels.
663    pub discoverable: Option<bool>,
664    /// Whether or not device discovery is currently being performed.
665    pub discovering: Option<bool>,
666    /// The addresses (LE and/or BR/EDR) associated with the host.
667    ///
668    /// The Public address is always reported first.
669    ///
670    /// This field is always present.
671    pub addresses: Option<Vec<fidl_fuchsia_bluetooth::Address>>,
672    #[doc(hidden)]
673    pub __source_breaking: fidl::marker::SourceBreaking,
674}
675
676impl fidl::Persistable for HostInfo {}
677
678/// Represents the persistent configuration of a single host-subsystem instance. This is used for
679/// identity presentation (inquiry, inquiry response, and advertisement) and for bonding secrets
680/// recall (encrypting link data to peers associated with this identity).
681///
682/// Each BR/EDR BD_ADDR and Low Energy public identity address used to bond should have its own
683/// Identity instance containing corresponding peers.
684///
685/// Each Identity instance that supports LE privacy should have an Identity Resolving Key (IRK) that
686/// is consistent with that distributed to its bonded peers.
687#[derive(Clone, Debug, Default, PartialEq)]
688pub struct Identity {
689    pub host: Option<HostData>,
690    /// All bonds that use a public identity address must contain the same local address.
691    pub bonds: Option<Vec<BondingData>>,
692    #[doc(hidden)]
693    pub __source_breaking: fidl::marker::SourceBreaking,
694}
695
696impl fidl::Persistable for Identity {}
697
698#[derive(Clone, Debug, Default, PartialEq)]
699pub struct LeBondData {
700    /// The peer's preferred connection parameters, if known.
701    pub connection_parameters: Option<LeConnectionParameters>,
702    /// Known GATT service UUIDs.
703    pub services: Option<Vec<fidl_fuchsia_bluetooth::Uuid>>,
704    /// Identity Resolving RemoteKey used to generate and resolve random addresses.
705    pub irk: Option<PeerKey>,
706    /// Connection Signature Resolving RemoteKey used for data signing without encryption.
707    pub csrk: Option<PeerKey>,
708    /// LE long-term key used to encrypt a connection when the peer is in the LE Peripheral role.
709    ///
710    /// In legacy pairing (`peer_ltk.security.secure_connections` is false),  this key corresponds
711    /// to the key distributed by the peer. In Secure Connections pairing there is only one LTK and
712    /// `peer_ltk` is the same as `local_ltk`.
713    pub peer_ltk: Option<Ltk>,
714    /// LE long-term key used to encrypt a connection when the peer is in the LE Central role.
715    ///
716    /// In legacy pairing (`local_ltk.security.secure_connections` is false), this key corresponds
717    /// to the key distributed by the local device. In Secure Connections pairing there is only one
718    /// LTK and `local_ltk` is the same as `peer_ltk`.
719    pub local_ltk: Option<Ltk>,
720    #[doc(hidden)]
721    pub __source_breaking: fidl::marker::SourceBreaking,
722}
723
724impl fidl::Persistable for LeBondData {}
725
726/// Parameters that give a caller more fine-grained control over the pairing process. All of the
727/// fields of this table are optional and pairing can still succeed if none of them are set.
728#[derive(Clone, Debug, Default, PartialEq)]
729pub struct PairingOptions {
730    /// Only relevant for LE. If present, determines the Security Manager security level to pair
731    /// with. If not present, interpreted as PairingSecurityLevel.AUTHENTICATED.
732    pub le_security_level: Option<PairingSecurityLevel>,
733    /// If transport is LOW_ENERGY or DUAL_MODE, whether the device should form a bond or not during
734    /// pairing. If not present, interpreted as bondable mode.
735    ///
736    /// If transport is CLASSIC, this option must be absent or otherwise the value BONDABLE.
737    /// NON_BONDABLE mode is not currently supported for the CLASSIC transport
738    pub bondable_mode: Option<BondableMode>,
739    /// If transport is LOW_ENERGY, indicate a desire to pair over the LE transport.
740    /// If transport is CLASSIC, indicate a desire to pair over the Br/Edr transport.
741    /// If transport is DUAL_MODE, indicate a desire to pair over both transports.
742    /// If not present, interpreted as TechnologyType.DUAL_MODE
743    pub transport: Option<TechnologyType>,
744    #[doc(hidden)]
745    pub __source_breaking: fidl::marker::SourceBreaking,
746}
747
748impl fidl::Persistable for PairingOptions {}
749
750#[derive(Clone, Debug, Default, PartialEq)]
751pub struct PairingRequestAcceptRequest {
752    pub entered_passkey: Option<u32>,
753    #[doc(hidden)]
754    pub __source_breaking: fidl::marker::SourceBreaking,
755}
756
757impl fidl::Persistable for PairingRequestAcceptRequest {}
758
759/// Represents a remote BR/EDR, LE, or dual-mode BR/EDR/LE peer.
760#[derive(Clone, Debug, Default, PartialEq)]
761pub struct Peer {
762    /// Uniquely identifies this peer on the current system.
763    ///
764    /// This field is always present.
765    pub id: Option<fidl_fuchsia_bluetooth::PeerId>,
766    /// Bluetooth device address that identifies this peer. Clients
767    /// should display this field to the user when `name` is not available.
768    ///
769    /// This field is always present.
770    ///
771    /// NOTE: Clients should use the `identifier` field to keep track of peers instead of their
772    /// address.
773    pub address: Option<fidl_fuchsia_bluetooth::Address>,
774    /// The Bluetooth technologies that are supported by this peer.
775    ///
776    /// This field is always present.
777    pub technology: Option<TechnologyType>,
778    /// Whether or not a BR/EDR and/or LE connection exists to this peer.
779    ///
780    /// This field is always present.
781    pub connected: Option<bool>,
782    /// Whether or not this peer is bonded.
783    ///
784    /// This field is always present.
785    pub bonded: Option<bool>,
786    /// The name of the peer, if known.
787    pub name: Option<String>,
788    /// The LE appearance property. Present if this peer supports LE and the
789    /// appearance information was obtained over advertising and/or GATT.
790    pub appearance: Option<fidl_fuchsia_bluetooth::Appearance>,
791    /// The class of device for this device, if known.
792    pub device_class: Option<fidl_fuchsia_bluetooth::DeviceClass>,
793    /// The most recently obtained advertising signal strength for this peer. Present if known.
794    pub rssi: Option<i8>,
795    /// The most recently obtained transmission power for this peer. Present if known.
796    pub tx_power: Option<i8>,
797    /// The list of service UUIDs known to be available on this peer.
798    ///
799    /// This is a legacy field that should not be depended on for new code.
800    pub services: Option<Vec<fidl_fuchsia_bluetooth::Uuid>>,
801    /// The list of service UUIDs known to be available on the LE transport.
802    ///
803    /// Never present if technology is CLASSIC.
804    pub le_services: Option<Vec<fidl_fuchsia_bluetooth::Uuid>>,
805    /// The cached list of service UUIDs previously discovered on the BR/EDR transport.
806    /// Services are not removed if peer is disconnected if subsequent searches don't find them.
807    ///
808    /// Never present if technology is LOW_ENERGY.
809    ///
810    /// This is a legacy field that should not be depended on for new code.
811    pub bredr_services: Option<Vec<fidl_fuchsia_bluetooth::Uuid>>,
812    #[doc(hidden)]
813    pub __source_breaking: fidl::marker::SourceBreaking,
814}
815
816impl fidl::Persistable for Peer {}
817
818/// Represents the Bluetooth Host Subsystem parameters available for configuration. Each parameter
819/// is set to a default upon Bluetooth system initialization. The default values for each parameter
820/// can be found in //src/connectivity/bluetooth/core/bt-gap/config/default.js.
821#[derive(Clone, Debug, Default, PartialEq)]
822pub struct Settings {
823    /// If true then enable the LE Privacy feature, if false disable it. If not present, leaves the
824    /// current value unchanged. When enabled, all BLE procedures that broadcast the local device
825    /// address (active scanning, connection initiation, and advertising) use a Resolvable Private
826    /// Address type. When disabled, these procedures reveal the local public identity address
827    /// assigned to the controller.
828    ///
829    /// Enabling this feature is highly recommended on products.
830    pub le_privacy: Option<bool>,
831    /// If true then enable LE background-scan feature, if false disable it. If not present, leaves
832    /// the current value unchanged. When enabled, the system maintains an on-going passive scan
833    /// and establishes connections to bonded peers that are in "Connectable" or "Directed
834    /// Connectable" mode.
835    pub le_background_scan: Option<bool>,
836    /// If true then enable BR/EDR connectable mode, if false disable it. If not present, leaves
837    /// the current value unchanged. When enabled, bt-host devices are put into BR/EDR page scan
838    /// mode and accept connections.
839    pub bredr_connectable_mode: Option<bool>,
840    /// If present then sets the LE Security mode of the Host Subsystem, if not present leaves the
841    /// current value unchanged. See BT Core Spec v5.2 Vol. 3 Part C 10.2 for more details. If
842    /// present and set to Secure Connections Only mode, any active connections not meeting the
843    /// requirements of Secure Connections Only mode are disconnected.
844    pub le_security_mode: Option<LeSecurityMode>,
845    /// If present then sets the BR/EDR Security mode of the Host Subsystem, if not present leaves
846    /// the current value unchanged. See BT Core Spec v5.2 Vol. 3 Part C 5.2.2 for more details. If
847    /// present and set to Secure Connections Only mode, any active connections not meeting the
848    /// requirements of Secure Connections Only mode are disconnected.
849    pub bredr_security_mode: Option<BrEdrSecurityMode>,
850    #[doc(hidden)]
851    pub __source_breaking: fidl::marker::SourceBreaking,
852}
853
854impl fidl::Persistable for Settings {}
855
856#[derive(Clone, Debug)]
857pub enum PairingProperties {
858    /// The user is asked to accept or reject pairing.
859    /// This is the minimum method - even when both devices do not support
860    /// input or output, the delegate will be asked to confirm any pairing
861    /// not initiated with user intent.
862    Consent(Consent),
863    /// The user is shown a 6-digit numerical passkey on this device which they
864    /// must key in on the peer device.
865    /// The passkey to be displayed is provided.
866    PasskeyDisplay(u32),
867    /// The user is shown a 6-digit numerical passkey on this device which will
868    /// also be shown on the peer device. The user must compare the passkeys and
869    /// accept the pairing if the passkeys match.
870    /// The passkey to be displayed is provided.
871    PasskeyConfirmation(u32),
872    /// The user is asked to enter a 6-digit passkey on this device which is
873    /// communicated via the peer device.
874    PasskeyEntry(PasskeyEntry),
875    #[doc(hidden)]
876    __SourceBreaking { unknown_ordinal: u64 },
877}
878
879/// Pattern that matches an unknown `PairingProperties` member.
880#[macro_export]
881macro_rules! PairingPropertiesUnknown {
882    () => {
883        _
884    };
885}
886
887// Custom PartialEq so that unknown variants are not equal to themselves.
888impl PartialEq for PairingProperties {
889    fn eq(&self, other: &Self) -> bool {
890        match (self, other) {
891            (Self::Consent(x), Self::Consent(y)) => *x == *y,
892            (Self::PasskeyDisplay(x), Self::PasskeyDisplay(y)) => *x == *y,
893            (Self::PasskeyConfirmation(x), Self::PasskeyConfirmation(y)) => *x == *y,
894            (Self::PasskeyEntry(x), Self::PasskeyEntry(y)) => *x == *y,
895            _ => false,
896        }
897    }
898}
899
900impl PairingProperties {
901    #[inline]
902    pub fn ordinal(&self) -> u64 {
903        match *self {
904            Self::Consent(_) => 1,
905            Self::PasskeyDisplay(_) => 2,
906            Self::PasskeyConfirmation(_) => 3,
907            Self::PasskeyEntry(_) => 4,
908            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
909        }
910    }
911
912    #[inline]
913    pub fn unknown_variant_for_testing() -> Self {
914        Self::__SourceBreaking { unknown_ordinal: 0 }
915    }
916
917    #[inline]
918    pub fn is_unknown(&self) -> bool {
919        match self {
920            Self::__SourceBreaking { .. } => true,
921            _ => false,
922        }
923    }
924}
925
926impl fidl::Persistable for PairingProperties {}
927
928mod internal {
929    use super::*;
930    unsafe impl fidl::encoding::TypeMarker for BondableMode {
931        type Owned = Self;
932
933        #[inline(always)]
934        fn inline_align(_context: fidl::encoding::Context) -> usize {
935            std::mem::align_of::<u32>()
936        }
937
938        #[inline(always)]
939        fn inline_size(_context: fidl::encoding::Context) -> usize {
940            std::mem::size_of::<u32>()
941        }
942
943        #[inline(always)]
944        fn encode_is_copy() -> bool {
945            true
946        }
947
948        #[inline(always)]
949        fn decode_is_copy() -> bool {
950            false
951        }
952    }
953
954    impl fidl::encoding::ValueTypeMarker for BondableMode {
955        type Borrowed<'a> = Self;
956        #[inline(always)]
957        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
958            *value
959        }
960    }
961
962    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for BondableMode {
963        #[inline]
964        unsafe fn encode(
965            self,
966            encoder: &mut fidl::encoding::Encoder<'_, D>,
967            offset: usize,
968            _depth: fidl::encoding::Depth,
969        ) -> fidl::Result<()> {
970            encoder.debug_check_bounds::<Self>(offset);
971            encoder.write_num(self.into_primitive(), offset);
972            Ok(())
973        }
974    }
975
976    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for BondableMode {
977        #[inline(always)]
978        fn new_empty() -> Self {
979            Self::Bondable
980        }
981
982        #[inline]
983        unsafe fn decode(
984            &mut self,
985            decoder: &mut fidl::encoding::Decoder<'_, D>,
986            offset: usize,
987            _depth: fidl::encoding::Depth,
988        ) -> fidl::Result<()> {
989            decoder.debug_check_bounds::<Self>(offset);
990            let prim = decoder.read_num::<u32>(offset);
991
992            *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
993            Ok(())
994        }
995    }
996    unsafe impl fidl::encoding::TypeMarker for BootstrapError {
997        type Owned = Self;
998
999        #[inline(always)]
1000        fn inline_align(_context: fidl::encoding::Context) -> usize {
1001            std::mem::align_of::<u32>()
1002        }
1003
1004        #[inline(always)]
1005        fn inline_size(_context: fidl::encoding::Context) -> usize {
1006            std::mem::size_of::<u32>()
1007        }
1008
1009        #[inline(always)]
1010        fn encode_is_copy() -> bool {
1011            true
1012        }
1013
1014        #[inline(always)]
1015        fn decode_is_copy() -> bool {
1016            false
1017        }
1018    }
1019
1020    impl fidl::encoding::ValueTypeMarker for BootstrapError {
1021        type Borrowed<'a> = Self;
1022        #[inline(always)]
1023        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1024            *value
1025        }
1026    }
1027
1028    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for BootstrapError {
1029        #[inline]
1030        unsafe fn encode(
1031            self,
1032            encoder: &mut fidl::encoding::Encoder<'_, D>,
1033            offset: usize,
1034            _depth: fidl::encoding::Depth,
1035        ) -> fidl::Result<()> {
1036            encoder.debug_check_bounds::<Self>(offset);
1037            encoder.write_num(self.into_primitive(), offset);
1038            Ok(())
1039        }
1040    }
1041
1042    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for BootstrapError {
1043        #[inline(always)]
1044        fn new_empty() -> Self {
1045            Self::InvalidHostIdentity
1046        }
1047
1048        #[inline]
1049        unsafe fn decode(
1050            &mut self,
1051            decoder: &mut fidl::encoding::Decoder<'_, D>,
1052            offset: usize,
1053            _depth: fidl::encoding::Depth,
1054        ) -> fidl::Result<()> {
1055            decoder.debug_check_bounds::<Self>(offset);
1056            let prim = decoder.read_num::<u32>(offset);
1057
1058            *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
1059            Ok(())
1060        }
1061    }
1062    unsafe impl fidl::encoding::TypeMarker for BrEdrSecurityMode {
1063        type Owned = Self;
1064
1065        #[inline(always)]
1066        fn inline_align(_context: fidl::encoding::Context) -> usize {
1067            std::mem::align_of::<u32>()
1068        }
1069
1070        #[inline(always)]
1071        fn inline_size(_context: fidl::encoding::Context) -> usize {
1072            std::mem::size_of::<u32>()
1073        }
1074
1075        #[inline(always)]
1076        fn encode_is_copy() -> bool {
1077            true
1078        }
1079
1080        #[inline(always)]
1081        fn decode_is_copy() -> bool {
1082            false
1083        }
1084    }
1085
1086    impl fidl::encoding::ValueTypeMarker for BrEdrSecurityMode {
1087        type Borrowed<'a> = Self;
1088        #[inline(always)]
1089        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1090            *value
1091        }
1092    }
1093
1094    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
1095        for BrEdrSecurityMode
1096    {
1097        #[inline]
1098        unsafe fn encode(
1099            self,
1100            encoder: &mut fidl::encoding::Encoder<'_, D>,
1101            offset: usize,
1102            _depth: fidl::encoding::Depth,
1103        ) -> fidl::Result<()> {
1104            encoder.debug_check_bounds::<Self>(offset);
1105            encoder.write_num(self.into_primitive(), offset);
1106            Ok(())
1107        }
1108    }
1109
1110    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for BrEdrSecurityMode {
1111        #[inline(always)]
1112        fn new_empty() -> Self {
1113            Self::Mode4
1114        }
1115
1116        #[inline]
1117        unsafe fn decode(
1118            &mut self,
1119            decoder: &mut fidl::encoding::Decoder<'_, D>,
1120            offset: usize,
1121            _depth: fidl::encoding::Depth,
1122        ) -> fidl::Result<()> {
1123            decoder.debug_check_bounds::<Self>(offset);
1124            let prim = decoder.read_num::<u32>(offset);
1125
1126            *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
1127            Ok(())
1128        }
1129    }
1130    unsafe impl fidl::encoding::TypeMarker for Error {
1131        type Owned = Self;
1132
1133        #[inline(always)]
1134        fn inline_align(_context: fidl::encoding::Context) -> usize {
1135            std::mem::align_of::<u32>()
1136        }
1137
1138        #[inline(always)]
1139        fn inline_size(_context: fidl::encoding::Context) -> usize {
1140            std::mem::size_of::<u32>()
1141        }
1142
1143        #[inline(always)]
1144        fn encode_is_copy() -> bool {
1145            true
1146        }
1147
1148        #[inline(always)]
1149        fn decode_is_copy() -> bool {
1150            false
1151        }
1152    }
1153
1154    impl fidl::encoding::ValueTypeMarker for Error {
1155        type Borrowed<'a> = Self;
1156        #[inline(always)]
1157        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1158            *value
1159        }
1160    }
1161
1162    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for Error {
1163        #[inline]
1164        unsafe fn encode(
1165            self,
1166            encoder: &mut fidl::encoding::Encoder<'_, D>,
1167            offset: usize,
1168            _depth: fidl::encoding::Depth,
1169        ) -> fidl::Result<()> {
1170            encoder.debug_check_bounds::<Self>(offset);
1171            encoder.write_num(self.into_primitive(), offset);
1172            Ok(())
1173        }
1174    }
1175
1176    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Error {
1177        #[inline(always)]
1178        fn new_empty() -> Self {
1179            Self::Failed
1180        }
1181
1182        #[inline]
1183        unsafe fn decode(
1184            &mut self,
1185            decoder: &mut fidl::encoding::Decoder<'_, D>,
1186            offset: usize,
1187            _depth: fidl::encoding::Depth,
1188        ) -> fidl::Result<()> {
1189            decoder.debug_check_bounds::<Self>(offset);
1190            let prim = decoder.read_num::<u32>(offset);
1191
1192            *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
1193            Ok(())
1194        }
1195    }
1196    unsafe impl fidl::encoding::TypeMarker for InputCapability {
1197        type Owned = Self;
1198
1199        #[inline(always)]
1200        fn inline_align(_context: fidl::encoding::Context) -> usize {
1201            std::mem::align_of::<u32>()
1202        }
1203
1204        #[inline(always)]
1205        fn inline_size(_context: fidl::encoding::Context) -> usize {
1206            std::mem::size_of::<u32>()
1207        }
1208
1209        #[inline(always)]
1210        fn encode_is_copy() -> bool {
1211            true
1212        }
1213
1214        #[inline(always)]
1215        fn decode_is_copy() -> bool {
1216            false
1217        }
1218    }
1219
1220    impl fidl::encoding::ValueTypeMarker for InputCapability {
1221        type Borrowed<'a> = Self;
1222        #[inline(always)]
1223        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1224            *value
1225        }
1226    }
1227
1228    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
1229        for InputCapability
1230    {
1231        #[inline]
1232        unsafe fn encode(
1233            self,
1234            encoder: &mut fidl::encoding::Encoder<'_, D>,
1235            offset: usize,
1236            _depth: fidl::encoding::Depth,
1237        ) -> fidl::Result<()> {
1238            encoder.debug_check_bounds::<Self>(offset);
1239            encoder.write_num(self.into_primitive(), offset);
1240            Ok(())
1241        }
1242    }
1243
1244    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for InputCapability {
1245        #[inline(always)]
1246        fn new_empty() -> Self {
1247            Self::None
1248        }
1249
1250        #[inline]
1251        unsafe fn decode(
1252            &mut self,
1253            decoder: &mut fidl::encoding::Decoder<'_, D>,
1254            offset: usize,
1255            _depth: fidl::encoding::Depth,
1256        ) -> fidl::Result<()> {
1257            decoder.debug_check_bounds::<Self>(offset);
1258            let prim = decoder.read_num::<u32>(offset);
1259
1260            *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
1261            Ok(())
1262        }
1263    }
1264    unsafe impl fidl::encoding::TypeMarker for LeSecurityMode {
1265        type Owned = Self;
1266
1267        #[inline(always)]
1268        fn inline_align(_context: fidl::encoding::Context) -> usize {
1269            std::mem::align_of::<u32>()
1270        }
1271
1272        #[inline(always)]
1273        fn inline_size(_context: fidl::encoding::Context) -> usize {
1274            std::mem::size_of::<u32>()
1275        }
1276
1277        #[inline(always)]
1278        fn encode_is_copy() -> bool {
1279            true
1280        }
1281
1282        #[inline(always)]
1283        fn decode_is_copy() -> bool {
1284            false
1285        }
1286    }
1287
1288    impl fidl::encoding::ValueTypeMarker for LeSecurityMode {
1289        type Borrowed<'a> = Self;
1290        #[inline(always)]
1291        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1292            *value
1293        }
1294    }
1295
1296    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for LeSecurityMode {
1297        #[inline]
1298        unsafe fn encode(
1299            self,
1300            encoder: &mut fidl::encoding::Encoder<'_, D>,
1301            offset: usize,
1302            _depth: fidl::encoding::Depth,
1303        ) -> fidl::Result<()> {
1304            encoder.debug_check_bounds::<Self>(offset);
1305            encoder.write_num(self.into_primitive(), offset);
1306            Ok(())
1307        }
1308    }
1309
1310    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for LeSecurityMode {
1311        #[inline(always)]
1312        fn new_empty() -> Self {
1313            Self::Mode1
1314        }
1315
1316        #[inline]
1317        unsafe fn decode(
1318            &mut self,
1319            decoder: &mut fidl::encoding::Decoder<'_, D>,
1320            offset: usize,
1321            _depth: fidl::encoding::Depth,
1322        ) -> fidl::Result<()> {
1323            decoder.debug_check_bounds::<Self>(offset);
1324            let prim = decoder.read_num::<u32>(offset);
1325
1326            *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
1327            Ok(())
1328        }
1329    }
1330    unsafe impl fidl::encoding::TypeMarker for OutputCapability {
1331        type Owned = Self;
1332
1333        #[inline(always)]
1334        fn inline_align(_context: fidl::encoding::Context) -> usize {
1335            std::mem::align_of::<u32>()
1336        }
1337
1338        #[inline(always)]
1339        fn inline_size(_context: fidl::encoding::Context) -> usize {
1340            std::mem::size_of::<u32>()
1341        }
1342
1343        #[inline(always)]
1344        fn encode_is_copy() -> bool {
1345            true
1346        }
1347
1348        #[inline(always)]
1349        fn decode_is_copy() -> bool {
1350            false
1351        }
1352    }
1353
1354    impl fidl::encoding::ValueTypeMarker for OutputCapability {
1355        type Borrowed<'a> = Self;
1356        #[inline(always)]
1357        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1358            *value
1359        }
1360    }
1361
1362    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
1363        for OutputCapability
1364    {
1365        #[inline]
1366        unsafe fn encode(
1367            self,
1368            encoder: &mut fidl::encoding::Encoder<'_, D>,
1369            offset: usize,
1370            _depth: fidl::encoding::Depth,
1371        ) -> fidl::Result<()> {
1372            encoder.debug_check_bounds::<Self>(offset);
1373            encoder.write_num(self.into_primitive(), offset);
1374            Ok(())
1375        }
1376    }
1377
1378    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for OutputCapability {
1379        #[inline(always)]
1380        fn new_empty() -> Self {
1381            Self::None
1382        }
1383
1384        #[inline]
1385        unsafe fn decode(
1386            &mut self,
1387            decoder: &mut fidl::encoding::Decoder<'_, D>,
1388            offset: usize,
1389            _depth: fidl::encoding::Depth,
1390        ) -> fidl::Result<()> {
1391            decoder.debug_check_bounds::<Self>(offset);
1392            let prim = decoder.read_num::<u32>(offset);
1393
1394            *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
1395            Ok(())
1396        }
1397    }
1398    unsafe impl fidl::encoding::TypeMarker for PairingKeypress {
1399        type Owned = Self;
1400
1401        #[inline(always)]
1402        fn inline_align(_context: fidl::encoding::Context) -> usize {
1403            std::mem::align_of::<u32>()
1404        }
1405
1406        #[inline(always)]
1407        fn inline_size(_context: fidl::encoding::Context) -> usize {
1408            std::mem::size_of::<u32>()
1409        }
1410
1411        #[inline(always)]
1412        fn encode_is_copy() -> bool {
1413            true
1414        }
1415
1416        #[inline(always)]
1417        fn decode_is_copy() -> bool {
1418            false
1419        }
1420    }
1421
1422    impl fidl::encoding::ValueTypeMarker for PairingKeypress {
1423        type Borrowed<'a> = Self;
1424        #[inline(always)]
1425        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1426            *value
1427        }
1428    }
1429
1430    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
1431        for PairingKeypress
1432    {
1433        #[inline]
1434        unsafe fn encode(
1435            self,
1436            encoder: &mut fidl::encoding::Encoder<'_, D>,
1437            offset: usize,
1438            _depth: fidl::encoding::Depth,
1439        ) -> fidl::Result<()> {
1440            encoder.debug_check_bounds::<Self>(offset);
1441            encoder.write_num(self.into_primitive(), offset);
1442            Ok(())
1443        }
1444    }
1445
1446    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for PairingKeypress {
1447        #[inline(always)]
1448        fn new_empty() -> Self {
1449            Self::DigitEntered
1450        }
1451
1452        #[inline]
1453        unsafe fn decode(
1454            &mut self,
1455            decoder: &mut fidl::encoding::Decoder<'_, D>,
1456            offset: usize,
1457            _depth: fidl::encoding::Depth,
1458        ) -> fidl::Result<()> {
1459            decoder.debug_check_bounds::<Self>(offset);
1460            let prim = decoder.read_num::<u32>(offset);
1461
1462            *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
1463            Ok(())
1464        }
1465    }
1466    unsafe impl fidl::encoding::TypeMarker for PairingMethod {
1467        type Owned = Self;
1468
1469        #[inline(always)]
1470        fn inline_align(_context: fidl::encoding::Context) -> usize {
1471            std::mem::align_of::<u32>()
1472        }
1473
1474        #[inline(always)]
1475        fn inline_size(_context: fidl::encoding::Context) -> usize {
1476            std::mem::size_of::<u32>()
1477        }
1478
1479        #[inline(always)]
1480        fn encode_is_copy() -> bool {
1481            true
1482        }
1483
1484        #[inline(always)]
1485        fn decode_is_copy() -> bool {
1486            false
1487        }
1488    }
1489
1490    impl fidl::encoding::ValueTypeMarker for PairingMethod {
1491        type Borrowed<'a> = Self;
1492        #[inline(always)]
1493        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1494            *value
1495        }
1496    }
1497
1498    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for PairingMethod {
1499        #[inline]
1500        unsafe fn encode(
1501            self,
1502            encoder: &mut fidl::encoding::Encoder<'_, D>,
1503            offset: usize,
1504            _depth: fidl::encoding::Depth,
1505        ) -> fidl::Result<()> {
1506            encoder.debug_check_bounds::<Self>(offset);
1507            encoder.write_num(self.into_primitive(), offset);
1508            Ok(())
1509        }
1510    }
1511
1512    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for PairingMethod {
1513        #[inline(always)]
1514        fn new_empty() -> Self {
1515            Self::Consent
1516        }
1517
1518        #[inline]
1519        unsafe fn decode(
1520            &mut self,
1521            decoder: &mut fidl::encoding::Decoder<'_, D>,
1522            offset: usize,
1523            _depth: fidl::encoding::Depth,
1524        ) -> fidl::Result<()> {
1525            decoder.debug_check_bounds::<Self>(offset);
1526            let prim = decoder.read_num::<u32>(offset);
1527
1528            *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
1529            Ok(())
1530        }
1531    }
1532    unsafe impl fidl::encoding::TypeMarker for PairingSecurityLevel {
1533        type Owned = Self;
1534
1535        #[inline(always)]
1536        fn inline_align(_context: fidl::encoding::Context) -> usize {
1537            std::mem::align_of::<u32>()
1538        }
1539
1540        #[inline(always)]
1541        fn inline_size(_context: fidl::encoding::Context) -> usize {
1542            std::mem::size_of::<u32>()
1543        }
1544
1545        #[inline(always)]
1546        fn encode_is_copy() -> bool {
1547            true
1548        }
1549
1550        #[inline(always)]
1551        fn decode_is_copy() -> bool {
1552            false
1553        }
1554    }
1555
1556    impl fidl::encoding::ValueTypeMarker for PairingSecurityLevel {
1557        type Borrowed<'a> = Self;
1558        #[inline(always)]
1559        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1560            *value
1561        }
1562    }
1563
1564    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
1565        for PairingSecurityLevel
1566    {
1567        #[inline]
1568        unsafe fn encode(
1569            self,
1570            encoder: &mut fidl::encoding::Encoder<'_, D>,
1571            offset: usize,
1572            _depth: fidl::encoding::Depth,
1573        ) -> fidl::Result<()> {
1574            encoder.debug_check_bounds::<Self>(offset);
1575            encoder.write_num(self.into_primitive(), offset);
1576            Ok(())
1577        }
1578    }
1579
1580    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for PairingSecurityLevel {
1581        #[inline(always)]
1582        fn new_empty() -> Self {
1583            Self::Encrypted
1584        }
1585
1586        #[inline]
1587        unsafe fn decode(
1588            &mut self,
1589            decoder: &mut fidl::encoding::Decoder<'_, D>,
1590            offset: usize,
1591            _depth: fidl::encoding::Depth,
1592        ) -> fidl::Result<()> {
1593            decoder.debug_check_bounds::<Self>(offset);
1594            let prim = decoder.read_num::<u32>(offset);
1595
1596            *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
1597            Ok(())
1598        }
1599    }
1600    unsafe impl fidl::encoding::TypeMarker for TechnologyType {
1601        type Owned = Self;
1602
1603        #[inline(always)]
1604        fn inline_align(_context: fidl::encoding::Context) -> usize {
1605            std::mem::align_of::<u32>()
1606        }
1607
1608        #[inline(always)]
1609        fn inline_size(_context: fidl::encoding::Context) -> usize {
1610            std::mem::size_of::<u32>()
1611        }
1612
1613        #[inline(always)]
1614        fn encode_is_copy() -> bool {
1615            true
1616        }
1617
1618        #[inline(always)]
1619        fn decode_is_copy() -> bool {
1620            false
1621        }
1622    }
1623
1624    impl fidl::encoding::ValueTypeMarker for TechnologyType {
1625        type Borrowed<'a> = Self;
1626        #[inline(always)]
1627        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1628            *value
1629        }
1630    }
1631
1632    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for TechnologyType {
1633        #[inline]
1634        unsafe fn encode(
1635            self,
1636            encoder: &mut fidl::encoding::Encoder<'_, D>,
1637            offset: usize,
1638            _depth: fidl::encoding::Depth,
1639        ) -> fidl::Result<()> {
1640            encoder.debug_check_bounds::<Self>(offset);
1641            encoder.write_num(self.into_primitive(), offset);
1642            Ok(())
1643        }
1644    }
1645
1646    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for TechnologyType {
1647        #[inline(always)]
1648        fn new_empty() -> Self {
1649            Self::LowEnergy
1650        }
1651
1652        #[inline]
1653        unsafe fn decode(
1654            &mut self,
1655            decoder: &mut fidl::encoding::Decoder<'_, D>,
1656            offset: usize,
1657            _depth: fidl::encoding::Depth,
1658        ) -> fidl::Result<()> {
1659            decoder.debug_check_bounds::<Self>(offset);
1660            let prim = decoder.read_num::<u32>(offset);
1661
1662            *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
1663            Ok(())
1664        }
1665    }
1666
1667    impl fidl::encoding::ValueTypeMarker for AccessConnectRequest {
1668        type Borrowed<'a> = &'a Self;
1669        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1670            value
1671        }
1672    }
1673
1674    unsafe impl fidl::encoding::TypeMarker for AccessConnectRequest {
1675        type Owned = Self;
1676
1677        #[inline(always)]
1678        fn inline_align(_context: fidl::encoding::Context) -> usize {
1679            8
1680        }
1681
1682        #[inline(always)]
1683        fn inline_size(_context: fidl::encoding::Context) -> usize {
1684            8
1685        }
1686    }
1687
1688    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<AccessConnectRequest, D>
1689        for &AccessConnectRequest
1690    {
1691        #[inline]
1692        unsafe fn encode(
1693            self,
1694            encoder: &mut fidl::encoding::Encoder<'_, D>,
1695            offset: usize,
1696            _depth: fidl::encoding::Depth,
1697        ) -> fidl::Result<()> {
1698            encoder.debug_check_bounds::<AccessConnectRequest>(offset);
1699            // Delegate to tuple encoding.
1700            fidl::encoding::Encode::<AccessConnectRequest, D>::encode(
1701                (<fidl_fuchsia_bluetooth::PeerId as fidl::encoding::ValueTypeMarker>::borrow(
1702                    &self.id,
1703                ),),
1704                encoder,
1705                offset,
1706                _depth,
1707            )
1708        }
1709    }
1710    unsafe impl<
1711            D: fidl::encoding::ResourceDialect,
1712            T0: fidl::encoding::Encode<fidl_fuchsia_bluetooth::PeerId, D>,
1713        > fidl::encoding::Encode<AccessConnectRequest, D> for (T0,)
1714    {
1715        #[inline]
1716        unsafe fn encode(
1717            self,
1718            encoder: &mut fidl::encoding::Encoder<'_, D>,
1719            offset: usize,
1720            depth: fidl::encoding::Depth,
1721        ) -> fidl::Result<()> {
1722            encoder.debug_check_bounds::<AccessConnectRequest>(offset);
1723            // Zero out padding regions. There's no need to apply masks
1724            // because the unmasked parts will be overwritten by fields.
1725            // Write the fields.
1726            self.0.encode(encoder, offset + 0, depth)?;
1727            Ok(())
1728        }
1729    }
1730
1731    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for AccessConnectRequest {
1732        #[inline(always)]
1733        fn new_empty() -> Self {
1734            Self { id: fidl::new_empty!(fidl_fuchsia_bluetooth::PeerId, D) }
1735        }
1736
1737        #[inline]
1738        unsafe fn decode(
1739            &mut self,
1740            decoder: &mut fidl::encoding::Decoder<'_, D>,
1741            offset: usize,
1742            _depth: fidl::encoding::Depth,
1743        ) -> fidl::Result<()> {
1744            decoder.debug_check_bounds::<Self>(offset);
1745            // Verify that padding bytes are zero.
1746            fidl::decode!(
1747                fidl_fuchsia_bluetooth::PeerId,
1748                D,
1749                &mut self.id,
1750                decoder,
1751                offset + 0,
1752                _depth
1753            )?;
1754            Ok(())
1755        }
1756    }
1757
1758    impl fidl::encoding::ValueTypeMarker for AccessDisconnectRequest {
1759        type Borrowed<'a> = &'a Self;
1760        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1761            value
1762        }
1763    }
1764
1765    unsafe impl fidl::encoding::TypeMarker for AccessDisconnectRequest {
1766        type Owned = Self;
1767
1768        #[inline(always)]
1769        fn inline_align(_context: fidl::encoding::Context) -> usize {
1770            8
1771        }
1772
1773        #[inline(always)]
1774        fn inline_size(_context: fidl::encoding::Context) -> usize {
1775            8
1776        }
1777    }
1778
1779    unsafe impl<D: fidl::encoding::ResourceDialect>
1780        fidl::encoding::Encode<AccessDisconnectRequest, D> for &AccessDisconnectRequest
1781    {
1782        #[inline]
1783        unsafe fn encode(
1784            self,
1785            encoder: &mut fidl::encoding::Encoder<'_, D>,
1786            offset: usize,
1787            _depth: fidl::encoding::Depth,
1788        ) -> fidl::Result<()> {
1789            encoder.debug_check_bounds::<AccessDisconnectRequest>(offset);
1790            // Delegate to tuple encoding.
1791            fidl::encoding::Encode::<AccessDisconnectRequest, D>::encode(
1792                (<fidl_fuchsia_bluetooth::PeerId as fidl::encoding::ValueTypeMarker>::borrow(
1793                    &self.id,
1794                ),),
1795                encoder,
1796                offset,
1797                _depth,
1798            )
1799        }
1800    }
1801    unsafe impl<
1802            D: fidl::encoding::ResourceDialect,
1803            T0: fidl::encoding::Encode<fidl_fuchsia_bluetooth::PeerId, D>,
1804        > fidl::encoding::Encode<AccessDisconnectRequest, D> for (T0,)
1805    {
1806        #[inline]
1807        unsafe fn encode(
1808            self,
1809            encoder: &mut fidl::encoding::Encoder<'_, D>,
1810            offset: usize,
1811            depth: fidl::encoding::Depth,
1812        ) -> fidl::Result<()> {
1813            encoder.debug_check_bounds::<AccessDisconnectRequest>(offset);
1814            // Zero out padding regions. There's no need to apply masks
1815            // because the unmasked parts will be overwritten by fields.
1816            // Write the fields.
1817            self.0.encode(encoder, offset + 0, depth)?;
1818            Ok(())
1819        }
1820    }
1821
1822    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1823        for AccessDisconnectRequest
1824    {
1825        #[inline(always)]
1826        fn new_empty() -> Self {
1827            Self { id: fidl::new_empty!(fidl_fuchsia_bluetooth::PeerId, D) }
1828        }
1829
1830        #[inline]
1831        unsafe fn decode(
1832            &mut self,
1833            decoder: &mut fidl::encoding::Decoder<'_, D>,
1834            offset: usize,
1835            _depth: fidl::encoding::Depth,
1836        ) -> fidl::Result<()> {
1837            decoder.debug_check_bounds::<Self>(offset);
1838            // Verify that padding bytes are zero.
1839            fidl::decode!(
1840                fidl_fuchsia_bluetooth::PeerId,
1841                D,
1842                &mut self.id,
1843                decoder,
1844                offset + 0,
1845                _depth
1846            )?;
1847            Ok(())
1848        }
1849    }
1850
1851    impl fidl::encoding::ValueTypeMarker for AccessForgetRequest {
1852        type Borrowed<'a> = &'a Self;
1853        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1854            value
1855        }
1856    }
1857
1858    unsafe impl fidl::encoding::TypeMarker for AccessForgetRequest {
1859        type Owned = Self;
1860
1861        #[inline(always)]
1862        fn inline_align(_context: fidl::encoding::Context) -> usize {
1863            8
1864        }
1865
1866        #[inline(always)]
1867        fn inline_size(_context: fidl::encoding::Context) -> usize {
1868            8
1869        }
1870    }
1871
1872    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<AccessForgetRequest, D>
1873        for &AccessForgetRequest
1874    {
1875        #[inline]
1876        unsafe fn encode(
1877            self,
1878            encoder: &mut fidl::encoding::Encoder<'_, D>,
1879            offset: usize,
1880            _depth: fidl::encoding::Depth,
1881        ) -> fidl::Result<()> {
1882            encoder.debug_check_bounds::<AccessForgetRequest>(offset);
1883            // Delegate to tuple encoding.
1884            fidl::encoding::Encode::<AccessForgetRequest, D>::encode(
1885                (<fidl_fuchsia_bluetooth::PeerId as fidl::encoding::ValueTypeMarker>::borrow(
1886                    &self.id,
1887                ),),
1888                encoder,
1889                offset,
1890                _depth,
1891            )
1892        }
1893    }
1894    unsafe impl<
1895            D: fidl::encoding::ResourceDialect,
1896            T0: fidl::encoding::Encode<fidl_fuchsia_bluetooth::PeerId, D>,
1897        > fidl::encoding::Encode<AccessForgetRequest, D> for (T0,)
1898    {
1899        #[inline]
1900        unsafe fn encode(
1901            self,
1902            encoder: &mut fidl::encoding::Encoder<'_, D>,
1903            offset: usize,
1904            depth: fidl::encoding::Depth,
1905        ) -> fidl::Result<()> {
1906            encoder.debug_check_bounds::<AccessForgetRequest>(offset);
1907            // Zero out padding regions. There's no need to apply masks
1908            // because the unmasked parts will be overwritten by fields.
1909            // Write the fields.
1910            self.0.encode(encoder, offset + 0, depth)?;
1911            Ok(())
1912        }
1913    }
1914
1915    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for AccessForgetRequest {
1916        #[inline(always)]
1917        fn new_empty() -> Self {
1918            Self { id: fidl::new_empty!(fidl_fuchsia_bluetooth::PeerId, D) }
1919        }
1920
1921        #[inline]
1922        unsafe fn decode(
1923            &mut self,
1924            decoder: &mut fidl::encoding::Decoder<'_, D>,
1925            offset: usize,
1926            _depth: fidl::encoding::Depth,
1927        ) -> fidl::Result<()> {
1928            decoder.debug_check_bounds::<Self>(offset);
1929            // Verify that padding bytes are zero.
1930            fidl::decode!(
1931                fidl_fuchsia_bluetooth::PeerId,
1932                D,
1933                &mut self.id,
1934                decoder,
1935                offset + 0,
1936                _depth
1937            )?;
1938            Ok(())
1939        }
1940    }
1941
1942    impl fidl::encoding::ValueTypeMarker for AccessPairRequest {
1943        type Borrowed<'a> = &'a Self;
1944        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1945            value
1946        }
1947    }
1948
1949    unsafe impl fidl::encoding::TypeMarker for AccessPairRequest {
1950        type Owned = Self;
1951
1952        #[inline(always)]
1953        fn inline_align(_context: fidl::encoding::Context) -> usize {
1954            8
1955        }
1956
1957        #[inline(always)]
1958        fn inline_size(_context: fidl::encoding::Context) -> usize {
1959            24
1960        }
1961    }
1962
1963    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<AccessPairRequest, D>
1964        for &AccessPairRequest
1965    {
1966        #[inline]
1967        unsafe fn encode(
1968            self,
1969            encoder: &mut fidl::encoding::Encoder<'_, D>,
1970            offset: usize,
1971            _depth: fidl::encoding::Depth,
1972        ) -> fidl::Result<()> {
1973            encoder.debug_check_bounds::<AccessPairRequest>(offset);
1974            // Delegate to tuple encoding.
1975            fidl::encoding::Encode::<AccessPairRequest, D>::encode(
1976                (
1977                    <fidl_fuchsia_bluetooth::PeerId as fidl::encoding::ValueTypeMarker>::borrow(
1978                        &self.id,
1979                    ),
1980                    <PairingOptions as fidl::encoding::ValueTypeMarker>::borrow(&self.options),
1981                ),
1982                encoder,
1983                offset,
1984                _depth,
1985            )
1986        }
1987    }
1988    unsafe impl<
1989            D: fidl::encoding::ResourceDialect,
1990            T0: fidl::encoding::Encode<fidl_fuchsia_bluetooth::PeerId, D>,
1991            T1: fidl::encoding::Encode<PairingOptions, D>,
1992        > fidl::encoding::Encode<AccessPairRequest, D> for (T0, T1)
1993    {
1994        #[inline]
1995        unsafe fn encode(
1996            self,
1997            encoder: &mut fidl::encoding::Encoder<'_, D>,
1998            offset: usize,
1999            depth: fidl::encoding::Depth,
2000        ) -> fidl::Result<()> {
2001            encoder.debug_check_bounds::<AccessPairRequest>(offset);
2002            // Zero out padding regions. There's no need to apply masks
2003            // because the unmasked parts will be overwritten by fields.
2004            // Write the fields.
2005            self.0.encode(encoder, offset + 0, depth)?;
2006            self.1.encode(encoder, offset + 8, depth)?;
2007            Ok(())
2008        }
2009    }
2010
2011    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for AccessPairRequest {
2012        #[inline(always)]
2013        fn new_empty() -> Self {
2014            Self {
2015                id: fidl::new_empty!(fidl_fuchsia_bluetooth::PeerId, D),
2016                options: fidl::new_empty!(PairingOptions, D),
2017            }
2018        }
2019
2020        #[inline]
2021        unsafe fn decode(
2022            &mut self,
2023            decoder: &mut fidl::encoding::Decoder<'_, D>,
2024            offset: usize,
2025            _depth: fidl::encoding::Depth,
2026        ) -> fidl::Result<()> {
2027            decoder.debug_check_bounds::<Self>(offset);
2028            // Verify that padding bytes are zero.
2029            fidl::decode!(
2030                fidl_fuchsia_bluetooth::PeerId,
2031                D,
2032                &mut self.id,
2033                decoder,
2034                offset + 0,
2035                _depth
2036            )?;
2037            fidl::decode!(PairingOptions, D, &mut self.options, decoder, offset + 8, _depth)?;
2038            Ok(())
2039        }
2040    }
2041
2042    impl fidl::encoding::ValueTypeMarker for AccessSetDeviceClassRequest {
2043        type Borrowed<'a> = &'a Self;
2044        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2045            value
2046        }
2047    }
2048
2049    unsafe impl fidl::encoding::TypeMarker for AccessSetDeviceClassRequest {
2050        type Owned = Self;
2051
2052        #[inline(always)]
2053        fn inline_align(_context: fidl::encoding::Context) -> usize {
2054            4
2055        }
2056
2057        #[inline(always)]
2058        fn inline_size(_context: fidl::encoding::Context) -> usize {
2059            4
2060        }
2061    }
2062
2063    unsafe impl<D: fidl::encoding::ResourceDialect>
2064        fidl::encoding::Encode<AccessSetDeviceClassRequest, D> for &AccessSetDeviceClassRequest
2065    {
2066        #[inline]
2067        unsafe fn encode(
2068            self,
2069            encoder: &mut fidl::encoding::Encoder<'_, D>,
2070            offset: usize,
2071            _depth: fidl::encoding::Depth,
2072        ) -> fidl::Result<()> {
2073            encoder.debug_check_bounds::<AccessSetDeviceClassRequest>(offset);
2074            // Delegate to tuple encoding.
2075            fidl::encoding::Encode::<AccessSetDeviceClassRequest, D>::encode(
2076                (<fidl_fuchsia_bluetooth::DeviceClass as fidl::encoding::ValueTypeMarker>::borrow(
2077                    &self.device_class,
2078                ),),
2079                encoder,
2080                offset,
2081                _depth,
2082            )
2083        }
2084    }
2085    unsafe impl<
2086            D: fidl::encoding::ResourceDialect,
2087            T0: fidl::encoding::Encode<fidl_fuchsia_bluetooth::DeviceClass, D>,
2088        > fidl::encoding::Encode<AccessSetDeviceClassRequest, D> for (T0,)
2089    {
2090        #[inline]
2091        unsafe fn encode(
2092            self,
2093            encoder: &mut fidl::encoding::Encoder<'_, D>,
2094            offset: usize,
2095            depth: fidl::encoding::Depth,
2096        ) -> fidl::Result<()> {
2097            encoder.debug_check_bounds::<AccessSetDeviceClassRequest>(offset);
2098            // Zero out padding regions. There's no need to apply masks
2099            // because the unmasked parts will be overwritten by fields.
2100            // Write the fields.
2101            self.0.encode(encoder, offset + 0, depth)?;
2102            Ok(())
2103        }
2104    }
2105
2106    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2107        for AccessSetDeviceClassRequest
2108    {
2109        #[inline(always)]
2110        fn new_empty() -> Self {
2111            Self { device_class: fidl::new_empty!(fidl_fuchsia_bluetooth::DeviceClass, D) }
2112        }
2113
2114        #[inline]
2115        unsafe fn decode(
2116            &mut self,
2117            decoder: &mut fidl::encoding::Decoder<'_, D>,
2118            offset: usize,
2119            _depth: fidl::encoding::Depth,
2120        ) -> fidl::Result<()> {
2121            decoder.debug_check_bounds::<Self>(offset);
2122            // Verify that padding bytes are zero.
2123            fidl::decode!(
2124                fidl_fuchsia_bluetooth::DeviceClass,
2125                D,
2126                &mut self.device_class,
2127                decoder,
2128                offset + 0,
2129                _depth
2130            )?;
2131            Ok(())
2132        }
2133    }
2134
2135    impl fidl::encoding::ValueTypeMarker for AccessSetLocalNameRequest {
2136        type Borrowed<'a> = &'a Self;
2137        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2138            value
2139        }
2140    }
2141
2142    unsafe impl fidl::encoding::TypeMarker for AccessSetLocalNameRequest {
2143        type Owned = Self;
2144
2145        #[inline(always)]
2146        fn inline_align(_context: fidl::encoding::Context) -> usize {
2147            8
2148        }
2149
2150        #[inline(always)]
2151        fn inline_size(_context: fidl::encoding::Context) -> usize {
2152            16
2153        }
2154    }
2155
2156    unsafe impl<D: fidl::encoding::ResourceDialect>
2157        fidl::encoding::Encode<AccessSetLocalNameRequest, D> for &AccessSetLocalNameRequest
2158    {
2159        #[inline]
2160        unsafe fn encode(
2161            self,
2162            encoder: &mut fidl::encoding::Encoder<'_, D>,
2163            offset: usize,
2164            _depth: fidl::encoding::Depth,
2165        ) -> fidl::Result<()> {
2166            encoder.debug_check_bounds::<AccessSetLocalNameRequest>(offset);
2167            // Delegate to tuple encoding.
2168            fidl::encoding::Encode::<AccessSetLocalNameRequest, D>::encode(
2169                (<fidl::encoding::BoundedString<248> as fidl::encoding::ValueTypeMarker>::borrow(
2170                    &self.name,
2171                ),),
2172                encoder,
2173                offset,
2174                _depth,
2175            )
2176        }
2177    }
2178    unsafe impl<
2179            D: fidl::encoding::ResourceDialect,
2180            T0: fidl::encoding::Encode<fidl::encoding::BoundedString<248>, D>,
2181        > fidl::encoding::Encode<AccessSetLocalNameRequest, D> for (T0,)
2182    {
2183        #[inline]
2184        unsafe fn encode(
2185            self,
2186            encoder: &mut fidl::encoding::Encoder<'_, D>,
2187            offset: usize,
2188            depth: fidl::encoding::Depth,
2189        ) -> fidl::Result<()> {
2190            encoder.debug_check_bounds::<AccessSetLocalNameRequest>(offset);
2191            // Zero out padding regions. There's no need to apply masks
2192            // because the unmasked parts will be overwritten by fields.
2193            // Write the fields.
2194            self.0.encode(encoder, offset + 0, depth)?;
2195            Ok(())
2196        }
2197    }
2198
2199    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2200        for AccessSetLocalNameRequest
2201    {
2202        #[inline(always)]
2203        fn new_empty() -> Self {
2204            Self { name: fidl::new_empty!(fidl::encoding::BoundedString<248>, D) }
2205        }
2206
2207        #[inline]
2208        unsafe fn decode(
2209            &mut self,
2210            decoder: &mut fidl::encoding::Decoder<'_, D>,
2211            offset: usize,
2212            _depth: fidl::encoding::Depth,
2213        ) -> fidl::Result<()> {
2214            decoder.debug_check_bounds::<Self>(offset);
2215            // Verify that padding bytes are zero.
2216            fidl::decode!(
2217                fidl::encoding::BoundedString<248>,
2218                D,
2219                &mut self.name,
2220                decoder,
2221                offset + 0,
2222                _depth
2223            )?;
2224            Ok(())
2225        }
2226    }
2227
2228    impl fidl::encoding::ValueTypeMarker for AccessWatchPeersResponse {
2229        type Borrowed<'a> = &'a Self;
2230        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2231            value
2232        }
2233    }
2234
2235    unsafe impl fidl::encoding::TypeMarker for AccessWatchPeersResponse {
2236        type Owned = Self;
2237
2238        #[inline(always)]
2239        fn inline_align(_context: fidl::encoding::Context) -> usize {
2240            8
2241        }
2242
2243        #[inline(always)]
2244        fn inline_size(_context: fidl::encoding::Context) -> usize {
2245            32
2246        }
2247    }
2248
2249    unsafe impl<D: fidl::encoding::ResourceDialect>
2250        fidl::encoding::Encode<AccessWatchPeersResponse, D> for &AccessWatchPeersResponse
2251    {
2252        #[inline]
2253        unsafe fn encode(
2254            self,
2255            encoder: &mut fidl::encoding::Encoder<'_, D>,
2256            offset: usize,
2257            _depth: fidl::encoding::Depth,
2258        ) -> fidl::Result<()> {
2259            encoder.debug_check_bounds::<AccessWatchPeersResponse>(offset);
2260            // Delegate to tuple encoding.
2261            fidl::encoding::Encode::<AccessWatchPeersResponse, D>::encode(
2262                (
2263                    <fidl::encoding::UnboundedVector<Peer> as fidl::encoding::ValueTypeMarker>::borrow(&self.updated),
2264                    <fidl::encoding::UnboundedVector<fidl_fuchsia_bluetooth::PeerId> as fidl::encoding::ValueTypeMarker>::borrow(&self.removed),
2265                ),
2266                encoder, offset, _depth
2267            )
2268        }
2269    }
2270    unsafe impl<
2271            D: fidl::encoding::ResourceDialect,
2272            T0: fidl::encoding::Encode<fidl::encoding::UnboundedVector<Peer>, D>,
2273            T1: fidl::encoding::Encode<
2274                fidl::encoding::UnboundedVector<fidl_fuchsia_bluetooth::PeerId>,
2275                D,
2276            >,
2277        > fidl::encoding::Encode<AccessWatchPeersResponse, D> for (T0, T1)
2278    {
2279        #[inline]
2280        unsafe fn encode(
2281            self,
2282            encoder: &mut fidl::encoding::Encoder<'_, D>,
2283            offset: usize,
2284            depth: fidl::encoding::Depth,
2285        ) -> fidl::Result<()> {
2286            encoder.debug_check_bounds::<AccessWatchPeersResponse>(offset);
2287            // Zero out padding regions. There's no need to apply masks
2288            // because the unmasked parts will be overwritten by fields.
2289            // Write the fields.
2290            self.0.encode(encoder, offset + 0, depth)?;
2291            self.1.encode(encoder, offset + 16, depth)?;
2292            Ok(())
2293        }
2294    }
2295
2296    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2297        for AccessWatchPeersResponse
2298    {
2299        #[inline(always)]
2300        fn new_empty() -> Self {
2301            Self {
2302                updated: fidl::new_empty!(fidl::encoding::UnboundedVector<Peer>, D),
2303                removed: fidl::new_empty!(
2304                    fidl::encoding::UnboundedVector<fidl_fuchsia_bluetooth::PeerId>,
2305                    D
2306                ),
2307            }
2308        }
2309
2310        #[inline]
2311        unsafe fn decode(
2312            &mut self,
2313            decoder: &mut fidl::encoding::Decoder<'_, D>,
2314            offset: usize,
2315            _depth: fidl::encoding::Depth,
2316        ) -> fidl::Result<()> {
2317            decoder.debug_check_bounds::<Self>(offset);
2318            // Verify that padding bytes are zero.
2319            fidl::decode!(
2320                fidl::encoding::UnboundedVector<Peer>,
2321                D,
2322                &mut self.updated,
2323                decoder,
2324                offset + 0,
2325                _depth
2326            )?;
2327            fidl::decode!(
2328                fidl::encoding::UnboundedVector<fidl_fuchsia_bluetooth::PeerId>,
2329                D,
2330                &mut self.removed,
2331                decoder,
2332                offset + 16,
2333                _depth
2334            )?;
2335            Ok(())
2336        }
2337    }
2338
2339    impl fidl::encoding::ValueTypeMarker for BootstrapAddIdentitiesRequest {
2340        type Borrowed<'a> = &'a Self;
2341        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2342            value
2343        }
2344    }
2345
2346    unsafe impl fidl::encoding::TypeMarker for BootstrapAddIdentitiesRequest {
2347        type Owned = Self;
2348
2349        #[inline(always)]
2350        fn inline_align(_context: fidl::encoding::Context) -> usize {
2351            8
2352        }
2353
2354        #[inline(always)]
2355        fn inline_size(_context: fidl::encoding::Context) -> usize {
2356            16
2357        }
2358    }
2359
2360    unsafe impl<D: fidl::encoding::ResourceDialect>
2361        fidl::encoding::Encode<BootstrapAddIdentitiesRequest, D>
2362        for &BootstrapAddIdentitiesRequest
2363    {
2364        #[inline]
2365        unsafe fn encode(
2366            self,
2367            encoder: &mut fidl::encoding::Encoder<'_, D>,
2368            offset: usize,
2369            _depth: fidl::encoding::Depth,
2370        ) -> fidl::Result<()> {
2371            encoder.debug_check_bounds::<BootstrapAddIdentitiesRequest>(offset);
2372            // Delegate to tuple encoding.
2373            fidl::encoding::Encode::<BootstrapAddIdentitiesRequest, D>::encode(
2374                (
2375                    <fidl::encoding::UnboundedVector<Identity> as fidl::encoding::ValueTypeMarker>::borrow(&self.identities),
2376                ),
2377                encoder, offset, _depth
2378            )
2379        }
2380    }
2381    unsafe impl<
2382            D: fidl::encoding::ResourceDialect,
2383            T0: fidl::encoding::Encode<fidl::encoding::UnboundedVector<Identity>, D>,
2384        > fidl::encoding::Encode<BootstrapAddIdentitiesRequest, D> for (T0,)
2385    {
2386        #[inline]
2387        unsafe fn encode(
2388            self,
2389            encoder: &mut fidl::encoding::Encoder<'_, D>,
2390            offset: usize,
2391            depth: fidl::encoding::Depth,
2392        ) -> fidl::Result<()> {
2393            encoder.debug_check_bounds::<BootstrapAddIdentitiesRequest>(offset);
2394            // Zero out padding regions. There's no need to apply masks
2395            // because the unmasked parts will be overwritten by fields.
2396            // Write the fields.
2397            self.0.encode(encoder, offset + 0, depth)?;
2398            Ok(())
2399        }
2400    }
2401
2402    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2403        for BootstrapAddIdentitiesRequest
2404    {
2405        #[inline(always)]
2406        fn new_empty() -> Self {
2407            Self { identities: fidl::new_empty!(fidl::encoding::UnboundedVector<Identity>, D) }
2408        }
2409
2410        #[inline]
2411        unsafe fn decode(
2412            &mut self,
2413            decoder: &mut fidl::encoding::Decoder<'_, D>,
2414            offset: usize,
2415            _depth: fidl::encoding::Depth,
2416        ) -> fidl::Result<()> {
2417            decoder.debug_check_bounds::<Self>(offset);
2418            // Verify that padding bytes are zero.
2419            fidl::decode!(
2420                fidl::encoding::UnboundedVector<Identity>,
2421                D,
2422                &mut self.identities,
2423                decoder,
2424                offset + 0,
2425                _depth
2426            )?;
2427            Ok(())
2428        }
2429    }
2430
2431    impl fidl::encoding::ValueTypeMarker for ConfigurationUpdateRequest {
2432        type Borrowed<'a> = &'a Self;
2433        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2434            value
2435        }
2436    }
2437
2438    unsafe impl fidl::encoding::TypeMarker for ConfigurationUpdateRequest {
2439        type Owned = Self;
2440
2441        #[inline(always)]
2442        fn inline_align(_context: fidl::encoding::Context) -> usize {
2443            8
2444        }
2445
2446        #[inline(always)]
2447        fn inline_size(_context: fidl::encoding::Context) -> usize {
2448            16
2449        }
2450    }
2451
2452    unsafe impl<D: fidl::encoding::ResourceDialect>
2453        fidl::encoding::Encode<ConfigurationUpdateRequest, D> for &ConfigurationUpdateRequest
2454    {
2455        #[inline]
2456        unsafe fn encode(
2457            self,
2458            encoder: &mut fidl::encoding::Encoder<'_, D>,
2459            offset: usize,
2460            _depth: fidl::encoding::Depth,
2461        ) -> fidl::Result<()> {
2462            encoder.debug_check_bounds::<ConfigurationUpdateRequest>(offset);
2463            // Delegate to tuple encoding.
2464            fidl::encoding::Encode::<ConfigurationUpdateRequest, D>::encode(
2465                (<Settings as fidl::encoding::ValueTypeMarker>::borrow(&self.settings),),
2466                encoder,
2467                offset,
2468                _depth,
2469            )
2470        }
2471    }
2472    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<Settings, D>>
2473        fidl::encoding::Encode<ConfigurationUpdateRequest, D> for (T0,)
2474    {
2475        #[inline]
2476        unsafe fn encode(
2477            self,
2478            encoder: &mut fidl::encoding::Encoder<'_, D>,
2479            offset: usize,
2480            depth: fidl::encoding::Depth,
2481        ) -> fidl::Result<()> {
2482            encoder.debug_check_bounds::<ConfigurationUpdateRequest>(offset);
2483            // Zero out padding regions. There's no need to apply masks
2484            // because the unmasked parts will be overwritten by fields.
2485            // Write the fields.
2486            self.0.encode(encoder, offset + 0, depth)?;
2487            Ok(())
2488        }
2489    }
2490
2491    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2492        for ConfigurationUpdateRequest
2493    {
2494        #[inline(always)]
2495        fn new_empty() -> Self {
2496            Self { settings: fidl::new_empty!(Settings, D) }
2497        }
2498
2499        #[inline]
2500        unsafe fn decode(
2501            &mut self,
2502            decoder: &mut fidl::encoding::Decoder<'_, D>,
2503            offset: usize,
2504            _depth: fidl::encoding::Depth,
2505        ) -> fidl::Result<()> {
2506            decoder.debug_check_bounds::<Self>(offset);
2507            // Verify that padding bytes are zero.
2508            fidl::decode!(Settings, D, &mut self.settings, decoder, offset + 0, _depth)?;
2509            Ok(())
2510        }
2511    }
2512
2513    impl fidl::encoding::ValueTypeMarker for ConfigurationUpdateResponse {
2514        type Borrowed<'a> = &'a Self;
2515        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2516            value
2517        }
2518    }
2519
2520    unsafe impl fidl::encoding::TypeMarker for ConfigurationUpdateResponse {
2521        type Owned = Self;
2522
2523        #[inline(always)]
2524        fn inline_align(_context: fidl::encoding::Context) -> usize {
2525            8
2526        }
2527
2528        #[inline(always)]
2529        fn inline_size(_context: fidl::encoding::Context) -> usize {
2530            16
2531        }
2532    }
2533
2534    unsafe impl<D: fidl::encoding::ResourceDialect>
2535        fidl::encoding::Encode<ConfigurationUpdateResponse, D> for &ConfigurationUpdateResponse
2536    {
2537        #[inline]
2538        unsafe fn encode(
2539            self,
2540            encoder: &mut fidl::encoding::Encoder<'_, D>,
2541            offset: usize,
2542            _depth: fidl::encoding::Depth,
2543        ) -> fidl::Result<()> {
2544            encoder.debug_check_bounds::<ConfigurationUpdateResponse>(offset);
2545            // Delegate to tuple encoding.
2546            fidl::encoding::Encode::<ConfigurationUpdateResponse, D>::encode(
2547                (<Settings as fidl::encoding::ValueTypeMarker>::borrow(&self.result),),
2548                encoder,
2549                offset,
2550                _depth,
2551            )
2552        }
2553    }
2554    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<Settings, D>>
2555        fidl::encoding::Encode<ConfigurationUpdateResponse, D> for (T0,)
2556    {
2557        #[inline]
2558        unsafe fn encode(
2559            self,
2560            encoder: &mut fidl::encoding::Encoder<'_, D>,
2561            offset: usize,
2562            depth: fidl::encoding::Depth,
2563        ) -> fidl::Result<()> {
2564            encoder.debug_check_bounds::<ConfigurationUpdateResponse>(offset);
2565            // Zero out padding regions. There's no need to apply masks
2566            // because the unmasked parts will be overwritten by fields.
2567            // Write the fields.
2568            self.0.encode(encoder, offset + 0, depth)?;
2569            Ok(())
2570        }
2571    }
2572
2573    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2574        for ConfigurationUpdateResponse
2575    {
2576        #[inline(always)]
2577        fn new_empty() -> Self {
2578            Self { result: fidl::new_empty!(Settings, D) }
2579        }
2580
2581        #[inline]
2582        unsafe fn decode(
2583            &mut self,
2584            decoder: &mut fidl::encoding::Decoder<'_, D>,
2585            offset: usize,
2586            _depth: fidl::encoding::Depth,
2587        ) -> fidl::Result<()> {
2588            decoder.debug_check_bounds::<Self>(offset);
2589            // Verify that padding bytes are zero.
2590            fidl::decode!(Settings, D, &mut self.result, decoder, offset + 0, _depth)?;
2591            Ok(())
2592        }
2593    }
2594
2595    impl fidl::encoding::ValueTypeMarker for Consent {
2596        type Borrowed<'a> = &'a Self;
2597        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2598            value
2599        }
2600    }
2601
2602    unsafe impl fidl::encoding::TypeMarker for Consent {
2603        type Owned = Self;
2604
2605        #[inline(always)]
2606        fn inline_align(_context: fidl::encoding::Context) -> usize {
2607            1
2608        }
2609
2610        #[inline(always)]
2611        fn inline_size(_context: fidl::encoding::Context) -> usize {
2612            1
2613        }
2614    }
2615
2616    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Consent, D> for &Consent {
2617        #[inline]
2618        unsafe fn encode(
2619            self,
2620            encoder: &mut fidl::encoding::Encoder<'_, D>,
2621            offset: usize,
2622            _depth: fidl::encoding::Depth,
2623        ) -> fidl::Result<()> {
2624            encoder.debug_check_bounds::<Consent>(offset);
2625            encoder.write_num(0u8, offset);
2626            Ok(())
2627        }
2628    }
2629
2630    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Consent {
2631        #[inline(always)]
2632        fn new_empty() -> Self {
2633            Self
2634        }
2635
2636        #[inline]
2637        unsafe fn decode(
2638            &mut self,
2639            decoder: &mut fidl::encoding::Decoder<'_, D>,
2640            offset: usize,
2641            _depth: fidl::encoding::Depth,
2642        ) -> fidl::Result<()> {
2643            decoder.debug_check_bounds::<Self>(offset);
2644            match decoder.read_num::<u8>(offset) {
2645                0 => Ok(()),
2646                _ => Err(fidl::Error::Invalid),
2647            }
2648        }
2649    }
2650
2651    impl fidl::encoding::ValueTypeMarker for HostWatcherSetActiveRequest {
2652        type Borrowed<'a> = &'a Self;
2653        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2654            value
2655        }
2656    }
2657
2658    unsafe impl fidl::encoding::TypeMarker for HostWatcherSetActiveRequest {
2659        type Owned = Self;
2660
2661        #[inline(always)]
2662        fn inline_align(_context: fidl::encoding::Context) -> usize {
2663            8
2664        }
2665
2666        #[inline(always)]
2667        fn inline_size(_context: fidl::encoding::Context) -> usize {
2668            8
2669        }
2670    }
2671
2672    unsafe impl<D: fidl::encoding::ResourceDialect>
2673        fidl::encoding::Encode<HostWatcherSetActiveRequest, D> for &HostWatcherSetActiveRequest
2674    {
2675        #[inline]
2676        unsafe fn encode(
2677            self,
2678            encoder: &mut fidl::encoding::Encoder<'_, D>,
2679            offset: usize,
2680            _depth: fidl::encoding::Depth,
2681        ) -> fidl::Result<()> {
2682            encoder.debug_check_bounds::<HostWatcherSetActiveRequest>(offset);
2683            // Delegate to tuple encoding.
2684            fidl::encoding::Encode::<HostWatcherSetActiveRequest, D>::encode(
2685                (<fidl_fuchsia_bluetooth::HostId as fidl::encoding::ValueTypeMarker>::borrow(
2686                    &self.id,
2687                ),),
2688                encoder,
2689                offset,
2690                _depth,
2691            )
2692        }
2693    }
2694    unsafe impl<
2695            D: fidl::encoding::ResourceDialect,
2696            T0: fidl::encoding::Encode<fidl_fuchsia_bluetooth::HostId, D>,
2697        > fidl::encoding::Encode<HostWatcherSetActiveRequest, D> for (T0,)
2698    {
2699        #[inline]
2700        unsafe fn encode(
2701            self,
2702            encoder: &mut fidl::encoding::Encoder<'_, D>,
2703            offset: usize,
2704            depth: fidl::encoding::Depth,
2705        ) -> fidl::Result<()> {
2706            encoder.debug_check_bounds::<HostWatcherSetActiveRequest>(offset);
2707            // Zero out padding regions. There's no need to apply masks
2708            // because the unmasked parts will be overwritten by fields.
2709            // Write the fields.
2710            self.0.encode(encoder, offset + 0, depth)?;
2711            Ok(())
2712        }
2713    }
2714
2715    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2716        for HostWatcherSetActiveRequest
2717    {
2718        #[inline(always)]
2719        fn new_empty() -> Self {
2720            Self { id: fidl::new_empty!(fidl_fuchsia_bluetooth::HostId, D) }
2721        }
2722
2723        #[inline]
2724        unsafe fn decode(
2725            &mut self,
2726            decoder: &mut fidl::encoding::Decoder<'_, D>,
2727            offset: usize,
2728            _depth: fidl::encoding::Depth,
2729        ) -> fidl::Result<()> {
2730            decoder.debug_check_bounds::<Self>(offset);
2731            // Verify that padding bytes are zero.
2732            fidl::decode!(
2733                fidl_fuchsia_bluetooth::HostId,
2734                D,
2735                &mut self.id,
2736                decoder,
2737                offset + 0,
2738                _depth
2739            )?;
2740            Ok(())
2741        }
2742    }
2743
2744    impl fidl::encoding::ValueTypeMarker for HostWatcherWatchResponse {
2745        type Borrowed<'a> = &'a Self;
2746        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2747            value
2748        }
2749    }
2750
2751    unsafe impl fidl::encoding::TypeMarker for HostWatcherWatchResponse {
2752        type Owned = Self;
2753
2754        #[inline(always)]
2755        fn inline_align(_context: fidl::encoding::Context) -> usize {
2756            8
2757        }
2758
2759        #[inline(always)]
2760        fn inline_size(_context: fidl::encoding::Context) -> usize {
2761            16
2762        }
2763    }
2764
2765    unsafe impl<D: fidl::encoding::ResourceDialect>
2766        fidl::encoding::Encode<HostWatcherWatchResponse, D> for &HostWatcherWatchResponse
2767    {
2768        #[inline]
2769        unsafe fn encode(
2770            self,
2771            encoder: &mut fidl::encoding::Encoder<'_, D>,
2772            offset: usize,
2773            _depth: fidl::encoding::Depth,
2774        ) -> fidl::Result<()> {
2775            encoder.debug_check_bounds::<HostWatcherWatchResponse>(offset);
2776            // Delegate to tuple encoding.
2777            fidl::encoding::Encode::<HostWatcherWatchResponse, D>::encode(
2778                (
2779                    <fidl::encoding::UnboundedVector<HostInfo> as fidl::encoding::ValueTypeMarker>::borrow(&self.hosts),
2780                ),
2781                encoder, offset, _depth
2782            )
2783        }
2784    }
2785    unsafe impl<
2786            D: fidl::encoding::ResourceDialect,
2787            T0: fidl::encoding::Encode<fidl::encoding::UnboundedVector<HostInfo>, D>,
2788        > fidl::encoding::Encode<HostWatcherWatchResponse, D> for (T0,)
2789    {
2790        #[inline]
2791        unsafe fn encode(
2792            self,
2793            encoder: &mut fidl::encoding::Encoder<'_, D>,
2794            offset: usize,
2795            depth: fidl::encoding::Depth,
2796        ) -> fidl::Result<()> {
2797            encoder.debug_check_bounds::<HostWatcherWatchResponse>(offset);
2798            // Zero out padding regions. There's no need to apply masks
2799            // because the unmasked parts will be overwritten by fields.
2800            // Write the fields.
2801            self.0.encode(encoder, offset + 0, depth)?;
2802            Ok(())
2803        }
2804    }
2805
2806    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2807        for HostWatcherWatchResponse
2808    {
2809        #[inline(always)]
2810        fn new_empty() -> Self {
2811            Self { hosts: fidl::new_empty!(fidl::encoding::UnboundedVector<HostInfo>, D) }
2812        }
2813
2814        #[inline]
2815        unsafe fn decode(
2816            &mut self,
2817            decoder: &mut fidl::encoding::Decoder<'_, D>,
2818            offset: usize,
2819            _depth: fidl::encoding::Depth,
2820        ) -> fidl::Result<()> {
2821            decoder.debug_check_bounds::<Self>(offset);
2822            // Verify that padding bytes are zero.
2823            fidl::decode!(
2824                fidl::encoding::UnboundedVector<HostInfo>,
2825                D,
2826                &mut self.hosts,
2827                decoder,
2828                offset + 0,
2829                _depth
2830            )?;
2831            Ok(())
2832        }
2833    }
2834
2835    impl fidl::encoding::ValueTypeMarker for Key {
2836        type Borrowed<'a> = &'a Self;
2837        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2838            value
2839        }
2840    }
2841
2842    unsafe impl fidl::encoding::TypeMarker for Key {
2843        type Owned = Self;
2844
2845        #[inline(always)]
2846        fn inline_align(_context: fidl::encoding::Context) -> usize {
2847            1
2848        }
2849
2850        #[inline(always)]
2851        fn inline_size(_context: fidl::encoding::Context) -> usize {
2852            16
2853        }
2854        #[inline(always)]
2855        fn encode_is_copy() -> bool {
2856            true
2857        }
2858
2859        #[inline(always)]
2860        fn decode_is_copy() -> bool {
2861            true
2862        }
2863    }
2864
2865    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Key, D> for &Key {
2866        #[inline]
2867        unsafe fn encode(
2868            self,
2869            encoder: &mut fidl::encoding::Encoder<'_, D>,
2870            offset: usize,
2871            _depth: fidl::encoding::Depth,
2872        ) -> fidl::Result<()> {
2873            encoder.debug_check_bounds::<Key>(offset);
2874            unsafe {
2875                // Copy the object into the buffer.
2876                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
2877                (buf_ptr as *mut Key).write_unaligned((self as *const Key).read());
2878                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
2879                // done second because the memcpy will write garbage to these bytes.
2880            }
2881            Ok(())
2882        }
2883    }
2884    unsafe impl<
2885            D: fidl::encoding::ResourceDialect,
2886            T0: fidl::encoding::Encode<fidl::encoding::Array<u8, 16>, D>,
2887        > fidl::encoding::Encode<Key, D> for (T0,)
2888    {
2889        #[inline]
2890        unsafe fn encode(
2891            self,
2892            encoder: &mut fidl::encoding::Encoder<'_, D>,
2893            offset: usize,
2894            depth: fidl::encoding::Depth,
2895        ) -> fidl::Result<()> {
2896            encoder.debug_check_bounds::<Key>(offset);
2897            // Zero out padding regions. There's no need to apply masks
2898            // because the unmasked parts will be overwritten by fields.
2899            // Write the fields.
2900            self.0.encode(encoder, offset + 0, depth)?;
2901            Ok(())
2902        }
2903    }
2904
2905    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Key {
2906        #[inline(always)]
2907        fn new_empty() -> Self {
2908            Self { value: fidl::new_empty!(fidl::encoding::Array<u8, 16>, D) }
2909        }
2910
2911        #[inline]
2912        unsafe fn decode(
2913            &mut self,
2914            decoder: &mut fidl::encoding::Decoder<'_, D>,
2915            offset: usize,
2916            _depth: fidl::encoding::Depth,
2917        ) -> fidl::Result<()> {
2918            decoder.debug_check_bounds::<Self>(offset);
2919            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
2920            // Verify that padding bytes are zero.
2921            // Copy from the buffer into the object.
2922            unsafe {
2923                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 16);
2924            }
2925            Ok(())
2926        }
2927    }
2928
2929    impl fidl::encoding::ValueTypeMarker for LeConnectionParameters {
2930        type Borrowed<'a> = &'a Self;
2931        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2932            value
2933        }
2934    }
2935
2936    unsafe impl fidl::encoding::TypeMarker for LeConnectionParameters {
2937        type Owned = Self;
2938
2939        #[inline(always)]
2940        fn inline_align(_context: fidl::encoding::Context) -> usize {
2941            2
2942        }
2943
2944        #[inline(always)]
2945        fn inline_size(_context: fidl::encoding::Context) -> usize {
2946            6
2947        }
2948        #[inline(always)]
2949        fn encode_is_copy() -> bool {
2950            true
2951        }
2952
2953        #[inline(always)]
2954        fn decode_is_copy() -> bool {
2955            true
2956        }
2957    }
2958
2959    unsafe impl<D: fidl::encoding::ResourceDialect>
2960        fidl::encoding::Encode<LeConnectionParameters, D> for &LeConnectionParameters
2961    {
2962        #[inline]
2963        unsafe fn encode(
2964            self,
2965            encoder: &mut fidl::encoding::Encoder<'_, D>,
2966            offset: usize,
2967            _depth: fidl::encoding::Depth,
2968        ) -> fidl::Result<()> {
2969            encoder.debug_check_bounds::<LeConnectionParameters>(offset);
2970            unsafe {
2971                // Copy the object into the buffer.
2972                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
2973                (buf_ptr as *mut LeConnectionParameters)
2974                    .write_unaligned((self as *const LeConnectionParameters).read());
2975                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
2976                // done second because the memcpy will write garbage to these bytes.
2977            }
2978            Ok(())
2979        }
2980    }
2981    unsafe impl<
2982            D: fidl::encoding::ResourceDialect,
2983            T0: fidl::encoding::Encode<u16, D>,
2984            T1: fidl::encoding::Encode<u16, D>,
2985            T2: fidl::encoding::Encode<u16, D>,
2986        > fidl::encoding::Encode<LeConnectionParameters, D> for (T0, T1, T2)
2987    {
2988        #[inline]
2989        unsafe fn encode(
2990            self,
2991            encoder: &mut fidl::encoding::Encoder<'_, D>,
2992            offset: usize,
2993            depth: fidl::encoding::Depth,
2994        ) -> fidl::Result<()> {
2995            encoder.debug_check_bounds::<LeConnectionParameters>(offset);
2996            // Zero out padding regions. There's no need to apply masks
2997            // because the unmasked parts will be overwritten by fields.
2998            // Write the fields.
2999            self.0.encode(encoder, offset + 0, depth)?;
3000            self.1.encode(encoder, offset + 2, depth)?;
3001            self.2.encode(encoder, offset + 4, depth)?;
3002            Ok(())
3003        }
3004    }
3005
3006    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3007        for LeConnectionParameters
3008    {
3009        #[inline(always)]
3010        fn new_empty() -> Self {
3011            Self {
3012                connection_interval: fidl::new_empty!(u16, D),
3013                connection_latency: fidl::new_empty!(u16, D),
3014                supervision_timeout: fidl::new_empty!(u16, D),
3015            }
3016        }
3017
3018        #[inline]
3019        unsafe fn decode(
3020            &mut self,
3021            decoder: &mut fidl::encoding::Decoder<'_, D>,
3022            offset: usize,
3023            _depth: fidl::encoding::Depth,
3024        ) -> fidl::Result<()> {
3025            decoder.debug_check_bounds::<Self>(offset);
3026            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
3027            // Verify that padding bytes are zero.
3028            // Copy from the buffer into the object.
3029            unsafe {
3030                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 6);
3031            }
3032            Ok(())
3033        }
3034    }
3035
3036    impl fidl::encoding::ValueTypeMarker for Ltk {
3037        type Borrowed<'a> = &'a Self;
3038        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3039            value
3040        }
3041    }
3042
3043    unsafe impl fidl::encoding::TypeMarker for Ltk {
3044        type Owned = Self;
3045
3046        #[inline(always)]
3047        fn inline_align(_context: fidl::encoding::Context) -> usize {
3048            8
3049        }
3050
3051        #[inline(always)]
3052        fn inline_size(_context: fidl::encoding::Context) -> usize {
3053            32
3054        }
3055    }
3056
3057    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Ltk, D> for &Ltk {
3058        #[inline]
3059        unsafe fn encode(
3060            self,
3061            encoder: &mut fidl::encoding::Encoder<'_, D>,
3062            offset: usize,
3063            _depth: fidl::encoding::Depth,
3064        ) -> fidl::Result<()> {
3065            encoder.debug_check_bounds::<Ltk>(offset);
3066            // Delegate to tuple encoding.
3067            fidl::encoding::Encode::<Ltk, D>::encode(
3068                (
3069                    <PeerKey as fidl::encoding::ValueTypeMarker>::borrow(&self.key),
3070                    <u16 as fidl::encoding::ValueTypeMarker>::borrow(&self.ediv),
3071                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.rand),
3072                ),
3073                encoder,
3074                offset,
3075                _depth,
3076            )
3077        }
3078    }
3079    unsafe impl<
3080            D: fidl::encoding::ResourceDialect,
3081            T0: fidl::encoding::Encode<PeerKey, D>,
3082            T1: fidl::encoding::Encode<u16, D>,
3083            T2: fidl::encoding::Encode<u64, D>,
3084        > fidl::encoding::Encode<Ltk, D> for (T0, T1, T2)
3085    {
3086        #[inline]
3087        unsafe fn encode(
3088            self,
3089            encoder: &mut fidl::encoding::Encoder<'_, D>,
3090            offset: usize,
3091            depth: fidl::encoding::Depth,
3092        ) -> fidl::Result<()> {
3093            encoder.debug_check_bounds::<Ltk>(offset);
3094            // Zero out padding regions. There's no need to apply masks
3095            // because the unmasked parts will be overwritten by fields.
3096            unsafe {
3097                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
3098                (ptr as *mut u64).write_unaligned(0);
3099            }
3100            // Write the fields.
3101            self.0.encode(encoder, offset + 0, depth)?;
3102            self.1.encode(encoder, offset + 20, depth)?;
3103            self.2.encode(encoder, offset + 24, depth)?;
3104            Ok(())
3105        }
3106    }
3107
3108    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Ltk {
3109        #[inline(always)]
3110        fn new_empty() -> Self {
3111            Self {
3112                key: fidl::new_empty!(PeerKey, D),
3113                ediv: fidl::new_empty!(u16, D),
3114                rand: fidl::new_empty!(u64, D),
3115            }
3116        }
3117
3118        #[inline]
3119        unsafe fn decode(
3120            &mut self,
3121            decoder: &mut fidl::encoding::Decoder<'_, D>,
3122            offset: usize,
3123            _depth: fidl::encoding::Depth,
3124        ) -> fidl::Result<()> {
3125            decoder.debug_check_bounds::<Self>(offset);
3126            // Verify that padding bytes are zero.
3127            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
3128            let padval = unsafe { (ptr as *const u64).read_unaligned() };
3129            let mask = 0xffff0000ff000000u64;
3130            let maskedval = padval & mask;
3131            if maskedval != 0 {
3132                return Err(fidl::Error::NonZeroPadding {
3133                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
3134                });
3135            }
3136            fidl::decode!(PeerKey, D, &mut self.key, decoder, offset + 0, _depth)?;
3137            fidl::decode!(u16, D, &mut self.ediv, decoder, offset + 20, _depth)?;
3138            fidl::decode!(u64, D, &mut self.rand, decoder, offset + 24, _depth)?;
3139            Ok(())
3140        }
3141    }
3142
3143    impl fidl::encoding::ValueTypeMarker for PairingDelegate2RequestCompleteRequest {
3144        type Borrowed<'a> = &'a Self;
3145        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3146            value
3147        }
3148    }
3149
3150    unsafe impl fidl::encoding::TypeMarker for PairingDelegate2RequestCompleteRequest {
3151        type Owned = Self;
3152
3153        #[inline(always)]
3154        fn inline_align(_context: fidl::encoding::Context) -> usize {
3155            8
3156        }
3157
3158        #[inline(always)]
3159        fn inline_size(_context: fidl::encoding::Context) -> usize {
3160            16
3161        }
3162    }
3163
3164    unsafe impl<D: fidl::encoding::ResourceDialect>
3165        fidl::encoding::Encode<PairingDelegate2RequestCompleteRequest, D>
3166        for &PairingDelegate2RequestCompleteRequest
3167    {
3168        #[inline]
3169        unsafe fn encode(
3170            self,
3171            encoder: &mut fidl::encoding::Encoder<'_, D>,
3172            offset: usize,
3173            _depth: fidl::encoding::Depth,
3174        ) -> fidl::Result<()> {
3175            encoder.debug_check_bounds::<PairingDelegate2RequestCompleteRequest>(offset);
3176            // Delegate to tuple encoding.
3177            fidl::encoding::Encode::<PairingDelegate2RequestCompleteRequest, D>::encode(
3178                (
3179                    <fidl_fuchsia_bluetooth::PeerId as fidl::encoding::ValueTypeMarker>::borrow(
3180                        &self.id,
3181                    ),
3182                    <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.success),
3183                ),
3184                encoder,
3185                offset,
3186                _depth,
3187            )
3188        }
3189    }
3190    unsafe impl<
3191            D: fidl::encoding::ResourceDialect,
3192            T0: fidl::encoding::Encode<fidl_fuchsia_bluetooth::PeerId, D>,
3193            T1: fidl::encoding::Encode<bool, D>,
3194        > fidl::encoding::Encode<PairingDelegate2RequestCompleteRequest, D> for (T0, T1)
3195    {
3196        #[inline]
3197        unsafe fn encode(
3198            self,
3199            encoder: &mut fidl::encoding::Encoder<'_, D>,
3200            offset: usize,
3201            depth: fidl::encoding::Depth,
3202        ) -> fidl::Result<()> {
3203            encoder.debug_check_bounds::<PairingDelegate2RequestCompleteRequest>(offset);
3204            // Zero out padding regions. There's no need to apply masks
3205            // because the unmasked parts will be overwritten by fields.
3206            unsafe {
3207                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
3208                (ptr as *mut u64).write_unaligned(0);
3209            }
3210            // Write the fields.
3211            self.0.encode(encoder, offset + 0, depth)?;
3212            self.1.encode(encoder, offset + 8, depth)?;
3213            Ok(())
3214        }
3215    }
3216
3217    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3218        for PairingDelegate2RequestCompleteRequest
3219    {
3220        #[inline(always)]
3221        fn new_empty() -> Self {
3222            Self {
3223                id: fidl::new_empty!(fidl_fuchsia_bluetooth::PeerId, D),
3224                success: fidl::new_empty!(bool, D),
3225            }
3226        }
3227
3228        #[inline]
3229        unsafe fn decode(
3230            &mut self,
3231            decoder: &mut fidl::encoding::Decoder<'_, D>,
3232            offset: usize,
3233            _depth: fidl::encoding::Depth,
3234        ) -> fidl::Result<()> {
3235            decoder.debug_check_bounds::<Self>(offset);
3236            // Verify that padding bytes are zero.
3237            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(8) };
3238            let padval = unsafe { (ptr as *const u64).read_unaligned() };
3239            let mask = 0xffffffffffffff00u64;
3240            let maskedval = padval & mask;
3241            if maskedval != 0 {
3242                return Err(fidl::Error::NonZeroPadding {
3243                    padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
3244                });
3245            }
3246            fidl::decode!(
3247                fidl_fuchsia_bluetooth::PeerId,
3248                D,
3249                &mut self.id,
3250                decoder,
3251                offset + 0,
3252                _depth
3253            )?;
3254            fidl::decode!(bool, D, &mut self.success, decoder, offset + 8, _depth)?;
3255            Ok(())
3256        }
3257    }
3258
3259    impl fidl::encoding::ValueTypeMarker for PairingDelegateOnLocalKeypressRequest {
3260        type Borrowed<'a> = &'a Self;
3261        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3262            value
3263        }
3264    }
3265
3266    unsafe impl fidl::encoding::TypeMarker for PairingDelegateOnLocalKeypressRequest {
3267        type Owned = Self;
3268
3269        #[inline(always)]
3270        fn inline_align(_context: fidl::encoding::Context) -> usize {
3271            8
3272        }
3273
3274        #[inline(always)]
3275        fn inline_size(_context: fidl::encoding::Context) -> usize {
3276            16
3277        }
3278    }
3279
3280    unsafe impl<D: fidl::encoding::ResourceDialect>
3281        fidl::encoding::Encode<PairingDelegateOnLocalKeypressRequest, D>
3282        for &PairingDelegateOnLocalKeypressRequest
3283    {
3284        #[inline]
3285        unsafe fn encode(
3286            self,
3287            encoder: &mut fidl::encoding::Encoder<'_, D>,
3288            offset: usize,
3289            _depth: fidl::encoding::Depth,
3290        ) -> fidl::Result<()> {
3291            encoder.debug_check_bounds::<PairingDelegateOnLocalKeypressRequest>(offset);
3292            // Delegate to tuple encoding.
3293            fidl::encoding::Encode::<PairingDelegateOnLocalKeypressRequest, D>::encode(
3294                (
3295                    <fidl_fuchsia_bluetooth::PeerId as fidl::encoding::ValueTypeMarker>::borrow(
3296                        &self.id,
3297                    ),
3298                    <PairingKeypress as fidl::encoding::ValueTypeMarker>::borrow(&self.keypress),
3299                ),
3300                encoder,
3301                offset,
3302                _depth,
3303            )
3304        }
3305    }
3306    unsafe impl<
3307            D: fidl::encoding::ResourceDialect,
3308            T0: fidl::encoding::Encode<fidl_fuchsia_bluetooth::PeerId, D>,
3309            T1: fidl::encoding::Encode<PairingKeypress, D>,
3310        > fidl::encoding::Encode<PairingDelegateOnLocalKeypressRequest, D> for (T0, T1)
3311    {
3312        #[inline]
3313        unsafe fn encode(
3314            self,
3315            encoder: &mut fidl::encoding::Encoder<'_, D>,
3316            offset: usize,
3317            depth: fidl::encoding::Depth,
3318        ) -> fidl::Result<()> {
3319            encoder.debug_check_bounds::<PairingDelegateOnLocalKeypressRequest>(offset);
3320            // Zero out padding regions. There's no need to apply masks
3321            // because the unmasked parts will be overwritten by fields.
3322            unsafe {
3323                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
3324                (ptr as *mut u64).write_unaligned(0);
3325            }
3326            // Write the fields.
3327            self.0.encode(encoder, offset + 0, depth)?;
3328            self.1.encode(encoder, offset + 8, depth)?;
3329            Ok(())
3330        }
3331    }
3332
3333    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3334        for PairingDelegateOnLocalKeypressRequest
3335    {
3336        #[inline(always)]
3337        fn new_empty() -> Self {
3338            Self {
3339                id: fidl::new_empty!(fidl_fuchsia_bluetooth::PeerId, D),
3340                keypress: fidl::new_empty!(PairingKeypress, D),
3341            }
3342        }
3343
3344        #[inline]
3345        unsafe fn decode(
3346            &mut self,
3347            decoder: &mut fidl::encoding::Decoder<'_, D>,
3348            offset: usize,
3349            _depth: fidl::encoding::Depth,
3350        ) -> fidl::Result<()> {
3351            decoder.debug_check_bounds::<Self>(offset);
3352            // Verify that padding bytes are zero.
3353            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(8) };
3354            let padval = unsafe { (ptr as *const u64).read_unaligned() };
3355            let mask = 0xffffffff00000000u64;
3356            let maskedval = padval & mask;
3357            if maskedval != 0 {
3358                return Err(fidl::Error::NonZeroPadding {
3359                    padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
3360                });
3361            }
3362            fidl::decode!(
3363                fidl_fuchsia_bluetooth::PeerId,
3364                D,
3365                &mut self.id,
3366                decoder,
3367                offset + 0,
3368                _depth
3369            )?;
3370            fidl::decode!(PairingKeypress, D, &mut self.keypress, decoder, offset + 8, _depth)?;
3371            Ok(())
3372        }
3373    }
3374
3375    impl fidl::encoding::ValueTypeMarker for PairingDelegateOnPairingCompleteRequest {
3376        type Borrowed<'a> = &'a Self;
3377        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3378            value
3379        }
3380    }
3381
3382    unsafe impl fidl::encoding::TypeMarker for PairingDelegateOnPairingCompleteRequest {
3383        type Owned = Self;
3384
3385        #[inline(always)]
3386        fn inline_align(_context: fidl::encoding::Context) -> usize {
3387            8
3388        }
3389
3390        #[inline(always)]
3391        fn inline_size(_context: fidl::encoding::Context) -> usize {
3392            16
3393        }
3394    }
3395
3396    unsafe impl<D: fidl::encoding::ResourceDialect>
3397        fidl::encoding::Encode<PairingDelegateOnPairingCompleteRequest, D>
3398        for &PairingDelegateOnPairingCompleteRequest
3399    {
3400        #[inline]
3401        unsafe fn encode(
3402            self,
3403            encoder: &mut fidl::encoding::Encoder<'_, D>,
3404            offset: usize,
3405            _depth: fidl::encoding::Depth,
3406        ) -> fidl::Result<()> {
3407            encoder.debug_check_bounds::<PairingDelegateOnPairingCompleteRequest>(offset);
3408            // Delegate to tuple encoding.
3409            fidl::encoding::Encode::<PairingDelegateOnPairingCompleteRequest, D>::encode(
3410                (
3411                    <fidl_fuchsia_bluetooth::PeerId as fidl::encoding::ValueTypeMarker>::borrow(
3412                        &self.id,
3413                    ),
3414                    <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.success),
3415                ),
3416                encoder,
3417                offset,
3418                _depth,
3419            )
3420        }
3421    }
3422    unsafe impl<
3423            D: fidl::encoding::ResourceDialect,
3424            T0: fidl::encoding::Encode<fidl_fuchsia_bluetooth::PeerId, D>,
3425            T1: fidl::encoding::Encode<bool, D>,
3426        > fidl::encoding::Encode<PairingDelegateOnPairingCompleteRequest, D> for (T0, T1)
3427    {
3428        #[inline]
3429        unsafe fn encode(
3430            self,
3431            encoder: &mut fidl::encoding::Encoder<'_, D>,
3432            offset: usize,
3433            depth: fidl::encoding::Depth,
3434        ) -> fidl::Result<()> {
3435            encoder.debug_check_bounds::<PairingDelegateOnPairingCompleteRequest>(offset);
3436            // Zero out padding regions. There's no need to apply masks
3437            // because the unmasked parts will be overwritten by fields.
3438            unsafe {
3439                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
3440                (ptr as *mut u64).write_unaligned(0);
3441            }
3442            // Write the fields.
3443            self.0.encode(encoder, offset + 0, depth)?;
3444            self.1.encode(encoder, offset + 8, depth)?;
3445            Ok(())
3446        }
3447    }
3448
3449    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3450        for PairingDelegateOnPairingCompleteRequest
3451    {
3452        #[inline(always)]
3453        fn new_empty() -> Self {
3454            Self {
3455                id: fidl::new_empty!(fidl_fuchsia_bluetooth::PeerId, D),
3456                success: fidl::new_empty!(bool, D),
3457            }
3458        }
3459
3460        #[inline]
3461        unsafe fn decode(
3462            &mut self,
3463            decoder: &mut fidl::encoding::Decoder<'_, D>,
3464            offset: usize,
3465            _depth: fidl::encoding::Depth,
3466        ) -> fidl::Result<()> {
3467            decoder.debug_check_bounds::<Self>(offset);
3468            // Verify that padding bytes are zero.
3469            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(8) };
3470            let padval = unsafe { (ptr as *const u64).read_unaligned() };
3471            let mask = 0xffffffffffffff00u64;
3472            let maskedval = padval & mask;
3473            if maskedval != 0 {
3474                return Err(fidl::Error::NonZeroPadding {
3475                    padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
3476                });
3477            }
3478            fidl::decode!(
3479                fidl_fuchsia_bluetooth::PeerId,
3480                D,
3481                &mut self.id,
3482                decoder,
3483                offset + 0,
3484                _depth
3485            )?;
3486            fidl::decode!(bool, D, &mut self.success, decoder, offset + 8, _depth)?;
3487            Ok(())
3488        }
3489    }
3490
3491    impl fidl::encoding::ValueTypeMarker for PairingDelegateOnPairingRequestRequest {
3492        type Borrowed<'a> = &'a Self;
3493        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3494            value
3495        }
3496    }
3497
3498    unsafe impl fidl::encoding::TypeMarker for PairingDelegateOnPairingRequestRequest {
3499        type Owned = Self;
3500
3501        #[inline(always)]
3502        fn inline_align(_context: fidl::encoding::Context) -> usize {
3503            8
3504        }
3505
3506        #[inline(always)]
3507        fn inline_size(_context: fidl::encoding::Context) -> usize {
3508            24
3509        }
3510    }
3511
3512    unsafe impl<D: fidl::encoding::ResourceDialect>
3513        fidl::encoding::Encode<PairingDelegateOnPairingRequestRequest, D>
3514        for &PairingDelegateOnPairingRequestRequest
3515    {
3516        #[inline]
3517        unsafe fn encode(
3518            self,
3519            encoder: &mut fidl::encoding::Encoder<'_, D>,
3520            offset: usize,
3521            _depth: fidl::encoding::Depth,
3522        ) -> fidl::Result<()> {
3523            encoder.debug_check_bounds::<PairingDelegateOnPairingRequestRequest>(offset);
3524            // Delegate to tuple encoding.
3525            fidl::encoding::Encode::<PairingDelegateOnPairingRequestRequest, D>::encode(
3526                (
3527                    <Peer as fidl::encoding::ValueTypeMarker>::borrow(&self.peer),
3528                    <PairingMethod as fidl::encoding::ValueTypeMarker>::borrow(&self.method),
3529                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.displayed_passkey),
3530                ),
3531                encoder,
3532                offset,
3533                _depth,
3534            )
3535        }
3536    }
3537    unsafe impl<
3538            D: fidl::encoding::ResourceDialect,
3539            T0: fidl::encoding::Encode<Peer, D>,
3540            T1: fidl::encoding::Encode<PairingMethod, D>,
3541            T2: fidl::encoding::Encode<u32, D>,
3542        > fidl::encoding::Encode<PairingDelegateOnPairingRequestRequest, D> for (T0, T1, T2)
3543    {
3544        #[inline]
3545        unsafe fn encode(
3546            self,
3547            encoder: &mut fidl::encoding::Encoder<'_, D>,
3548            offset: usize,
3549            depth: fidl::encoding::Depth,
3550        ) -> fidl::Result<()> {
3551            encoder.debug_check_bounds::<PairingDelegateOnPairingRequestRequest>(offset);
3552            // Zero out padding regions. There's no need to apply masks
3553            // because the unmasked parts will be overwritten by fields.
3554            // Write the fields.
3555            self.0.encode(encoder, offset + 0, depth)?;
3556            self.1.encode(encoder, offset + 16, depth)?;
3557            self.2.encode(encoder, offset + 20, depth)?;
3558            Ok(())
3559        }
3560    }
3561
3562    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3563        for PairingDelegateOnPairingRequestRequest
3564    {
3565        #[inline(always)]
3566        fn new_empty() -> Self {
3567            Self {
3568                peer: fidl::new_empty!(Peer, D),
3569                method: fidl::new_empty!(PairingMethod, D),
3570                displayed_passkey: fidl::new_empty!(u32, D),
3571            }
3572        }
3573
3574        #[inline]
3575        unsafe fn decode(
3576            &mut self,
3577            decoder: &mut fidl::encoding::Decoder<'_, D>,
3578            offset: usize,
3579            _depth: fidl::encoding::Depth,
3580        ) -> fidl::Result<()> {
3581            decoder.debug_check_bounds::<Self>(offset);
3582            // Verify that padding bytes are zero.
3583            fidl::decode!(Peer, D, &mut self.peer, decoder, offset + 0, _depth)?;
3584            fidl::decode!(PairingMethod, D, &mut self.method, decoder, offset + 16, _depth)?;
3585            fidl::decode!(u32, D, &mut self.displayed_passkey, decoder, offset + 20, _depth)?;
3586            Ok(())
3587        }
3588    }
3589
3590    impl fidl::encoding::ValueTypeMarker for PairingDelegateOnPairingRequestResponse {
3591        type Borrowed<'a> = &'a Self;
3592        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3593            value
3594        }
3595    }
3596
3597    unsafe impl fidl::encoding::TypeMarker for PairingDelegateOnPairingRequestResponse {
3598        type Owned = Self;
3599
3600        #[inline(always)]
3601        fn inline_align(_context: fidl::encoding::Context) -> usize {
3602            4
3603        }
3604
3605        #[inline(always)]
3606        fn inline_size(_context: fidl::encoding::Context) -> usize {
3607            8
3608        }
3609    }
3610
3611    unsafe impl<D: fidl::encoding::ResourceDialect>
3612        fidl::encoding::Encode<PairingDelegateOnPairingRequestResponse, D>
3613        for &PairingDelegateOnPairingRequestResponse
3614    {
3615        #[inline]
3616        unsafe fn encode(
3617            self,
3618            encoder: &mut fidl::encoding::Encoder<'_, D>,
3619            offset: usize,
3620            _depth: fidl::encoding::Depth,
3621        ) -> fidl::Result<()> {
3622            encoder.debug_check_bounds::<PairingDelegateOnPairingRequestResponse>(offset);
3623            // Delegate to tuple encoding.
3624            fidl::encoding::Encode::<PairingDelegateOnPairingRequestResponse, D>::encode(
3625                (
3626                    <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.accept),
3627                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.entered_passkey),
3628                ),
3629                encoder,
3630                offset,
3631                _depth,
3632            )
3633        }
3634    }
3635    unsafe impl<
3636            D: fidl::encoding::ResourceDialect,
3637            T0: fidl::encoding::Encode<bool, D>,
3638            T1: fidl::encoding::Encode<u32, D>,
3639        > fidl::encoding::Encode<PairingDelegateOnPairingRequestResponse, D> for (T0, T1)
3640    {
3641        #[inline]
3642        unsafe fn encode(
3643            self,
3644            encoder: &mut fidl::encoding::Encoder<'_, D>,
3645            offset: usize,
3646            depth: fidl::encoding::Depth,
3647        ) -> fidl::Result<()> {
3648            encoder.debug_check_bounds::<PairingDelegateOnPairingRequestResponse>(offset);
3649            // Zero out padding regions. There's no need to apply masks
3650            // because the unmasked parts will be overwritten by fields.
3651            unsafe {
3652                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
3653                (ptr as *mut u32).write_unaligned(0);
3654            }
3655            // Write the fields.
3656            self.0.encode(encoder, offset + 0, depth)?;
3657            self.1.encode(encoder, offset + 4, depth)?;
3658            Ok(())
3659        }
3660    }
3661
3662    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3663        for PairingDelegateOnPairingRequestResponse
3664    {
3665        #[inline(always)]
3666        fn new_empty() -> Self {
3667            Self { accept: fidl::new_empty!(bool, D), entered_passkey: fidl::new_empty!(u32, D) }
3668        }
3669
3670        #[inline]
3671        unsafe fn decode(
3672            &mut self,
3673            decoder: &mut fidl::encoding::Decoder<'_, D>,
3674            offset: usize,
3675            _depth: fidl::encoding::Depth,
3676        ) -> fidl::Result<()> {
3677            decoder.debug_check_bounds::<Self>(offset);
3678            // Verify that padding bytes are zero.
3679            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
3680            let padval = unsafe { (ptr as *const u32).read_unaligned() };
3681            let mask = 0xffffff00u32;
3682            let maskedval = padval & mask;
3683            if maskedval != 0 {
3684                return Err(fidl::Error::NonZeroPadding {
3685                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
3686                });
3687            }
3688            fidl::decode!(bool, D, &mut self.accept, decoder, offset + 0, _depth)?;
3689            fidl::decode!(u32, D, &mut self.entered_passkey, decoder, offset + 4, _depth)?;
3690            Ok(())
3691        }
3692    }
3693
3694    impl fidl::encoding::ValueTypeMarker for PairingDelegateOnRemoteKeypressRequest {
3695        type Borrowed<'a> = &'a Self;
3696        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3697            value
3698        }
3699    }
3700
3701    unsafe impl fidl::encoding::TypeMarker for PairingDelegateOnRemoteKeypressRequest {
3702        type Owned = Self;
3703
3704        #[inline(always)]
3705        fn inline_align(_context: fidl::encoding::Context) -> usize {
3706            8
3707        }
3708
3709        #[inline(always)]
3710        fn inline_size(_context: fidl::encoding::Context) -> usize {
3711            16
3712        }
3713    }
3714
3715    unsafe impl<D: fidl::encoding::ResourceDialect>
3716        fidl::encoding::Encode<PairingDelegateOnRemoteKeypressRequest, D>
3717        for &PairingDelegateOnRemoteKeypressRequest
3718    {
3719        #[inline]
3720        unsafe fn encode(
3721            self,
3722            encoder: &mut fidl::encoding::Encoder<'_, D>,
3723            offset: usize,
3724            _depth: fidl::encoding::Depth,
3725        ) -> fidl::Result<()> {
3726            encoder.debug_check_bounds::<PairingDelegateOnRemoteKeypressRequest>(offset);
3727            // Delegate to tuple encoding.
3728            fidl::encoding::Encode::<PairingDelegateOnRemoteKeypressRequest, D>::encode(
3729                (
3730                    <fidl_fuchsia_bluetooth::PeerId as fidl::encoding::ValueTypeMarker>::borrow(
3731                        &self.id,
3732                    ),
3733                    <PairingKeypress as fidl::encoding::ValueTypeMarker>::borrow(&self.keypress),
3734                ),
3735                encoder,
3736                offset,
3737                _depth,
3738            )
3739        }
3740    }
3741    unsafe impl<
3742            D: fidl::encoding::ResourceDialect,
3743            T0: fidl::encoding::Encode<fidl_fuchsia_bluetooth::PeerId, D>,
3744            T1: fidl::encoding::Encode<PairingKeypress, D>,
3745        > fidl::encoding::Encode<PairingDelegateOnRemoteKeypressRequest, D> for (T0, T1)
3746    {
3747        #[inline]
3748        unsafe fn encode(
3749            self,
3750            encoder: &mut fidl::encoding::Encoder<'_, D>,
3751            offset: usize,
3752            depth: fidl::encoding::Depth,
3753        ) -> fidl::Result<()> {
3754            encoder.debug_check_bounds::<PairingDelegateOnRemoteKeypressRequest>(offset);
3755            // Zero out padding regions. There's no need to apply masks
3756            // because the unmasked parts will be overwritten by fields.
3757            unsafe {
3758                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
3759                (ptr as *mut u64).write_unaligned(0);
3760            }
3761            // Write the fields.
3762            self.0.encode(encoder, offset + 0, depth)?;
3763            self.1.encode(encoder, offset + 8, depth)?;
3764            Ok(())
3765        }
3766    }
3767
3768    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3769        for PairingDelegateOnRemoteKeypressRequest
3770    {
3771        #[inline(always)]
3772        fn new_empty() -> Self {
3773            Self {
3774                id: fidl::new_empty!(fidl_fuchsia_bluetooth::PeerId, D),
3775                keypress: fidl::new_empty!(PairingKeypress, D),
3776            }
3777        }
3778
3779        #[inline]
3780        unsafe fn decode(
3781            &mut self,
3782            decoder: &mut fidl::encoding::Decoder<'_, D>,
3783            offset: usize,
3784            _depth: fidl::encoding::Depth,
3785        ) -> fidl::Result<()> {
3786            decoder.debug_check_bounds::<Self>(offset);
3787            // Verify that padding bytes are zero.
3788            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(8) };
3789            let padval = unsafe { (ptr as *const u64).read_unaligned() };
3790            let mask = 0xffffffff00000000u64;
3791            let maskedval = padval & mask;
3792            if maskedval != 0 {
3793                return Err(fidl::Error::NonZeroPadding {
3794                    padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
3795                });
3796            }
3797            fidl::decode!(
3798                fidl_fuchsia_bluetooth::PeerId,
3799                D,
3800                &mut self.id,
3801                decoder,
3802                offset + 0,
3803                _depth
3804            )?;
3805            fidl::decode!(PairingKeypress, D, &mut self.keypress, decoder, offset + 8, _depth)?;
3806            Ok(())
3807        }
3808    }
3809
3810    impl fidl::encoding::ValueTypeMarker for PairingRequestKeypressRequest {
3811        type Borrowed<'a> = &'a Self;
3812        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3813            value
3814        }
3815    }
3816
3817    unsafe impl fidl::encoding::TypeMarker for PairingRequestKeypressRequest {
3818        type Owned = Self;
3819
3820        #[inline(always)]
3821        fn inline_align(_context: fidl::encoding::Context) -> usize {
3822            4
3823        }
3824
3825        #[inline(always)]
3826        fn inline_size(_context: fidl::encoding::Context) -> usize {
3827            4
3828        }
3829    }
3830
3831    unsafe impl<D: fidl::encoding::ResourceDialect>
3832        fidl::encoding::Encode<PairingRequestKeypressRequest, D>
3833        for &PairingRequestKeypressRequest
3834    {
3835        #[inline]
3836        unsafe fn encode(
3837            self,
3838            encoder: &mut fidl::encoding::Encoder<'_, D>,
3839            offset: usize,
3840            _depth: fidl::encoding::Depth,
3841        ) -> fidl::Result<()> {
3842            encoder.debug_check_bounds::<PairingRequestKeypressRequest>(offset);
3843            // Delegate to tuple encoding.
3844            fidl::encoding::Encode::<PairingRequestKeypressRequest, D>::encode(
3845                (<PairingKeypress as fidl::encoding::ValueTypeMarker>::borrow(&self.keypress),),
3846                encoder,
3847                offset,
3848                _depth,
3849            )
3850        }
3851    }
3852    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<PairingKeypress, D>>
3853        fidl::encoding::Encode<PairingRequestKeypressRequest, D> for (T0,)
3854    {
3855        #[inline]
3856        unsafe fn encode(
3857            self,
3858            encoder: &mut fidl::encoding::Encoder<'_, D>,
3859            offset: usize,
3860            depth: fidl::encoding::Depth,
3861        ) -> fidl::Result<()> {
3862            encoder.debug_check_bounds::<PairingRequestKeypressRequest>(offset);
3863            // Zero out padding regions. There's no need to apply masks
3864            // because the unmasked parts will be overwritten by fields.
3865            // Write the fields.
3866            self.0.encode(encoder, offset + 0, depth)?;
3867            Ok(())
3868        }
3869    }
3870
3871    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3872        for PairingRequestKeypressRequest
3873    {
3874        #[inline(always)]
3875        fn new_empty() -> Self {
3876            Self { keypress: fidl::new_empty!(PairingKeypress, D) }
3877        }
3878
3879        #[inline]
3880        unsafe fn decode(
3881            &mut self,
3882            decoder: &mut fidl::encoding::Decoder<'_, D>,
3883            offset: usize,
3884            _depth: fidl::encoding::Depth,
3885        ) -> fidl::Result<()> {
3886            decoder.debug_check_bounds::<Self>(offset);
3887            // Verify that padding bytes are zero.
3888            fidl::decode!(PairingKeypress, D, &mut self.keypress, decoder, offset + 0, _depth)?;
3889            Ok(())
3890        }
3891    }
3892
3893    impl fidl::encoding::ValueTypeMarker for PairingRequestOnCompleteRequest {
3894        type Borrowed<'a> = &'a Self;
3895        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3896            value
3897        }
3898    }
3899
3900    unsafe impl fidl::encoding::TypeMarker for PairingRequestOnCompleteRequest {
3901        type Owned = Self;
3902
3903        #[inline(always)]
3904        fn inline_align(_context: fidl::encoding::Context) -> usize {
3905            1
3906        }
3907
3908        #[inline(always)]
3909        fn inline_size(_context: fidl::encoding::Context) -> usize {
3910            1
3911        }
3912    }
3913
3914    unsafe impl<D: fidl::encoding::ResourceDialect>
3915        fidl::encoding::Encode<PairingRequestOnCompleteRequest, D>
3916        for &PairingRequestOnCompleteRequest
3917    {
3918        #[inline]
3919        unsafe fn encode(
3920            self,
3921            encoder: &mut fidl::encoding::Encoder<'_, D>,
3922            offset: usize,
3923            _depth: fidl::encoding::Depth,
3924        ) -> fidl::Result<()> {
3925            encoder.debug_check_bounds::<PairingRequestOnCompleteRequest>(offset);
3926            // Delegate to tuple encoding.
3927            fidl::encoding::Encode::<PairingRequestOnCompleteRequest, D>::encode(
3928                (<bool as fidl::encoding::ValueTypeMarker>::borrow(&self.success),),
3929                encoder,
3930                offset,
3931                _depth,
3932            )
3933        }
3934    }
3935    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<bool, D>>
3936        fidl::encoding::Encode<PairingRequestOnCompleteRequest, D> for (T0,)
3937    {
3938        #[inline]
3939        unsafe fn encode(
3940            self,
3941            encoder: &mut fidl::encoding::Encoder<'_, D>,
3942            offset: usize,
3943            depth: fidl::encoding::Depth,
3944        ) -> fidl::Result<()> {
3945            encoder.debug_check_bounds::<PairingRequestOnCompleteRequest>(offset);
3946            // Zero out padding regions. There's no need to apply masks
3947            // because the unmasked parts will be overwritten by fields.
3948            // Write the fields.
3949            self.0.encode(encoder, offset + 0, depth)?;
3950            Ok(())
3951        }
3952    }
3953
3954    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3955        for PairingRequestOnCompleteRequest
3956    {
3957        #[inline(always)]
3958        fn new_empty() -> Self {
3959            Self { success: fidl::new_empty!(bool, D) }
3960        }
3961
3962        #[inline]
3963        unsafe fn decode(
3964            &mut self,
3965            decoder: &mut fidl::encoding::Decoder<'_, D>,
3966            offset: usize,
3967            _depth: fidl::encoding::Depth,
3968        ) -> fidl::Result<()> {
3969            decoder.debug_check_bounds::<Self>(offset);
3970            // Verify that padding bytes are zero.
3971            fidl::decode!(bool, D, &mut self.success, decoder, offset + 0, _depth)?;
3972            Ok(())
3973        }
3974    }
3975
3976    impl fidl::encoding::ValueTypeMarker for PairingRequestOnKeypressRequest {
3977        type Borrowed<'a> = &'a Self;
3978        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3979            value
3980        }
3981    }
3982
3983    unsafe impl fidl::encoding::TypeMarker for PairingRequestOnKeypressRequest {
3984        type Owned = Self;
3985
3986        #[inline(always)]
3987        fn inline_align(_context: fidl::encoding::Context) -> usize {
3988            4
3989        }
3990
3991        #[inline(always)]
3992        fn inline_size(_context: fidl::encoding::Context) -> usize {
3993            4
3994        }
3995    }
3996
3997    unsafe impl<D: fidl::encoding::ResourceDialect>
3998        fidl::encoding::Encode<PairingRequestOnKeypressRequest, D>
3999        for &PairingRequestOnKeypressRequest
4000    {
4001        #[inline]
4002        unsafe fn encode(
4003            self,
4004            encoder: &mut fidl::encoding::Encoder<'_, D>,
4005            offset: usize,
4006            _depth: fidl::encoding::Depth,
4007        ) -> fidl::Result<()> {
4008            encoder.debug_check_bounds::<PairingRequestOnKeypressRequest>(offset);
4009            // Delegate to tuple encoding.
4010            fidl::encoding::Encode::<PairingRequestOnKeypressRequest, D>::encode(
4011                (<PairingKeypress as fidl::encoding::ValueTypeMarker>::borrow(&self.keypress),),
4012                encoder,
4013                offset,
4014                _depth,
4015            )
4016        }
4017    }
4018    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<PairingKeypress, D>>
4019        fidl::encoding::Encode<PairingRequestOnKeypressRequest, D> for (T0,)
4020    {
4021        #[inline]
4022        unsafe fn encode(
4023            self,
4024            encoder: &mut fidl::encoding::Encoder<'_, D>,
4025            offset: usize,
4026            depth: fidl::encoding::Depth,
4027        ) -> fidl::Result<()> {
4028            encoder.debug_check_bounds::<PairingRequestOnKeypressRequest>(offset);
4029            // Zero out padding regions. There's no need to apply masks
4030            // because the unmasked parts will be overwritten by fields.
4031            // Write the fields.
4032            self.0.encode(encoder, offset + 0, depth)?;
4033            Ok(())
4034        }
4035    }
4036
4037    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
4038        for PairingRequestOnKeypressRequest
4039    {
4040        #[inline(always)]
4041        fn new_empty() -> Self {
4042            Self { keypress: fidl::new_empty!(PairingKeypress, D) }
4043        }
4044
4045        #[inline]
4046        unsafe fn decode(
4047            &mut self,
4048            decoder: &mut fidl::encoding::Decoder<'_, D>,
4049            offset: usize,
4050            _depth: fidl::encoding::Depth,
4051        ) -> fidl::Result<()> {
4052            decoder.debug_check_bounds::<Self>(offset);
4053            // Verify that padding bytes are zero.
4054            fidl::decode!(PairingKeypress, D, &mut self.keypress, decoder, offset + 0, _depth)?;
4055            Ok(())
4056        }
4057    }
4058
4059    impl fidl::encoding::ValueTypeMarker for PasskeyEntry {
4060        type Borrowed<'a> = &'a Self;
4061        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4062            value
4063        }
4064    }
4065
4066    unsafe impl fidl::encoding::TypeMarker for PasskeyEntry {
4067        type Owned = Self;
4068
4069        #[inline(always)]
4070        fn inline_align(_context: fidl::encoding::Context) -> usize {
4071            1
4072        }
4073
4074        #[inline(always)]
4075        fn inline_size(_context: fidl::encoding::Context) -> usize {
4076            1
4077        }
4078    }
4079
4080    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<PasskeyEntry, D>
4081        for &PasskeyEntry
4082    {
4083        #[inline]
4084        unsafe fn encode(
4085            self,
4086            encoder: &mut fidl::encoding::Encoder<'_, D>,
4087            offset: usize,
4088            _depth: fidl::encoding::Depth,
4089        ) -> fidl::Result<()> {
4090            encoder.debug_check_bounds::<PasskeyEntry>(offset);
4091            encoder.write_num(0u8, offset);
4092            Ok(())
4093        }
4094    }
4095
4096    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for PasskeyEntry {
4097        #[inline(always)]
4098        fn new_empty() -> Self {
4099            Self
4100        }
4101
4102        #[inline]
4103        unsafe fn decode(
4104            &mut self,
4105            decoder: &mut fidl::encoding::Decoder<'_, D>,
4106            offset: usize,
4107            _depth: fidl::encoding::Depth,
4108        ) -> fidl::Result<()> {
4109            decoder.debug_check_bounds::<Self>(offset);
4110            match decoder.read_num::<u8>(offset) {
4111                0 => Ok(()),
4112                _ => Err(fidl::Error::Invalid),
4113            }
4114        }
4115    }
4116
4117    impl fidl::encoding::ValueTypeMarker for PeerKey {
4118        type Borrowed<'a> = &'a Self;
4119        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4120            value
4121        }
4122    }
4123
4124    unsafe impl fidl::encoding::TypeMarker for PeerKey {
4125        type Owned = Self;
4126
4127        #[inline(always)]
4128        fn inline_align(_context: fidl::encoding::Context) -> usize {
4129            1
4130        }
4131
4132        #[inline(always)]
4133        fn inline_size(_context: fidl::encoding::Context) -> usize {
4134            19
4135        }
4136    }
4137
4138    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<PeerKey, D> for &PeerKey {
4139        #[inline]
4140        unsafe fn encode(
4141            self,
4142            encoder: &mut fidl::encoding::Encoder<'_, D>,
4143            offset: usize,
4144            _depth: fidl::encoding::Depth,
4145        ) -> fidl::Result<()> {
4146            encoder.debug_check_bounds::<PeerKey>(offset);
4147            // Delegate to tuple encoding.
4148            fidl::encoding::Encode::<PeerKey, D>::encode(
4149                (
4150                    <SecurityProperties as fidl::encoding::ValueTypeMarker>::borrow(&self.security),
4151                    <Key as fidl::encoding::ValueTypeMarker>::borrow(&self.data),
4152                ),
4153                encoder,
4154                offset,
4155                _depth,
4156            )
4157        }
4158    }
4159    unsafe impl<
4160            D: fidl::encoding::ResourceDialect,
4161            T0: fidl::encoding::Encode<SecurityProperties, D>,
4162            T1: fidl::encoding::Encode<Key, D>,
4163        > fidl::encoding::Encode<PeerKey, D> for (T0, T1)
4164    {
4165        #[inline]
4166        unsafe fn encode(
4167            self,
4168            encoder: &mut fidl::encoding::Encoder<'_, D>,
4169            offset: usize,
4170            depth: fidl::encoding::Depth,
4171        ) -> fidl::Result<()> {
4172            encoder.debug_check_bounds::<PeerKey>(offset);
4173            // Zero out padding regions. There's no need to apply masks
4174            // because the unmasked parts will be overwritten by fields.
4175            // Write the fields.
4176            self.0.encode(encoder, offset + 0, depth)?;
4177            self.1.encode(encoder, offset + 3, depth)?;
4178            Ok(())
4179        }
4180    }
4181
4182    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for PeerKey {
4183        #[inline(always)]
4184        fn new_empty() -> Self {
4185            Self {
4186                security: fidl::new_empty!(SecurityProperties, D),
4187                data: fidl::new_empty!(Key, D),
4188            }
4189        }
4190
4191        #[inline]
4192        unsafe fn decode(
4193            &mut self,
4194            decoder: &mut fidl::encoding::Decoder<'_, D>,
4195            offset: usize,
4196            _depth: fidl::encoding::Depth,
4197        ) -> fidl::Result<()> {
4198            decoder.debug_check_bounds::<Self>(offset);
4199            // Verify that padding bytes are zero.
4200            fidl::decode!(SecurityProperties, D, &mut self.security, decoder, offset + 0, _depth)?;
4201            fidl::decode!(Key, D, &mut self.data, decoder, offset + 3, _depth)?;
4202            Ok(())
4203        }
4204    }
4205
4206    impl fidl::encoding::ValueTypeMarker for SecurityProperties {
4207        type Borrowed<'a> = &'a Self;
4208        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4209            value
4210        }
4211    }
4212
4213    unsafe impl fidl::encoding::TypeMarker for SecurityProperties {
4214        type Owned = Self;
4215
4216        #[inline(always)]
4217        fn inline_align(_context: fidl::encoding::Context) -> usize {
4218            1
4219        }
4220
4221        #[inline(always)]
4222        fn inline_size(_context: fidl::encoding::Context) -> usize {
4223            3
4224        }
4225    }
4226
4227    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<SecurityProperties, D>
4228        for &SecurityProperties
4229    {
4230        #[inline]
4231        unsafe fn encode(
4232            self,
4233            encoder: &mut fidl::encoding::Encoder<'_, D>,
4234            offset: usize,
4235            _depth: fidl::encoding::Depth,
4236        ) -> fidl::Result<()> {
4237            encoder.debug_check_bounds::<SecurityProperties>(offset);
4238            // Delegate to tuple encoding.
4239            fidl::encoding::Encode::<SecurityProperties, D>::encode(
4240                (
4241                    <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.authenticated),
4242                    <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.secure_connections),
4243                    <u8 as fidl::encoding::ValueTypeMarker>::borrow(&self.encryption_key_size),
4244                ),
4245                encoder,
4246                offset,
4247                _depth,
4248            )
4249        }
4250    }
4251    unsafe impl<
4252            D: fidl::encoding::ResourceDialect,
4253            T0: fidl::encoding::Encode<bool, D>,
4254            T1: fidl::encoding::Encode<bool, D>,
4255            T2: fidl::encoding::Encode<u8, D>,
4256        > fidl::encoding::Encode<SecurityProperties, D> for (T0, T1, T2)
4257    {
4258        #[inline]
4259        unsafe fn encode(
4260            self,
4261            encoder: &mut fidl::encoding::Encoder<'_, D>,
4262            offset: usize,
4263            depth: fidl::encoding::Depth,
4264        ) -> fidl::Result<()> {
4265            encoder.debug_check_bounds::<SecurityProperties>(offset);
4266            // Zero out padding regions. There's no need to apply masks
4267            // because the unmasked parts will be overwritten by fields.
4268            // Write the fields.
4269            self.0.encode(encoder, offset + 0, depth)?;
4270            self.1.encode(encoder, offset + 1, depth)?;
4271            self.2.encode(encoder, offset + 2, depth)?;
4272            Ok(())
4273        }
4274    }
4275
4276    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SecurityProperties {
4277        #[inline(always)]
4278        fn new_empty() -> Self {
4279            Self {
4280                authenticated: fidl::new_empty!(bool, D),
4281                secure_connections: fidl::new_empty!(bool, D),
4282                encryption_key_size: fidl::new_empty!(u8, D),
4283            }
4284        }
4285
4286        #[inline]
4287        unsafe fn decode(
4288            &mut self,
4289            decoder: &mut fidl::encoding::Decoder<'_, D>,
4290            offset: usize,
4291            _depth: fidl::encoding::Depth,
4292        ) -> fidl::Result<()> {
4293            decoder.debug_check_bounds::<Self>(offset);
4294            // Verify that padding bytes are zero.
4295            fidl::decode!(bool, D, &mut self.authenticated, decoder, offset + 0, _depth)?;
4296            fidl::decode!(bool, D, &mut self.secure_connections, decoder, offset + 1, _depth)?;
4297            fidl::decode!(u8, D, &mut self.encryption_key_size, decoder, offset + 2, _depth)?;
4298            Ok(())
4299        }
4300    }
4301
4302    impl BondingData {
4303        #[inline(always)]
4304        fn max_ordinal_present(&self) -> u64 {
4305            if let Some(_) = self.bredr_bond {
4306                return 8;
4307            }
4308            if let Some(_) = self.le_bond {
4309                return 7;
4310            }
4311            if let Some(_) = self.address {
4312                return 6;
4313            }
4314            if let Some(_) = self.name {
4315                return 3;
4316            }
4317            if let Some(_) = self.local_address {
4318                return 2;
4319            }
4320            if let Some(_) = self.identifier {
4321                return 1;
4322            }
4323            0
4324        }
4325    }
4326
4327    impl fidl::encoding::ValueTypeMarker for BondingData {
4328        type Borrowed<'a> = &'a Self;
4329        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4330            value
4331        }
4332    }
4333
4334    unsafe impl fidl::encoding::TypeMarker for BondingData {
4335        type Owned = Self;
4336
4337        #[inline(always)]
4338        fn inline_align(_context: fidl::encoding::Context) -> usize {
4339            8
4340        }
4341
4342        #[inline(always)]
4343        fn inline_size(_context: fidl::encoding::Context) -> usize {
4344            16
4345        }
4346    }
4347
4348    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<BondingData, D>
4349        for &BondingData
4350    {
4351        unsafe fn encode(
4352            self,
4353            encoder: &mut fidl::encoding::Encoder<'_, D>,
4354            offset: usize,
4355            mut depth: fidl::encoding::Depth,
4356        ) -> fidl::Result<()> {
4357            encoder.debug_check_bounds::<BondingData>(offset);
4358            // Vector header
4359            let max_ordinal: u64 = self.max_ordinal_present();
4360            encoder.write_num(max_ordinal, offset);
4361            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
4362            // Calling encoder.out_of_line_offset(0) is not allowed.
4363            if max_ordinal == 0 {
4364                return Ok(());
4365            }
4366            depth.increment()?;
4367            let envelope_size = 8;
4368            let bytes_len = max_ordinal as usize * envelope_size;
4369            #[allow(unused_variables)]
4370            let offset = encoder.out_of_line_offset(bytes_len);
4371            let mut _prev_end_offset: usize = 0;
4372            if 1 > max_ordinal {
4373                return Ok(());
4374            }
4375
4376            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4377            // are envelope_size bytes.
4378            let cur_offset: usize = (1 - 1) * envelope_size;
4379
4380            // Zero reserved fields.
4381            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4382
4383            // Safety:
4384            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4385            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4386            //   envelope_size bytes, there is always sufficient room.
4387            fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_bluetooth::PeerId, D>(
4388                self.identifier.as_ref().map(
4389                    <fidl_fuchsia_bluetooth::PeerId as fidl::encoding::ValueTypeMarker>::borrow,
4390                ),
4391                encoder,
4392                offset + cur_offset,
4393                depth,
4394            )?;
4395
4396            _prev_end_offset = cur_offset + envelope_size;
4397            if 2 > max_ordinal {
4398                return Ok(());
4399            }
4400
4401            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4402            // are envelope_size bytes.
4403            let cur_offset: usize = (2 - 1) * envelope_size;
4404
4405            // Zero reserved fields.
4406            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4407
4408            // Safety:
4409            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4410            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4411            //   envelope_size bytes, there is always sufficient room.
4412            fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_bluetooth::Address, D>(
4413                self.local_address.as_ref().map(
4414                    <fidl_fuchsia_bluetooth::Address as fidl::encoding::ValueTypeMarker>::borrow,
4415                ),
4416                encoder,
4417                offset + cur_offset,
4418                depth,
4419            )?;
4420
4421            _prev_end_offset = cur_offset + envelope_size;
4422            if 3 > max_ordinal {
4423                return Ok(());
4424            }
4425
4426            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4427            // are envelope_size bytes.
4428            let cur_offset: usize = (3 - 1) * envelope_size;
4429
4430            // Zero reserved fields.
4431            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4432
4433            // Safety:
4434            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4435            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4436            //   envelope_size bytes, there is always sufficient room.
4437            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<248>, D>(
4438                self.name.as_ref().map(
4439                    <fidl::encoding::BoundedString<248> as fidl::encoding::ValueTypeMarker>::borrow,
4440                ),
4441                encoder,
4442                offset + cur_offset,
4443                depth,
4444            )?;
4445
4446            _prev_end_offset = cur_offset + envelope_size;
4447            if 6 > max_ordinal {
4448                return Ok(());
4449            }
4450
4451            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4452            // are envelope_size bytes.
4453            let cur_offset: usize = (6 - 1) * envelope_size;
4454
4455            // Zero reserved fields.
4456            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4457
4458            // Safety:
4459            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4460            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4461            //   envelope_size bytes, there is always sufficient room.
4462            fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_bluetooth::Address, D>(
4463                self.address.as_ref().map(
4464                    <fidl_fuchsia_bluetooth::Address as fidl::encoding::ValueTypeMarker>::borrow,
4465                ),
4466                encoder,
4467                offset + cur_offset,
4468                depth,
4469            )?;
4470
4471            _prev_end_offset = cur_offset + envelope_size;
4472            if 7 > max_ordinal {
4473                return Ok(());
4474            }
4475
4476            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4477            // are envelope_size bytes.
4478            let cur_offset: usize = (7 - 1) * envelope_size;
4479
4480            // Zero reserved fields.
4481            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4482
4483            // Safety:
4484            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4485            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4486            //   envelope_size bytes, there is always sufficient room.
4487            fidl::encoding::encode_in_envelope_optional::<LeBondData, D>(
4488                self.le_bond.as_ref().map(<LeBondData as fidl::encoding::ValueTypeMarker>::borrow),
4489                encoder,
4490                offset + cur_offset,
4491                depth,
4492            )?;
4493
4494            _prev_end_offset = cur_offset + envelope_size;
4495            if 8 > max_ordinal {
4496                return Ok(());
4497            }
4498
4499            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4500            // are envelope_size bytes.
4501            let cur_offset: usize = (8 - 1) * envelope_size;
4502
4503            // Zero reserved fields.
4504            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4505
4506            // Safety:
4507            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4508            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4509            //   envelope_size bytes, there is always sufficient room.
4510            fidl::encoding::encode_in_envelope_optional::<BredrBondData, D>(
4511                self.bredr_bond
4512                    .as_ref()
4513                    .map(<BredrBondData as fidl::encoding::ValueTypeMarker>::borrow),
4514                encoder,
4515                offset + cur_offset,
4516                depth,
4517            )?;
4518
4519            _prev_end_offset = cur_offset + envelope_size;
4520
4521            Ok(())
4522        }
4523    }
4524
4525    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for BondingData {
4526        #[inline(always)]
4527        fn new_empty() -> Self {
4528            Self::default()
4529        }
4530
4531        unsafe fn decode(
4532            &mut self,
4533            decoder: &mut fidl::encoding::Decoder<'_, D>,
4534            offset: usize,
4535            mut depth: fidl::encoding::Depth,
4536        ) -> fidl::Result<()> {
4537            decoder.debug_check_bounds::<Self>(offset);
4538            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
4539                None => return Err(fidl::Error::NotNullable),
4540                Some(len) => len,
4541            };
4542            // Calling decoder.out_of_line_offset(0) is not allowed.
4543            if len == 0 {
4544                return Ok(());
4545            };
4546            depth.increment()?;
4547            let envelope_size = 8;
4548            let bytes_len = len * envelope_size;
4549            let offset = decoder.out_of_line_offset(bytes_len)?;
4550            // Decode the envelope for each type.
4551            let mut _next_ordinal_to_read = 0;
4552            let mut next_offset = offset;
4553            let end_offset = offset + bytes_len;
4554            _next_ordinal_to_read += 1;
4555            if next_offset >= end_offset {
4556                return Ok(());
4557            }
4558
4559            // Decode unknown envelopes for gaps in ordinals.
4560            while _next_ordinal_to_read < 1 {
4561                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4562                _next_ordinal_to_read += 1;
4563                next_offset += envelope_size;
4564            }
4565
4566            let next_out_of_line = decoder.next_out_of_line();
4567            let handles_before = decoder.remaining_handles();
4568            if let Some((inlined, num_bytes, num_handles)) =
4569                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4570            {
4571                let member_inline_size =
4572                    <fidl_fuchsia_bluetooth::PeerId as fidl::encoding::TypeMarker>::inline_size(
4573                        decoder.context,
4574                    );
4575                if inlined != (member_inline_size <= 4) {
4576                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4577                }
4578                let inner_offset;
4579                let mut inner_depth = depth.clone();
4580                if inlined {
4581                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4582                    inner_offset = next_offset;
4583                } else {
4584                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4585                    inner_depth.increment()?;
4586                }
4587                let val_ref = self
4588                    .identifier
4589                    .get_or_insert_with(|| fidl::new_empty!(fidl_fuchsia_bluetooth::PeerId, D));
4590                fidl::decode!(
4591                    fidl_fuchsia_bluetooth::PeerId,
4592                    D,
4593                    val_ref,
4594                    decoder,
4595                    inner_offset,
4596                    inner_depth
4597                )?;
4598                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4599                {
4600                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4601                }
4602                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4603                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4604                }
4605            }
4606
4607            next_offset += envelope_size;
4608            _next_ordinal_to_read += 1;
4609            if next_offset >= end_offset {
4610                return Ok(());
4611            }
4612
4613            // Decode unknown envelopes for gaps in ordinals.
4614            while _next_ordinal_to_read < 2 {
4615                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4616                _next_ordinal_to_read += 1;
4617                next_offset += envelope_size;
4618            }
4619
4620            let next_out_of_line = decoder.next_out_of_line();
4621            let handles_before = decoder.remaining_handles();
4622            if let Some((inlined, num_bytes, num_handles)) =
4623                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4624            {
4625                let member_inline_size =
4626                    <fidl_fuchsia_bluetooth::Address as fidl::encoding::TypeMarker>::inline_size(
4627                        decoder.context,
4628                    );
4629                if inlined != (member_inline_size <= 4) {
4630                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4631                }
4632                let inner_offset;
4633                let mut inner_depth = depth.clone();
4634                if inlined {
4635                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4636                    inner_offset = next_offset;
4637                } else {
4638                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4639                    inner_depth.increment()?;
4640                }
4641                let val_ref = self
4642                    .local_address
4643                    .get_or_insert_with(|| fidl::new_empty!(fidl_fuchsia_bluetooth::Address, D));
4644                fidl::decode!(
4645                    fidl_fuchsia_bluetooth::Address,
4646                    D,
4647                    val_ref,
4648                    decoder,
4649                    inner_offset,
4650                    inner_depth
4651                )?;
4652                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4653                {
4654                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4655                }
4656                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4657                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4658                }
4659            }
4660
4661            next_offset += envelope_size;
4662            _next_ordinal_to_read += 1;
4663            if next_offset >= end_offset {
4664                return Ok(());
4665            }
4666
4667            // Decode unknown envelopes for gaps in ordinals.
4668            while _next_ordinal_to_read < 3 {
4669                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4670                _next_ordinal_to_read += 1;
4671                next_offset += envelope_size;
4672            }
4673
4674            let next_out_of_line = decoder.next_out_of_line();
4675            let handles_before = decoder.remaining_handles();
4676            if let Some((inlined, num_bytes, num_handles)) =
4677                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4678            {
4679                let member_inline_size =
4680                    <fidl::encoding::BoundedString<248> as fidl::encoding::TypeMarker>::inline_size(
4681                        decoder.context,
4682                    );
4683                if inlined != (member_inline_size <= 4) {
4684                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4685                }
4686                let inner_offset;
4687                let mut inner_depth = depth.clone();
4688                if inlined {
4689                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4690                    inner_offset = next_offset;
4691                } else {
4692                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4693                    inner_depth.increment()?;
4694                }
4695                let val_ref = self
4696                    .name
4697                    .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::BoundedString<248>, D));
4698                fidl::decode!(
4699                    fidl::encoding::BoundedString<248>,
4700                    D,
4701                    val_ref,
4702                    decoder,
4703                    inner_offset,
4704                    inner_depth
4705                )?;
4706                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4707                {
4708                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4709                }
4710                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4711                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4712                }
4713            }
4714
4715            next_offset += envelope_size;
4716            _next_ordinal_to_read += 1;
4717            if next_offset >= end_offset {
4718                return Ok(());
4719            }
4720
4721            // Decode unknown envelopes for gaps in ordinals.
4722            while _next_ordinal_to_read < 6 {
4723                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4724                _next_ordinal_to_read += 1;
4725                next_offset += envelope_size;
4726            }
4727
4728            let next_out_of_line = decoder.next_out_of_line();
4729            let handles_before = decoder.remaining_handles();
4730            if let Some((inlined, num_bytes, num_handles)) =
4731                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4732            {
4733                let member_inline_size =
4734                    <fidl_fuchsia_bluetooth::Address as fidl::encoding::TypeMarker>::inline_size(
4735                        decoder.context,
4736                    );
4737                if inlined != (member_inline_size <= 4) {
4738                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4739                }
4740                let inner_offset;
4741                let mut inner_depth = depth.clone();
4742                if inlined {
4743                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4744                    inner_offset = next_offset;
4745                } else {
4746                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4747                    inner_depth.increment()?;
4748                }
4749                let val_ref = self
4750                    .address
4751                    .get_or_insert_with(|| fidl::new_empty!(fidl_fuchsia_bluetooth::Address, D));
4752                fidl::decode!(
4753                    fidl_fuchsia_bluetooth::Address,
4754                    D,
4755                    val_ref,
4756                    decoder,
4757                    inner_offset,
4758                    inner_depth
4759                )?;
4760                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4761                {
4762                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4763                }
4764                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4765                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4766                }
4767            }
4768
4769            next_offset += envelope_size;
4770            _next_ordinal_to_read += 1;
4771            if next_offset >= end_offset {
4772                return Ok(());
4773            }
4774
4775            // Decode unknown envelopes for gaps in ordinals.
4776            while _next_ordinal_to_read < 7 {
4777                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4778                _next_ordinal_to_read += 1;
4779                next_offset += envelope_size;
4780            }
4781
4782            let next_out_of_line = decoder.next_out_of_line();
4783            let handles_before = decoder.remaining_handles();
4784            if let Some((inlined, num_bytes, num_handles)) =
4785                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4786            {
4787                let member_inline_size =
4788                    <LeBondData as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4789                if inlined != (member_inline_size <= 4) {
4790                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4791                }
4792                let inner_offset;
4793                let mut inner_depth = depth.clone();
4794                if inlined {
4795                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4796                    inner_offset = next_offset;
4797                } else {
4798                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4799                    inner_depth.increment()?;
4800                }
4801                let val_ref = self.le_bond.get_or_insert_with(|| fidl::new_empty!(LeBondData, D));
4802                fidl::decode!(LeBondData, D, val_ref, decoder, inner_offset, inner_depth)?;
4803                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4804                {
4805                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4806                }
4807                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4808                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4809                }
4810            }
4811
4812            next_offset += envelope_size;
4813            _next_ordinal_to_read += 1;
4814            if next_offset >= end_offset {
4815                return Ok(());
4816            }
4817
4818            // Decode unknown envelopes for gaps in ordinals.
4819            while _next_ordinal_to_read < 8 {
4820                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4821                _next_ordinal_to_read += 1;
4822                next_offset += envelope_size;
4823            }
4824
4825            let next_out_of_line = decoder.next_out_of_line();
4826            let handles_before = decoder.remaining_handles();
4827            if let Some((inlined, num_bytes, num_handles)) =
4828                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4829            {
4830                let member_inline_size =
4831                    <BredrBondData as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4832                if inlined != (member_inline_size <= 4) {
4833                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4834                }
4835                let inner_offset;
4836                let mut inner_depth = depth.clone();
4837                if inlined {
4838                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4839                    inner_offset = next_offset;
4840                } else {
4841                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4842                    inner_depth.increment()?;
4843                }
4844                let val_ref =
4845                    self.bredr_bond.get_or_insert_with(|| fidl::new_empty!(BredrBondData, D));
4846                fidl::decode!(BredrBondData, D, val_ref, decoder, inner_offset, inner_depth)?;
4847                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4848                {
4849                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4850                }
4851                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4852                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4853                }
4854            }
4855
4856            next_offset += envelope_size;
4857
4858            // Decode the remaining unknown envelopes.
4859            while next_offset < end_offset {
4860                _next_ordinal_to_read += 1;
4861                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4862                next_offset += envelope_size;
4863            }
4864
4865            Ok(())
4866        }
4867    }
4868
4869    impl BredrBondData {
4870        #[inline(always)]
4871        fn max_ordinal_present(&self) -> u64 {
4872            if let Some(_) = self.link_key {
4873                return 3;
4874            }
4875            if let Some(_) = self.services {
4876                return 2;
4877            }
4878            if let Some(_) = self.role_preference {
4879                return 1;
4880            }
4881            0
4882        }
4883    }
4884
4885    impl fidl::encoding::ValueTypeMarker for BredrBondData {
4886        type Borrowed<'a> = &'a Self;
4887        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4888            value
4889        }
4890    }
4891
4892    unsafe impl fidl::encoding::TypeMarker for BredrBondData {
4893        type Owned = Self;
4894
4895        #[inline(always)]
4896        fn inline_align(_context: fidl::encoding::Context) -> usize {
4897            8
4898        }
4899
4900        #[inline(always)]
4901        fn inline_size(_context: fidl::encoding::Context) -> usize {
4902            16
4903        }
4904    }
4905
4906    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<BredrBondData, D>
4907        for &BredrBondData
4908    {
4909        unsafe fn encode(
4910            self,
4911            encoder: &mut fidl::encoding::Encoder<'_, D>,
4912            offset: usize,
4913            mut depth: fidl::encoding::Depth,
4914        ) -> fidl::Result<()> {
4915            encoder.debug_check_bounds::<BredrBondData>(offset);
4916            // Vector header
4917            let max_ordinal: u64 = self.max_ordinal_present();
4918            encoder.write_num(max_ordinal, offset);
4919            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
4920            // Calling encoder.out_of_line_offset(0) is not allowed.
4921            if max_ordinal == 0 {
4922                return Ok(());
4923            }
4924            depth.increment()?;
4925            let envelope_size = 8;
4926            let bytes_len = max_ordinal as usize * envelope_size;
4927            #[allow(unused_variables)]
4928            let offset = encoder.out_of_line_offset(bytes_len);
4929            let mut _prev_end_offset: usize = 0;
4930            if 1 > max_ordinal {
4931                return Ok(());
4932            }
4933
4934            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4935            // are envelope_size bytes.
4936            let cur_offset: usize = (1 - 1) * envelope_size;
4937
4938            // Zero reserved fields.
4939            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4940
4941            // Safety:
4942            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4943            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4944            //   envelope_size bytes, there is always sufficient room.
4945            fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_bluetooth::ConnectionRole, D>(
4946            self.role_preference.as_ref().map(<fidl_fuchsia_bluetooth::ConnectionRole as fidl::encoding::ValueTypeMarker>::borrow),
4947            encoder, offset + cur_offset, depth
4948        )?;
4949
4950            _prev_end_offset = cur_offset + envelope_size;
4951            if 2 > max_ordinal {
4952                return Ok(());
4953            }
4954
4955            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4956            // are envelope_size bytes.
4957            let cur_offset: usize = (2 - 1) * envelope_size;
4958
4959            // Zero reserved fields.
4960            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4961
4962            // Safety:
4963            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4964            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4965            //   envelope_size bytes, there is always sufficient room.
4966            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<fidl_fuchsia_bluetooth::Uuid, 65535>, D>(
4967            self.services.as_ref().map(<fidl::encoding::Vector<fidl_fuchsia_bluetooth::Uuid, 65535> as fidl::encoding::ValueTypeMarker>::borrow),
4968            encoder, offset + cur_offset, depth
4969        )?;
4970
4971            _prev_end_offset = cur_offset + envelope_size;
4972            if 3 > max_ordinal {
4973                return Ok(());
4974            }
4975
4976            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4977            // are envelope_size bytes.
4978            let cur_offset: usize = (3 - 1) * envelope_size;
4979
4980            // Zero reserved fields.
4981            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4982
4983            // Safety:
4984            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4985            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4986            //   envelope_size bytes, there is always sufficient room.
4987            fidl::encoding::encode_in_envelope_optional::<PeerKey, D>(
4988                self.link_key.as_ref().map(<PeerKey as fidl::encoding::ValueTypeMarker>::borrow),
4989                encoder,
4990                offset + cur_offset,
4991                depth,
4992            )?;
4993
4994            _prev_end_offset = cur_offset + envelope_size;
4995
4996            Ok(())
4997        }
4998    }
4999
5000    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for BredrBondData {
5001        #[inline(always)]
5002        fn new_empty() -> Self {
5003            Self::default()
5004        }
5005
5006        unsafe fn decode(
5007            &mut self,
5008            decoder: &mut fidl::encoding::Decoder<'_, D>,
5009            offset: usize,
5010            mut depth: fidl::encoding::Depth,
5011        ) -> fidl::Result<()> {
5012            decoder.debug_check_bounds::<Self>(offset);
5013            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
5014                None => return Err(fidl::Error::NotNullable),
5015                Some(len) => len,
5016            };
5017            // Calling decoder.out_of_line_offset(0) is not allowed.
5018            if len == 0 {
5019                return Ok(());
5020            };
5021            depth.increment()?;
5022            let envelope_size = 8;
5023            let bytes_len = len * envelope_size;
5024            let offset = decoder.out_of_line_offset(bytes_len)?;
5025            // Decode the envelope for each type.
5026            let mut _next_ordinal_to_read = 0;
5027            let mut next_offset = offset;
5028            let end_offset = offset + bytes_len;
5029            _next_ordinal_to_read += 1;
5030            if next_offset >= end_offset {
5031                return Ok(());
5032            }
5033
5034            // Decode unknown envelopes for gaps in ordinals.
5035            while _next_ordinal_to_read < 1 {
5036                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5037                _next_ordinal_to_read += 1;
5038                next_offset += envelope_size;
5039            }
5040
5041            let next_out_of_line = decoder.next_out_of_line();
5042            let handles_before = decoder.remaining_handles();
5043            if let Some((inlined, num_bytes, num_handles)) =
5044                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5045            {
5046                let member_inline_size = <fidl_fuchsia_bluetooth::ConnectionRole as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5047                if inlined != (member_inline_size <= 4) {
5048                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5049                }
5050                let inner_offset;
5051                let mut inner_depth = depth.clone();
5052                if inlined {
5053                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5054                    inner_offset = next_offset;
5055                } else {
5056                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5057                    inner_depth.increment()?;
5058                }
5059                let val_ref = self.role_preference.get_or_insert_with(|| {
5060                    fidl::new_empty!(fidl_fuchsia_bluetooth::ConnectionRole, D)
5061                });
5062                fidl::decode!(
5063                    fidl_fuchsia_bluetooth::ConnectionRole,
5064                    D,
5065                    val_ref,
5066                    decoder,
5067                    inner_offset,
5068                    inner_depth
5069                )?;
5070                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5071                {
5072                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5073                }
5074                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5075                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5076                }
5077            }
5078
5079            next_offset += envelope_size;
5080            _next_ordinal_to_read += 1;
5081            if next_offset >= end_offset {
5082                return Ok(());
5083            }
5084
5085            // Decode unknown envelopes for gaps in ordinals.
5086            while _next_ordinal_to_read < 2 {
5087                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5088                _next_ordinal_to_read += 1;
5089                next_offset += envelope_size;
5090            }
5091
5092            let next_out_of_line = decoder.next_out_of_line();
5093            let handles_before = decoder.remaining_handles();
5094            if let Some((inlined, num_bytes, num_handles)) =
5095                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5096            {
5097                let member_inline_size = <fidl::encoding::Vector<
5098                    fidl_fuchsia_bluetooth::Uuid,
5099                    65535,
5100                > as fidl::encoding::TypeMarker>::inline_size(
5101                    decoder.context
5102                );
5103                if inlined != (member_inline_size <= 4) {
5104                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5105                }
5106                let inner_offset;
5107                let mut inner_depth = depth.clone();
5108                if inlined {
5109                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5110                    inner_offset = next_offset;
5111                } else {
5112                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5113                    inner_depth.increment()?;
5114                }
5115                let val_ref =
5116                self.services.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<fidl_fuchsia_bluetooth::Uuid, 65535>, D));
5117                fidl::decode!(fidl::encoding::Vector<fidl_fuchsia_bluetooth::Uuid, 65535>, D, val_ref, decoder, inner_offset, inner_depth)?;
5118                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5119                {
5120                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5121                }
5122                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5123                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5124                }
5125            }
5126
5127            next_offset += envelope_size;
5128            _next_ordinal_to_read += 1;
5129            if next_offset >= end_offset {
5130                return Ok(());
5131            }
5132
5133            // Decode unknown envelopes for gaps in ordinals.
5134            while _next_ordinal_to_read < 3 {
5135                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5136                _next_ordinal_to_read += 1;
5137                next_offset += envelope_size;
5138            }
5139
5140            let next_out_of_line = decoder.next_out_of_line();
5141            let handles_before = decoder.remaining_handles();
5142            if let Some((inlined, num_bytes, num_handles)) =
5143                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5144            {
5145                let member_inline_size =
5146                    <PeerKey as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5147                if inlined != (member_inline_size <= 4) {
5148                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5149                }
5150                let inner_offset;
5151                let mut inner_depth = depth.clone();
5152                if inlined {
5153                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5154                    inner_offset = next_offset;
5155                } else {
5156                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5157                    inner_depth.increment()?;
5158                }
5159                let val_ref = self.link_key.get_or_insert_with(|| fidl::new_empty!(PeerKey, D));
5160                fidl::decode!(PeerKey, D, val_ref, decoder, inner_offset, inner_depth)?;
5161                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5162                {
5163                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5164                }
5165                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5166                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5167                }
5168            }
5169
5170            next_offset += envelope_size;
5171
5172            // Decode the remaining unknown envelopes.
5173            while next_offset < end_offset {
5174                _next_ordinal_to_read += 1;
5175                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5176                next_offset += envelope_size;
5177            }
5178
5179            Ok(())
5180        }
5181    }
5182
5183    impl HostData {
5184        #[inline(always)]
5185        fn max_ordinal_present(&self) -> u64 {
5186            if let Some(_) = self.irk {
5187                return 1;
5188            }
5189            0
5190        }
5191    }
5192
5193    impl fidl::encoding::ValueTypeMarker for HostData {
5194        type Borrowed<'a> = &'a Self;
5195        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
5196            value
5197        }
5198    }
5199
5200    unsafe impl fidl::encoding::TypeMarker for HostData {
5201        type Owned = Self;
5202
5203        #[inline(always)]
5204        fn inline_align(_context: fidl::encoding::Context) -> usize {
5205            8
5206        }
5207
5208        #[inline(always)]
5209        fn inline_size(_context: fidl::encoding::Context) -> usize {
5210            16
5211        }
5212    }
5213
5214    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<HostData, D> for &HostData {
5215        unsafe fn encode(
5216            self,
5217            encoder: &mut fidl::encoding::Encoder<'_, D>,
5218            offset: usize,
5219            mut depth: fidl::encoding::Depth,
5220        ) -> fidl::Result<()> {
5221            encoder.debug_check_bounds::<HostData>(offset);
5222            // Vector header
5223            let max_ordinal: u64 = self.max_ordinal_present();
5224            encoder.write_num(max_ordinal, offset);
5225            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
5226            // Calling encoder.out_of_line_offset(0) is not allowed.
5227            if max_ordinal == 0 {
5228                return Ok(());
5229            }
5230            depth.increment()?;
5231            let envelope_size = 8;
5232            let bytes_len = max_ordinal as usize * envelope_size;
5233            #[allow(unused_variables)]
5234            let offset = encoder.out_of_line_offset(bytes_len);
5235            let mut _prev_end_offset: usize = 0;
5236            if 1 > max_ordinal {
5237                return Ok(());
5238            }
5239
5240            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5241            // are envelope_size bytes.
5242            let cur_offset: usize = (1 - 1) * envelope_size;
5243
5244            // Zero reserved fields.
5245            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5246
5247            // Safety:
5248            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5249            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5250            //   envelope_size bytes, there is always sufficient room.
5251            fidl::encoding::encode_in_envelope_optional::<Key, D>(
5252                self.irk.as_ref().map(<Key as fidl::encoding::ValueTypeMarker>::borrow),
5253                encoder,
5254                offset + cur_offset,
5255                depth,
5256            )?;
5257
5258            _prev_end_offset = cur_offset + envelope_size;
5259
5260            Ok(())
5261        }
5262    }
5263
5264    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for HostData {
5265        #[inline(always)]
5266        fn new_empty() -> Self {
5267            Self::default()
5268        }
5269
5270        unsafe fn decode(
5271            &mut self,
5272            decoder: &mut fidl::encoding::Decoder<'_, D>,
5273            offset: usize,
5274            mut depth: fidl::encoding::Depth,
5275        ) -> fidl::Result<()> {
5276            decoder.debug_check_bounds::<Self>(offset);
5277            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
5278                None => return Err(fidl::Error::NotNullable),
5279                Some(len) => len,
5280            };
5281            // Calling decoder.out_of_line_offset(0) is not allowed.
5282            if len == 0 {
5283                return Ok(());
5284            };
5285            depth.increment()?;
5286            let envelope_size = 8;
5287            let bytes_len = len * envelope_size;
5288            let offset = decoder.out_of_line_offset(bytes_len)?;
5289            // Decode the envelope for each type.
5290            let mut _next_ordinal_to_read = 0;
5291            let mut next_offset = offset;
5292            let end_offset = offset + bytes_len;
5293            _next_ordinal_to_read += 1;
5294            if next_offset >= end_offset {
5295                return Ok(());
5296            }
5297
5298            // Decode unknown envelopes for gaps in ordinals.
5299            while _next_ordinal_to_read < 1 {
5300                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5301                _next_ordinal_to_read += 1;
5302                next_offset += envelope_size;
5303            }
5304
5305            let next_out_of_line = decoder.next_out_of_line();
5306            let handles_before = decoder.remaining_handles();
5307            if let Some((inlined, num_bytes, num_handles)) =
5308                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5309            {
5310                let member_inline_size =
5311                    <Key as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5312                if inlined != (member_inline_size <= 4) {
5313                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5314                }
5315                let inner_offset;
5316                let mut inner_depth = depth.clone();
5317                if inlined {
5318                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5319                    inner_offset = next_offset;
5320                } else {
5321                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5322                    inner_depth.increment()?;
5323                }
5324                let val_ref = self.irk.get_or_insert_with(|| fidl::new_empty!(Key, D));
5325                fidl::decode!(Key, D, val_ref, decoder, inner_offset, inner_depth)?;
5326                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5327                {
5328                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5329                }
5330                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5331                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5332                }
5333            }
5334
5335            next_offset += envelope_size;
5336
5337            // Decode the remaining unknown envelopes.
5338            while next_offset < end_offset {
5339                _next_ordinal_to_read += 1;
5340                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5341                next_offset += envelope_size;
5342            }
5343
5344            Ok(())
5345        }
5346    }
5347
5348    impl HostInfo {
5349        #[inline(always)]
5350        fn max_ordinal_present(&self) -> u64 {
5351            if let Some(_) = self.addresses {
5352                return 8;
5353            }
5354            if let Some(_) = self.discovering {
5355                return 7;
5356            }
5357            if let Some(_) = self.discoverable {
5358                return 6;
5359            }
5360            if let Some(_) = self.local_name {
5361                return 5;
5362            }
5363            if let Some(_) = self.active {
5364                return 4;
5365            }
5366            if let Some(_) = self.technology {
5367                return 2;
5368            }
5369            if let Some(_) = self.id {
5370                return 1;
5371            }
5372            0
5373        }
5374    }
5375
5376    impl fidl::encoding::ValueTypeMarker for HostInfo {
5377        type Borrowed<'a> = &'a Self;
5378        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
5379            value
5380        }
5381    }
5382
5383    unsafe impl fidl::encoding::TypeMarker for HostInfo {
5384        type Owned = Self;
5385
5386        #[inline(always)]
5387        fn inline_align(_context: fidl::encoding::Context) -> usize {
5388            8
5389        }
5390
5391        #[inline(always)]
5392        fn inline_size(_context: fidl::encoding::Context) -> usize {
5393            16
5394        }
5395    }
5396
5397    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<HostInfo, D> for &HostInfo {
5398        unsafe fn encode(
5399            self,
5400            encoder: &mut fidl::encoding::Encoder<'_, D>,
5401            offset: usize,
5402            mut depth: fidl::encoding::Depth,
5403        ) -> fidl::Result<()> {
5404            encoder.debug_check_bounds::<HostInfo>(offset);
5405            // Vector header
5406            let max_ordinal: u64 = self.max_ordinal_present();
5407            encoder.write_num(max_ordinal, offset);
5408            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
5409            // Calling encoder.out_of_line_offset(0) is not allowed.
5410            if max_ordinal == 0 {
5411                return Ok(());
5412            }
5413            depth.increment()?;
5414            let envelope_size = 8;
5415            let bytes_len = max_ordinal as usize * envelope_size;
5416            #[allow(unused_variables)]
5417            let offset = encoder.out_of_line_offset(bytes_len);
5418            let mut _prev_end_offset: usize = 0;
5419            if 1 > max_ordinal {
5420                return Ok(());
5421            }
5422
5423            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5424            // are envelope_size bytes.
5425            let cur_offset: usize = (1 - 1) * envelope_size;
5426
5427            // Zero reserved fields.
5428            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5429
5430            // Safety:
5431            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5432            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5433            //   envelope_size bytes, there is always sufficient room.
5434            fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_bluetooth::HostId, D>(
5435                self.id.as_ref().map(
5436                    <fidl_fuchsia_bluetooth::HostId as fidl::encoding::ValueTypeMarker>::borrow,
5437                ),
5438                encoder,
5439                offset + cur_offset,
5440                depth,
5441            )?;
5442
5443            _prev_end_offset = cur_offset + envelope_size;
5444            if 2 > max_ordinal {
5445                return Ok(());
5446            }
5447
5448            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5449            // are envelope_size bytes.
5450            let cur_offset: usize = (2 - 1) * envelope_size;
5451
5452            // Zero reserved fields.
5453            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5454
5455            // Safety:
5456            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5457            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5458            //   envelope_size bytes, there is always sufficient room.
5459            fidl::encoding::encode_in_envelope_optional::<TechnologyType, D>(
5460                self.technology
5461                    .as_ref()
5462                    .map(<TechnologyType as fidl::encoding::ValueTypeMarker>::borrow),
5463                encoder,
5464                offset + cur_offset,
5465                depth,
5466            )?;
5467
5468            _prev_end_offset = cur_offset + envelope_size;
5469            if 4 > max_ordinal {
5470                return Ok(());
5471            }
5472
5473            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5474            // are envelope_size bytes.
5475            let cur_offset: usize = (4 - 1) * envelope_size;
5476
5477            // Zero reserved fields.
5478            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5479
5480            // Safety:
5481            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5482            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5483            //   envelope_size bytes, there is always sufficient room.
5484            fidl::encoding::encode_in_envelope_optional::<bool, D>(
5485                self.active.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
5486                encoder,
5487                offset + cur_offset,
5488                depth,
5489            )?;
5490
5491            _prev_end_offset = cur_offset + envelope_size;
5492            if 5 > max_ordinal {
5493                return Ok(());
5494            }
5495
5496            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5497            // are envelope_size bytes.
5498            let cur_offset: usize = (5 - 1) * envelope_size;
5499
5500            // Zero reserved fields.
5501            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5502
5503            // Safety:
5504            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5505            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5506            //   envelope_size bytes, there is always sufficient room.
5507            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<248>, D>(
5508                self.local_name.as_ref().map(
5509                    <fidl::encoding::BoundedString<248> as fidl::encoding::ValueTypeMarker>::borrow,
5510                ),
5511                encoder,
5512                offset + cur_offset,
5513                depth,
5514            )?;
5515
5516            _prev_end_offset = cur_offset + envelope_size;
5517            if 6 > max_ordinal {
5518                return Ok(());
5519            }
5520
5521            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5522            // are envelope_size bytes.
5523            let cur_offset: usize = (6 - 1) * envelope_size;
5524
5525            // Zero reserved fields.
5526            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5527
5528            // Safety:
5529            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5530            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5531            //   envelope_size bytes, there is always sufficient room.
5532            fidl::encoding::encode_in_envelope_optional::<bool, D>(
5533                self.discoverable.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
5534                encoder,
5535                offset + cur_offset,
5536                depth,
5537            )?;
5538
5539            _prev_end_offset = cur_offset + envelope_size;
5540            if 7 > max_ordinal {
5541                return Ok(());
5542            }
5543
5544            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5545            // are envelope_size bytes.
5546            let cur_offset: usize = (7 - 1) * envelope_size;
5547
5548            // Zero reserved fields.
5549            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5550
5551            // Safety:
5552            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5553            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5554            //   envelope_size bytes, there is always sufficient room.
5555            fidl::encoding::encode_in_envelope_optional::<bool, D>(
5556                self.discovering.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
5557                encoder,
5558                offset + cur_offset,
5559                depth,
5560            )?;
5561
5562            _prev_end_offset = cur_offset + envelope_size;
5563            if 8 > max_ordinal {
5564                return Ok(());
5565            }
5566
5567            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5568            // are envelope_size bytes.
5569            let cur_offset: usize = (8 - 1) * envelope_size;
5570
5571            // Zero reserved fields.
5572            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5573
5574            // Safety:
5575            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5576            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5577            //   envelope_size bytes, there is always sufficient room.
5578            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedVector<fidl_fuchsia_bluetooth::Address>, D>(
5579            self.addresses.as_ref().map(<fidl::encoding::UnboundedVector<fidl_fuchsia_bluetooth::Address> as fidl::encoding::ValueTypeMarker>::borrow),
5580            encoder, offset + cur_offset, depth
5581        )?;
5582
5583            _prev_end_offset = cur_offset + envelope_size;
5584
5585            Ok(())
5586        }
5587    }
5588
5589    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for HostInfo {
5590        #[inline(always)]
5591        fn new_empty() -> Self {
5592            Self::default()
5593        }
5594
5595        unsafe fn decode(
5596            &mut self,
5597            decoder: &mut fidl::encoding::Decoder<'_, D>,
5598            offset: usize,
5599            mut depth: fidl::encoding::Depth,
5600        ) -> fidl::Result<()> {
5601            decoder.debug_check_bounds::<Self>(offset);
5602            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
5603                None => return Err(fidl::Error::NotNullable),
5604                Some(len) => len,
5605            };
5606            // Calling decoder.out_of_line_offset(0) is not allowed.
5607            if len == 0 {
5608                return Ok(());
5609            };
5610            depth.increment()?;
5611            let envelope_size = 8;
5612            let bytes_len = len * envelope_size;
5613            let offset = decoder.out_of_line_offset(bytes_len)?;
5614            // Decode the envelope for each type.
5615            let mut _next_ordinal_to_read = 0;
5616            let mut next_offset = offset;
5617            let end_offset = offset + bytes_len;
5618            _next_ordinal_to_read += 1;
5619            if next_offset >= end_offset {
5620                return Ok(());
5621            }
5622
5623            // Decode unknown envelopes for gaps in ordinals.
5624            while _next_ordinal_to_read < 1 {
5625                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5626                _next_ordinal_to_read += 1;
5627                next_offset += envelope_size;
5628            }
5629
5630            let next_out_of_line = decoder.next_out_of_line();
5631            let handles_before = decoder.remaining_handles();
5632            if let Some((inlined, num_bytes, num_handles)) =
5633                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5634            {
5635                let member_inline_size =
5636                    <fidl_fuchsia_bluetooth::HostId as fidl::encoding::TypeMarker>::inline_size(
5637                        decoder.context,
5638                    );
5639                if inlined != (member_inline_size <= 4) {
5640                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5641                }
5642                let inner_offset;
5643                let mut inner_depth = depth.clone();
5644                if inlined {
5645                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5646                    inner_offset = next_offset;
5647                } else {
5648                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5649                    inner_depth.increment()?;
5650                }
5651                let val_ref = self
5652                    .id
5653                    .get_or_insert_with(|| fidl::new_empty!(fidl_fuchsia_bluetooth::HostId, D));
5654                fidl::decode!(
5655                    fidl_fuchsia_bluetooth::HostId,
5656                    D,
5657                    val_ref,
5658                    decoder,
5659                    inner_offset,
5660                    inner_depth
5661                )?;
5662                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5663                {
5664                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5665                }
5666                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5667                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5668                }
5669            }
5670
5671            next_offset += envelope_size;
5672            _next_ordinal_to_read += 1;
5673            if next_offset >= end_offset {
5674                return Ok(());
5675            }
5676
5677            // Decode unknown envelopes for gaps in ordinals.
5678            while _next_ordinal_to_read < 2 {
5679                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5680                _next_ordinal_to_read += 1;
5681                next_offset += envelope_size;
5682            }
5683
5684            let next_out_of_line = decoder.next_out_of_line();
5685            let handles_before = decoder.remaining_handles();
5686            if let Some((inlined, num_bytes, num_handles)) =
5687                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5688            {
5689                let member_inline_size =
5690                    <TechnologyType as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5691                if inlined != (member_inline_size <= 4) {
5692                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5693                }
5694                let inner_offset;
5695                let mut inner_depth = depth.clone();
5696                if inlined {
5697                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5698                    inner_offset = next_offset;
5699                } else {
5700                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5701                    inner_depth.increment()?;
5702                }
5703                let val_ref =
5704                    self.technology.get_or_insert_with(|| fidl::new_empty!(TechnologyType, D));
5705                fidl::decode!(TechnologyType, D, val_ref, decoder, inner_offset, inner_depth)?;
5706                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5707                {
5708                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5709                }
5710                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5711                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5712                }
5713            }
5714
5715            next_offset += envelope_size;
5716            _next_ordinal_to_read += 1;
5717            if next_offset >= end_offset {
5718                return Ok(());
5719            }
5720
5721            // Decode unknown envelopes for gaps in ordinals.
5722            while _next_ordinal_to_read < 4 {
5723                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5724                _next_ordinal_to_read += 1;
5725                next_offset += envelope_size;
5726            }
5727
5728            let next_out_of_line = decoder.next_out_of_line();
5729            let handles_before = decoder.remaining_handles();
5730            if let Some((inlined, num_bytes, num_handles)) =
5731                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5732            {
5733                let member_inline_size =
5734                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5735                if inlined != (member_inline_size <= 4) {
5736                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5737                }
5738                let inner_offset;
5739                let mut inner_depth = depth.clone();
5740                if inlined {
5741                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5742                    inner_offset = next_offset;
5743                } else {
5744                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5745                    inner_depth.increment()?;
5746                }
5747                let val_ref = self.active.get_or_insert_with(|| fidl::new_empty!(bool, D));
5748                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
5749                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5750                {
5751                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5752                }
5753                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5754                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5755                }
5756            }
5757
5758            next_offset += envelope_size;
5759            _next_ordinal_to_read += 1;
5760            if next_offset >= end_offset {
5761                return Ok(());
5762            }
5763
5764            // Decode unknown envelopes for gaps in ordinals.
5765            while _next_ordinal_to_read < 5 {
5766                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5767                _next_ordinal_to_read += 1;
5768                next_offset += envelope_size;
5769            }
5770
5771            let next_out_of_line = decoder.next_out_of_line();
5772            let handles_before = decoder.remaining_handles();
5773            if let Some((inlined, num_bytes, num_handles)) =
5774                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5775            {
5776                let member_inline_size =
5777                    <fidl::encoding::BoundedString<248> as fidl::encoding::TypeMarker>::inline_size(
5778                        decoder.context,
5779                    );
5780                if inlined != (member_inline_size <= 4) {
5781                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5782                }
5783                let inner_offset;
5784                let mut inner_depth = depth.clone();
5785                if inlined {
5786                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5787                    inner_offset = next_offset;
5788                } else {
5789                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5790                    inner_depth.increment()?;
5791                }
5792                let val_ref = self
5793                    .local_name
5794                    .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::BoundedString<248>, D));
5795                fidl::decode!(
5796                    fidl::encoding::BoundedString<248>,
5797                    D,
5798                    val_ref,
5799                    decoder,
5800                    inner_offset,
5801                    inner_depth
5802                )?;
5803                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5804                {
5805                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5806                }
5807                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5808                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5809                }
5810            }
5811
5812            next_offset += envelope_size;
5813            _next_ordinal_to_read += 1;
5814            if next_offset >= end_offset {
5815                return Ok(());
5816            }
5817
5818            // Decode unknown envelopes for gaps in ordinals.
5819            while _next_ordinal_to_read < 6 {
5820                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5821                _next_ordinal_to_read += 1;
5822                next_offset += envelope_size;
5823            }
5824
5825            let next_out_of_line = decoder.next_out_of_line();
5826            let handles_before = decoder.remaining_handles();
5827            if let Some((inlined, num_bytes, num_handles)) =
5828                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5829            {
5830                let member_inline_size =
5831                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5832                if inlined != (member_inline_size <= 4) {
5833                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5834                }
5835                let inner_offset;
5836                let mut inner_depth = depth.clone();
5837                if inlined {
5838                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5839                    inner_offset = next_offset;
5840                } else {
5841                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5842                    inner_depth.increment()?;
5843                }
5844                let val_ref = self.discoverable.get_or_insert_with(|| fidl::new_empty!(bool, D));
5845                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
5846                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5847                {
5848                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5849                }
5850                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5851                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5852                }
5853            }
5854
5855            next_offset += envelope_size;
5856            _next_ordinal_to_read += 1;
5857            if next_offset >= end_offset {
5858                return Ok(());
5859            }
5860
5861            // Decode unknown envelopes for gaps in ordinals.
5862            while _next_ordinal_to_read < 7 {
5863                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5864                _next_ordinal_to_read += 1;
5865                next_offset += envelope_size;
5866            }
5867
5868            let next_out_of_line = decoder.next_out_of_line();
5869            let handles_before = decoder.remaining_handles();
5870            if let Some((inlined, num_bytes, num_handles)) =
5871                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5872            {
5873                let member_inline_size =
5874                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5875                if inlined != (member_inline_size <= 4) {
5876                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5877                }
5878                let inner_offset;
5879                let mut inner_depth = depth.clone();
5880                if inlined {
5881                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5882                    inner_offset = next_offset;
5883                } else {
5884                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5885                    inner_depth.increment()?;
5886                }
5887                let val_ref = self.discovering.get_or_insert_with(|| fidl::new_empty!(bool, D));
5888                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
5889                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5890                {
5891                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5892                }
5893                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5894                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5895                }
5896            }
5897
5898            next_offset += envelope_size;
5899            _next_ordinal_to_read += 1;
5900            if next_offset >= end_offset {
5901                return Ok(());
5902            }
5903
5904            // Decode unknown envelopes for gaps in ordinals.
5905            while _next_ordinal_to_read < 8 {
5906                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5907                _next_ordinal_to_read += 1;
5908                next_offset += envelope_size;
5909            }
5910
5911            let next_out_of_line = decoder.next_out_of_line();
5912            let handles_before = decoder.remaining_handles();
5913            if let Some((inlined, num_bytes, num_handles)) =
5914                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5915            {
5916                let member_inline_size = <fidl::encoding::UnboundedVector<
5917                    fidl_fuchsia_bluetooth::Address,
5918                > as fidl::encoding::TypeMarker>::inline_size(
5919                    decoder.context
5920                );
5921                if inlined != (member_inline_size <= 4) {
5922                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5923                }
5924                let inner_offset;
5925                let mut inner_depth = depth.clone();
5926                if inlined {
5927                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5928                    inner_offset = next_offset;
5929                } else {
5930                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5931                    inner_depth.increment()?;
5932                }
5933                let val_ref = self.addresses.get_or_insert_with(|| {
5934                    fidl::new_empty!(
5935                        fidl::encoding::UnboundedVector<fidl_fuchsia_bluetooth::Address>,
5936                        D
5937                    )
5938                });
5939                fidl::decode!(
5940                    fidl::encoding::UnboundedVector<fidl_fuchsia_bluetooth::Address>,
5941                    D,
5942                    val_ref,
5943                    decoder,
5944                    inner_offset,
5945                    inner_depth
5946                )?;
5947                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5948                {
5949                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5950                }
5951                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5952                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5953                }
5954            }
5955
5956            next_offset += envelope_size;
5957
5958            // Decode the remaining unknown envelopes.
5959            while next_offset < end_offset {
5960                _next_ordinal_to_read += 1;
5961                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5962                next_offset += envelope_size;
5963            }
5964
5965            Ok(())
5966        }
5967    }
5968
5969    impl Identity {
5970        #[inline(always)]
5971        fn max_ordinal_present(&self) -> u64 {
5972            if let Some(_) = self.bonds {
5973                return 2;
5974            }
5975            if let Some(_) = self.host {
5976                return 1;
5977            }
5978            0
5979        }
5980    }
5981
5982    impl fidl::encoding::ValueTypeMarker for Identity {
5983        type Borrowed<'a> = &'a Self;
5984        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
5985            value
5986        }
5987    }
5988
5989    unsafe impl fidl::encoding::TypeMarker for Identity {
5990        type Owned = Self;
5991
5992        #[inline(always)]
5993        fn inline_align(_context: fidl::encoding::Context) -> usize {
5994            8
5995        }
5996
5997        #[inline(always)]
5998        fn inline_size(_context: fidl::encoding::Context) -> usize {
5999            16
6000        }
6001    }
6002
6003    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Identity, D> for &Identity {
6004        unsafe fn encode(
6005            self,
6006            encoder: &mut fidl::encoding::Encoder<'_, D>,
6007            offset: usize,
6008            mut depth: fidl::encoding::Depth,
6009        ) -> fidl::Result<()> {
6010            encoder.debug_check_bounds::<Identity>(offset);
6011            // Vector header
6012            let max_ordinal: u64 = self.max_ordinal_present();
6013            encoder.write_num(max_ordinal, offset);
6014            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
6015            // Calling encoder.out_of_line_offset(0) is not allowed.
6016            if max_ordinal == 0 {
6017                return Ok(());
6018            }
6019            depth.increment()?;
6020            let envelope_size = 8;
6021            let bytes_len = max_ordinal as usize * envelope_size;
6022            #[allow(unused_variables)]
6023            let offset = encoder.out_of_line_offset(bytes_len);
6024            let mut _prev_end_offset: usize = 0;
6025            if 1 > max_ordinal {
6026                return Ok(());
6027            }
6028
6029            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
6030            // are envelope_size bytes.
6031            let cur_offset: usize = (1 - 1) * envelope_size;
6032
6033            // Zero reserved fields.
6034            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6035
6036            // Safety:
6037            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
6038            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
6039            //   envelope_size bytes, there is always sufficient room.
6040            fidl::encoding::encode_in_envelope_optional::<HostData, D>(
6041                self.host.as_ref().map(<HostData as fidl::encoding::ValueTypeMarker>::borrow),
6042                encoder,
6043                offset + cur_offset,
6044                depth,
6045            )?;
6046
6047            _prev_end_offset = cur_offset + envelope_size;
6048            if 2 > max_ordinal {
6049                return Ok(());
6050            }
6051
6052            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
6053            // are envelope_size bytes.
6054            let cur_offset: usize = (2 - 1) * envelope_size;
6055
6056            // Zero reserved fields.
6057            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6058
6059            // Safety:
6060            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
6061            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
6062            //   envelope_size bytes, there is always sufficient room.
6063            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedVector<BondingData>, D>(
6064            self.bonds.as_ref().map(<fidl::encoding::UnboundedVector<BondingData> as fidl::encoding::ValueTypeMarker>::borrow),
6065            encoder, offset + cur_offset, depth
6066        )?;
6067
6068            _prev_end_offset = cur_offset + envelope_size;
6069
6070            Ok(())
6071        }
6072    }
6073
6074    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Identity {
6075        #[inline(always)]
6076        fn new_empty() -> Self {
6077            Self::default()
6078        }
6079
6080        unsafe fn decode(
6081            &mut self,
6082            decoder: &mut fidl::encoding::Decoder<'_, D>,
6083            offset: usize,
6084            mut depth: fidl::encoding::Depth,
6085        ) -> fidl::Result<()> {
6086            decoder.debug_check_bounds::<Self>(offset);
6087            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
6088                None => return Err(fidl::Error::NotNullable),
6089                Some(len) => len,
6090            };
6091            // Calling decoder.out_of_line_offset(0) is not allowed.
6092            if len == 0 {
6093                return Ok(());
6094            };
6095            depth.increment()?;
6096            let envelope_size = 8;
6097            let bytes_len = len * envelope_size;
6098            let offset = decoder.out_of_line_offset(bytes_len)?;
6099            // Decode the envelope for each type.
6100            let mut _next_ordinal_to_read = 0;
6101            let mut next_offset = offset;
6102            let end_offset = offset + bytes_len;
6103            _next_ordinal_to_read += 1;
6104            if next_offset >= end_offset {
6105                return Ok(());
6106            }
6107
6108            // Decode unknown envelopes for gaps in ordinals.
6109            while _next_ordinal_to_read < 1 {
6110                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6111                _next_ordinal_to_read += 1;
6112                next_offset += envelope_size;
6113            }
6114
6115            let next_out_of_line = decoder.next_out_of_line();
6116            let handles_before = decoder.remaining_handles();
6117            if let Some((inlined, num_bytes, num_handles)) =
6118                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6119            {
6120                let member_inline_size =
6121                    <HostData as fidl::encoding::TypeMarker>::inline_size(decoder.context);
6122                if inlined != (member_inline_size <= 4) {
6123                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6124                }
6125                let inner_offset;
6126                let mut inner_depth = depth.clone();
6127                if inlined {
6128                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6129                    inner_offset = next_offset;
6130                } else {
6131                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6132                    inner_depth.increment()?;
6133                }
6134                let val_ref = self.host.get_or_insert_with(|| fidl::new_empty!(HostData, D));
6135                fidl::decode!(HostData, D, val_ref, decoder, inner_offset, inner_depth)?;
6136                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6137                {
6138                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6139                }
6140                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6141                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6142                }
6143            }
6144
6145            next_offset += envelope_size;
6146            _next_ordinal_to_read += 1;
6147            if next_offset >= end_offset {
6148                return Ok(());
6149            }
6150
6151            // Decode unknown envelopes for gaps in ordinals.
6152            while _next_ordinal_to_read < 2 {
6153                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6154                _next_ordinal_to_read += 1;
6155                next_offset += envelope_size;
6156            }
6157
6158            let next_out_of_line = decoder.next_out_of_line();
6159            let handles_before = decoder.remaining_handles();
6160            if let Some((inlined, num_bytes, num_handles)) =
6161                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6162            {
6163                let member_inline_size = <fidl::encoding::UnboundedVector<BondingData> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
6164                if inlined != (member_inline_size <= 4) {
6165                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6166                }
6167                let inner_offset;
6168                let mut inner_depth = depth.clone();
6169                if inlined {
6170                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6171                    inner_offset = next_offset;
6172                } else {
6173                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6174                    inner_depth.increment()?;
6175                }
6176                let val_ref = self.bonds.get_or_insert_with(|| {
6177                    fidl::new_empty!(fidl::encoding::UnboundedVector<BondingData>, D)
6178                });
6179                fidl::decode!(
6180                    fidl::encoding::UnboundedVector<BondingData>,
6181                    D,
6182                    val_ref,
6183                    decoder,
6184                    inner_offset,
6185                    inner_depth
6186                )?;
6187                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6188                {
6189                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6190                }
6191                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6192                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6193                }
6194            }
6195
6196            next_offset += envelope_size;
6197
6198            // Decode the remaining unknown envelopes.
6199            while next_offset < end_offset {
6200                _next_ordinal_to_read += 1;
6201                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6202                next_offset += envelope_size;
6203            }
6204
6205            Ok(())
6206        }
6207    }
6208
6209    impl LeBondData {
6210        #[inline(always)]
6211        fn max_ordinal_present(&self) -> u64 {
6212            if let Some(_) = self.local_ltk {
6213                return 6;
6214            }
6215            if let Some(_) = self.peer_ltk {
6216                return 5;
6217            }
6218            if let Some(_) = self.csrk {
6219                return 4;
6220            }
6221            if let Some(_) = self.irk {
6222                return 3;
6223            }
6224            if let Some(_) = self.services {
6225                return 2;
6226            }
6227            if let Some(_) = self.connection_parameters {
6228                return 1;
6229            }
6230            0
6231        }
6232    }
6233
6234    impl fidl::encoding::ValueTypeMarker for LeBondData {
6235        type Borrowed<'a> = &'a Self;
6236        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
6237            value
6238        }
6239    }
6240
6241    unsafe impl fidl::encoding::TypeMarker for LeBondData {
6242        type Owned = Self;
6243
6244        #[inline(always)]
6245        fn inline_align(_context: fidl::encoding::Context) -> usize {
6246            8
6247        }
6248
6249        #[inline(always)]
6250        fn inline_size(_context: fidl::encoding::Context) -> usize {
6251            16
6252        }
6253    }
6254
6255    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<LeBondData, D>
6256        for &LeBondData
6257    {
6258        unsafe fn encode(
6259            self,
6260            encoder: &mut fidl::encoding::Encoder<'_, D>,
6261            offset: usize,
6262            mut depth: fidl::encoding::Depth,
6263        ) -> fidl::Result<()> {
6264            encoder.debug_check_bounds::<LeBondData>(offset);
6265            // Vector header
6266            let max_ordinal: u64 = self.max_ordinal_present();
6267            encoder.write_num(max_ordinal, offset);
6268            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
6269            // Calling encoder.out_of_line_offset(0) is not allowed.
6270            if max_ordinal == 0 {
6271                return Ok(());
6272            }
6273            depth.increment()?;
6274            let envelope_size = 8;
6275            let bytes_len = max_ordinal as usize * envelope_size;
6276            #[allow(unused_variables)]
6277            let offset = encoder.out_of_line_offset(bytes_len);
6278            let mut _prev_end_offset: usize = 0;
6279            if 1 > max_ordinal {
6280                return Ok(());
6281            }
6282
6283            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
6284            // are envelope_size bytes.
6285            let cur_offset: usize = (1 - 1) * envelope_size;
6286
6287            // Zero reserved fields.
6288            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6289
6290            // Safety:
6291            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
6292            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
6293            //   envelope_size bytes, there is always sufficient room.
6294            fidl::encoding::encode_in_envelope_optional::<LeConnectionParameters, D>(
6295                self.connection_parameters
6296                    .as_ref()
6297                    .map(<LeConnectionParameters as fidl::encoding::ValueTypeMarker>::borrow),
6298                encoder,
6299                offset + cur_offset,
6300                depth,
6301            )?;
6302
6303            _prev_end_offset = cur_offset + envelope_size;
6304            if 2 > max_ordinal {
6305                return Ok(());
6306            }
6307
6308            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
6309            // are envelope_size bytes.
6310            let cur_offset: usize = (2 - 1) * envelope_size;
6311
6312            // Zero reserved fields.
6313            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6314
6315            // Safety:
6316            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
6317            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
6318            //   envelope_size bytes, there is always sufficient room.
6319            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<fidl_fuchsia_bluetooth::Uuid, 65535>, D>(
6320            self.services.as_ref().map(<fidl::encoding::Vector<fidl_fuchsia_bluetooth::Uuid, 65535> as fidl::encoding::ValueTypeMarker>::borrow),
6321            encoder, offset + cur_offset, depth
6322        )?;
6323
6324            _prev_end_offset = cur_offset + envelope_size;
6325            if 3 > max_ordinal {
6326                return Ok(());
6327            }
6328
6329            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
6330            // are envelope_size bytes.
6331            let cur_offset: usize = (3 - 1) * envelope_size;
6332
6333            // Zero reserved fields.
6334            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6335
6336            // Safety:
6337            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
6338            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
6339            //   envelope_size bytes, there is always sufficient room.
6340            fidl::encoding::encode_in_envelope_optional::<PeerKey, D>(
6341                self.irk.as_ref().map(<PeerKey as fidl::encoding::ValueTypeMarker>::borrow),
6342                encoder,
6343                offset + cur_offset,
6344                depth,
6345            )?;
6346
6347            _prev_end_offset = cur_offset + envelope_size;
6348            if 4 > max_ordinal {
6349                return Ok(());
6350            }
6351
6352            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
6353            // are envelope_size bytes.
6354            let cur_offset: usize = (4 - 1) * envelope_size;
6355
6356            // Zero reserved fields.
6357            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6358
6359            // Safety:
6360            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
6361            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
6362            //   envelope_size bytes, there is always sufficient room.
6363            fidl::encoding::encode_in_envelope_optional::<PeerKey, D>(
6364                self.csrk.as_ref().map(<PeerKey as fidl::encoding::ValueTypeMarker>::borrow),
6365                encoder,
6366                offset + cur_offset,
6367                depth,
6368            )?;
6369
6370            _prev_end_offset = cur_offset + envelope_size;
6371            if 5 > max_ordinal {
6372                return Ok(());
6373            }
6374
6375            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
6376            // are envelope_size bytes.
6377            let cur_offset: usize = (5 - 1) * envelope_size;
6378
6379            // Zero reserved fields.
6380            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6381
6382            // Safety:
6383            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
6384            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
6385            //   envelope_size bytes, there is always sufficient room.
6386            fidl::encoding::encode_in_envelope_optional::<Ltk, D>(
6387                self.peer_ltk.as_ref().map(<Ltk as fidl::encoding::ValueTypeMarker>::borrow),
6388                encoder,
6389                offset + cur_offset,
6390                depth,
6391            )?;
6392
6393            _prev_end_offset = cur_offset + envelope_size;
6394            if 6 > max_ordinal {
6395                return Ok(());
6396            }
6397
6398            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
6399            // are envelope_size bytes.
6400            let cur_offset: usize = (6 - 1) * envelope_size;
6401
6402            // Zero reserved fields.
6403            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6404
6405            // Safety:
6406            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
6407            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
6408            //   envelope_size bytes, there is always sufficient room.
6409            fidl::encoding::encode_in_envelope_optional::<Ltk, D>(
6410                self.local_ltk.as_ref().map(<Ltk as fidl::encoding::ValueTypeMarker>::borrow),
6411                encoder,
6412                offset + cur_offset,
6413                depth,
6414            )?;
6415
6416            _prev_end_offset = cur_offset + envelope_size;
6417
6418            Ok(())
6419        }
6420    }
6421
6422    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for LeBondData {
6423        #[inline(always)]
6424        fn new_empty() -> Self {
6425            Self::default()
6426        }
6427
6428        unsafe fn decode(
6429            &mut self,
6430            decoder: &mut fidl::encoding::Decoder<'_, D>,
6431            offset: usize,
6432            mut depth: fidl::encoding::Depth,
6433        ) -> fidl::Result<()> {
6434            decoder.debug_check_bounds::<Self>(offset);
6435            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
6436                None => return Err(fidl::Error::NotNullable),
6437                Some(len) => len,
6438            };
6439            // Calling decoder.out_of_line_offset(0) is not allowed.
6440            if len == 0 {
6441                return Ok(());
6442            };
6443            depth.increment()?;
6444            let envelope_size = 8;
6445            let bytes_len = len * envelope_size;
6446            let offset = decoder.out_of_line_offset(bytes_len)?;
6447            // Decode the envelope for each type.
6448            let mut _next_ordinal_to_read = 0;
6449            let mut next_offset = offset;
6450            let end_offset = offset + bytes_len;
6451            _next_ordinal_to_read += 1;
6452            if next_offset >= end_offset {
6453                return Ok(());
6454            }
6455
6456            // Decode unknown envelopes for gaps in ordinals.
6457            while _next_ordinal_to_read < 1 {
6458                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6459                _next_ordinal_to_read += 1;
6460                next_offset += envelope_size;
6461            }
6462
6463            let next_out_of_line = decoder.next_out_of_line();
6464            let handles_before = decoder.remaining_handles();
6465            if let Some((inlined, num_bytes, num_handles)) =
6466                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6467            {
6468                let member_inline_size =
6469                    <LeConnectionParameters as fidl::encoding::TypeMarker>::inline_size(
6470                        decoder.context,
6471                    );
6472                if inlined != (member_inline_size <= 4) {
6473                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6474                }
6475                let inner_offset;
6476                let mut inner_depth = depth.clone();
6477                if inlined {
6478                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6479                    inner_offset = next_offset;
6480                } else {
6481                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6482                    inner_depth.increment()?;
6483                }
6484                let val_ref = self
6485                    .connection_parameters
6486                    .get_or_insert_with(|| fidl::new_empty!(LeConnectionParameters, D));
6487                fidl::decode!(
6488                    LeConnectionParameters,
6489                    D,
6490                    val_ref,
6491                    decoder,
6492                    inner_offset,
6493                    inner_depth
6494                )?;
6495                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6496                {
6497                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6498                }
6499                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6500                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6501                }
6502            }
6503
6504            next_offset += envelope_size;
6505            _next_ordinal_to_read += 1;
6506            if next_offset >= end_offset {
6507                return Ok(());
6508            }
6509
6510            // Decode unknown envelopes for gaps in ordinals.
6511            while _next_ordinal_to_read < 2 {
6512                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6513                _next_ordinal_to_read += 1;
6514                next_offset += envelope_size;
6515            }
6516
6517            let next_out_of_line = decoder.next_out_of_line();
6518            let handles_before = decoder.remaining_handles();
6519            if let Some((inlined, num_bytes, num_handles)) =
6520                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6521            {
6522                let member_inline_size = <fidl::encoding::Vector<
6523                    fidl_fuchsia_bluetooth::Uuid,
6524                    65535,
6525                > as fidl::encoding::TypeMarker>::inline_size(
6526                    decoder.context
6527                );
6528                if inlined != (member_inline_size <= 4) {
6529                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6530                }
6531                let inner_offset;
6532                let mut inner_depth = depth.clone();
6533                if inlined {
6534                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6535                    inner_offset = next_offset;
6536                } else {
6537                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6538                    inner_depth.increment()?;
6539                }
6540                let val_ref =
6541                self.services.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<fidl_fuchsia_bluetooth::Uuid, 65535>, D));
6542                fidl::decode!(fidl::encoding::Vector<fidl_fuchsia_bluetooth::Uuid, 65535>, 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 < 3 {
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                    <PeerKey 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.irk.get_or_insert_with(|| fidl::new_empty!(PeerKey, D));
6585                fidl::decode!(PeerKey, 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 < 4 {
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                    <PeerKey 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.csrk.get_or_insert_with(|| fidl::new_empty!(PeerKey, D));
6628                fidl::decode!(PeerKey, 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            _next_ordinal_to_read += 1;
6640            if next_offset >= end_offset {
6641                return Ok(());
6642            }
6643
6644            // Decode unknown envelopes for gaps in ordinals.
6645            while _next_ordinal_to_read < 5 {
6646                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6647                _next_ordinal_to_read += 1;
6648                next_offset += envelope_size;
6649            }
6650
6651            let next_out_of_line = decoder.next_out_of_line();
6652            let handles_before = decoder.remaining_handles();
6653            if let Some((inlined, num_bytes, num_handles)) =
6654                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6655            {
6656                let member_inline_size =
6657                    <Ltk as fidl::encoding::TypeMarker>::inline_size(decoder.context);
6658                if inlined != (member_inline_size <= 4) {
6659                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6660                }
6661                let inner_offset;
6662                let mut inner_depth = depth.clone();
6663                if inlined {
6664                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6665                    inner_offset = next_offset;
6666                } else {
6667                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6668                    inner_depth.increment()?;
6669                }
6670                let val_ref = self.peer_ltk.get_or_insert_with(|| fidl::new_empty!(Ltk, D));
6671                fidl::decode!(Ltk, D, val_ref, decoder, inner_offset, inner_depth)?;
6672                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6673                {
6674                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6675                }
6676                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6677                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6678                }
6679            }
6680
6681            next_offset += envelope_size;
6682            _next_ordinal_to_read += 1;
6683            if next_offset >= end_offset {
6684                return Ok(());
6685            }
6686
6687            // Decode unknown envelopes for gaps in ordinals.
6688            while _next_ordinal_to_read < 6 {
6689                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6690                _next_ordinal_to_read += 1;
6691                next_offset += envelope_size;
6692            }
6693
6694            let next_out_of_line = decoder.next_out_of_line();
6695            let handles_before = decoder.remaining_handles();
6696            if let Some((inlined, num_bytes, num_handles)) =
6697                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6698            {
6699                let member_inline_size =
6700                    <Ltk as fidl::encoding::TypeMarker>::inline_size(decoder.context);
6701                if inlined != (member_inline_size <= 4) {
6702                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6703                }
6704                let inner_offset;
6705                let mut inner_depth = depth.clone();
6706                if inlined {
6707                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6708                    inner_offset = next_offset;
6709                } else {
6710                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6711                    inner_depth.increment()?;
6712                }
6713                let val_ref = self.local_ltk.get_or_insert_with(|| fidl::new_empty!(Ltk, D));
6714                fidl::decode!(Ltk, D, val_ref, decoder, inner_offset, inner_depth)?;
6715                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6716                {
6717                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6718                }
6719                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6720                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6721                }
6722            }
6723
6724            next_offset += envelope_size;
6725
6726            // Decode the remaining unknown envelopes.
6727            while next_offset < end_offset {
6728                _next_ordinal_to_read += 1;
6729                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6730                next_offset += envelope_size;
6731            }
6732
6733            Ok(())
6734        }
6735    }
6736
6737    impl PairingOptions {
6738        #[inline(always)]
6739        fn max_ordinal_present(&self) -> u64 {
6740            if let Some(_) = self.transport {
6741                return 3;
6742            }
6743            if let Some(_) = self.bondable_mode {
6744                return 2;
6745            }
6746            if let Some(_) = self.le_security_level {
6747                return 1;
6748            }
6749            0
6750        }
6751    }
6752
6753    impl fidl::encoding::ValueTypeMarker for PairingOptions {
6754        type Borrowed<'a> = &'a Self;
6755        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
6756            value
6757        }
6758    }
6759
6760    unsafe impl fidl::encoding::TypeMarker for PairingOptions {
6761        type Owned = Self;
6762
6763        #[inline(always)]
6764        fn inline_align(_context: fidl::encoding::Context) -> usize {
6765            8
6766        }
6767
6768        #[inline(always)]
6769        fn inline_size(_context: fidl::encoding::Context) -> usize {
6770            16
6771        }
6772    }
6773
6774    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<PairingOptions, D>
6775        for &PairingOptions
6776    {
6777        unsafe fn encode(
6778            self,
6779            encoder: &mut fidl::encoding::Encoder<'_, D>,
6780            offset: usize,
6781            mut depth: fidl::encoding::Depth,
6782        ) -> fidl::Result<()> {
6783            encoder.debug_check_bounds::<PairingOptions>(offset);
6784            // Vector header
6785            let max_ordinal: u64 = self.max_ordinal_present();
6786            encoder.write_num(max_ordinal, offset);
6787            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
6788            // Calling encoder.out_of_line_offset(0) is not allowed.
6789            if max_ordinal == 0 {
6790                return Ok(());
6791            }
6792            depth.increment()?;
6793            let envelope_size = 8;
6794            let bytes_len = max_ordinal as usize * envelope_size;
6795            #[allow(unused_variables)]
6796            let offset = encoder.out_of_line_offset(bytes_len);
6797            let mut _prev_end_offset: usize = 0;
6798            if 1 > max_ordinal {
6799                return Ok(());
6800            }
6801
6802            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
6803            // are envelope_size bytes.
6804            let cur_offset: usize = (1 - 1) * envelope_size;
6805
6806            // Zero reserved fields.
6807            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6808
6809            // Safety:
6810            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
6811            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
6812            //   envelope_size bytes, there is always sufficient room.
6813            fidl::encoding::encode_in_envelope_optional::<PairingSecurityLevel, D>(
6814                self.le_security_level
6815                    .as_ref()
6816                    .map(<PairingSecurityLevel as fidl::encoding::ValueTypeMarker>::borrow),
6817                encoder,
6818                offset + cur_offset,
6819                depth,
6820            )?;
6821
6822            _prev_end_offset = cur_offset + envelope_size;
6823            if 2 > max_ordinal {
6824                return Ok(());
6825            }
6826
6827            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
6828            // are envelope_size bytes.
6829            let cur_offset: usize = (2 - 1) * envelope_size;
6830
6831            // Zero reserved fields.
6832            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6833
6834            // Safety:
6835            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
6836            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
6837            //   envelope_size bytes, there is always sufficient room.
6838            fidl::encoding::encode_in_envelope_optional::<BondableMode, D>(
6839                self.bondable_mode
6840                    .as_ref()
6841                    .map(<BondableMode as fidl::encoding::ValueTypeMarker>::borrow),
6842                encoder,
6843                offset + cur_offset,
6844                depth,
6845            )?;
6846
6847            _prev_end_offset = cur_offset + envelope_size;
6848            if 3 > max_ordinal {
6849                return Ok(());
6850            }
6851
6852            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
6853            // are envelope_size bytes.
6854            let cur_offset: usize = (3 - 1) * envelope_size;
6855
6856            // Zero reserved fields.
6857            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6858
6859            // Safety:
6860            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
6861            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
6862            //   envelope_size bytes, there is always sufficient room.
6863            fidl::encoding::encode_in_envelope_optional::<TechnologyType, D>(
6864                self.transport
6865                    .as_ref()
6866                    .map(<TechnologyType as fidl::encoding::ValueTypeMarker>::borrow),
6867                encoder,
6868                offset + cur_offset,
6869                depth,
6870            )?;
6871
6872            _prev_end_offset = cur_offset + envelope_size;
6873
6874            Ok(())
6875        }
6876    }
6877
6878    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for PairingOptions {
6879        #[inline(always)]
6880        fn new_empty() -> Self {
6881            Self::default()
6882        }
6883
6884        unsafe fn decode(
6885            &mut self,
6886            decoder: &mut fidl::encoding::Decoder<'_, D>,
6887            offset: usize,
6888            mut depth: fidl::encoding::Depth,
6889        ) -> fidl::Result<()> {
6890            decoder.debug_check_bounds::<Self>(offset);
6891            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
6892                None => return Err(fidl::Error::NotNullable),
6893                Some(len) => len,
6894            };
6895            // Calling decoder.out_of_line_offset(0) is not allowed.
6896            if len == 0 {
6897                return Ok(());
6898            };
6899            depth.increment()?;
6900            let envelope_size = 8;
6901            let bytes_len = len * envelope_size;
6902            let offset = decoder.out_of_line_offset(bytes_len)?;
6903            // Decode the envelope for each type.
6904            let mut _next_ordinal_to_read = 0;
6905            let mut next_offset = offset;
6906            let end_offset = offset + bytes_len;
6907            _next_ordinal_to_read += 1;
6908            if next_offset >= end_offset {
6909                return Ok(());
6910            }
6911
6912            // Decode unknown envelopes for gaps in ordinals.
6913            while _next_ordinal_to_read < 1 {
6914                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6915                _next_ordinal_to_read += 1;
6916                next_offset += envelope_size;
6917            }
6918
6919            let next_out_of_line = decoder.next_out_of_line();
6920            let handles_before = decoder.remaining_handles();
6921            if let Some((inlined, num_bytes, num_handles)) =
6922                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6923            {
6924                let member_inline_size =
6925                    <PairingSecurityLevel as fidl::encoding::TypeMarker>::inline_size(
6926                        decoder.context,
6927                    );
6928                if inlined != (member_inline_size <= 4) {
6929                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6930                }
6931                let inner_offset;
6932                let mut inner_depth = depth.clone();
6933                if inlined {
6934                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6935                    inner_offset = next_offset;
6936                } else {
6937                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6938                    inner_depth.increment()?;
6939                }
6940                let val_ref = self
6941                    .le_security_level
6942                    .get_or_insert_with(|| fidl::new_empty!(PairingSecurityLevel, D));
6943                fidl::decode!(
6944                    PairingSecurityLevel,
6945                    D,
6946                    val_ref,
6947                    decoder,
6948                    inner_offset,
6949                    inner_depth
6950                )?;
6951                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6952                {
6953                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6954                }
6955                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6956                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6957                }
6958            }
6959
6960            next_offset += envelope_size;
6961            _next_ordinal_to_read += 1;
6962            if next_offset >= end_offset {
6963                return Ok(());
6964            }
6965
6966            // Decode unknown envelopes for gaps in ordinals.
6967            while _next_ordinal_to_read < 2 {
6968                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6969                _next_ordinal_to_read += 1;
6970                next_offset += envelope_size;
6971            }
6972
6973            let next_out_of_line = decoder.next_out_of_line();
6974            let handles_before = decoder.remaining_handles();
6975            if let Some((inlined, num_bytes, num_handles)) =
6976                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6977            {
6978                let member_inline_size =
6979                    <BondableMode as fidl::encoding::TypeMarker>::inline_size(decoder.context);
6980                if inlined != (member_inline_size <= 4) {
6981                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6982                }
6983                let inner_offset;
6984                let mut inner_depth = depth.clone();
6985                if inlined {
6986                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6987                    inner_offset = next_offset;
6988                } else {
6989                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6990                    inner_depth.increment()?;
6991                }
6992                let val_ref =
6993                    self.bondable_mode.get_or_insert_with(|| fidl::new_empty!(BondableMode, D));
6994                fidl::decode!(BondableMode, D, val_ref, decoder, inner_offset, inner_depth)?;
6995                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6996                {
6997                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6998                }
6999                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7000                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7001                }
7002            }
7003
7004            next_offset += envelope_size;
7005            _next_ordinal_to_read += 1;
7006            if next_offset >= end_offset {
7007                return Ok(());
7008            }
7009
7010            // Decode unknown envelopes for gaps in ordinals.
7011            while _next_ordinal_to_read < 3 {
7012                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7013                _next_ordinal_to_read += 1;
7014                next_offset += envelope_size;
7015            }
7016
7017            let next_out_of_line = decoder.next_out_of_line();
7018            let handles_before = decoder.remaining_handles();
7019            if let Some((inlined, num_bytes, num_handles)) =
7020                fidl::encoding::decode_envelope_header(decoder, next_offset)?
7021            {
7022                let member_inline_size =
7023                    <TechnologyType as fidl::encoding::TypeMarker>::inline_size(decoder.context);
7024                if inlined != (member_inline_size <= 4) {
7025                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
7026                }
7027                let inner_offset;
7028                let mut inner_depth = depth.clone();
7029                if inlined {
7030                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7031                    inner_offset = next_offset;
7032                } else {
7033                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7034                    inner_depth.increment()?;
7035                }
7036                let val_ref =
7037                    self.transport.get_or_insert_with(|| fidl::new_empty!(TechnologyType, D));
7038                fidl::decode!(TechnologyType, D, val_ref, decoder, inner_offset, inner_depth)?;
7039                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7040                {
7041                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
7042                }
7043                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7044                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7045                }
7046            }
7047
7048            next_offset += envelope_size;
7049
7050            // Decode the remaining unknown envelopes.
7051            while next_offset < end_offset {
7052                _next_ordinal_to_read += 1;
7053                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7054                next_offset += envelope_size;
7055            }
7056
7057            Ok(())
7058        }
7059    }
7060
7061    impl PairingRequestAcceptRequest {
7062        #[inline(always)]
7063        fn max_ordinal_present(&self) -> u64 {
7064            if let Some(_) = self.entered_passkey {
7065                return 1;
7066            }
7067            0
7068        }
7069    }
7070
7071    impl fidl::encoding::ValueTypeMarker for PairingRequestAcceptRequest {
7072        type Borrowed<'a> = &'a Self;
7073        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
7074            value
7075        }
7076    }
7077
7078    unsafe impl fidl::encoding::TypeMarker for PairingRequestAcceptRequest {
7079        type Owned = Self;
7080
7081        #[inline(always)]
7082        fn inline_align(_context: fidl::encoding::Context) -> usize {
7083            8
7084        }
7085
7086        #[inline(always)]
7087        fn inline_size(_context: fidl::encoding::Context) -> usize {
7088            16
7089        }
7090    }
7091
7092    unsafe impl<D: fidl::encoding::ResourceDialect>
7093        fidl::encoding::Encode<PairingRequestAcceptRequest, D> for &PairingRequestAcceptRequest
7094    {
7095        unsafe fn encode(
7096            self,
7097            encoder: &mut fidl::encoding::Encoder<'_, D>,
7098            offset: usize,
7099            mut depth: fidl::encoding::Depth,
7100        ) -> fidl::Result<()> {
7101            encoder.debug_check_bounds::<PairingRequestAcceptRequest>(offset);
7102            // Vector header
7103            let max_ordinal: u64 = self.max_ordinal_present();
7104            encoder.write_num(max_ordinal, offset);
7105            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
7106            // Calling encoder.out_of_line_offset(0) is not allowed.
7107            if max_ordinal == 0 {
7108                return Ok(());
7109            }
7110            depth.increment()?;
7111            let envelope_size = 8;
7112            let bytes_len = max_ordinal as usize * envelope_size;
7113            #[allow(unused_variables)]
7114            let offset = encoder.out_of_line_offset(bytes_len);
7115            let mut _prev_end_offset: usize = 0;
7116            if 1 > max_ordinal {
7117                return Ok(());
7118            }
7119
7120            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
7121            // are envelope_size bytes.
7122            let cur_offset: usize = (1 - 1) * envelope_size;
7123
7124            // Zero reserved fields.
7125            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7126
7127            // Safety:
7128            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
7129            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
7130            //   envelope_size bytes, there is always sufficient room.
7131            fidl::encoding::encode_in_envelope_optional::<u32, D>(
7132                self.entered_passkey.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
7133                encoder,
7134                offset + cur_offset,
7135                depth,
7136            )?;
7137
7138            _prev_end_offset = cur_offset + envelope_size;
7139
7140            Ok(())
7141        }
7142    }
7143
7144    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
7145        for PairingRequestAcceptRequest
7146    {
7147        #[inline(always)]
7148        fn new_empty() -> Self {
7149            Self::default()
7150        }
7151
7152        unsafe fn decode(
7153            &mut self,
7154            decoder: &mut fidl::encoding::Decoder<'_, D>,
7155            offset: usize,
7156            mut depth: fidl::encoding::Depth,
7157        ) -> fidl::Result<()> {
7158            decoder.debug_check_bounds::<Self>(offset);
7159            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
7160                None => return Err(fidl::Error::NotNullable),
7161                Some(len) => len,
7162            };
7163            // Calling decoder.out_of_line_offset(0) is not allowed.
7164            if len == 0 {
7165                return Ok(());
7166            };
7167            depth.increment()?;
7168            let envelope_size = 8;
7169            let bytes_len = len * envelope_size;
7170            let offset = decoder.out_of_line_offset(bytes_len)?;
7171            // Decode the envelope for each type.
7172            let mut _next_ordinal_to_read = 0;
7173            let mut next_offset = offset;
7174            let end_offset = offset + bytes_len;
7175            _next_ordinal_to_read += 1;
7176            if next_offset >= end_offset {
7177                return Ok(());
7178            }
7179
7180            // Decode unknown envelopes for gaps in ordinals.
7181            while _next_ordinal_to_read < 1 {
7182                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7183                _next_ordinal_to_read += 1;
7184                next_offset += envelope_size;
7185            }
7186
7187            let next_out_of_line = decoder.next_out_of_line();
7188            let handles_before = decoder.remaining_handles();
7189            if let Some((inlined, num_bytes, num_handles)) =
7190                fidl::encoding::decode_envelope_header(decoder, next_offset)?
7191            {
7192                let member_inline_size =
7193                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
7194                if inlined != (member_inline_size <= 4) {
7195                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
7196                }
7197                let inner_offset;
7198                let mut inner_depth = depth.clone();
7199                if inlined {
7200                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7201                    inner_offset = next_offset;
7202                } else {
7203                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7204                    inner_depth.increment()?;
7205                }
7206                let val_ref = self.entered_passkey.get_or_insert_with(|| fidl::new_empty!(u32, D));
7207                fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
7208                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7209                {
7210                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
7211                }
7212                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7213                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7214                }
7215            }
7216
7217            next_offset += envelope_size;
7218
7219            // Decode the remaining unknown envelopes.
7220            while next_offset < end_offset {
7221                _next_ordinal_to_read += 1;
7222                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7223                next_offset += envelope_size;
7224            }
7225
7226            Ok(())
7227        }
7228    }
7229
7230    impl Peer {
7231        #[inline(always)]
7232        fn max_ordinal_present(&self) -> u64 {
7233            if let Some(_) = self.bredr_services {
7234                return 13;
7235            }
7236            if let Some(_) = self.le_services {
7237                return 12;
7238            }
7239            if let Some(_) = self.services {
7240                return 11;
7241            }
7242            if let Some(_) = self.tx_power {
7243                return 10;
7244            }
7245            if let Some(_) = self.rssi {
7246                return 9;
7247            }
7248            if let Some(_) = self.device_class {
7249                return 8;
7250            }
7251            if let Some(_) = self.appearance {
7252                return 7;
7253            }
7254            if let Some(_) = self.name {
7255                return 6;
7256            }
7257            if let Some(_) = self.bonded {
7258                return 5;
7259            }
7260            if let Some(_) = self.connected {
7261                return 4;
7262            }
7263            if let Some(_) = self.technology {
7264                return 3;
7265            }
7266            if let Some(_) = self.address {
7267                return 2;
7268            }
7269            if let Some(_) = self.id {
7270                return 1;
7271            }
7272            0
7273        }
7274    }
7275
7276    impl fidl::encoding::ValueTypeMarker for Peer {
7277        type Borrowed<'a> = &'a Self;
7278        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
7279            value
7280        }
7281    }
7282
7283    unsafe impl fidl::encoding::TypeMarker for Peer {
7284        type Owned = Self;
7285
7286        #[inline(always)]
7287        fn inline_align(_context: fidl::encoding::Context) -> usize {
7288            8
7289        }
7290
7291        #[inline(always)]
7292        fn inline_size(_context: fidl::encoding::Context) -> usize {
7293            16
7294        }
7295    }
7296
7297    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Peer, D> for &Peer {
7298        unsafe fn encode(
7299            self,
7300            encoder: &mut fidl::encoding::Encoder<'_, D>,
7301            offset: usize,
7302            mut depth: fidl::encoding::Depth,
7303        ) -> fidl::Result<()> {
7304            encoder.debug_check_bounds::<Peer>(offset);
7305            // Vector header
7306            let max_ordinal: u64 = self.max_ordinal_present();
7307            encoder.write_num(max_ordinal, offset);
7308            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
7309            // Calling encoder.out_of_line_offset(0) is not allowed.
7310            if max_ordinal == 0 {
7311                return Ok(());
7312            }
7313            depth.increment()?;
7314            let envelope_size = 8;
7315            let bytes_len = max_ordinal as usize * envelope_size;
7316            #[allow(unused_variables)]
7317            let offset = encoder.out_of_line_offset(bytes_len);
7318            let mut _prev_end_offset: usize = 0;
7319            if 1 > max_ordinal {
7320                return Ok(());
7321            }
7322
7323            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
7324            // are envelope_size bytes.
7325            let cur_offset: usize = (1 - 1) * envelope_size;
7326
7327            // Zero reserved fields.
7328            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7329
7330            // Safety:
7331            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
7332            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
7333            //   envelope_size bytes, there is always sufficient room.
7334            fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_bluetooth::PeerId, D>(
7335                self.id.as_ref().map(
7336                    <fidl_fuchsia_bluetooth::PeerId as fidl::encoding::ValueTypeMarker>::borrow,
7337                ),
7338                encoder,
7339                offset + cur_offset,
7340                depth,
7341            )?;
7342
7343            _prev_end_offset = cur_offset + envelope_size;
7344            if 2 > max_ordinal {
7345                return Ok(());
7346            }
7347
7348            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
7349            // are envelope_size bytes.
7350            let cur_offset: usize = (2 - 1) * envelope_size;
7351
7352            // Zero reserved fields.
7353            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7354
7355            // Safety:
7356            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
7357            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
7358            //   envelope_size bytes, there is always sufficient room.
7359            fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_bluetooth::Address, D>(
7360                self.address.as_ref().map(
7361                    <fidl_fuchsia_bluetooth::Address as fidl::encoding::ValueTypeMarker>::borrow,
7362                ),
7363                encoder,
7364                offset + cur_offset,
7365                depth,
7366            )?;
7367
7368            _prev_end_offset = cur_offset + envelope_size;
7369            if 3 > max_ordinal {
7370                return Ok(());
7371            }
7372
7373            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
7374            // are envelope_size bytes.
7375            let cur_offset: usize = (3 - 1) * envelope_size;
7376
7377            // Zero reserved fields.
7378            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7379
7380            // Safety:
7381            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
7382            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
7383            //   envelope_size bytes, there is always sufficient room.
7384            fidl::encoding::encode_in_envelope_optional::<TechnologyType, D>(
7385                self.technology
7386                    .as_ref()
7387                    .map(<TechnologyType as fidl::encoding::ValueTypeMarker>::borrow),
7388                encoder,
7389                offset + cur_offset,
7390                depth,
7391            )?;
7392
7393            _prev_end_offset = cur_offset + envelope_size;
7394            if 4 > max_ordinal {
7395                return Ok(());
7396            }
7397
7398            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
7399            // are envelope_size bytes.
7400            let cur_offset: usize = (4 - 1) * envelope_size;
7401
7402            // Zero reserved fields.
7403            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7404
7405            // Safety:
7406            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
7407            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
7408            //   envelope_size bytes, there is always sufficient room.
7409            fidl::encoding::encode_in_envelope_optional::<bool, D>(
7410                self.connected.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
7411                encoder,
7412                offset + cur_offset,
7413                depth,
7414            )?;
7415
7416            _prev_end_offset = cur_offset + envelope_size;
7417            if 5 > max_ordinal {
7418                return Ok(());
7419            }
7420
7421            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
7422            // are envelope_size bytes.
7423            let cur_offset: usize = (5 - 1) * envelope_size;
7424
7425            // Zero reserved fields.
7426            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7427
7428            // Safety:
7429            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
7430            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
7431            //   envelope_size bytes, there is always sufficient room.
7432            fidl::encoding::encode_in_envelope_optional::<bool, D>(
7433                self.bonded.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
7434                encoder,
7435                offset + cur_offset,
7436                depth,
7437            )?;
7438
7439            _prev_end_offset = cur_offset + envelope_size;
7440            if 6 > max_ordinal {
7441                return Ok(());
7442            }
7443
7444            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
7445            // are envelope_size bytes.
7446            let cur_offset: usize = (6 - 1) * envelope_size;
7447
7448            // Zero reserved fields.
7449            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7450
7451            // Safety:
7452            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
7453            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
7454            //   envelope_size bytes, there is always sufficient room.
7455            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<248>, D>(
7456                self.name.as_ref().map(
7457                    <fidl::encoding::BoundedString<248> as fidl::encoding::ValueTypeMarker>::borrow,
7458                ),
7459                encoder,
7460                offset + cur_offset,
7461                depth,
7462            )?;
7463
7464            _prev_end_offset = cur_offset + envelope_size;
7465            if 7 > max_ordinal {
7466                return Ok(());
7467            }
7468
7469            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
7470            // are envelope_size bytes.
7471            let cur_offset: usize = (7 - 1) * envelope_size;
7472
7473            // Zero reserved fields.
7474            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7475
7476            // Safety:
7477            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
7478            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
7479            //   envelope_size bytes, there is always sufficient room.
7480            fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_bluetooth::Appearance, D>(
7481                self.appearance.as_ref().map(
7482                    <fidl_fuchsia_bluetooth::Appearance as fidl::encoding::ValueTypeMarker>::borrow,
7483                ),
7484                encoder,
7485                offset + cur_offset,
7486                depth,
7487            )?;
7488
7489            _prev_end_offset = cur_offset + envelope_size;
7490            if 8 > max_ordinal {
7491                return Ok(());
7492            }
7493
7494            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
7495            // are envelope_size bytes.
7496            let cur_offset: usize = (8 - 1) * envelope_size;
7497
7498            // Zero reserved fields.
7499            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7500
7501            // Safety:
7502            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
7503            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
7504            //   envelope_size bytes, there is always sufficient room.
7505            fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_bluetooth::DeviceClass, D>(
7506            self.device_class.as_ref().map(<fidl_fuchsia_bluetooth::DeviceClass as fidl::encoding::ValueTypeMarker>::borrow),
7507            encoder, offset + cur_offset, depth
7508        )?;
7509
7510            _prev_end_offset = cur_offset + envelope_size;
7511            if 9 > max_ordinal {
7512                return Ok(());
7513            }
7514
7515            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
7516            // are envelope_size bytes.
7517            let cur_offset: usize = (9 - 1) * envelope_size;
7518
7519            // Zero reserved fields.
7520            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7521
7522            // Safety:
7523            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
7524            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
7525            //   envelope_size bytes, there is always sufficient room.
7526            fidl::encoding::encode_in_envelope_optional::<i8, D>(
7527                self.rssi.as_ref().map(<i8 as fidl::encoding::ValueTypeMarker>::borrow),
7528                encoder,
7529                offset + cur_offset,
7530                depth,
7531            )?;
7532
7533            _prev_end_offset = cur_offset + envelope_size;
7534            if 10 > max_ordinal {
7535                return Ok(());
7536            }
7537
7538            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
7539            // are envelope_size bytes.
7540            let cur_offset: usize = (10 - 1) * envelope_size;
7541
7542            // Zero reserved fields.
7543            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7544
7545            // Safety:
7546            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
7547            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
7548            //   envelope_size bytes, there is always sufficient room.
7549            fidl::encoding::encode_in_envelope_optional::<i8, D>(
7550                self.tx_power.as_ref().map(<i8 as fidl::encoding::ValueTypeMarker>::borrow),
7551                encoder,
7552                offset + cur_offset,
7553                depth,
7554            )?;
7555
7556            _prev_end_offset = cur_offset + envelope_size;
7557            if 11 > max_ordinal {
7558                return Ok(());
7559            }
7560
7561            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
7562            // are envelope_size bytes.
7563            let cur_offset: usize = (11 - 1) * envelope_size;
7564
7565            // Zero reserved fields.
7566            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7567
7568            // Safety:
7569            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
7570            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
7571            //   envelope_size bytes, there is always sufficient room.
7572            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<fidl_fuchsia_bluetooth::Uuid, 65535>, D>(
7573            self.services.as_ref().map(<fidl::encoding::Vector<fidl_fuchsia_bluetooth::Uuid, 65535> as fidl::encoding::ValueTypeMarker>::borrow),
7574            encoder, offset + cur_offset, depth
7575        )?;
7576
7577            _prev_end_offset = cur_offset + envelope_size;
7578            if 12 > max_ordinal {
7579                return Ok(());
7580            }
7581
7582            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
7583            // are envelope_size bytes.
7584            let cur_offset: usize = (12 - 1) * envelope_size;
7585
7586            // Zero reserved fields.
7587            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7588
7589            // Safety:
7590            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
7591            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
7592            //   envelope_size bytes, there is always sufficient room.
7593            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<fidl_fuchsia_bluetooth::Uuid, 65535>, D>(
7594            self.le_services.as_ref().map(<fidl::encoding::Vector<fidl_fuchsia_bluetooth::Uuid, 65535> as fidl::encoding::ValueTypeMarker>::borrow),
7595            encoder, offset + cur_offset, depth
7596        )?;
7597
7598            _prev_end_offset = cur_offset + envelope_size;
7599            if 13 > max_ordinal {
7600                return Ok(());
7601            }
7602
7603            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
7604            // are envelope_size bytes.
7605            let cur_offset: usize = (13 - 1) * envelope_size;
7606
7607            // Zero reserved fields.
7608            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7609
7610            // Safety:
7611            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
7612            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
7613            //   envelope_size bytes, there is always sufficient room.
7614            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<fidl_fuchsia_bluetooth::Uuid, 65535>, D>(
7615            self.bredr_services.as_ref().map(<fidl::encoding::Vector<fidl_fuchsia_bluetooth::Uuid, 65535> as fidl::encoding::ValueTypeMarker>::borrow),
7616            encoder, offset + cur_offset, depth
7617        )?;
7618
7619            _prev_end_offset = cur_offset + envelope_size;
7620
7621            Ok(())
7622        }
7623    }
7624
7625    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Peer {
7626        #[inline(always)]
7627        fn new_empty() -> Self {
7628            Self::default()
7629        }
7630
7631        unsafe fn decode(
7632            &mut self,
7633            decoder: &mut fidl::encoding::Decoder<'_, D>,
7634            offset: usize,
7635            mut depth: fidl::encoding::Depth,
7636        ) -> fidl::Result<()> {
7637            decoder.debug_check_bounds::<Self>(offset);
7638            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
7639                None => return Err(fidl::Error::NotNullable),
7640                Some(len) => len,
7641            };
7642            // Calling decoder.out_of_line_offset(0) is not allowed.
7643            if len == 0 {
7644                return Ok(());
7645            };
7646            depth.increment()?;
7647            let envelope_size = 8;
7648            let bytes_len = len * envelope_size;
7649            let offset = decoder.out_of_line_offset(bytes_len)?;
7650            // Decode the envelope for each type.
7651            let mut _next_ordinal_to_read = 0;
7652            let mut next_offset = offset;
7653            let end_offset = offset + bytes_len;
7654            _next_ordinal_to_read += 1;
7655            if next_offset >= end_offset {
7656                return Ok(());
7657            }
7658
7659            // Decode unknown envelopes for gaps in ordinals.
7660            while _next_ordinal_to_read < 1 {
7661                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7662                _next_ordinal_to_read += 1;
7663                next_offset += envelope_size;
7664            }
7665
7666            let next_out_of_line = decoder.next_out_of_line();
7667            let handles_before = decoder.remaining_handles();
7668            if let Some((inlined, num_bytes, num_handles)) =
7669                fidl::encoding::decode_envelope_header(decoder, next_offset)?
7670            {
7671                let member_inline_size =
7672                    <fidl_fuchsia_bluetooth::PeerId as fidl::encoding::TypeMarker>::inline_size(
7673                        decoder.context,
7674                    );
7675                if inlined != (member_inline_size <= 4) {
7676                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
7677                }
7678                let inner_offset;
7679                let mut inner_depth = depth.clone();
7680                if inlined {
7681                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7682                    inner_offset = next_offset;
7683                } else {
7684                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7685                    inner_depth.increment()?;
7686                }
7687                let val_ref = self
7688                    .id
7689                    .get_or_insert_with(|| fidl::new_empty!(fidl_fuchsia_bluetooth::PeerId, D));
7690                fidl::decode!(
7691                    fidl_fuchsia_bluetooth::PeerId,
7692                    D,
7693                    val_ref,
7694                    decoder,
7695                    inner_offset,
7696                    inner_depth
7697                )?;
7698                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7699                {
7700                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
7701                }
7702                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7703                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7704                }
7705            }
7706
7707            next_offset += envelope_size;
7708            _next_ordinal_to_read += 1;
7709            if next_offset >= end_offset {
7710                return Ok(());
7711            }
7712
7713            // Decode unknown envelopes for gaps in ordinals.
7714            while _next_ordinal_to_read < 2 {
7715                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7716                _next_ordinal_to_read += 1;
7717                next_offset += envelope_size;
7718            }
7719
7720            let next_out_of_line = decoder.next_out_of_line();
7721            let handles_before = decoder.remaining_handles();
7722            if let Some((inlined, num_bytes, num_handles)) =
7723                fidl::encoding::decode_envelope_header(decoder, next_offset)?
7724            {
7725                let member_inline_size =
7726                    <fidl_fuchsia_bluetooth::Address as fidl::encoding::TypeMarker>::inline_size(
7727                        decoder.context,
7728                    );
7729                if inlined != (member_inline_size <= 4) {
7730                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
7731                }
7732                let inner_offset;
7733                let mut inner_depth = depth.clone();
7734                if inlined {
7735                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7736                    inner_offset = next_offset;
7737                } else {
7738                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7739                    inner_depth.increment()?;
7740                }
7741                let val_ref = self
7742                    .address
7743                    .get_or_insert_with(|| fidl::new_empty!(fidl_fuchsia_bluetooth::Address, D));
7744                fidl::decode!(
7745                    fidl_fuchsia_bluetooth::Address,
7746                    D,
7747                    val_ref,
7748                    decoder,
7749                    inner_offset,
7750                    inner_depth
7751                )?;
7752                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7753                {
7754                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
7755                }
7756                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7757                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7758                }
7759            }
7760
7761            next_offset += envelope_size;
7762            _next_ordinal_to_read += 1;
7763            if next_offset >= end_offset {
7764                return Ok(());
7765            }
7766
7767            // Decode unknown envelopes for gaps in ordinals.
7768            while _next_ordinal_to_read < 3 {
7769                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7770                _next_ordinal_to_read += 1;
7771                next_offset += envelope_size;
7772            }
7773
7774            let next_out_of_line = decoder.next_out_of_line();
7775            let handles_before = decoder.remaining_handles();
7776            if let Some((inlined, num_bytes, num_handles)) =
7777                fidl::encoding::decode_envelope_header(decoder, next_offset)?
7778            {
7779                let member_inline_size =
7780                    <TechnologyType as fidl::encoding::TypeMarker>::inline_size(decoder.context);
7781                if inlined != (member_inline_size <= 4) {
7782                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
7783                }
7784                let inner_offset;
7785                let mut inner_depth = depth.clone();
7786                if inlined {
7787                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7788                    inner_offset = next_offset;
7789                } else {
7790                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7791                    inner_depth.increment()?;
7792                }
7793                let val_ref =
7794                    self.technology.get_or_insert_with(|| fidl::new_empty!(TechnologyType, D));
7795                fidl::decode!(TechnologyType, D, val_ref, decoder, inner_offset, inner_depth)?;
7796                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7797                {
7798                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
7799                }
7800                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7801                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7802                }
7803            }
7804
7805            next_offset += envelope_size;
7806            _next_ordinal_to_read += 1;
7807            if next_offset >= end_offset {
7808                return Ok(());
7809            }
7810
7811            // Decode unknown envelopes for gaps in ordinals.
7812            while _next_ordinal_to_read < 4 {
7813                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7814                _next_ordinal_to_read += 1;
7815                next_offset += envelope_size;
7816            }
7817
7818            let next_out_of_line = decoder.next_out_of_line();
7819            let handles_before = decoder.remaining_handles();
7820            if let Some((inlined, num_bytes, num_handles)) =
7821                fidl::encoding::decode_envelope_header(decoder, next_offset)?
7822            {
7823                let member_inline_size =
7824                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
7825                if inlined != (member_inline_size <= 4) {
7826                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
7827                }
7828                let inner_offset;
7829                let mut inner_depth = depth.clone();
7830                if inlined {
7831                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7832                    inner_offset = next_offset;
7833                } else {
7834                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7835                    inner_depth.increment()?;
7836                }
7837                let val_ref = self.connected.get_or_insert_with(|| fidl::new_empty!(bool, D));
7838                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
7839                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7840                {
7841                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
7842                }
7843                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7844                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7845                }
7846            }
7847
7848            next_offset += envelope_size;
7849            _next_ordinal_to_read += 1;
7850            if next_offset >= end_offset {
7851                return Ok(());
7852            }
7853
7854            // Decode unknown envelopes for gaps in ordinals.
7855            while _next_ordinal_to_read < 5 {
7856                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7857                _next_ordinal_to_read += 1;
7858                next_offset += envelope_size;
7859            }
7860
7861            let next_out_of_line = decoder.next_out_of_line();
7862            let handles_before = decoder.remaining_handles();
7863            if let Some((inlined, num_bytes, num_handles)) =
7864                fidl::encoding::decode_envelope_header(decoder, next_offset)?
7865            {
7866                let member_inline_size =
7867                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
7868                if inlined != (member_inline_size <= 4) {
7869                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
7870                }
7871                let inner_offset;
7872                let mut inner_depth = depth.clone();
7873                if inlined {
7874                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7875                    inner_offset = next_offset;
7876                } else {
7877                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7878                    inner_depth.increment()?;
7879                }
7880                let val_ref = self.bonded.get_or_insert_with(|| fidl::new_empty!(bool, D));
7881                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
7882                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7883                {
7884                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
7885                }
7886                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7887                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7888                }
7889            }
7890
7891            next_offset += envelope_size;
7892            _next_ordinal_to_read += 1;
7893            if next_offset >= end_offset {
7894                return Ok(());
7895            }
7896
7897            // Decode unknown envelopes for gaps in ordinals.
7898            while _next_ordinal_to_read < 6 {
7899                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7900                _next_ordinal_to_read += 1;
7901                next_offset += envelope_size;
7902            }
7903
7904            let next_out_of_line = decoder.next_out_of_line();
7905            let handles_before = decoder.remaining_handles();
7906            if let Some((inlined, num_bytes, num_handles)) =
7907                fidl::encoding::decode_envelope_header(decoder, next_offset)?
7908            {
7909                let member_inline_size =
7910                    <fidl::encoding::BoundedString<248> as fidl::encoding::TypeMarker>::inline_size(
7911                        decoder.context,
7912                    );
7913                if inlined != (member_inline_size <= 4) {
7914                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
7915                }
7916                let inner_offset;
7917                let mut inner_depth = depth.clone();
7918                if inlined {
7919                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7920                    inner_offset = next_offset;
7921                } else {
7922                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7923                    inner_depth.increment()?;
7924                }
7925                let val_ref = self
7926                    .name
7927                    .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::BoundedString<248>, D));
7928                fidl::decode!(
7929                    fidl::encoding::BoundedString<248>,
7930                    D,
7931                    val_ref,
7932                    decoder,
7933                    inner_offset,
7934                    inner_depth
7935                )?;
7936                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7937                {
7938                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
7939                }
7940                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7941                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7942                }
7943            }
7944
7945            next_offset += envelope_size;
7946            _next_ordinal_to_read += 1;
7947            if next_offset >= end_offset {
7948                return Ok(());
7949            }
7950
7951            // Decode unknown envelopes for gaps in ordinals.
7952            while _next_ordinal_to_read < 7 {
7953                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7954                _next_ordinal_to_read += 1;
7955                next_offset += envelope_size;
7956            }
7957
7958            let next_out_of_line = decoder.next_out_of_line();
7959            let handles_before = decoder.remaining_handles();
7960            if let Some((inlined, num_bytes, num_handles)) =
7961                fidl::encoding::decode_envelope_header(decoder, next_offset)?
7962            {
7963                let member_inline_size =
7964                    <fidl_fuchsia_bluetooth::Appearance as fidl::encoding::TypeMarker>::inline_size(
7965                        decoder.context,
7966                    );
7967                if inlined != (member_inline_size <= 4) {
7968                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
7969                }
7970                let inner_offset;
7971                let mut inner_depth = depth.clone();
7972                if inlined {
7973                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7974                    inner_offset = next_offset;
7975                } else {
7976                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7977                    inner_depth.increment()?;
7978                }
7979                let val_ref = self
7980                    .appearance
7981                    .get_or_insert_with(|| fidl::new_empty!(fidl_fuchsia_bluetooth::Appearance, D));
7982                fidl::decode!(
7983                    fidl_fuchsia_bluetooth::Appearance,
7984                    D,
7985                    val_ref,
7986                    decoder,
7987                    inner_offset,
7988                    inner_depth
7989                )?;
7990                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7991                {
7992                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
7993                }
7994                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7995                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7996                }
7997            }
7998
7999            next_offset += envelope_size;
8000            _next_ordinal_to_read += 1;
8001            if next_offset >= end_offset {
8002                return Ok(());
8003            }
8004
8005            // Decode unknown envelopes for gaps in ordinals.
8006            while _next_ordinal_to_read < 8 {
8007                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8008                _next_ordinal_to_read += 1;
8009                next_offset += envelope_size;
8010            }
8011
8012            let next_out_of_line = decoder.next_out_of_line();
8013            let handles_before = decoder.remaining_handles();
8014            if let Some((inlined, num_bytes, num_handles)) =
8015                fidl::encoding::decode_envelope_header(decoder, next_offset)?
8016            {
8017                let member_inline_size = <fidl_fuchsia_bluetooth::DeviceClass as fidl::encoding::TypeMarker>::inline_size(decoder.context);
8018                if inlined != (member_inline_size <= 4) {
8019                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
8020                }
8021                let inner_offset;
8022                let mut inner_depth = depth.clone();
8023                if inlined {
8024                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8025                    inner_offset = next_offset;
8026                } else {
8027                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8028                    inner_depth.increment()?;
8029                }
8030                let val_ref = self.device_class.get_or_insert_with(|| {
8031                    fidl::new_empty!(fidl_fuchsia_bluetooth::DeviceClass, D)
8032                });
8033                fidl::decode!(
8034                    fidl_fuchsia_bluetooth::DeviceClass,
8035                    D,
8036                    val_ref,
8037                    decoder,
8038                    inner_offset,
8039                    inner_depth
8040                )?;
8041                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8042                {
8043                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
8044                }
8045                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8046                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8047                }
8048            }
8049
8050            next_offset += envelope_size;
8051            _next_ordinal_to_read += 1;
8052            if next_offset >= end_offset {
8053                return Ok(());
8054            }
8055
8056            // Decode unknown envelopes for gaps in ordinals.
8057            while _next_ordinal_to_read < 9 {
8058                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8059                _next_ordinal_to_read += 1;
8060                next_offset += envelope_size;
8061            }
8062
8063            let next_out_of_line = decoder.next_out_of_line();
8064            let handles_before = decoder.remaining_handles();
8065            if let Some((inlined, num_bytes, num_handles)) =
8066                fidl::encoding::decode_envelope_header(decoder, next_offset)?
8067            {
8068                let member_inline_size =
8069                    <i8 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
8070                if inlined != (member_inline_size <= 4) {
8071                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
8072                }
8073                let inner_offset;
8074                let mut inner_depth = depth.clone();
8075                if inlined {
8076                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8077                    inner_offset = next_offset;
8078                } else {
8079                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8080                    inner_depth.increment()?;
8081                }
8082                let val_ref = self.rssi.get_or_insert_with(|| fidl::new_empty!(i8, D));
8083                fidl::decode!(i8, D, val_ref, decoder, inner_offset, inner_depth)?;
8084                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8085                {
8086                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
8087                }
8088                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8089                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8090                }
8091            }
8092
8093            next_offset += envelope_size;
8094            _next_ordinal_to_read += 1;
8095            if next_offset >= end_offset {
8096                return Ok(());
8097            }
8098
8099            // Decode unknown envelopes for gaps in ordinals.
8100            while _next_ordinal_to_read < 10 {
8101                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8102                _next_ordinal_to_read += 1;
8103                next_offset += envelope_size;
8104            }
8105
8106            let next_out_of_line = decoder.next_out_of_line();
8107            let handles_before = decoder.remaining_handles();
8108            if let Some((inlined, num_bytes, num_handles)) =
8109                fidl::encoding::decode_envelope_header(decoder, next_offset)?
8110            {
8111                let member_inline_size =
8112                    <i8 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
8113                if inlined != (member_inline_size <= 4) {
8114                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
8115                }
8116                let inner_offset;
8117                let mut inner_depth = depth.clone();
8118                if inlined {
8119                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8120                    inner_offset = next_offset;
8121                } else {
8122                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8123                    inner_depth.increment()?;
8124                }
8125                let val_ref = self.tx_power.get_or_insert_with(|| fidl::new_empty!(i8, D));
8126                fidl::decode!(i8, D, val_ref, decoder, inner_offset, inner_depth)?;
8127                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8128                {
8129                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
8130                }
8131                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8132                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8133                }
8134            }
8135
8136            next_offset += envelope_size;
8137            _next_ordinal_to_read += 1;
8138            if next_offset >= end_offset {
8139                return Ok(());
8140            }
8141
8142            // Decode unknown envelopes for gaps in ordinals.
8143            while _next_ordinal_to_read < 11 {
8144                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8145                _next_ordinal_to_read += 1;
8146                next_offset += envelope_size;
8147            }
8148
8149            let next_out_of_line = decoder.next_out_of_line();
8150            let handles_before = decoder.remaining_handles();
8151            if let Some((inlined, num_bytes, num_handles)) =
8152                fidl::encoding::decode_envelope_header(decoder, next_offset)?
8153            {
8154                let member_inline_size = <fidl::encoding::Vector<
8155                    fidl_fuchsia_bluetooth::Uuid,
8156                    65535,
8157                > as fidl::encoding::TypeMarker>::inline_size(
8158                    decoder.context
8159                );
8160                if inlined != (member_inline_size <= 4) {
8161                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
8162                }
8163                let inner_offset;
8164                let mut inner_depth = depth.clone();
8165                if inlined {
8166                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8167                    inner_offset = next_offset;
8168                } else {
8169                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8170                    inner_depth.increment()?;
8171                }
8172                let val_ref =
8173                self.services.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<fidl_fuchsia_bluetooth::Uuid, 65535>, D));
8174                fidl::decode!(fidl::encoding::Vector<fidl_fuchsia_bluetooth::Uuid, 65535>, D, val_ref, decoder, inner_offset, inner_depth)?;
8175                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8176                {
8177                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
8178                }
8179                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8180                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8181                }
8182            }
8183
8184            next_offset += envelope_size;
8185            _next_ordinal_to_read += 1;
8186            if next_offset >= end_offset {
8187                return Ok(());
8188            }
8189
8190            // Decode unknown envelopes for gaps in ordinals.
8191            while _next_ordinal_to_read < 12 {
8192                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8193                _next_ordinal_to_read += 1;
8194                next_offset += envelope_size;
8195            }
8196
8197            let next_out_of_line = decoder.next_out_of_line();
8198            let handles_before = decoder.remaining_handles();
8199            if let Some((inlined, num_bytes, num_handles)) =
8200                fidl::encoding::decode_envelope_header(decoder, next_offset)?
8201            {
8202                let member_inline_size = <fidl::encoding::Vector<
8203                    fidl_fuchsia_bluetooth::Uuid,
8204                    65535,
8205                > as fidl::encoding::TypeMarker>::inline_size(
8206                    decoder.context
8207                );
8208                if inlined != (member_inline_size <= 4) {
8209                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
8210                }
8211                let inner_offset;
8212                let mut inner_depth = depth.clone();
8213                if inlined {
8214                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8215                    inner_offset = next_offset;
8216                } else {
8217                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8218                    inner_depth.increment()?;
8219                }
8220                let val_ref =
8221                self.le_services.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<fidl_fuchsia_bluetooth::Uuid, 65535>, D));
8222                fidl::decode!(fidl::encoding::Vector<fidl_fuchsia_bluetooth::Uuid, 65535>, D, val_ref, decoder, inner_offset, inner_depth)?;
8223                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8224                {
8225                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
8226                }
8227                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8228                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8229                }
8230            }
8231
8232            next_offset += envelope_size;
8233            _next_ordinal_to_read += 1;
8234            if next_offset >= end_offset {
8235                return Ok(());
8236            }
8237
8238            // Decode unknown envelopes for gaps in ordinals.
8239            while _next_ordinal_to_read < 13 {
8240                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8241                _next_ordinal_to_read += 1;
8242                next_offset += envelope_size;
8243            }
8244
8245            let next_out_of_line = decoder.next_out_of_line();
8246            let handles_before = decoder.remaining_handles();
8247            if let Some((inlined, num_bytes, num_handles)) =
8248                fidl::encoding::decode_envelope_header(decoder, next_offset)?
8249            {
8250                let member_inline_size = <fidl::encoding::Vector<
8251                    fidl_fuchsia_bluetooth::Uuid,
8252                    65535,
8253                > as fidl::encoding::TypeMarker>::inline_size(
8254                    decoder.context
8255                );
8256                if inlined != (member_inline_size <= 4) {
8257                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
8258                }
8259                let inner_offset;
8260                let mut inner_depth = depth.clone();
8261                if inlined {
8262                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8263                    inner_offset = next_offset;
8264                } else {
8265                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8266                    inner_depth.increment()?;
8267                }
8268                let val_ref =
8269                self.bredr_services.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<fidl_fuchsia_bluetooth::Uuid, 65535>, D));
8270                fidl::decode!(fidl::encoding::Vector<fidl_fuchsia_bluetooth::Uuid, 65535>, D, val_ref, decoder, inner_offset, inner_depth)?;
8271                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8272                {
8273                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
8274                }
8275                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8276                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8277                }
8278            }
8279
8280            next_offset += envelope_size;
8281
8282            // Decode the remaining unknown envelopes.
8283            while next_offset < end_offset {
8284                _next_ordinal_to_read += 1;
8285                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8286                next_offset += envelope_size;
8287            }
8288
8289            Ok(())
8290        }
8291    }
8292
8293    impl Settings {
8294        #[inline(always)]
8295        fn max_ordinal_present(&self) -> u64 {
8296            if let Some(_) = self.bredr_security_mode {
8297                return 5;
8298            }
8299            if let Some(_) = self.le_security_mode {
8300                return 4;
8301            }
8302            if let Some(_) = self.bredr_connectable_mode {
8303                return 3;
8304            }
8305            if let Some(_) = self.le_background_scan {
8306                return 2;
8307            }
8308            if let Some(_) = self.le_privacy {
8309                return 1;
8310            }
8311            0
8312        }
8313    }
8314
8315    impl fidl::encoding::ValueTypeMarker for Settings {
8316        type Borrowed<'a> = &'a Self;
8317        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
8318            value
8319        }
8320    }
8321
8322    unsafe impl fidl::encoding::TypeMarker for Settings {
8323        type Owned = Self;
8324
8325        #[inline(always)]
8326        fn inline_align(_context: fidl::encoding::Context) -> usize {
8327            8
8328        }
8329
8330        #[inline(always)]
8331        fn inline_size(_context: fidl::encoding::Context) -> usize {
8332            16
8333        }
8334    }
8335
8336    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Settings, D> for &Settings {
8337        unsafe fn encode(
8338            self,
8339            encoder: &mut fidl::encoding::Encoder<'_, D>,
8340            offset: usize,
8341            mut depth: fidl::encoding::Depth,
8342        ) -> fidl::Result<()> {
8343            encoder.debug_check_bounds::<Settings>(offset);
8344            // Vector header
8345            let max_ordinal: u64 = self.max_ordinal_present();
8346            encoder.write_num(max_ordinal, offset);
8347            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
8348            // Calling encoder.out_of_line_offset(0) is not allowed.
8349            if max_ordinal == 0 {
8350                return Ok(());
8351            }
8352            depth.increment()?;
8353            let envelope_size = 8;
8354            let bytes_len = max_ordinal as usize * envelope_size;
8355            #[allow(unused_variables)]
8356            let offset = encoder.out_of_line_offset(bytes_len);
8357            let mut _prev_end_offset: usize = 0;
8358            if 1 > max_ordinal {
8359                return Ok(());
8360            }
8361
8362            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
8363            // are envelope_size bytes.
8364            let cur_offset: usize = (1 - 1) * envelope_size;
8365
8366            // Zero reserved fields.
8367            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
8368
8369            // Safety:
8370            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
8371            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
8372            //   envelope_size bytes, there is always sufficient room.
8373            fidl::encoding::encode_in_envelope_optional::<bool, D>(
8374                self.le_privacy.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
8375                encoder,
8376                offset + cur_offset,
8377                depth,
8378            )?;
8379
8380            _prev_end_offset = cur_offset + envelope_size;
8381            if 2 > max_ordinal {
8382                return Ok(());
8383            }
8384
8385            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
8386            // are envelope_size bytes.
8387            let cur_offset: usize = (2 - 1) * envelope_size;
8388
8389            // Zero reserved fields.
8390            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
8391
8392            // Safety:
8393            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
8394            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
8395            //   envelope_size bytes, there is always sufficient room.
8396            fidl::encoding::encode_in_envelope_optional::<bool, D>(
8397                self.le_background_scan
8398                    .as_ref()
8399                    .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
8400                encoder,
8401                offset + cur_offset,
8402                depth,
8403            )?;
8404
8405            _prev_end_offset = cur_offset + envelope_size;
8406            if 3 > max_ordinal {
8407                return Ok(());
8408            }
8409
8410            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
8411            // are envelope_size bytes.
8412            let cur_offset: usize = (3 - 1) * envelope_size;
8413
8414            // Zero reserved fields.
8415            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
8416
8417            // Safety:
8418            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
8419            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
8420            //   envelope_size bytes, there is always sufficient room.
8421            fidl::encoding::encode_in_envelope_optional::<bool, D>(
8422                self.bredr_connectable_mode
8423                    .as_ref()
8424                    .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
8425                encoder,
8426                offset + cur_offset,
8427                depth,
8428            )?;
8429
8430            _prev_end_offset = cur_offset + envelope_size;
8431            if 4 > max_ordinal {
8432                return Ok(());
8433            }
8434
8435            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
8436            // are envelope_size bytes.
8437            let cur_offset: usize = (4 - 1) * envelope_size;
8438
8439            // Zero reserved fields.
8440            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
8441
8442            // Safety:
8443            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
8444            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
8445            //   envelope_size bytes, there is always sufficient room.
8446            fidl::encoding::encode_in_envelope_optional::<LeSecurityMode, D>(
8447                self.le_security_mode
8448                    .as_ref()
8449                    .map(<LeSecurityMode as fidl::encoding::ValueTypeMarker>::borrow),
8450                encoder,
8451                offset + cur_offset,
8452                depth,
8453            )?;
8454
8455            _prev_end_offset = cur_offset + envelope_size;
8456            if 5 > max_ordinal {
8457                return Ok(());
8458            }
8459
8460            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
8461            // are envelope_size bytes.
8462            let cur_offset: usize = (5 - 1) * envelope_size;
8463
8464            // Zero reserved fields.
8465            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
8466
8467            // Safety:
8468            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
8469            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
8470            //   envelope_size bytes, there is always sufficient room.
8471            fidl::encoding::encode_in_envelope_optional::<BrEdrSecurityMode, D>(
8472                self.bredr_security_mode
8473                    .as_ref()
8474                    .map(<BrEdrSecurityMode as fidl::encoding::ValueTypeMarker>::borrow),
8475                encoder,
8476                offset + cur_offset,
8477                depth,
8478            )?;
8479
8480            _prev_end_offset = cur_offset + envelope_size;
8481
8482            Ok(())
8483        }
8484    }
8485
8486    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Settings {
8487        #[inline(always)]
8488        fn new_empty() -> Self {
8489            Self::default()
8490        }
8491
8492        unsafe fn decode(
8493            &mut self,
8494            decoder: &mut fidl::encoding::Decoder<'_, D>,
8495            offset: usize,
8496            mut depth: fidl::encoding::Depth,
8497        ) -> fidl::Result<()> {
8498            decoder.debug_check_bounds::<Self>(offset);
8499            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
8500                None => return Err(fidl::Error::NotNullable),
8501                Some(len) => len,
8502            };
8503            // Calling decoder.out_of_line_offset(0) is not allowed.
8504            if len == 0 {
8505                return Ok(());
8506            };
8507            depth.increment()?;
8508            let envelope_size = 8;
8509            let bytes_len = len * envelope_size;
8510            let offset = decoder.out_of_line_offset(bytes_len)?;
8511            // Decode the envelope for each type.
8512            let mut _next_ordinal_to_read = 0;
8513            let mut next_offset = offset;
8514            let end_offset = offset + bytes_len;
8515            _next_ordinal_to_read += 1;
8516            if next_offset >= end_offset {
8517                return Ok(());
8518            }
8519
8520            // Decode unknown envelopes for gaps in ordinals.
8521            while _next_ordinal_to_read < 1 {
8522                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8523                _next_ordinal_to_read += 1;
8524                next_offset += envelope_size;
8525            }
8526
8527            let next_out_of_line = decoder.next_out_of_line();
8528            let handles_before = decoder.remaining_handles();
8529            if let Some((inlined, num_bytes, num_handles)) =
8530                fidl::encoding::decode_envelope_header(decoder, next_offset)?
8531            {
8532                let member_inline_size =
8533                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
8534                if inlined != (member_inline_size <= 4) {
8535                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
8536                }
8537                let inner_offset;
8538                let mut inner_depth = depth.clone();
8539                if inlined {
8540                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8541                    inner_offset = next_offset;
8542                } else {
8543                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8544                    inner_depth.increment()?;
8545                }
8546                let val_ref = self.le_privacy.get_or_insert_with(|| fidl::new_empty!(bool, D));
8547                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
8548                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8549                {
8550                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
8551                }
8552                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8553                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8554                }
8555            }
8556
8557            next_offset += envelope_size;
8558            _next_ordinal_to_read += 1;
8559            if next_offset >= end_offset {
8560                return Ok(());
8561            }
8562
8563            // Decode unknown envelopes for gaps in ordinals.
8564            while _next_ordinal_to_read < 2 {
8565                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8566                _next_ordinal_to_read += 1;
8567                next_offset += envelope_size;
8568            }
8569
8570            let next_out_of_line = decoder.next_out_of_line();
8571            let handles_before = decoder.remaining_handles();
8572            if let Some((inlined, num_bytes, num_handles)) =
8573                fidl::encoding::decode_envelope_header(decoder, next_offset)?
8574            {
8575                let member_inline_size =
8576                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
8577                if inlined != (member_inline_size <= 4) {
8578                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
8579                }
8580                let inner_offset;
8581                let mut inner_depth = depth.clone();
8582                if inlined {
8583                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8584                    inner_offset = next_offset;
8585                } else {
8586                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8587                    inner_depth.increment()?;
8588                }
8589                let val_ref =
8590                    self.le_background_scan.get_or_insert_with(|| fidl::new_empty!(bool, D));
8591                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
8592                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8593                {
8594                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
8595                }
8596                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8597                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8598                }
8599            }
8600
8601            next_offset += envelope_size;
8602            _next_ordinal_to_read += 1;
8603            if next_offset >= end_offset {
8604                return Ok(());
8605            }
8606
8607            // Decode unknown envelopes for gaps in ordinals.
8608            while _next_ordinal_to_read < 3 {
8609                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8610                _next_ordinal_to_read += 1;
8611                next_offset += envelope_size;
8612            }
8613
8614            let next_out_of_line = decoder.next_out_of_line();
8615            let handles_before = decoder.remaining_handles();
8616            if let Some((inlined, num_bytes, num_handles)) =
8617                fidl::encoding::decode_envelope_header(decoder, next_offset)?
8618            {
8619                let member_inline_size =
8620                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
8621                if inlined != (member_inline_size <= 4) {
8622                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
8623                }
8624                let inner_offset;
8625                let mut inner_depth = depth.clone();
8626                if inlined {
8627                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8628                    inner_offset = next_offset;
8629                } else {
8630                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8631                    inner_depth.increment()?;
8632                }
8633                let val_ref =
8634                    self.bredr_connectable_mode.get_or_insert_with(|| fidl::new_empty!(bool, D));
8635                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
8636                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8637                {
8638                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
8639                }
8640                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8641                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8642                }
8643            }
8644
8645            next_offset += envelope_size;
8646            _next_ordinal_to_read += 1;
8647            if next_offset >= end_offset {
8648                return Ok(());
8649            }
8650
8651            // Decode unknown envelopes for gaps in ordinals.
8652            while _next_ordinal_to_read < 4 {
8653                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8654                _next_ordinal_to_read += 1;
8655                next_offset += envelope_size;
8656            }
8657
8658            let next_out_of_line = decoder.next_out_of_line();
8659            let handles_before = decoder.remaining_handles();
8660            if let Some((inlined, num_bytes, num_handles)) =
8661                fidl::encoding::decode_envelope_header(decoder, next_offset)?
8662            {
8663                let member_inline_size =
8664                    <LeSecurityMode as fidl::encoding::TypeMarker>::inline_size(decoder.context);
8665                if inlined != (member_inline_size <= 4) {
8666                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
8667                }
8668                let inner_offset;
8669                let mut inner_depth = depth.clone();
8670                if inlined {
8671                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8672                    inner_offset = next_offset;
8673                } else {
8674                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8675                    inner_depth.increment()?;
8676                }
8677                let val_ref = self
8678                    .le_security_mode
8679                    .get_or_insert_with(|| fidl::new_empty!(LeSecurityMode, D));
8680                fidl::decode!(LeSecurityMode, D, val_ref, decoder, inner_offset, inner_depth)?;
8681                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8682                {
8683                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
8684                }
8685                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8686                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8687                }
8688            }
8689
8690            next_offset += envelope_size;
8691            _next_ordinal_to_read += 1;
8692            if next_offset >= end_offset {
8693                return Ok(());
8694            }
8695
8696            // Decode unknown envelopes for gaps in ordinals.
8697            while _next_ordinal_to_read < 5 {
8698                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8699                _next_ordinal_to_read += 1;
8700                next_offset += envelope_size;
8701            }
8702
8703            let next_out_of_line = decoder.next_out_of_line();
8704            let handles_before = decoder.remaining_handles();
8705            if let Some((inlined, num_bytes, num_handles)) =
8706                fidl::encoding::decode_envelope_header(decoder, next_offset)?
8707            {
8708                let member_inline_size =
8709                    <BrEdrSecurityMode as fidl::encoding::TypeMarker>::inline_size(decoder.context);
8710                if inlined != (member_inline_size <= 4) {
8711                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
8712                }
8713                let inner_offset;
8714                let mut inner_depth = depth.clone();
8715                if inlined {
8716                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8717                    inner_offset = next_offset;
8718                } else {
8719                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8720                    inner_depth.increment()?;
8721                }
8722                let val_ref = self
8723                    .bredr_security_mode
8724                    .get_or_insert_with(|| fidl::new_empty!(BrEdrSecurityMode, D));
8725                fidl::decode!(BrEdrSecurityMode, D, val_ref, decoder, inner_offset, inner_depth)?;
8726                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8727                {
8728                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
8729                }
8730                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8731                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8732                }
8733            }
8734
8735            next_offset += envelope_size;
8736
8737            // Decode the remaining unknown envelopes.
8738            while next_offset < end_offset {
8739                _next_ordinal_to_read += 1;
8740                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8741                next_offset += envelope_size;
8742            }
8743
8744            Ok(())
8745        }
8746    }
8747
8748    impl fidl::encoding::ValueTypeMarker for PairingProperties {
8749        type Borrowed<'a> = &'a Self;
8750        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
8751            value
8752        }
8753    }
8754
8755    unsafe impl fidl::encoding::TypeMarker for PairingProperties {
8756        type Owned = Self;
8757
8758        #[inline(always)]
8759        fn inline_align(_context: fidl::encoding::Context) -> usize {
8760            8
8761        }
8762
8763        #[inline(always)]
8764        fn inline_size(_context: fidl::encoding::Context) -> usize {
8765            16
8766        }
8767    }
8768
8769    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<PairingProperties, D>
8770        for &PairingProperties
8771    {
8772        #[inline]
8773        unsafe fn encode(
8774            self,
8775            encoder: &mut fidl::encoding::Encoder<'_, D>,
8776            offset: usize,
8777            _depth: fidl::encoding::Depth,
8778        ) -> fidl::Result<()> {
8779            encoder.debug_check_bounds::<PairingProperties>(offset);
8780            encoder.write_num::<u64>(self.ordinal(), offset);
8781            match self {
8782                PairingProperties::Consent(ref val) => {
8783                    fidl::encoding::encode_in_envelope::<Consent, D>(
8784                        <Consent as fidl::encoding::ValueTypeMarker>::borrow(val),
8785                        encoder,
8786                        offset + 8,
8787                        _depth,
8788                    )
8789                }
8790                PairingProperties::PasskeyDisplay(ref val) => {
8791                    fidl::encoding::encode_in_envelope::<u32, D>(
8792                        <u32 as fidl::encoding::ValueTypeMarker>::borrow(val),
8793                        encoder,
8794                        offset + 8,
8795                        _depth,
8796                    )
8797                }
8798                PairingProperties::PasskeyConfirmation(ref val) => {
8799                    fidl::encoding::encode_in_envelope::<u32, D>(
8800                        <u32 as fidl::encoding::ValueTypeMarker>::borrow(val),
8801                        encoder,
8802                        offset + 8,
8803                        _depth,
8804                    )
8805                }
8806                PairingProperties::PasskeyEntry(ref val) => {
8807                    fidl::encoding::encode_in_envelope::<PasskeyEntry, D>(
8808                        <PasskeyEntry as fidl::encoding::ValueTypeMarker>::borrow(val),
8809                        encoder,
8810                        offset + 8,
8811                        _depth,
8812                    )
8813                }
8814                PairingProperties::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
8815            }
8816        }
8817    }
8818
8819    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for PairingProperties {
8820        #[inline(always)]
8821        fn new_empty() -> Self {
8822            Self::__SourceBreaking { unknown_ordinal: 0 }
8823        }
8824
8825        #[inline]
8826        unsafe fn decode(
8827            &mut self,
8828            decoder: &mut fidl::encoding::Decoder<'_, D>,
8829            offset: usize,
8830            mut depth: fidl::encoding::Depth,
8831        ) -> fidl::Result<()> {
8832            decoder.debug_check_bounds::<Self>(offset);
8833            #[allow(unused_variables)]
8834            let next_out_of_line = decoder.next_out_of_line();
8835            let handles_before = decoder.remaining_handles();
8836            let (ordinal, inlined, num_bytes, num_handles) =
8837                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
8838
8839            let member_inline_size = match ordinal {
8840                1 => <Consent as fidl::encoding::TypeMarker>::inline_size(decoder.context),
8841                2 => <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context),
8842                3 => <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context),
8843                4 => <PasskeyEntry as fidl::encoding::TypeMarker>::inline_size(decoder.context),
8844                0 => return Err(fidl::Error::UnknownUnionTag),
8845                _ => num_bytes as usize,
8846            };
8847
8848            if inlined != (member_inline_size <= 4) {
8849                return Err(fidl::Error::InvalidInlineBitInEnvelope);
8850            }
8851            let _inner_offset;
8852            if inlined {
8853                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
8854                _inner_offset = offset + 8;
8855            } else {
8856                depth.increment()?;
8857                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8858            }
8859            match ordinal {
8860                1 => {
8861                    #[allow(irrefutable_let_patterns)]
8862                    if let PairingProperties::Consent(_) = self {
8863                        // Do nothing, read the value into the object
8864                    } else {
8865                        // Initialize `self` to the right variant
8866                        *self = PairingProperties::Consent(fidl::new_empty!(Consent, D));
8867                    }
8868                    #[allow(irrefutable_let_patterns)]
8869                    if let PairingProperties::Consent(ref mut val) = self {
8870                        fidl::decode!(Consent, D, val, decoder, _inner_offset, depth)?;
8871                    } else {
8872                        unreachable!()
8873                    }
8874                }
8875                2 => {
8876                    #[allow(irrefutable_let_patterns)]
8877                    if let PairingProperties::PasskeyDisplay(_) = self {
8878                        // Do nothing, read the value into the object
8879                    } else {
8880                        // Initialize `self` to the right variant
8881                        *self = PairingProperties::PasskeyDisplay(fidl::new_empty!(u32, D));
8882                    }
8883                    #[allow(irrefutable_let_patterns)]
8884                    if let PairingProperties::PasskeyDisplay(ref mut val) = self {
8885                        fidl::decode!(u32, D, val, decoder, _inner_offset, depth)?;
8886                    } else {
8887                        unreachable!()
8888                    }
8889                }
8890                3 => {
8891                    #[allow(irrefutable_let_patterns)]
8892                    if let PairingProperties::PasskeyConfirmation(_) = self {
8893                        // Do nothing, read the value into the object
8894                    } else {
8895                        // Initialize `self` to the right variant
8896                        *self = PairingProperties::PasskeyConfirmation(fidl::new_empty!(u32, D));
8897                    }
8898                    #[allow(irrefutable_let_patterns)]
8899                    if let PairingProperties::PasskeyConfirmation(ref mut val) = self {
8900                        fidl::decode!(u32, D, val, decoder, _inner_offset, depth)?;
8901                    } else {
8902                        unreachable!()
8903                    }
8904                }
8905                4 => {
8906                    #[allow(irrefutable_let_patterns)]
8907                    if let PairingProperties::PasskeyEntry(_) = self {
8908                        // Do nothing, read the value into the object
8909                    } else {
8910                        // Initialize `self` to the right variant
8911                        *self = PairingProperties::PasskeyEntry(fidl::new_empty!(PasskeyEntry, D));
8912                    }
8913                    #[allow(irrefutable_let_patterns)]
8914                    if let PairingProperties::PasskeyEntry(ref mut val) = self {
8915                        fidl::decode!(PasskeyEntry, D, val, decoder, _inner_offset, depth)?;
8916                    } else {
8917                        unreachable!()
8918                    }
8919                }
8920                #[allow(deprecated)]
8921                ordinal => {
8922                    for _ in 0..num_handles {
8923                        decoder.drop_next_handle()?;
8924                    }
8925                    *self = PairingProperties::__SourceBreaking { unknown_ordinal: ordinal };
8926                }
8927            }
8928            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
8929                return Err(fidl::Error::InvalidNumBytesInEnvelope);
8930            }
8931            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8932                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8933            }
8934            Ok(())
8935        }
8936    }
8937}