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__common::PeerId,
374}
375
376impl fidl::Persistable for AccessConnectRequest {}
377
378#[derive(Clone, Debug, PartialEq)]
379pub struct AccessDisconnectRequest {
380    pub id: fidl_fuchsia_bluetooth__common::PeerId,
381}
382
383impl fidl::Persistable for AccessDisconnectRequest {}
384
385#[derive(Clone, Debug, PartialEq)]
386pub struct AccessForgetRequest {
387    pub id: fidl_fuchsia_bluetooth__common::PeerId,
388}
389
390impl fidl::Persistable for AccessForgetRequest {}
391
392#[derive(Clone, Debug, PartialEq)]
393pub struct AccessPairRequest {
394    pub id: fidl_fuchsia_bluetooth__common::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__common::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__common::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__common::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__common::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__common::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__common::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__common::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__common::PeerId>,
593    /// The local Bluetooth identity address that this bond is associated with.
594    pub local_address: Option<fidl_fuchsia_bluetooth__common::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__common::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__common::ConnectionRole>,
615    /// Known service UUIDs obtained from EIR data or SDP.
616    pub services: Option<Vec<fidl_fuchsia_bluetooth__common::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__common::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__common::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__common::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__common::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__common::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__common::Appearance>,
791    /// The class of device for this device, if known.
792    pub device_class: Option<fidl_fuchsia_bluetooth__common::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__common::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__common::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__common::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                (
1702                    <fidl_fuchsia_bluetooth__common::PeerId as fidl::encoding::ValueTypeMarker>::borrow(&self.id),
1703                ),
1704                encoder, offset, _depth
1705            )
1706        }
1707    }
1708    unsafe impl<
1709            D: fidl::encoding::ResourceDialect,
1710            T0: fidl::encoding::Encode<fidl_fuchsia_bluetooth__common::PeerId, D>,
1711        > fidl::encoding::Encode<AccessConnectRequest, D> for (T0,)
1712    {
1713        #[inline]
1714        unsafe fn encode(
1715            self,
1716            encoder: &mut fidl::encoding::Encoder<'_, D>,
1717            offset: usize,
1718            depth: fidl::encoding::Depth,
1719        ) -> fidl::Result<()> {
1720            encoder.debug_check_bounds::<AccessConnectRequest>(offset);
1721            // Zero out padding regions. There's no need to apply masks
1722            // because the unmasked parts will be overwritten by fields.
1723            // Write the fields.
1724            self.0.encode(encoder, offset + 0, depth)?;
1725            Ok(())
1726        }
1727    }
1728
1729    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for AccessConnectRequest {
1730        #[inline(always)]
1731        fn new_empty() -> Self {
1732            Self { id: fidl::new_empty!(fidl_fuchsia_bluetooth__common::PeerId, D) }
1733        }
1734
1735        #[inline]
1736        unsafe fn decode(
1737            &mut self,
1738            decoder: &mut fidl::encoding::Decoder<'_, D>,
1739            offset: usize,
1740            _depth: fidl::encoding::Depth,
1741        ) -> fidl::Result<()> {
1742            decoder.debug_check_bounds::<Self>(offset);
1743            // Verify that padding bytes are zero.
1744            fidl::decode!(
1745                fidl_fuchsia_bluetooth__common::PeerId,
1746                D,
1747                &mut self.id,
1748                decoder,
1749                offset + 0,
1750                _depth
1751            )?;
1752            Ok(())
1753        }
1754    }
1755
1756    impl fidl::encoding::ValueTypeMarker for AccessDisconnectRequest {
1757        type Borrowed<'a> = &'a Self;
1758        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1759            value
1760        }
1761    }
1762
1763    unsafe impl fidl::encoding::TypeMarker for AccessDisconnectRequest {
1764        type Owned = Self;
1765
1766        #[inline(always)]
1767        fn inline_align(_context: fidl::encoding::Context) -> usize {
1768            8
1769        }
1770
1771        #[inline(always)]
1772        fn inline_size(_context: fidl::encoding::Context) -> usize {
1773            8
1774        }
1775    }
1776
1777    unsafe impl<D: fidl::encoding::ResourceDialect>
1778        fidl::encoding::Encode<AccessDisconnectRequest, D> for &AccessDisconnectRequest
1779    {
1780        #[inline]
1781        unsafe fn encode(
1782            self,
1783            encoder: &mut fidl::encoding::Encoder<'_, D>,
1784            offset: usize,
1785            _depth: fidl::encoding::Depth,
1786        ) -> fidl::Result<()> {
1787            encoder.debug_check_bounds::<AccessDisconnectRequest>(offset);
1788            // Delegate to tuple encoding.
1789            fidl::encoding::Encode::<AccessDisconnectRequest, D>::encode(
1790                (
1791                    <fidl_fuchsia_bluetooth__common::PeerId as fidl::encoding::ValueTypeMarker>::borrow(&self.id),
1792                ),
1793                encoder, offset, _depth
1794            )
1795        }
1796    }
1797    unsafe impl<
1798            D: fidl::encoding::ResourceDialect,
1799            T0: fidl::encoding::Encode<fidl_fuchsia_bluetooth__common::PeerId, D>,
1800        > fidl::encoding::Encode<AccessDisconnectRequest, D> for (T0,)
1801    {
1802        #[inline]
1803        unsafe fn encode(
1804            self,
1805            encoder: &mut fidl::encoding::Encoder<'_, D>,
1806            offset: usize,
1807            depth: fidl::encoding::Depth,
1808        ) -> fidl::Result<()> {
1809            encoder.debug_check_bounds::<AccessDisconnectRequest>(offset);
1810            // Zero out padding regions. There's no need to apply masks
1811            // because the unmasked parts will be overwritten by fields.
1812            // Write the fields.
1813            self.0.encode(encoder, offset + 0, depth)?;
1814            Ok(())
1815        }
1816    }
1817
1818    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1819        for AccessDisconnectRequest
1820    {
1821        #[inline(always)]
1822        fn new_empty() -> Self {
1823            Self { id: fidl::new_empty!(fidl_fuchsia_bluetooth__common::PeerId, D) }
1824        }
1825
1826        #[inline]
1827        unsafe fn decode(
1828            &mut self,
1829            decoder: &mut fidl::encoding::Decoder<'_, D>,
1830            offset: usize,
1831            _depth: fidl::encoding::Depth,
1832        ) -> fidl::Result<()> {
1833            decoder.debug_check_bounds::<Self>(offset);
1834            // Verify that padding bytes are zero.
1835            fidl::decode!(
1836                fidl_fuchsia_bluetooth__common::PeerId,
1837                D,
1838                &mut self.id,
1839                decoder,
1840                offset + 0,
1841                _depth
1842            )?;
1843            Ok(())
1844        }
1845    }
1846
1847    impl fidl::encoding::ValueTypeMarker for AccessForgetRequest {
1848        type Borrowed<'a> = &'a Self;
1849        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1850            value
1851        }
1852    }
1853
1854    unsafe impl fidl::encoding::TypeMarker for AccessForgetRequest {
1855        type Owned = Self;
1856
1857        #[inline(always)]
1858        fn inline_align(_context: fidl::encoding::Context) -> usize {
1859            8
1860        }
1861
1862        #[inline(always)]
1863        fn inline_size(_context: fidl::encoding::Context) -> usize {
1864            8
1865        }
1866    }
1867
1868    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<AccessForgetRequest, D>
1869        for &AccessForgetRequest
1870    {
1871        #[inline]
1872        unsafe fn encode(
1873            self,
1874            encoder: &mut fidl::encoding::Encoder<'_, D>,
1875            offset: usize,
1876            _depth: fidl::encoding::Depth,
1877        ) -> fidl::Result<()> {
1878            encoder.debug_check_bounds::<AccessForgetRequest>(offset);
1879            // Delegate to tuple encoding.
1880            fidl::encoding::Encode::<AccessForgetRequest, D>::encode(
1881                (
1882                    <fidl_fuchsia_bluetooth__common::PeerId as fidl::encoding::ValueTypeMarker>::borrow(&self.id),
1883                ),
1884                encoder, offset, _depth
1885            )
1886        }
1887    }
1888    unsafe impl<
1889            D: fidl::encoding::ResourceDialect,
1890            T0: fidl::encoding::Encode<fidl_fuchsia_bluetooth__common::PeerId, D>,
1891        > fidl::encoding::Encode<AccessForgetRequest, D> for (T0,)
1892    {
1893        #[inline]
1894        unsafe fn encode(
1895            self,
1896            encoder: &mut fidl::encoding::Encoder<'_, D>,
1897            offset: usize,
1898            depth: fidl::encoding::Depth,
1899        ) -> fidl::Result<()> {
1900            encoder.debug_check_bounds::<AccessForgetRequest>(offset);
1901            // Zero out padding regions. There's no need to apply masks
1902            // because the unmasked parts will be overwritten by fields.
1903            // Write the fields.
1904            self.0.encode(encoder, offset + 0, depth)?;
1905            Ok(())
1906        }
1907    }
1908
1909    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for AccessForgetRequest {
1910        #[inline(always)]
1911        fn new_empty() -> Self {
1912            Self { id: fidl::new_empty!(fidl_fuchsia_bluetooth__common::PeerId, D) }
1913        }
1914
1915        #[inline]
1916        unsafe fn decode(
1917            &mut self,
1918            decoder: &mut fidl::encoding::Decoder<'_, D>,
1919            offset: usize,
1920            _depth: fidl::encoding::Depth,
1921        ) -> fidl::Result<()> {
1922            decoder.debug_check_bounds::<Self>(offset);
1923            // Verify that padding bytes are zero.
1924            fidl::decode!(
1925                fidl_fuchsia_bluetooth__common::PeerId,
1926                D,
1927                &mut self.id,
1928                decoder,
1929                offset + 0,
1930                _depth
1931            )?;
1932            Ok(())
1933        }
1934    }
1935
1936    impl fidl::encoding::ValueTypeMarker for AccessPairRequest {
1937        type Borrowed<'a> = &'a Self;
1938        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1939            value
1940        }
1941    }
1942
1943    unsafe impl fidl::encoding::TypeMarker for AccessPairRequest {
1944        type Owned = Self;
1945
1946        #[inline(always)]
1947        fn inline_align(_context: fidl::encoding::Context) -> usize {
1948            8
1949        }
1950
1951        #[inline(always)]
1952        fn inline_size(_context: fidl::encoding::Context) -> usize {
1953            24
1954        }
1955    }
1956
1957    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<AccessPairRequest, D>
1958        for &AccessPairRequest
1959    {
1960        #[inline]
1961        unsafe fn encode(
1962            self,
1963            encoder: &mut fidl::encoding::Encoder<'_, D>,
1964            offset: usize,
1965            _depth: fidl::encoding::Depth,
1966        ) -> fidl::Result<()> {
1967            encoder.debug_check_bounds::<AccessPairRequest>(offset);
1968            // Delegate to tuple encoding.
1969            fidl::encoding::Encode::<AccessPairRequest, D>::encode(
1970                (
1971                    <fidl_fuchsia_bluetooth__common::PeerId as fidl::encoding::ValueTypeMarker>::borrow(&self.id),
1972                    <PairingOptions as fidl::encoding::ValueTypeMarker>::borrow(&self.options),
1973                ),
1974                encoder, offset, _depth
1975            )
1976        }
1977    }
1978    unsafe impl<
1979            D: fidl::encoding::ResourceDialect,
1980            T0: fidl::encoding::Encode<fidl_fuchsia_bluetooth__common::PeerId, D>,
1981            T1: fidl::encoding::Encode<PairingOptions, D>,
1982        > fidl::encoding::Encode<AccessPairRequest, D> for (T0, T1)
1983    {
1984        #[inline]
1985        unsafe fn encode(
1986            self,
1987            encoder: &mut fidl::encoding::Encoder<'_, D>,
1988            offset: usize,
1989            depth: fidl::encoding::Depth,
1990        ) -> fidl::Result<()> {
1991            encoder.debug_check_bounds::<AccessPairRequest>(offset);
1992            // Zero out padding regions. There's no need to apply masks
1993            // because the unmasked parts will be overwritten by fields.
1994            // Write the fields.
1995            self.0.encode(encoder, offset + 0, depth)?;
1996            self.1.encode(encoder, offset + 8, depth)?;
1997            Ok(())
1998        }
1999    }
2000
2001    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for AccessPairRequest {
2002        #[inline(always)]
2003        fn new_empty() -> Self {
2004            Self {
2005                id: fidl::new_empty!(fidl_fuchsia_bluetooth__common::PeerId, D),
2006                options: fidl::new_empty!(PairingOptions, D),
2007            }
2008        }
2009
2010        #[inline]
2011        unsafe fn decode(
2012            &mut self,
2013            decoder: &mut fidl::encoding::Decoder<'_, D>,
2014            offset: usize,
2015            _depth: fidl::encoding::Depth,
2016        ) -> fidl::Result<()> {
2017            decoder.debug_check_bounds::<Self>(offset);
2018            // Verify that padding bytes are zero.
2019            fidl::decode!(
2020                fidl_fuchsia_bluetooth__common::PeerId,
2021                D,
2022                &mut self.id,
2023                decoder,
2024                offset + 0,
2025                _depth
2026            )?;
2027            fidl::decode!(PairingOptions, D, &mut self.options, decoder, offset + 8, _depth)?;
2028            Ok(())
2029        }
2030    }
2031
2032    impl fidl::encoding::ValueTypeMarker for AccessSetDeviceClassRequest {
2033        type Borrowed<'a> = &'a Self;
2034        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2035            value
2036        }
2037    }
2038
2039    unsafe impl fidl::encoding::TypeMarker for AccessSetDeviceClassRequest {
2040        type Owned = Self;
2041
2042        #[inline(always)]
2043        fn inline_align(_context: fidl::encoding::Context) -> usize {
2044            4
2045        }
2046
2047        #[inline(always)]
2048        fn inline_size(_context: fidl::encoding::Context) -> usize {
2049            4
2050        }
2051    }
2052
2053    unsafe impl<D: fidl::encoding::ResourceDialect>
2054        fidl::encoding::Encode<AccessSetDeviceClassRequest, D> for &AccessSetDeviceClassRequest
2055    {
2056        #[inline]
2057        unsafe fn encode(
2058            self,
2059            encoder: &mut fidl::encoding::Encoder<'_, D>,
2060            offset: usize,
2061            _depth: fidl::encoding::Depth,
2062        ) -> fidl::Result<()> {
2063            encoder.debug_check_bounds::<AccessSetDeviceClassRequest>(offset);
2064            // Delegate to tuple encoding.
2065            fidl::encoding::Encode::<AccessSetDeviceClassRequest, D>::encode(
2066                (
2067                    <fidl_fuchsia_bluetooth__common::DeviceClass as fidl::encoding::ValueTypeMarker>::borrow(&self.device_class),
2068                ),
2069                encoder, offset, _depth
2070            )
2071        }
2072    }
2073    unsafe impl<
2074            D: fidl::encoding::ResourceDialect,
2075            T0: fidl::encoding::Encode<fidl_fuchsia_bluetooth__common::DeviceClass, D>,
2076        > fidl::encoding::Encode<AccessSetDeviceClassRequest, D> for (T0,)
2077    {
2078        #[inline]
2079        unsafe fn encode(
2080            self,
2081            encoder: &mut fidl::encoding::Encoder<'_, D>,
2082            offset: usize,
2083            depth: fidl::encoding::Depth,
2084        ) -> fidl::Result<()> {
2085            encoder.debug_check_bounds::<AccessSetDeviceClassRequest>(offset);
2086            // Zero out padding regions. There's no need to apply masks
2087            // because the unmasked parts will be overwritten by fields.
2088            // Write the fields.
2089            self.0.encode(encoder, offset + 0, depth)?;
2090            Ok(())
2091        }
2092    }
2093
2094    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2095        for AccessSetDeviceClassRequest
2096    {
2097        #[inline(always)]
2098        fn new_empty() -> Self {
2099            Self { device_class: fidl::new_empty!(fidl_fuchsia_bluetooth__common::DeviceClass, D) }
2100        }
2101
2102        #[inline]
2103        unsafe fn decode(
2104            &mut self,
2105            decoder: &mut fidl::encoding::Decoder<'_, D>,
2106            offset: usize,
2107            _depth: fidl::encoding::Depth,
2108        ) -> fidl::Result<()> {
2109            decoder.debug_check_bounds::<Self>(offset);
2110            // Verify that padding bytes are zero.
2111            fidl::decode!(
2112                fidl_fuchsia_bluetooth__common::DeviceClass,
2113                D,
2114                &mut self.device_class,
2115                decoder,
2116                offset + 0,
2117                _depth
2118            )?;
2119            Ok(())
2120        }
2121    }
2122
2123    impl fidl::encoding::ValueTypeMarker for AccessSetLocalNameRequest {
2124        type Borrowed<'a> = &'a Self;
2125        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2126            value
2127        }
2128    }
2129
2130    unsafe impl fidl::encoding::TypeMarker for AccessSetLocalNameRequest {
2131        type Owned = Self;
2132
2133        #[inline(always)]
2134        fn inline_align(_context: fidl::encoding::Context) -> usize {
2135            8
2136        }
2137
2138        #[inline(always)]
2139        fn inline_size(_context: fidl::encoding::Context) -> usize {
2140            16
2141        }
2142    }
2143
2144    unsafe impl<D: fidl::encoding::ResourceDialect>
2145        fidl::encoding::Encode<AccessSetLocalNameRequest, D> for &AccessSetLocalNameRequest
2146    {
2147        #[inline]
2148        unsafe fn encode(
2149            self,
2150            encoder: &mut fidl::encoding::Encoder<'_, D>,
2151            offset: usize,
2152            _depth: fidl::encoding::Depth,
2153        ) -> fidl::Result<()> {
2154            encoder.debug_check_bounds::<AccessSetLocalNameRequest>(offset);
2155            // Delegate to tuple encoding.
2156            fidl::encoding::Encode::<AccessSetLocalNameRequest, D>::encode(
2157                (<fidl::encoding::BoundedString<248> as fidl::encoding::ValueTypeMarker>::borrow(
2158                    &self.name,
2159                ),),
2160                encoder,
2161                offset,
2162                _depth,
2163            )
2164        }
2165    }
2166    unsafe impl<
2167            D: fidl::encoding::ResourceDialect,
2168            T0: fidl::encoding::Encode<fidl::encoding::BoundedString<248>, D>,
2169        > fidl::encoding::Encode<AccessSetLocalNameRequest, D> for (T0,)
2170    {
2171        #[inline]
2172        unsafe fn encode(
2173            self,
2174            encoder: &mut fidl::encoding::Encoder<'_, D>,
2175            offset: usize,
2176            depth: fidl::encoding::Depth,
2177        ) -> fidl::Result<()> {
2178            encoder.debug_check_bounds::<AccessSetLocalNameRequest>(offset);
2179            // Zero out padding regions. There's no need to apply masks
2180            // because the unmasked parts will be overwritten by fields.
2181            // Write the fields.
2182            self.0.encode(encoder, offset + 0, depth)?;
2183            Ok(())
2184        }
2185    }
2186
2187    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2188        for AccessSetLocalNameRequest
2189    {
2190        #[inline(always)]
2191        fn new_empty() -> Self {
2192            Self { name: fidl::new_empty!(fidl::encoding::BoundedString<248>, D) }
2193        }
2194
2195        #[inline]
2196        unsafe fn decode(
2197            &mut self,
2198            decoder: &mut fidl::encoding::Decoder<'_, D>,
2199            offset: usize,
2200            _depth: fidl::encoding::Depth,
2201        ) -> fidl::Result<()> {
2202            decoder.debug_check_bounds::<Self>(offset);
2203            // Verify that padding bytes are zero.
2204            fidl::decode!(
2205                fidl::encoding::BoundedString<248>,
2206                D,
2207                &mut self.name,
2208                decoder,
2209                offset + 0,
2210                _depth
2211            )?;
2212            Ok(())
2213        }
2214    }
2215
2216    impl fidl::encoding::ValueTypeMarker for AccessWatchPeersResponse {
2217        type Borrowed<'a> = &'a Self;
2218        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2219            value
2220        }
2221    }
2222
2223    unsafe impl fidl::encoding::TypeMarker for AccessWatchPeersResponse {
2224        type Owned = Self;
2225
2226        #[inline(always)]
2227        fn inline_align(_context: fidl::encoding::Context) -> usize {
2228            8
2229        }
2230
2231        #[inline(always)]
2232        fn inline_size(_context: fidl::encoding::Context) -> usize {
2233            32
2234        }
2235    }
2236
2237    unsafe impl<D: fidl::encoding::ResourceDialect>
2238        fidl::encoding::Encode<AccessWatchPeersResponse, D> for &AccessWatchPeersResponse
2239    {
2240        #[inline]
2241        unsafe fn encode(
2242            self,
2243            encoder: &mut fidl::encoding::Encoder<'_, D>,
2244            offset: usize,
2245            _depth: fidl::encoding::Depth,
2246        ) -> fidl::Result<()> {
2247            encoder.debug_check_bounds::<AccessWatchPeersResponse>(offset);
2248            // Delegate to tuple encoding.
2249            fidl::encoding::Encode::<AccessWatchPeersResponse, D>::encode(
2250                (
2251                    <fidl::encoding::UnboundedVector<Peer> as fidl::encoding::ValueTypeMarker>::borrow(&self.updated),
2252                    <fidl::encoding::UnboundedVector<fidl_fuchsia_bluetooth__common::PeerId> as fidl::encoding::ValueTypeMarker>::borrow(&self.removed),
2253                ),
2254                encoder, offset, _depth
2255            )
2256        }
2257    }
2258    unsafe impl<
2259            D: fidl::encoding::ResourceDialect,
2260            T0: fidl::encoding::Encode<fidl::encoding::UnboundedVector<Peer>, D>,
2261            T1: fidl::encoding::Encode<
2262                fidl::encoding::UnboundedVector<fidl_fuchsia_bluetooth__common::PeerId>,
2263                D,
2264            >,
2265        > fidl::encoding::Encode<AccessWatchPeersResponse, D> for (T0, T1)
2266    {
2267        #[inline]
2268        unsafe fn encode(
2269            self,
2270            encoder: &mut fidl::encoding::Encoder<'_, D>,
2271            offset: usize,
2272            depth: fidl::encoding::Depth,
2273        ) -> fidl::Result<()> {
2274            encoder.debug_check_bounds::<AccessWatchPeersResponse>(offset);
2275            // Zero out padding regions. There's no need to apply masks
2276            // because the unmasked parts will be overwritten by fields.
2277            // Write the fields.
2278            self.0.encode(encoder, offset + 0, depth)?;
2279            self.1.encode(encoder, offset + 16, depth)?;
2280            Ok(())
2281        }
2282    }
2283
2284    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2285        for AccessWatchPeersResponse
2286    {
2287        #[inline(always)]
2288        fn new_empty() -> Self {
2289            Self {
2290                updated: fidl::new_empty!(fidl::encoding::UnboundedVector<Peer>, D),
2291                removed: fidl::new_empty!(
2292                    fidl::encoding::UnboundedVector<fidl_fuchsia_bluetooth__common::PeerId>,
2293                    D
2294                ),
2295            }
2296        }
2297
2298        #[inline]
2299        unsafe fn decode(
2300            &mut self,
2301            decoder: &mut fidl::encoding::Decoder<'_, D>,
2302            offset: usize,
2303            _depth: fidl::encoding::Depth,
2304        ) -> fidl::Result<()> {
2305            decoder.debug_check_bounds::<Self>(offset);
2306            // Verify that padding bytes are zero.
2307            fidl::decode!(
2308                fidl::encoding::UnboundedVector<Peer>,
2309                D,
2310                &mut self.updated,
2311                decoder,
2312                offset + 0,
2313                _depth
2314            )?;
2315            fidl::decode!(
2316                fidl::encoding::UnboundedVector<fidl_fuchsia_bluetooth__common::PeerId>,
2317                D,
2318                &mut self.removed,
2319                decoder,
2320                offset + 16,
2321                _depth
2322            )?;
2323            Ok(())
2324        }
2325    }
2326
2327    impl fidl::encoding::ValueTypeMarker for BootstrapAddIdentitiesRequest {
2328        type Borrowed<'a> = &'a Self;
2329        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2330            value
2331        }
2332    }
2333
2334    unsafe impl fidl::encoding::TypeMarker for BootstrapAddIdentitiesRequest {
2335        type Owned = Self;
2336
2337        #[inline(always)]
2338        fn inline_align(_context: fidl::encoding::Context) -> usize {
2339            8
2340        }
2341
2342        #[inline(always)]
2343        fn inline_size(_context: fidl::encoding::Context) -> usize {
2344            16
2345        }
2346    }
2347
2348    unsafe impl<D: fidl::encoding::ResourceDialect>
2349        fidl::encoding::Encode<BootstrapAddIdentitiesRequest, D>
2350        for &BootstrapAddIdentitiesRequest
2351    {
2352        #[inline]
2353        unsafe fn encode(
2354            self,
2355            encoder: &mut fidl::encoding::Encoder<'_, D>,
2356            offset: usize,
2357            _depth: fidl::encoding::Depth,
2358        ) -> fidl::Result<()> {
2359            encoder.debug_check_bounds::<BootstrapAddIdentitiesRequest>(offset);
2360            // Delegate to tuple encoding.
2361            fidl::encoding::Encode::<BootstrapAddIdentitiesRequest, D>::encode(
2362                (
2363                    <fidl::encoding::UnboundedVector<Identity> as fidl::encoding::ValueTypeMarker>::borrow(&self.identities),
2364                ),
2365                encoder, offset, _depth
2366            )
2367        }
2368    }
2369    unsafe impl<
2370            D: fidl::encoding::ResourceDialect,
2371            T0: fidl::encoding::Encode<fidl::encoding::UnboundedVector<Identity>, D>,
2372        > fidl::encoding::Encode<BootstrapAddIdentitiesRequest, D> for (T0,)
2373    {
2374        #[inline]
2375        unsafe fn encode(
2376            self,
2377            encoder: &mut fidl::encoding::Encoder<'_, D>,
2378            offset: usize,
2379            depth: fidl::encoding::Depth,
2380        ) -> fidl::Result<()> {
2381            encoder.debug_check_bounds::<BootstrapAddIdentitiesRequest>(offset);
2382            // Zero out padding regions. There's no need to apply masks
2383            // because the unmasked parts will be overwritten by fields.
2384            // Write the fields.
2385            self.0.encode(encoder, offset + 0, depth)?;
2386            Ok(())
2387        }
2388    }
2389
2390    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2391        for BootstrapAddIdentitiesRequest
2392    {
2393        #[inline(always)]
2394        fn new_empty() -> Self {
2395            Self { identities: fidl::new_empty!(fidl::encoding::UnboundedVector<Identity>, D) }
2396        }
2397
2398        #[inline]
2399        unsafe fn decode(
2400            &mut self,
2401            decoder: &mut fidl::encoding::Decoder<'_, D>,
2402            offset: usize,
2403            _depth: fidl::encoding::Depth,
2404        ) -> fidl::Result<()> {
2405            decoder.debug_check_bounds::<Self>(offset);
2406            // Verify that padding bytes are zero.
2407            fidl::decode!(
2408                fidl::encoding::UnboundedVector<Identity>,
2409                D,
2410                &mut self.identities,
2411                decoder,
2412                offset + 0,
2413                _depth
2414            )?;
2415            Ok(())
2416        }
2417    }
2418
2419    impl fidl::encoding::ValueTypeMarker for ConfigurationUpdateRequest {
2420        type Borrowed<'a> = &'a Self;
2421        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2422            value
2423        }
2424    }
2425
2426    unsafe impl fidl::encoding::TypeMarker for ConfigurationUpdateRequest {
2427        type Owned = Self;
2428
2429        #[inline(always)]
2430        fn inline_align(_context: fidl::encoding::Context) -> usize {
2431            8
2432        }
2433
2434        #[inline(always)]
2435        fn inline_size(_context: fidl::encoding::Context) -> usize {
2436            16
2437        }
2438    }
2439
2440    unsafe impl<D: fidl::encoding::ResourceDialect>
2441        fidl::encoding::Encode<ConfigurationUpdateRequest, D> for &ConfigurationUpdateRequest
2442    {
2443        #[inline]
2444        unsafe fn encode(
2445            self,
2446            encoder: &mut fidl::encoding::Encoder<'_, D>,
2447            offset: usize,
2448            _depth: fidl::encoding::Depth,
2449        ) -> fidl::Result<()> {
2450            encoder.debug_check_bounds::<ConfigurationUpdateRequest>(offset);
2451            // Delegate to tuple encoding.
2452            fidl::encoding::Encode::<ConfigurationUpdateRequest, D>::encode(
2453                (<Settings as fidl::encoding::ValueTypeMarker>::borrow(&self.settings),),
2454                encoder,
2455                offset,
2456                _depth,
2457            )
2458        }
2459    }
2460    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<Settings, D>>
2461        fidl::encoding::Encode<ConfigurationUpdateRequest, D> for (T0,)
2462    {
2463        #[inline]
2464        unsafe fn encode(
2465            self,
2466            encoder: &mut fidl::encoding::Encoder<'_, D>,
2467            offset: usize,
2468            depth: fidl::encoding::Depth,
2469        ) -> fidl::Result<()> {
2470            encoder.debug_check_bounds::<ConfigurationUpdateRequest>(offset);
2471            // Zero out padding regions. There's no need to apply masks
2472            // because the unmasked parts will be overwritten by fields.
2473            // Write the fields.
2474            self.0.encode(encoder, offset + 0, depth)?;
2475            Ok(())
2476        }
2477    }
2478
2479    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2480        for ConfigurationUpdateRequest
2481    {
2482        #[inline(always)]
2483        fn new_empty() -> Self {
2484            Self { settings: fidl::new_empty!(Settings, D) }
2485        }
2486
2487        #[inline]
2488        unsafe fn decode(
2489            &mut self,
2490            decoder: &mut fidl::encoding::Decoder<'_, D>,
2491            offset: usize,
2492            _depth: fidl::encoding::Depth,
2493        ) -> fidl::Result<()> {
2494            decoder.debug_check_bounds::<Self>(offset);
2495            // Verify that padding bytes are zero.
2496            fidl::decode!(Settings, D, &mut self.settings, decoder, offset + 0, _depth)?;
2497            Ok(())
2498        }
2499    }
2500
2501    impl fidl::encoding::ValueTypeMarker for ConfigurationUpdateResponse {
2502        type Borrowed<'a> = &'a Self;
2503        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2504            value
2505        }
2506    }
2507
2508    unsafe impl fidl::encoding::TypeMarker for ConfigurationUpdateResponse {
2509        type Owned = Self;
2510
2511        #[inline(always)]
2512        fn inline_align(_context: fidl::encoding::Context) -> usize {
2513            8
2514        }
2515
2516        #[inline(always)]
2517        fn inline_size(_context: fidl::encoding::Context) -> usize {
2518            16
2519        }
2520    }
2521
2522    unsafe impl<D: fidl::encoding::ResourceDialect>
2523        fidl::encoding::Encode<ConfigurationUpdateResponse, D> for &ConfigurationUpdateResponse
2524    {
2525        #[inline]
2526        unsafe fn encode(
2527            self,
2528            encoder: &mut fidl::encoding::Encoder<'_, D>,
2529            offset: usize,
2530            _depth: fidl::encoding::Depth,
2531        ) -> fidl::Result<()> {
2532            encoder.debug_check_bounds::<ConfigurationUpdateResponse>(offset);
2533            // Delegate to tuple encoding.
2534            fidl::encoding::Encode::<ConfigurationUpdateResponse, D>::encode(
2535                (<Settings as fidl::encoding::ValueTypeMarker>::borrow(&self.result),),
2536                encoder,
2537                offset,
2538                _depth,
2539            )
2540        }
2541    }
2542    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<Settings, D>>
2543        fidl::encoding::Encode<ConfigurationUpdateResponse, D> for (T0,)
2544    {
2545        #[inline]
2546        unsafe fn encode(
2547            self,
2548            encoder: &mut fidl::encoding::Encoder<'_, D>,
2549            offset: usize,
2550            depth: fidl::encoding::Depth,
2551        ) -> fidl::Result<()> {
2552            encoder.debug_check_bounds::<ConfigurationUpdateResponse>(offset);
2553            // Zero out padding regions. There's no need to apply masks
2554            // because the unmasked parts will be overwritten by fields.
2555            // Write the fields.
2556            self.0.encode(encoder, offset + 0, depth)?;
2557            Ok(())
2558        }
2559    }
2560
2561    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2562        for ConfigurationUpdateResponse
2563    {
2564        #[inline(always)]
2565        fn new_empty() -> Self {
2566            Self { result: fidl::new_empty!(Settings, D) }
2567        }
2568
2569        #[inline]
2570        unsafe fn decode(
2571            &mut self,
2572            decoder: &mut fidl::encoding::Decoder<'_, D>,
2573            offset: usize,
2574            _depth: fidl::encoding::Depth,
2575        ) -> fidl::Result<()> {
2576            decoder.debug_check_bounds::<Self>(offset);
2577            // Verify that padding bytes are zero.
2578            fidl::decode!(Settings, D, &mut self.result, decoder, offset + 0, _depth)?;
2579            Ok(())
2580        }
2581    }
2582
2583    impl fidl::encoding::ValueTypeMarker for Consent {
2584        type Borrowed<'a> = &'a Self;
2585        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2586            value
2587        }
2588    }
2589
2590    unsafe impl fidl::encoding::TypeMarker for Consent {
2591        type Owned = Self;
2592
2593        #[inline(always)]
2594        fn inline_align(_context: fidl::encoding::Context) -> usize {
2595            1
2596        }
2597
2598        #[inline(always)]
2599        fn inline_size(_context: fidl::encoding::Context) -> usize {
2600            1
2601        }
2602    }
2603
2604    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Consent, D> for &Consent {
2605        #[inline]
2606        unsafe fn encode(
2607            self,
2608            encoder: &mut fidl::encoding::Encoder<'_, D>,
2609            offset: usize,
2610            _depth: fidl::encoding::Depth,
2611        ) -> fidl::Result<()> {
2612            encoder.debug_check_bounds::<Consent>(offset);
2613            encoder.write_num(0u8, offset);
2614            Ok(())
2615        }
2616    }
2617
2618    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Consent {
2619        #[inline(always)]
2620        fn new_empty() -> Self {
2621            Self
2622        }
2623
2624        #[inline]
2625        unsafe fn decode(
2626            &mut self,
2627            decoder: &mut fidl::encoding::Decoder<'_, D>,
2628            offset: usize,
2629            _depth: fidl::encoding::Depth,
2630        ) -> fidl::Result<()> {
2631            decoder.debug_check_bounds::<Self>(offset);
2632            match decoder.read_num::<u8>(offset) {
2633                0 => Ok(()),
2634                _ => Err(fidl::Error::Invalid),
2635            }
2636        }
2637    }
2638
2639    impl fidl::encoding::ValueTypeMarker for HostWatcherSetActiveRequest {
2640        type Borrowed<'a> = &'a Self;
2641        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2642            value
2643        }
2644    }
2645
2646    unsafe impl fidl::encoding::TypeMarker for HostWatcherSetActiveRequest {
2647        type Owned = Self;
2648
2649        #[inline(always)]
2650        fn inline_align(_context: fidl::encoding::Context) -> usize {
2651            8
2652        }
2653
2654        #[inline(always)]
2655        fn inline_size(_context: fidl::encoding::Context) -> usize {
2656            8
2657        }
2658    }
2659
2660    unsafe impl<D: fidl::encoding::ResourceDialect>
2661        fidl::encoding::Encode<HostWatcherSetActiveRequest, D> for &HostWatcherSetActiveRequest
2662    {
2663        #[inline]
2664        unsafe fn encode(
2665            self,
2666            encoder: &mut fidl::encoding::Encoder<'_, D>,
2667            offset: usize,
2668            _depth: fidl::encoding::Depth,
2669        ) -> fidl::Result<()> {
2670            encoder.debug_check_bounds::<HostWatcherSetActiveRequest>(offset);
2671            // Delegate to tuple encoding.
2672            fidl::encoding::Encode::<HostWatcherSetActiveRequest, D>::encode(
2673                (
2674                    <fidl_fuchsia_bluetooth__common::HostId as fidl::encoding::ValueTypeMarker>::borrow(&self.id),
2675                ),
2676                encoder, offset, _depth
2677            )
2678        }
2679    }
2680    unsafe impl<
2681            D: fidl::encoding::ResourceDialect,
2682            T0: fidl::encoding::Encode<fidl_fuchsia_bluetooth__common::HostId, D>,
2683        > fidl::encoding::Encode<HostWatcherSetActiveRequest, D> for (T0,)
2684    {
2685        #[inline]
2686        unsafe fn encode(
2687            self,
2688            encoder: &mut fidl::encoding::Encoder<'_, D>,
2689            offset: usize,
2690            depth: fidl::encoding::Depth,
2691        ) -> fidl::Result<()> {
2692            encoder.debug_check_bounds::<HostWatcherSetActiveRequest>(offset);
2693            // Zero out padding regions. There's no need to apply masks
2694            // because the unmasked parts will be overwritten by fields.
2695            // Write the fields.
2696            self.0.encode(encoder, offset + 0, depth)?;
2697            Ok(())
2698        }
2699    }
2700
2701    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2702        for HostWatcherSetActiveRequest
2703    {
2704        #[inline(always)]
2705        fn new_empty() -> Self {
2706            Self { id: fidl::new_empty!(fidl_fuchsia_bluetooth__common::HostId, D) }
2707        }
2708
2709        #[inline]
2710        unsafe fn decode(
2711            &mut self,
2712            decoder: &mut fidl::encoding::Decoder<'_, D>,
2713            offset: usize,
2714            _depth: fidl::encoding::Depth,
2715        ) -> fidl::Result<()> {
2716            decoder.debug_check_bounds::<Self>(offset);
2717            // Verify that padding bytes are zero.
2718            fidl::decode!(
2719                fidl_fuchsia_bluetooth__common::HostId,
2720                D,
2721                &mut self.id,
2722                decoder,
2723                offset + 0,
2724                _depth
2725            )?;
2726            Ok(())
2727        }
2728    }
2729
2730    impl fidl::encoding::ValueTypeMarker for HostWatcherWatchResponse {
2731        type Borrowed<'a> = &'a Self;
2732        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2733            value
2734        }
2735    }
2736
2737    unsafe impl fidl::encoding::TypeMarker for HostWatcherWatchResponse {
2738        type Owned = Self;
2739
2740        #[inline(always)]
2741        fn inline_align(_context: fidl::encoding::Context) -> usize {
2742            8
2743        }
2744
2745        #[inline(always)]
2746        fn inline_size(_context: fidl::encoding::Context) -> usize {
2747            16
2748        }
2749    }
2750
2751    unsafe impl<D: fidl::encoding::ResourceDialect>
2752        fidl::encoding::Encode<HostWatcherWatchResponse, D> for &HostWatcherWatchResponse
2753    {
2754        #[inline]
2755        unsafe fn encode(
2756            self,
2757            encoder: &mut fidl::encoding::Encoder<'_, D>,
2758            offset: usize,
2759            _depth: fidl::encoding::Depth,
2760        ) -> fidl::Result<()> {
2761            encoder.debug_check_bounds::<HostWatcherWatchResponse>(offset);
2762            // Delegate to tuple encoding.
2763            fidl::encoding::Encode::<HostWatcherWatchResponse, D>::encode(
2764                (
2765                    <fidl::encoding::UnboundedVector<HostInfo> as fidl::encoding::ValueTypeMarker>::borrow(&self.hosts),
2766                ),
2767                encoder, offset, _depth
2768            )
2769        }
2770    }
2771    unsafe impl<
2772            D: fidl::encoding::ResourceDialect,
2773            T0: fidl::encoding::Encode<fidl::encoding::UnboundedVector<HostInfo>, D>,
2774        > fidl::encoding::Encode<HostWatcherWatchResponse, D> for (T0,)
2775    {
2776        #[inline]
2777        unsafe fn encode(
2778            self,
2779            encoder: &mut fidl::encoding::Encoder<'_, D>,
2780            offset: usize,
2781            depth: fidl::encoding::Depth,
2782        ) -> fidl::Result<()> {
2783            encoder.debug_check_bounds::<HostWatcherWatchResponse>(offset);
2784            // Zero out padding regions. There's no need to apply masks
2785            // because the unmasked parts will be overwritten by fields.
2786            // Write the fields.
2787            self.0.encode(encoder, offset + 0, depth)?;
2788            Ok(())
2789        }
2790    }
2791
2792    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2793        for HostWatcherWatchResponse
2794    {
2795        #[inline(always)]
2796        fn new_empty() -> Self {
2797            Self { hosts: fidl::new_empty!(fidl::encoding::UnboundedVector<HostInfo>, D) }
2798        }
2799
2800        #[inline]
2801        unsafe fn decode(
2802            &mut self,
2803            decoder: &mut fidl::encoding::Decoder<'_, D>,
2804            offset: usize,
2805            _depth: fidl::encoding::Depth,
2806        ) -> fidl::Result<()> {
2807            decoder.debug_check_bounds::<Self>(offset);
2808            // Verify that padding bytes are zero.
2809            fidl::decode!(
2810                fidl::encoding::UnboundedVector<HostInfo>,
2811                D,
2812                &mut self.hosts,
2813                decoder,
2814                offset + 0,
2815                _depth
2816            )?;
2817            Ok(())
2818        }
2819    }
2820
2821    impl fidl::encoding::ValueTypeMarker for Key {
2822        type Borrowed<'a> = &'a Self;
2823        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2824            value
2825        }
2826    }
2827
2828    unsafe impl fidl::encoding::TypeMarker for Key {
2829        type Owned = Self;
2830
2831        #[inline(always)]
2832        fn inline_align(_context: fidl::encoding::Context) -> usize {
2833            1
2834        }
2835
2836        #[inline(always)]
2837        fn inline_size(_context: fidl::encoding::Context) -> usize {
2838            16
2839        }
2840        #[inline(always)]
2841        fn encode_is_copy() -> bool {
2842            true
2843        }
2844
2845        #[inline(always)]
2846        fn decode_is_copy() -> bool {
2847            true
2848        }
2849    }
2850
2851    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Key, D> for &Key {
2852        #[inline]
2853        unsafe fn encode(
2854            self,
2855            encoder: &mut fidl::encoding::Encoder<'_, D>,
2856            offset: usize,
2857            _depth: fidl::encoding::Depth,
2858        ) -> fidl::Result<()> {
2859            encoder.debug_check_bounds::<Key>(offset);
2860            unsafe {
2861                // Copy the object into the buffer.
2862                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
2863                (buf_ptr as *mut Key).write_unaligned((self as *const Key).read());
2864                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
2865                // done second because the memcpy will write garbage to these bytes.
2866            }
2867            Ok(())
2868        }
2869    }
2870    unsafe impl<
2871            D: fidl::encoding::ResourceDialect,
2872            T0: fidl::encoding::Encode<fidl::encoding::Array<u8, 16>, D>,
2873        > fidl::encoding::Encode<Key, D> for (T0,)
2874    {
2875        #[inline]
2876        unsafe fn encode(
2877            self,
2878            encoder: &mut fidl::encoding::Encoder<'_, D>,
2879            offset: usize,
2880            depth: fidl::encoding::Depth,
2881        ) -> fidl::Result<()> {
2882            encoder.debug_check_bounds::<Key>(offset);
2883            // Zero out padding regions. There's no need to apply masks
2884            // because the unmasked parts will be overwritten by fields.
2885            // Write the fields.
2886            self.0.encode(encoder, offset + 0, depth)?;
2887            Ok(())
2888        }
2889    }
2890
2891    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Key {
2892        #[inline(always)]
2893        fn new_empty() -> Self {
2894            Self { value: fidl::new_empty!(fidl::encoding::Array<u8, 16>, D) }
2895        }
2896
2897        #[inline]
2898        unsafe fn decode(
2899            &mut self,
2900            decoder: &mut fidl::encoding::Decoder<'_, D>,
2901            offset: usize,
2902            _depth: fidl::encoding::Depth,
2903        ) -> fidl::Result<()> {
2904            decoder.debug_check_bounds::<Self>(offset);
2905            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
2906            // Verify that padding bytes are zero.
2907            // Copy from the buffer into the object.
2908            unsafe {
2909                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 16);
2910            }
2911            Ok(())
2912        }
2913    }
2914
2915    impl fidl::encoding::ValueTypeMarker for LeConnectionParameters {
2916        type Borrowed<'a> = &'a Self;
2917        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2918            value
2919        }
2920    }
2921
2922    unsafe impl fidl::encoding::TypeMarker for LeConnectionParameters {
2923        type Owned = Self;
2924
2925        #[inline(always)]
2926        fn inline_align(_context: fidl::encoding::Context) -> usize {
2927            2
2928        }
2929
2930        #[inline(always)]
2931        fn inline_size(_context: fidl::encoding::Context) -> usize {
2932            6
2933        }
2934        #[inline(always)]
2935        fn encode_is_copy() -> bool {
2936            true
2937        }
2938
2939        #[inline(always)]
2940        fn decode_is_copy() -> bool {
2941            true
2942        }
2943    }
2944
2945    unsafe impl<D: fidl::encoding::ResourceDialect>
2946        fidl::encoding::Encode<LeConnectionParameters, D> for &LeConnectionParameters
2947    {
2948        #[inline]
2949        unsafe fn encode(
2950            self,
2951            encoder: &mut fidl::encoding::Encoder<'_, D>,
2952            offset: usize,
2953            _depth: fidl::encoding::Depth,
2954        ) -> fidl::Result<()> {
2955            encoder.debug_check_bounds::<LeConnectionParameters>(offset);
2956            unsafe {
2957                // Copy the object into the buffer.
2958                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
2959                (buf_ptr as *mut LeConnectionParameters)
2960                    .write_unaligned((self as *const LeConnectionParameters).read());
2961                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
2962                // done second because the memcpy will write garbage to these bytes.
2963            }
2964            Ok(())
2965        }
2966    }
2967    unsafe impl<
2968            D: fidl::encoding::ResourceDialect,
2969            T0: fidl::encoding::Encode<u16, D>,
2970            T1: fidl::encoding::Encode<u16, D>,
2971            T2: fidl::encoding::Encode<u16, D>,
2972        > fidl::encoding::Encode<LeConnectionParameters, D> for (T0, T1, T2)
2973    {
2974        #[inline]
2975        unsafe fn encode(
2976            self,
2977            encoder: &mut fidl::encoding::Encoder<'_, D>,
2978            offset: usize,
2979            depth: fidl::encoding::Depth,
2980        ) -> fidl::Result<()> {
2981            encoder.debug_check_bounds::<LeConnectionParameters>(offset);
2982            // Zero out padding regions. There's no need to apply masks
2983            // because the unmasked parts will be overwritten by fields.
2984            // Write the fields.
2985            self.0.encode(encoder, offset + 0, depth)?;
2986            self.1.encode(encoder, offset + 2, depth)?;
2987            self.2.encode(encoder, offset + 4, depth)?;
2988            Ok(())
2989        }
2990    }
2991
2992    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2993        for LeConnectionParameters
2994    {
2995        #[inline(always)]
2996        fn new_empty() -> Self {
2997            Self {
2998                connection_interval: fidl::new_empty!(u16, D),
2999                connection_latency: fidl::new_empty!(u16, D),
3000                supervision_timeout: fidl::new_empty!(u16, D),
3001            }
3002        }
3003
3004        #[inline]
3005        unsafe fn decode(
3006            &mut self,
3007            decoder: &mut fidl::encoding::Decoder<'_, D>,
3008            offset: usize,
3009            _depth: fidl::encoding::Depth,
3010        ) -> fidl::Result<()> {
3011            decoder.debug_check_bounds::<Self>(offset);
3012            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
3013            // Verify that padding bytes are zero.
3014            // Copy from the buffer into the object.
3015            unsafe {
3016                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 6);
3017            }
3018            Ok(())
3019        }
3020    }
3021
3022    impl fidl::encoding::ValueTypeMarker for Ltk {
3023        type Borrowed<'a> = &'a Self;
3024        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3025            value
3026        }
3027    }
3028
3029    unsafe impl fidl::encoding::TypeMarker for Ltk {
3030        type Owned = Self;
3031
3032        #[inline(always)]
3033        fn inline_align(_context: fidl::encoding::Context) -> usize {
3034            8
3035        }
3036
3037        #[inline(always)]
3038        fn inline_size(_context: fidl::encoding::Context) -> usize {
3039            32
3040        }
3041    }
3042
3043    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Ltk, D> for &Ltk {
3044        #[inline]
3045        unsafe fn encode(
3046            self,
3047            encoder: &mut fidl::encoding::Encoder<'_, D>,
3048            offset: usize,
3049            _depth: fidl::encoding::Depth,
3050        ) -> fidl::Result<()> {
3051            encoder.debug_check_bounds::<Ltk>(offset);
3052            // Delegate to tuple encoding.
3053            fidl::encoding::Encode::<Ltk, D>::encode(
3054                (
3055                    <PeerKey as fidl::encoding::ValueTypeMarker>::borrow(&self.key),
3056                    <u16 as fidl::encoding::ValueTypeMarker>::borrow(&self.ediv),
3057                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.rand),
3058                ),
3059                encoder,
3060                offset,
3061                _depth,
3062            )
3063        }
3064    }
3065    unsafe impl<
3066            D: fidl::encoding::ResourceDialect,
3067            T0: fidl::encoding::Encode<PeerKey, D>,
3068            T1: fidl::encoding::Encode<u16, D>,
3069            T2: fidl::encoding::Encode<u64, D>,
3070        > fidl::encoding::Encode<Ltk, D> for (T0, T1, T2)
3071    {
3072        #[inline]
3073        unsafe fn encode(
3074            self,
3075            encoder: &mut fidl::encoding::Encoder<'_, D>,
3076            offset: usize,
3077            depth: fidl::encoding::Depth,
3078        ) -> fidl::Result<()> {
3079            encoder.debug_check_bounds::<Ltk>(offset);
3080            // Zero out padding regions. There's no need to apply masks
3081            // because the unmasked parts will be overwritten by fields.
3082            unsafe {
3083                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
3084                (ptr as *mut u64).write_unaligned(0);
3085            }
3086            // Write the fields.
3087            self.0.encode(encoder, offset + 0, depth)?;
3088            self.1.encode(encoder, offset + 20, depth)?;
3089            self.2.encode(encoder, offset + 24, depth)?;
3090            Ok(())
3091        }
3092    }
3093
3094    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Ltk {
3095        #[inline(always)]
3096        fn new_empty() -> Self {
3097            Self {
3098                key: fidl::new_empty!(PeerKey, D),
3099                ediv: fidl::new_empty!(u16, D),
3100                rand: fidl::new_empty!(u64, D),
3101            }
3102        }
3103
3104        #[inline]
3105        unsafe fn decode(
3106            &mut self,
3107            decoder: &mut fidl::encoding::Decoder<'_, D>,
3108            offset: usize,
3109            _depth: fidl::encoding::Depth,
3110        ) -> fidl::Result<()> {
3111            decoder.debug_check_bounds::<Self>(offset);
3112            // Verify that padding bytes are zero.
3113            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
3114            let padval = unsafe { (ptr as *const u64).read_unaligned() };
3115            let mask = 0xffff0000ff000000u64;
3116            let maskedval = padval & mask;
3117            if maskedval != 0 {
3118                return Err(fidl::Error::NonZeroPadding {
3119                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
3120                });
3121            }
3122            fidl::decode!(PeerKey, D, &mut self.key, decoder, offset + 0, _depth)?;
3123            fidl::decode!(u16, D, &mut self.ediv, decoder, offset + 20, _depth)?;
3124            fidl::decode!(u64, D, &mut self.rand, decoder, offset + 24, _depth)?;
3125            Ok(())
3126        }
3127    }
3128
3129    impl fidl::encoding::ValueTypeMarker for PairingDelegate2RequestCompleteRequest {
3130        type Borrowed<'a> = &'a Self;
3131        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3132            value
3133        }
3134    }
3135
3136    unsafe impl fidl::encoding::TypeMarker for PairingDelegate2RequestCompleteRequest {
3137        type Owned = Self;
3138
3139        #[inline(always)]
3140        fn inline_align(_context: fidl::encoding::Context) -> usize {
3141            8
3142        }
3143
3144        #[inline(always)]
3145        fn inline_size(_context: fidl::encoding::Context) -> usize {
3146            16
3147        }
3148    }
3149
3150    unsafe impl<D: fidl::encoding::ResourceDialect>
3151        fidl::encoding::Encode<PairingDelegate2RequestCompleteRequest, D>
3152        for &PairingDelegate2RequestCompleteRequest
3153    {
3154        #[inline]
3155        unsafe fn encode(
3156            self,
3157            encoder: &mut fidl::encoding::Encoder<'_, D>,
3158            offset: usize,
3159            _depth: fidl::encoding::Depth,
3160        ) -> fidl::Result<()> {
3161            encoder.debug_check_bounds::<PairingDelegate2RequestCompleteRequest>(offset);
3162            // Delegate to tuple encoding.
3163            fidl::encoding::Encode::<PairingDelegate2RequestCompleteRequest, D>::encode(
3164                (
3165                    <fidl_fuchsia_bluetooth__common::PeerId as fidl::encoding::ValueTypeMarker>::borrow(&self.id),
3166                    <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.success),
3167                ),
3168                encoder, offset, _depth
3169            )
3170        }
3171    }
3172    unsafe impl<
3173            D: fidl::encoding::ResourceDialect,
3174            T0: fidl::encoding::Encode<fidl_fuchsia_bluetooth__common::PeerId, D>,
3175            T1: fidl::encoding::Encode<bool, D>,
3176        > fidl::encoding::Encode<PairingDelegate2RequestCompleteRequest, D> for (T0, T1)
3177    {
3178        #[inline]
3179        unsafe fn encode(
3180            self,
3181            encoder: &mut fidl::encoding::Encoder<'_, D>,
3182            offset: usize,
3183            depth: fidl::encoding::Depth,
3184        ) -> fidl::Result<()> {
3185            encoder.debug_check_bounds::<PairingDelegate2RequestCompleteRequest>(offset);
3186            // Zero out padding regions. There's no need to apply masks
3187            // because the unmasked parts will be overwritten by fields.
3188            unsafe {
3189                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
3190                (ptr as *mut u64).write_unaligned(0);
3191            }
3192            // Write the fields.
3193            self.0.encode(encoder, offset + 0, depth)?;
3194            self.1.encode(encoder, offset + 8, depth)?;
3195            Ok(())
3196        }
3197    }
3198
3199    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3200        for PairingDelegate2RequestCompleteRequest
3201    {
3202        #[inline(always)]
3203        fn new_empty() -> Self {
3204            Self {
3205                id: fidl::new_empty!(fidl_fuchsia_bluetooth__common::PeerId, D),
3206                success: fidl::new_empty!(bool, D),
3207            }
3208        }
3209
3210        #[inline]
3211        unsafe fn decode(
3212            &mut self,
3213            decoder: &mut fidl::encoding::Decoder<'_, D>,
3214            offset: usize,
3215            _depth: fidl::encoding::Depth,
3216        ) -> fidl::Result<()> {
3217            decoder.debug_check_bounds::<Self>(offset);
3218            // Verify that padding bytes are zero.
3219            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(8) };
3220            let padval = unsafe { (ptr as *const u64).read_unaligned() };
3221            let mask = 0xffffffffffffff00u64;
3222            let maskedval = padval & mask;
3223            if maskedval != 0 {
3224                return Err(fidl::Error::NonZeroPadding {
3225                    padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
3226                });
3227            }
3228            fidl::decode!(
3229                fidl_fuchsia_bluetooth__common::PeerId,
3230                D,
3231                &mut self.id,
3232                decoder,
3233                offset + 0,
3234                _depth
3235            )?;
3236            fidl::decode!(bool, D, &mut self.success, decoder, offset + 8, _depth)?;
3237            Ok(())
3238        }
3239    }
3240
3241    impl fidl::encoding::ValueTypeMarker for PairingDelegateOnLocalKeypressRequest {
3242        type Borrowed<'a> = &'a Self;
3243        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3244            value
3245        }
3246    }
3247
3248    unsafe impl fidl::encoding::TypeMarker for PairingDelegateOnLocalKeypressRequest {
3249        type Owned = Self;
3250
3251        #[inline(always)]
3252        fn inline_align(_context: fidl::encoding::Context) -> usize {
3253            8
3254        }
3255
3256        #[inline(always)]
3257        fn inline_size(_context: fidl::encoding::Context) -> usize {
3258            16
3259        }
3260    }
3261
3262    unsafe impl<D: fidl::encoding::ResourceDialect>
3263        fidl::encoding::Encode<PairingDelegateOnLocalKeypressRequest, D>
3264        for &PairingDelegateOnLocalKeypressRequest
3265    {
3266        #[inline]
3267        unsafe fn encode(
3268            self,
3269            encoder: &mut fidl::encoding::Encoder<'_, D>,
3270            offset: usize,
3271            _depth: fidl::encoding::Depth,
3272        ) -> fidl::Result<()> {
3273            encoder.debug_check_bounds::<PairingDelegateOnLocalKeypressRequest>(offset);
3274            // Delegate to tuple encoding.
3275            fidl::encoding::Encode::<PairingDelegateOnLocalKeypressRequest, D>::encode(
3276                (
3277                    <fidl_fuchsia_bluetooth__common::PeerId as fidl::encoding::ValueTypeMarker>::borrow(&self.id),
3278                    <PairingKeypress as fidl::encoding::ValueTypeMarker>::borrow(&self.keypress),
3279                ),
3280                encoder, offset, _depth
3281            )
3282        }
3283    }
3284    unsafe impl<
3285            D: fidl::encoding::ResourceDialect,
3286            T0: fidl::encoding::Encode<fidl_fuchsia_bluetooth__common::PeerId, D>,
3287            T1: fidl::encoding::Encode<PairingKeypress, D>,
3288        > fidl::encoding::Encode<PairingDelegateOnLocalKeypressRequest, D> for (T0, T1)
3289    {
3290        #[inline]
3291        unsafe fn encode(
3292            self,
3293            encoder: &mut fidl::encoding::Encoder<'_, D>,
3294            offset: usize,
3295            depth: fidl::encoding::Depth,
3296        ) -> fidl::Result<()> {
3297            encoder.debug_check_bounds::<PairingDelegateOnLocalKeypressRequest>(offset);
3298            // Zero out padding regions. There's no need to apply masks
3299            // because the unmasked parts will be overwritten by fields.
3300            unsafe {
3301                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
3302                (ptr as *mut u64).write_unaligned(0);
3303            }
3304            // Write the fields.
3305            self.0.encode(encoder, offset + 0, depth)?;
3306            self.1.encode(encoder, offset + 8, depth)?;
3307            Ok(())
3308        }
3309    }
3310
3311    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3312        for PairingDelegateOnLocalKeypressRequest
3313    {
3314        #[inline(always)]
3315        fn new_empty() -> Self {
3316            Self {
3317                id: fidl::new_empty!(fidl_fuchsia_bluetooth__common::PeerId, D),
3318                keypress: fidl::new_empty!(PairingKeypress, D),
3319            }
3320        }
3321
3322        #[inline]
3323        unsafe fn decode(
3324            &mut self,
3325            decoder: &mut fidl::encoding::Decoder<'_, D>,
3326            offset: usize,
3327            _depth: fidl::encoding::Depth,
3328        ) -> fidl::Result<()> {
3329            decoder.debug_check_bounds::<Self>(offset);
3330            // Verify that padding bytes are zero.
3331            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(8) };
3332            let padval = unsafe { (ptr as *const u64).read_unaligned() };
3333            let mask = 0xffffffff00000000u64;
3334            let maskedval = padval & mask;
3335            if maskedval != 0 {
3336                return Err(fidl::Error::NonZeroPadding {
3337                    padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
3338                });
3339            }
3340            fidl::decode!(
3341                fidl_fuchsia_bluetooth__common::PeerId,
3342                D,
3343                &mut self.id,
3344                decoder,
3345                offset + 0,
3346                _depth
3347            )?;
3348            fidl::decode!(PairingKeypress, D, &mut self.keypress, decoder, offset + 8, _depth)?;
3349            Ok(())
3350        }
3351    }
3352
3353    impl fidl::encoding::ValueTypeMarker for PairingDelegateOnPairingCompleteRequest {
3354        type Borrowed<'a> = &'a Self;
3355        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3356            value
3357        }
3358    }
3359
3360    unsafe impl fidl::encoding::TypeMarker for PairingDelegateOnPairingCompleteRequest {
3361        type Owned = Self;
3362
3363        #[inline(always)]
3364        fn inline_align(_context: fidl::encoding::Context) -> usize {
3365            8
3366        }
3367
3368        #[inline(always)]
3369        fn inline_size(_context: fidl::encoding::Context) -> usize {
3370            16
3371        }
3372    }
3373
3374    unsafe impl<D: fidl::encoding::ResourceDialect>
3375        fidl::encoding::Encode<PairingDelegateOnPairingCompleteRequest, D>
3376        for &PairingDelegateOnPairingCompleteRequest
3377    {
3378        #[inline]
3379        unsafe fn encode(
3380            self,
3381            encoder: &mut fidl::encoding::Encoder<'_, D>,
3382            offset: usize,
3383            _depth: fidl::encoding::Depth,
3384        ) -> fidl::Result<()> {
3385            encoder.debug_check_bounds::<PairingDelegateOnPairingCompleteRequest>(offset);
3386            // Delegate to tuple encoding.
3387            fidl::encoding::Encode::<PairingDelegateOnPairingCompleteRequest, D>::encode(
3388                (
3389                    <fidl_fuchsia_bluetooth__common::PeerId as fidl::encoding::ValueTypeMarker>::borrow(&self.id),
3390                    <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.success),
3391                ),
3392                encoder, offset, _depth
3393            )
3394        }
3395    }
3396    unsafe impl<
3397            D: fidl::encoding::ResourceDialect,
3398            T0: fidl::encoding::Encode<fidl_fuchsia_bluetooth__common::PeerId, D>,
3399            T1: fidl::encoding::Encode<bool, D>,
3400        > fidl::encoding::Encode<PairingDelegateOnPairingCompleteRequest, D> for (T0, T1)
3401    {
3402        #[inline]
3403        unsafe fn encode(
3404            self,
3405            encoder: &mut fidl::encoding::Encoder<'_, D>,
3406            offset: usize,
3407            depth: fidl::encoding::Depth,
3408        ) -> fidl::Result<()> {
3409            encoder.debug_check_bounds::<PairingDelegateOnPairingCompleteRequest>(offset);
3410            // Zero out padding regions. There's no need to apply masks
3411            // because the unmasked parts will be overwritten by fields.
3412            unsafe {
3413                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
3414                (ptr as *mut u64).write_unaligned(0);
3415            }
3416            // Write the fields.
3417            self.0.encode(encoder, offset + 0, depth)?;
3418            self.1.encode(encoder, offset + 8, depth)?;
3419            Ok(())
3420        }
3421    }
3422
3423    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3424        for PairingDelegateOnPairingCompleteRequest
3425    {
3426        #[inline(always)]
3427        fn new_empty() -> Self {
3428            Self {
3429                id: fidl::new_empty!(fidl_fuchsia_bluetooth__common::PeerId, D),
3430                success: fidl::new_empty!(bool, D),
3431            }
3432        }
3433
3434        #[inline]
3435        unsafe fn decode(
3436            &mut self,
3437            decoder: &mut fidl::encoding::Decoder<'_, D>,
3438            offset: usize,
3439            _depth: fidl::encoding::Depth,
3440        ) -> fidl::Result<()> {
3441            decoder.debug_check_bounds::<Self>(offset);
3442            // Verify that padding bytes are zero.
3443            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(8) };
3444            let padval = unsafe { (ptr as *const u64).read_unaligned() };
3445            let mask = 0xffffffffffffff00u64;
3446            let maskedval = padval & mask;
3447            if maskedval != 0 {
3448                return Err(fidl::Error::NonZeroPadding {
3449                    padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
3450                });
3451            }
3452            fidl::decode!(
3453                fidl_fuchsia_bluetooth__common::PeerId,
3454                D,
3455                &mut self.id,
3456                decoder,
3457                offset + 0,
3458                _depth
3459            )?;
3460            fidl::decode!(bool, D, &mut self.success, decoder, offset + 8, _depth)?;
3461            Ok(())
3462        }
3463    }
3464
3465    impl fidl::encoding::ValueTypeMarker for PairingDelegateOnPairingRequestRequest {
3466        type Borrowed<'a> = &'a Self;
3467        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3468            value
3469        }
3470    }
3471
3472    unsafe impl fidl::encoding::TypeMarker for PairingDelegateOnPairingRequestRequest {
3473        type Owned = Self;
3474
3475        #[inline(always)]
3476        fn inline_align(_context: fidl::encoding::Context) -> usize {
3477            8
3478        }
3479
3480        #[inline(always)]
3481        fn inline_size(_context: fidl::encoding::Context) -> usize {
3482            24
3483        }
3484    }
3485
3486    unsafe impl<D: fidl::encoding::ResourceDialect>
3487        fidl::encoding::Encode<PairingDelegateOnPairingRequestRequest, D>
3488        for &PairingDelegateOnPairingRequestRequest
3489    {
3490        #[inline]
3491        unsafe fn encode(
3492            self,
3493            encoder: &mut fidl::encoding::Encoder<'_, D>,
3494            offset: usize,
3495            _depth: fidl::encoding::Depth,
3496        ) -> fidl::Result<()> {
3497            encoder.debug_check_bounds::<PairingDelegateOnPairingRequestRequest>(offset);
3498            // Delegate to tuple encoding.
3499            fidl::encoding::Encode::<PairingDelegateOnPairingRequestRequest, D>::encode(
3500                (
3501                    <Peer as fidl::encoding::ValueTypeMarker>::borrow(&self.peer),
3502                    <PairingMethod as fidl::encoding::ValueTypeMarker>::borrow(&self.method),
3503                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.displayed_passkey),
3504                ),
3505                encoder,
3506                offset,
3507                _depth,
3508            )
3509        }
3510    }
3511    unsafe impl<
3512            D: fidl::encoding::ResourceDialect,
3513            T0: fidl::encoding::Encode<Peer, D>,
3514            T1: fidl::encoding::Encode<PairingMethod, D>,
3515            T2: fidl::encoding::Encode<u32, D>,
3516        > fidl::encoding::Encode<PairingDelegateOnPairingRequestRequest, D> for (T0, T1, T2)
3517    {
3518        #[inline]
3519        unsafe fn encode(
3520            self,
3521            encoder: &mut fidl::encoding::Encoder<'_, D>,
3522            offset: usize,
3523            depth: fidl::encoding::Depth,
3524        ) -> fidl::Result<()> {
3525            encoder.debug_check_bounds::<PairingDelegateOnPairingRequestRequest>(offset);
3526            // Zero out padding regions. There's no need to apply masks
3527            // because the unmasked parts will be overwritten by fields.
3528            // Write the fields.
3529            self.0.encode(encoder, offset + 0, depth)?;
3530            self.1.encode(encoder, offset + 16, depth)?;
3531            self.2.encode(encoder, offset + 20, depth)?;
3532            Ok(())
3533        }
3534    }
3535
3536    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3537        for PairingDelegateOnPairingRequestRequest
3538    {
3539        #[inline(always)]
3540        fn new_empty() -> Self {
3541            Self {
3542                peer: fidl::new_empty!(Peer, D),
3543                method: fidl::new_empty!(PairingMethod, D),
3544                displayed_passkey: fidl::new_empty!(u32, D),
3545            }
3546        }
3547
3548        #[inline]
3549        unsafe fn decode(
3550            &mut self,
3551            decoder: &mut fidl::encoding::Decoder<'_, D>,
3552            offset: usize,
3553            _depth: fidl::encoding::Depth,
3554        ) -> fidl::Result<()> {
3555            decoder.debug_check_bounds::<Self>(offset);
3556            // Verify that padding bytes are zero.
3557            fidl::decode!(Peer, D, &mut self.peer, decoder, offset + 0, _depth)?;
3558            fidl::decode!(PairingMethod, D, &mut self.method, decoder, offset + 16, _depth)?;
3559            fidl::decode!(u32, D, &mut self.displayed_passkey, decoder, offset + 20, _depth)?;
3560            Ok(())
3561        }
3562    }
3563
3564    impl fidl::encoding::ValueTypeMarker for PairingDelegateOnPairingRequestResponse {
3565        type Borrowed<'a> = &'a Self;
3566        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3567            value
3568        }
3569    }
3570
3571    unsafe impl fidl::encoding::TypeMarker for PairingDelegateOnPairingRequestResponse {
3572        type Owned = Self;
3573
3574        #[inline(always)]
3575        fn inline_align(_context: fidl::encoding::Context) -> usize {
3576            4
3577        }
3578
3579        #[inline(always)]
3580        fn inline_size(_context: fidl::encoding::Context) -> usize {
3581            8
3582        }
3583    }
3584
3585    unsafe impl<D: fidl::encoding::ResourceDialect>
3586        fidl::encoding::Encode<PairingDelegateOnPairingRequestResponse, D>
3587        for &PairingDelegateOnPairingRequestResponse
3588    {
3589        #[inline]
3590        unsafe fn encode(
3591            self,
3592            encoder: &mut fidl::encoding::Encoder<'_, D>,
3593            offset: usize,
3594            _depth: fidl::encoding::Depth,
3595        ) -> fidl::Result<()> {
3596            encoder.debug_check_bounds::<PairingDelegateOnPairingRequestResponse>(offset);
3597            // Delegate to tuple encoding.
3598            fidl::encoding::Encode::<PairingDelegateOnPairingRequestResponse, D>::encode(
3599                (
3600                    <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.accept),
3601                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.entered_passkey),
3602                ),
3603                encoder,
3604                offset,
3605                _depth,
3606            )
3607        }
3608    }
3609    unsafe impl<
3610            D: fidl::encoding::ResourceDialect,
3611            T0: fidl::encoding::Encode<bool, D>,
3612            T1: fidl::encoding::Encode<u32, D>,
3613        > fidl::encoding::Encode<PairingDelegateOnPairingRequestResponse, D> for (T0, T1)
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            // Zero out padding regions. There's no need to apply masks
3624            // because the unmasked parts will be overwritten by fields.
3625            unsafe {
3626                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
3627                (ptr as *mut u32).write_unaligned(0);
3628            }
3629            // Write the fields.
3630            self.0.encode(encoder, offset + 0, depth)?;
3631            self.1.encode(encoder, offset + 4, depth)?;
3632            Ok(())
3633        }
3634    }
3635
3636    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3637        for PairingDelegateOnPairingRequestResponse
3638    {
3639        #[inline(always)]
3640        fn new_empty() -> Self {
3641            Self { accept: fidl::new_empty!(bool, D), entered_passkey: fidl::new_empty!(u32, D) }
3642        }
3643
3644        #[inline]
3645        unsafe fn decode(
3646            &mut self,
3647            decoder: &mut fidl::encoding::Decoder<'_, D>,
3648            offset: usize,
3649            _depth: fidl::encoding::Depth,
3650        ) -> fidl::Result<()> {
3651            decoder.debug_check_bounds::<Self>(offset);
3652            // Verify that padding bytes are zero.
3653            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
3654            let padval = unsafe { (ptr as *const u32).read_unaligned() };
3655            let mask = 0xffffff00u32;
3656            let maskedval = padval & mask;
3657            if maskedval != 0 {
3658                return Err(fidl::Error::NonZeroPadding {
3659                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
3660                });
3661            }
3662            fidl::decode!(bool, D, &mut self.accept, decoder, offset + 0, _depth)?;
3663            fidl::decode!(u32, D, &mut self.entered_passkey, decoder, offset + 4, _depth)?;
3664            Ok(())
3665        }
3666    }
3667
3668    impl fidl::encoding::ValueTypeMarker for PairingDelegateOnRemoteKeypressRequest {
3669        type Borrowed<'a> = &'a Self;
3670        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3671            value
3672        }
3673    }
3674
3675    unsafe impl fidl::encoding::TypeMarker for PairingDelegateOnRemoteKeypressRequest {
3676        type Owned = Self;
3677
3678        #[inline(always)]
3679        fn inline_align(_context: fidl::encoding::Context) -> usize {
3680            8
3681        }
3682
3683        #[inline(always)]
3684        fn inline_size(_context: fidl::encoding::Context) -> usize {
3685            16
3686        }
3687    }
3688
3689    unsafe impl<D: fidl::encoding::ResourceDialect>
3690        fidl::encoding::Encode<PairingDelegateOnRemoteKeypressRequest, D>
3691        for &PairingDelegateOnRemoteKeypressRequest
3692    {
3693        #[inline]
3694        unsafe fn encode(
3695            self,
3696            encoder: &mut fidl::encoding::Encoder<'_, D>,
3697            offset: usize,
3698            _depth: fidl::encoding::Depth,
3699        ) -> fidl::Result<()> {
3700            encoder.debug_check_bounds::<PairingDelegateOnRemoteKeypressRequest>(offset);
3701            // Delegate to tuple encoding.
3702            fidl::encoding::Encode::<PairingDelegateOnRemoteKeypressRequest, D>::encode(
3703                (
3704                    <fidl_fuchsia_bluetooth__common::PeerId as fidl::encoding::ValueTypeMarker>::borrow(&self.id),
3705                    <PairingKeypress as fidl::encoding::ValueTypeMarker>::borrow(&self.keypress),
3706                ),
3707                encoder, offset, _depth
3708            )
3709        }
3710    }
3711    unsafe impl<
3712            D: fidl::encoding::ResourceDialect,
3713            T0: fidl::encoding::Encode<fidl_fuchsia_bluetooth__common::PeerId, D>,
3714            T1: fidl::encoding::Encode<PairingKeypress, D>,
3715        > fidl::encoding::Encode<PairingDelegateOnRemoteKeypressRequest, D> for (T0, T1)
3716    {
3717        #[inline]
3718        unsafe fn encode(
3719            self,
3720            encoder: &mut fidl::encoding::Encoder<'_, D>,
3721            offset: usize,
3722            depth: fidl::encoding::Depth,
3723        ) -> fidl::Result<()> {
3724            encoder.debug_check_bounds::<PairingDelegateOnRemoteKeypressRequest>(offset);
3725            // Zero out padding regions. There's no need to apply masks
3726            // because the unmasked parts will be overwritten by fields.
3727            unsafe {
3728                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
3729                (ptr as *mut u64).write_unaligned(0);
3730            }
3731            // Write the fields.
3732            self.0.encode(encoder, offset + 0, depth)?;
3733            self.1.encode(encoder, offset + 8, depth)?;
3734            Ok(())
3735        }
3736    }
3737
3738    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3739        for PairingDelegateOnRemoteKeypressRequest
3740    {
3741        #[inline(always)]
3742        fn new_empty() -> Self {
3743            Self {
3744                id: fidl::new_empty!(fidl_fuchsia_bluetooth__common::PeerId, D),
3745                keypress: fidl::new_empty!(PairingKeypress, D),
3746            }
3747        }
3748
3749        #[inline]
3750        unsafe fn decode(
3751            &mut self,
3752            decoder: &mut fidl::encoding::Decoder<'_, D>,
3753            offset: usize,
3754            _depth: fidl::encoding::Depth,
3755        ) -> fidl::Result<()> {
3756            decoder.debug_check_bounds::<Self>(offset);
3757            // Verify that padding bytes are zero.
3758            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(8) };
3759            let padval = unsafe { (ptr as *const u64).read_unaligned() };
3760            let mask = 0xffffffff00000000u64;
3761            let maskedval = padval & mask;
3762            if maskedval != 0 {
3763                return Err(fidl::Error::NonZeroPadding {
3764                    padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
3765                });
3766            }
3767            fidl::decode!(
3768                fidl_fuchsia_bluetooth__common::PeerId,
3769                D,
3770                &mut self.id,
3771                decoder,
3772                offset + 0,
3773                _depth
3774            )?;
3775            fidl::decode!(PairingKeypress, D, &mut self.keypress, decoder, offset + 8, _depth)?;
3776            Ok(())
3777        }
3778    }
3779
3780    impl fidl::encoding::ValueTypeMarker for PairingRequestKeypressRequest {
3781        type Borrowed<'a> = &'a Self;
3782        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3783            value
3784        }
3785    }
3786
3787    unsafe impl fidl::encoding::TypeMarker for PairingRequestKeypressRequest {
3788        type Owned = Self;
3789
3790        #[inline(always)]
3791        fn inline_align(_context: fidl::encoding::Context) -> usize {
3792            4
3793        }
3794
3795        #[inline(always)]
3796        fn inline_size(_context: fidl::encoding::Context) -> usize {
3797            4
3798        }
3799    }
3800
3801    unsafe impl<D: fidl::encoding::ResourceDialect>
3802        fidl::encoding::Encode<PairingRequestKeypressRequest, D>
3803        for &PairingRequestKeypressRequest
3804    {
3805        #[inline]
3806        unsafe fn encode(
3807            self,
3808            encoder: &mut fidl::encoding::Encoder<'_, D>,
3809            offset: usize,
3810            _depth: fidl::encoding::Depth,
3811        ) -> fidl::Result<()> {
3812            encoder.debug_check_bounds::<PairingRequestKeypressRequest>(offset);
3813            // Delegate to tuple encoding.
3814            fidl::encoding::Encode::<PairingRequestKeypressRequest, D>::encode(
3815                (<PairingKeypress as fidl::encoding::ValueTypeMarker>::borrow(&self.keypress),),
3816                encoder,
3817                offset,
3818                _depth,
3819            )
3820        }
3821    }
3822    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<PairingKeypress, D>>
3823        fidl::encoding::Encode<PairingRequestKeypressRequest, D> for (T0,)
3824    {
3825        #[inline]
3826        unsafe fn encode(
3827            self,
3828            encoder: &mut fidl::encoding::Encoder<'_, D>,
3829            offset: usize,
3830            depth: fidl::encoding::Depth,
3831        ) -> fidl::Result<()> {
3832            encoder.debug_check_bounds::<PairingRequestKeypressRequest>(offset);
3833            // Zero out padding regions. There's no need to apply masks
3834            // because the unmasked parts will be overwritten by fields.
3835            // Write the fields.
3836            self.0.encode(encoder, offset + 0, depth)?;
3837            Ok(())
3838        }
3839    }
3840
3841    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3842        for PairingRequestKeypressRequest
3843    {
3844        #[inline(always)]
3845        fn new_empty() -> Self {
3846            Self { keypress: fidl::new_empty!(PairingKeypress, D) }
3847        }
3848
3849        #[inline]
3850        unsafe fn decode(
3851            &mut self,
3852            decoder: &mut fidl::encoding::Decoder<'_, D>,
3853            offset: usize,
3854            _depth: fidl::encoding::Depth,
3855        ) -> fidl::Result<()> {
3856            decoder.debug_check_bounds::<Self>(offset);
3857            // Verify that padding bytes are zero.
3858            fidl::decode!(PairingKeypress, D, &mut self.keypress, decoder, offset + 0, _depth)?;
3859            Ok(())
3860        }
3861    }
3862
3863    impl fidl::encoding::ValueTypeMarker for PairingRequestOnCompleteRequest {
3864        type Borrowed<'a> = &'a Self;
3865        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3866            value
3867        }
3868    }
3869
3870    unsafe impl fidl::encoding::TypeMarker for PairingRequestOnCompleteRequest {
3871        type Owned = Self;
3872
3873        #[inline(always)]
3874        fn inline_align(_context: fidl::encoding::Context) -> usize {
3875            1
3876        }
3877
3878        #[inline(always)]
3879        fn inline_size(_context: fidl::encoding::Context) -> usize {
3880            1
3881        }
3882    }
3883
3884    unsafe impl<D: fidl::encoding::ResourceDialect>
3885        fidl::encoding::Encode<PairingRequestOnCompleteRequest, D>
3886        for &PairingRequestOnCompleteRequest
3887    {
3888        #[inline]
3889        unsafe fn encode(
3890            self,
3891            encoder: &mut fidl::encoding::Encoder<'_, D>,
3892            offset: usize,
3893            _depth: fidl::encoding::Depth,
3894        ) -> fidl::Result<()> {
3895            encoder.debug_check_bounds::<PairingRequestOnCompleteRequest>(offset);
3896            // Delegate to tuple encoding.
3897            fidl::encoding::Encode::<PairingRequestOnCompleteRequest, D>::encode(
3898                (<bool as fidl::encoding::ValueTypeMarker>::borrow(&self.success),),
3899                encoder,
3900                offset,
3901                _depth,
3902            )
3903        }
3904    }
3905    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<bool, D>>
3906        fidl::encoding::Encode<PairingRequestOnCompleteRequest, D> for (T0,)
3907    {
3908        #[inline]
3909        unsafe fn encode(
3910            self,
3911            encoder: &mut fidl::encoding::Encoder<'_, D>,
3912            offset: usize,
3913            depth: fidl::encoding::Depth,
3914        ) -> fidl::Result<()> {
3915            encoder.debug_check_bounds::<PairingRequestOnCompleteRequest>(offset);
3916            // Zero out padding regions. There's no need to apply masks
3917            // because the unmasked parts will be overwritten by fields.
3918            // Write the fields.
3919            self.0.encode(encoder, offset + 0, depth)?;
3920            Ok(())
3921        }
3922    }
3923
3924    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3925        for PairingRequestOnCompleteRequest
3926    {
3927        #[inline(always)]
3928        fn new_empty() -> Self {
3929            Self { success: fidl::new_empty!(bool, D) }
3930        }
3931
3932        #[inline]
3933        unsafe fn decode(
3934            &mut self,
3935            decoder: &mut fidl::encoding::Decoder<'_, D>,
3936            offset: usize,
3937            _depth: fidl::encoding::Depth,
3938        ) -> fidl::Result<()> {
3939            decoder.debug_check_bounds::<Self>(offset);
3940            // Verify that padding bytes are zero.
3941            fidl::decode!(bool, D, &mut self.success, decoder, offset + 0, _depth)?;
3942            Ok(())
3943        }
3944    }
3945
3946    impl fidl::encoding::ValueTypeMarker for PairingRequestOnKeypressRequest {
3947        type Borrowed<'a> = &'a Self;
3948        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3949            value
3950        }
3951    }
3952
3953    unsafe impl fidl::encoding::TypeMarker for PairingRequestOnKeypressRequest {
3954        type Owned = Self;
3955
3956        #[inline(always)]
3957        fn inline_align(_context: fidl::encoding::Context) -> usize {
3958            4
3959        }
3960
3961        #[inline(always)]
3962        fn inline_size(_context: fidl::encoding::Context) -> usize {
3963            4
3964        }
3965    }
3966
3967    unsafe impl<D: fidl::encoding::ResourceDialect>
3968        fidl::encoding::Encode<PairingRequestOnKeypressRequest, D>
3969        for &PairingRequestOnKeypressRequest
3970    {
3971        #[inline]
3972        unsafe fn encode(
3973            self,
3974            encoder: &mut fidl::encoding::Encoder<'_, D>,
3975            offset: usize,
3976            _depth: fidl::encoding::Depth,
3977        ) -> fidl::Result<()> {
3978            encoder.debug_check_bounds::<PairingRequestOnKeypressRequest>(offset);
3979            // Delegate to tuple encoding.
3980            fidl::encoding::Encode::<PairingRequestOnKeypressRequest, D>::encode(
3981                (<PairingKeypress as fidl::encoding::ValueTypeMarker>::borrow(&self.keypress),),
3982                encoder,
3983                offset,
3984                _depth,
3985            )
3986        }
3987    }
3988    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<PairingKeypress, D>>
3989        fidl::encoding::Encode<PairingRequestOnKeypressRequest, D> for (T0,)
3990    {
3991        #[inline]
3992        unsafe fn encode(
3993            self,
3994            encoder: &mut fidl::encoding::Encoder<'_, D>,
3995            offset: usize,
3996            depth: fidl::encoding::Depth,
3997        ) -> fidl::Result<()> {
3998            encoder.debug_check_bounds::<PairingRequestOnKeypressRequest>(offset);
3999            // Zero out padding regions. There's no need to apply masks
4000            // because the unmasked parts will be overwritten by fields.
4001            // Write the fields.
4002            self.0.encode(encoder, offset + 0, depth)?;
4003            Ok(())
4004        }
4005    }
4006
4007    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
4008        for PairingRequestOnKeypressRequest
4009    {
4010        #[inline(always)]
4011        fn new_empty() -> Self {
4012            Self { keypress: fidl::new_empty!(PairingKeypress, D) }
4013        }
4014
4015        #[inline]
4016        unsafe fn decode(
4017            &mut self,
4018            decoder: &mut fidl::encoding::Decoder<'_, D>,
4019            offset: usize,
4020            _depth: fidl::encoding::Depth,
4021        ) -> fidl::Result<()> {
4022            decoder.debug_check_bounds::<Self>(offset);
4023            // Verify that padding bytes are zero.
4024            fidl::decode!(PairingKeypress, D, &mut self.keypress, decoder, offset + 0, _depth)?;
4025            Ok(())
4026        }
4027    }
4028
4029    impl fidl::encoding::ValueTypeMarker for PasskeyEntry {
4030        type Borrowed<'a> = &'a Self;
4031        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4032            value
4033        }
4034    }
4035
4036    unsafe impl fidl::encoding::TypeMarker for PasskeyEntry {
4037        type Owned = Self;
4038
4039        #[inline(always)]
4040        fn inline_align(_context: fidl::encoding::Context) -> usize {
4041            1
4042        }
4043
4044        #[inline(always)]
4045        fn inline_size(_context: fidl::encoding::Context) -> usize {
4046            1
4047        }
4048    }
4049
4050    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<PasskeyEntry, D>
4051        for &PasskeyEntry
4052    {
4053        #[inline]
4054        unsafe fn encode(
4055            self,
4056            encoder: &mut fidl::encoding::Encoder<'_, D>,
4057            offset: usize,
4058            _depth: fidl::encoding::Depth,
4059        ) -> fidl::Result<()> {
4060            encoder.debug_check_bounds::<PasskeyEntry>(offset);
4061            encoder.write_num(0u8, offset);
4062            Ok(())
4063        }
4064    }
4065
4066    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for PasskeyEntry {
4067        #[inline(always)]
4068        fn new_empty() -> Self {
4069            Self
4070        }
4071
4072        #[inline]
4073        unsafe fn decode(
4074            &mut self,
4075            decoder: &mut fidl::encoding::Decoder<'_, D>,
4076            offset: usize,
4077            _depth: fidl::encoding::Depth,
4078        ) -> fidl::Result<()> {
4079            decoder.debug_check_bounds::<Self>(offset);
4080            match decoder.read_num::<u8>(offset) {
4081                0 => Ok(()),
4082                _ => Err(fidl::Error::Invalid),
4083            }
4084        }
4085    }
4086
4087    impl fidl::encoding::ValueTypeMarker for PeerKey {
4088        type Borrowed<'a> = &'a Self;
4089        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4090            value
4091        }
4092    }
4093
4094    unsafe impl fidl::encoding::TypeMarker for PeerKey {
4095        type Owned = Self;
4096
4097        #[inline(always)]
4098        fn inline_align(_context: fidl::encoding::Context) -> usize {
4099            1
4100        }
4101
4102        #[inline(always)]
4103        fn inline_size(_context: fidl::encoding::Context) -> usize {
4104            19
4105        }
4106    }
4107
4108    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<PeerKey, D> for &PeerKey {
4109        #[inline]
4110        unsafe fn encode(
4111            self,
4112            encoder: &mut fidl::encoding::Encoder<'_, D>,
4113            offset: usize,
4114            _depth: fidl::encoding::Depth,
4115        ) -> fidl::Result<()> {
4116            encoder.debug_check_bounds::<PeerKey>(offset);
4117            // Delegate to tuple encoding.
4118            fidl::encoding::Encode::<PeerKey, D>::encode(
4119                (
4120                    <SecurityProperties as fidl::encoding::ValueTypeMarker>::borrow(&self.security),
4121                    <Key as fidl::encoding::ValueTypeMarker>::borrow(&self.data),
4122                ),
4123                encoder,
4124                offset,
4125                _depth,
4126            )
4127        }
4128    }
4129    unsafe impl<
4130            D: fidl::encoding::ResourceDialect,
4131            T0: fidl::encoding::Encode<SecurityProperties, D>,
4132            T1: fidl::encoding::Encode<Key, D>,
4133        > fidl::encoding::Encode<PeerKey, D> for (T0, T1)
4134    {
4135        #[inline]
4136        unsafe fn encode(
4137            self,
4138            encoder: &mut fidl::encoding::Encoder<'_, D>,
4139            offset: usize,
4140            depth: fidl::encoding::Depth,
4141        ) -> fidl::Result<()> {
4142            encoder.debug_check_bounds::<PeerKey>(offset);
4143            // Zero out padding regions. There's no need to apply masks
4144            // because the unmasked parts will be overwritten by fields.
4145            // Write the fields.
4146            self.0.encode(encoder, offset + 0, depth)?;
4147            self.1.encode(encoder, offset + 3, depth)?;
4148            Ok(())
4149        }
4150    }
4151
4152    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for PeerKey {
4153        #[inline(always)]
4154        fn new_empty() -> Self {
4155            Self {
4156                security: fidl::new_empty!(SecurityProperties, D),
4157                data: fidl::new_empty!(Key, D),
4158            }
4159        }
4160
4161        #[inline]
4162        unsafe fn decode(
4163            &mut self,
4164            decoder: &mut fidl::encoding::Decoder<'_, D>,
4165            offset: usize,
4166            _depth: fidl::encoding::Depth,
4167        ) -> fidl::Result<()> {
4168            decoder.debug_check_bounds::<Self>(offset);
4169            // Verify that padding bytes are zero.
4170            fidl::decode!(SecurityProperties, D, &mut self.security, decoder, offset + 0, _depth)?;
4171            fidl::decode!(Key, D, &mut self.data, decoder, offset + 3, _depth)?;
4172            Ok(())
4173        }
4174    }
4175
4176    impl fidl::encoding::ValueTypeMarker for SecurityProperties {
4177        type Borrowed<'a> = &'a Self;
4178        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4179            value
4180        }
4181    }
4182
4183    unsafe impl fidl::encoding::TypeMarker for SecurityProperties {
4184        type Owned = Self;
4185
4186        #[inline(always)]
4187        fn inline_align(_context: fidl::encoding::Context) -> usize {
4188            1
4189        }
4190
4191        #[inline(always)]
4192        fn inline_size(_context: fidl::encoding::Context) -> usize {
4193            3
4194        }
4195    }
4196
4197    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<SecurityProperties, D>
4198        for &SecurityProperties
4199    {
4200        #[inline]
4201        unsafe fn encode(
4202            self,
4203            encoder: &mut fidl::encoding::Encoder<'_, D>,
4204            offset: usize,
4205            _depth: fidl::encoding::Depth,
4206        ) -> fidl::Result<()> {
4207            encoder.debug_check_bounds::<SecurityProperties>(offset);
4208            // Delegate to tuple encoding.
4209            fidl::encoding::Encode::<SecurityProperties, D>::encode(
4210                (
4211                    <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.authenticated),
4212                    <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.secure_connections),
4213                    <u8 as fidl::encoding::ValueTypeMarker>::borrow(&self.encryption_key_size),
4214                ),
4215                encoder,
4216                offset,
4217                _depth,
4218            )
4219        }
4220    }
4221    unsafe impl<
4222            D: fidl::encoding::ResourceDialect,
4223            T0: fidl::encoding::Encode<bool, D>,
4224            T1: fidl::encoding::Encode<bool, D>,
4225            T2: fidl::encoding::Encode<u8, D>,
4226        > fidl::encoding::Encode<SecurityProperties, D> for (T0, T1, T2)
4227    {
4228        #[inline]
4229        unsafe fn encode(
4230            self,
4231            encoder: &mut fidl::encoding::Encoder<'_, D>,
4232            offset: usize,
4233            depth: fidl::encoding::Depth,
4234        ) -> fidl::Result<()> {
4235            encoder.debug_check_bounds::<SecurityProperties>(offset);
4236            // Zero out padding regions. There's no need to apply masks
4237            // because the unmasked parts will be overwritten by fields.
4238            // Write the fields.
4239            self.0.encode(encoder, offset + 0, depth)?;
4240            self.1.encode(encoder, offset + 1, depth)?;
4241            self.2.encode(encoder, offset + 2, depth)?;
4242            Ok(())
4243        }
4244    }
4245
4246    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SecurityProperties {
4247        #[inline(always)]
4248        fn new_empty() -> Self {
4249            Self {
4250                authenticated: fidl::new_empty!(bool, D),
4251                secure_connections: fidl::new_empty!(bool, D),
4252                encryption_key_size: fidl::new_empty!(u8, D),
4253            }
4254        }
4255
4256        #[inline]
4257        unsafe fn decode(
4258            &mut self,
4259            decoder: &mut fidl::encoding::Decoder<'_, D>,
4260            offset: usize,
4261            _depth: fidl::encoding::Depth,
4262        ) -> fidl::Result<()> {
4263            decoder.debug_check_bounds::<Self>(offset);
4264            // Verify that padding bytes are zero.
4265            fidl::decode!(bool, D, &mut self.authenticated, decoder, offset + 0, _depth)?;
4266            fidl::decode!(bool, D, &mut self.secure_connections, decoder, offset + 1, _depth)?;
4267            fidl::decode!(u8, D, &mut self.encryption_key_size, decoder, offset + 2, _depth)?;
4268            Ok(())
4269        }
4270    }
4271
4272    impl BondingData {
4273        #[inline(always)]
4274        fn max_ordinal_present(&self) -> u64 {
4275            if let Some(_) = self.bredr_bond {
4276                return 8;
4277            }
4278            if let Some(_) = self.le_bond {
4279                return 7;
4280            }
4281            if let Some(_) = self.address {
4282                return 6;
4283            }
4284            if let Some(_) = self.name {
4285                return 3;
4286            }
4287            if let Some(_) = self.local_address {
4288                return 2;
4289            }
4290            if let Some(_) = self.identifier {
4291                return 1;
4292            }
4293            0
4294        }
4295    }
4296
4297    impl fidl::encoding::ValueTypeMarker for BondingData {
4298        type Borrowed<'a> = &'a Self;
4299        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4300            value
4301        }
4302    }
4303
4304    unsafe impl fidl::encoding::TypeMarker for BondingData {
4305        type Owned = Self;
4306
4307        #[inline(always)]
4308        fn inline_align(_context: fidl::encoding::Context) -> usize {
4309            8
4310        }
4311
4312        #[inline(always)]
4313        fn inline_size(_context: fidl::encoding::Context) -> usize {
4314            16
4315        }
4316    }
4317
4318    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<BondingData, D>
4319        for &BondingData
4320    {
4321        unsafe fn encode(
4322            self,
4323            encoder: &mut fidl::encoding::Encoder<'_, D>,
4324            offset: usize,
4325            mut depth: fidl::encoding::Depth,
4326        ) -> fidl::Result<()> {
4327            encoder.debug_check_bounds::<BondingData>(offset);
4328            // Vector header
4329            let max_ordinal: u64 = self.max_ordinal_present();
4330            encoder.write_num(max_ordinal, offset);
4331            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
4332            // Calling encoder.out_of_line_offset(0) is not allowed.
4333            if max_ordinal == 0 {
4334                return Ok(());
4335            }
4336            depth.increment()?;
4337            let envelope_size = 8;
4338            let bytes_len = max_ordinal as usize * envelope_size;
4339            #[allow(unused_variables)]
4340            let offset = encoder.out_of_line_offset(bytes_len);
4341            let mut _prev_end_offset: usize = 0;
4342            if 1 > max_ordinal {
4343                return Ok(());
4344            }
4345
4346            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4347            // are envelope_size bytes.
4348            let cur_offset: usize = (1 - 1) * envelope_size;
4349
4350            // Zero reserved fields.
4351            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4352
4353            // Safety:
4354            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4355            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4356            //   envelope_size bytes, there is always sufficient room.
4357            fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_bluetooth__common::PeerId, D>(
4358            self.identifier.as_ref().map(<fidl_fuchsia_bluetooth__common::PeerId as fidl::encoding::ValueTypeMarker>::borrow),
4359            encoder, offset + cur_offset, depth
4360        )?;
4361
4362            _prev_end_offset = cur_offset + envelope_size;
4363            if 2 > max_ordinal {
4364                return Ok(());
4365            }
4366
4367            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4368            // are envelope_size bytes.
4369            let cur_offset: usize = (2 - 1) * envelope_size;
4370
4371            // Zero reserved fields.
4372            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4373
4374            // Safety:
4375            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4376            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4377            //   envelope_size bytes, there is always sufficient room.
4378            fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_bluetooth__common::Address, D>(
4379            self.local_address.as_ref().map(<fidl_fuchsia_bluetooth__common::Address as fidl::encoding::ValueTypeMarker>::borrow),
4380            encoder, offset + cur_offset, depth
4381        )?;
4382
4383            _prev_end_offset = cur_offset + envelope_size;
4384            if 3 > max_ordinal {
4385                return Ok(());
4386            }
4387
4388            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4389            // are envelope_size bytes.
4390            let cur_offset: usize = (3 - 1) * envelope_size;
4391
4392            // Zero reserved fields.
4393            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4394
4395            // Safety:
4396            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4397            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4398            //   envelope_size bytes, there is always sufficient room.
4399            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<248>, D>(
4400                self.name.as_ref().map(
4401                    <fidl::encoding::BoundedString<248> as fidl::encoding::ValueTypeMarker>::borrow,
4402                ),
4403                encoder,
4404                offset + cur_offset,
4405                depth,
4406            )?;
4407
4408            _prev_end_offset = cur_offset + envelope_size;
4409            if 6 > max_ordinal {
4410                return Ok(());
4411            }
4412
4413            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4414            // are envelope_size bytes.
4415            let cur_offset: usize = (6 - 1) * envelope_size;
4416
4417            // Zero reserved fields.
4418            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4419
4420            // Safety:
4421            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4422            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4423            //   envelope_size bytes, there is always sufficient room.
4424            fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_bluetooth__common::Address, D>(
4425            self.address.as_ref().map(<fidl_fuchsia_bluetooth__common::Address as fidl::encoding::ValueTypeMarker>::borrow),
4426            encoder, offset + cur_offset, depth
4427        )?;
4428
4429            _prev_end_offset = cur_offset + envelope_size;
4430            if 7 > max_ordinal {
4431                return Ok(());
4432            }
4433
4434            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4435            // are envelope_size bytes.
4436            let cur_offset: usize = (7 - 1) * envelope_size;
4437
4438            // Zero reserved fields.
4439            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4440
4441            // Safety:
4442            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4443            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4444            //   envelope_size bytes, there is always sufficient room.
4445            fidl::encoding::encode_in_envelope_optional::<LeBondData, D>(
4446                self.le_bond.as_ref().map(<LeBondData as fidl::encoding::ValueTypeMarker>::borrow),
4447                encoder,
4448                offset + cur_offset,
4449                depth,
4450            )?;
4451
4452            _prev_end_offset = cur_offset + envelope_size;
4453            if 8 > max_ordinal {
4454                return Ok(());
4455            }
4456
4457            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4458            // are envelope_size bytes.
4459            let cur_offset: usize = (8 - 1) * envelope_size;
4460
4461            // Zero reserved fields.
4462            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4463
4464            // Safety:
4465            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4466            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4467            //   envelope_size bytes, there is always sufficient room.
4468            fidl::encoding::encode_in_envelope_optional::<BredrBondData, D>(
4469                self.bredr_bond
4470                    .as_ref()
4471                    .map(<BredrBondData as fidl::encoding::ValueTypeMarker>::borrow),
4472                encoder,
4473                offset + cur_offset,
4474                depth,
4475            )?;
4476
4477            _prev_end_offset = cur_offset + envelope_size;
4478
4479            Ok(())
4480        }
4481    }
4482
4483    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for BondingData {
4484        #[inline(always)]
4485        fn new_empty() -> Self {
4486            Self::default()
4487        }
4488
4489        unsafe fn decode(
4490            &mut self,
4491            decoder: &mut fidl::encoding::Decoder<'_, D>,
4492            offset: usize,
4493            mut depth: fidl::encoding::Depth,
4494        ) -> fidl::Result<()> {
4495            decoder.debug_check_bounds::<Self>(offset);
4496            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
4497                None => return Err(fidl::Error::NotNullable),
4498                Some(len) => len,
4499            };
4500            // Calling decoder.out_of_line_offset(0) is not allowed.
4501            if len == 0 {
4502                return Ok(());
4503            };
4504            depth.increment()?;
4505            let envelope_size = 8;
4506            let bytes_len = len * envelope_size;
4507            let offset = decoder.out_of_line_offset(bytes_len)?;
4508            // Decode the envelope for each type.
4509            let mut _next_ordinal_to_read = 0;
4510            let mut next_offset = offset;
4511            let end_offset = offset + bytes_len;
4512            _next_ordinal_to_read += 1;
4513            if next_offset >= end_offset {
4514                return Ok(());
4515            }
4516
4517            // Decode unknown envelopes for gaps in ordinals.
4518            while _next_ordinal_to_read < 1 {
4519                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4520                _next_ordinal_to_read += 1;
4521                next_offset += envelope_size;
4522            }
4523
4524            let next_out_of_line = decoder.next_out_of_line();
4525            let handles_before = decoder.remaining_handles();
4526            if let Some((inlined, num_bytes, num_handles)) =
4527                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4528            {
4529                let member_inline_size = <fidl_fuchsia_bluetooth__common::PeerId as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4530                if inlined != (member_inline_size <= 4) {
4531                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4532                }
4533                let inner_offset;
4534                let mut inner_depth = depth.clone();
4535                if inlined {
4536                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4537                    inner_offset = next_offset;
4538                } else {
4539                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4540                    inner_depth.increment()?;
4541                }
4542                let val_ref = self.identifier.get_or_insert_with(|| {
4543                    fidl::new_empty!(fidl_fuchsia_bluetooth__common::PeerId, D)
4544                });
4545                fidl::decode!(
4546                    fidl_fuchsia_bluetooth__common::PeerId,
4547                    D,
4548                    val_ref,
4549                    decoder,
4550                    inner_offset,
4551                    inner_depth
4552                )?;
4553                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4554                {
4555                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4556                }
4557                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4558                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4559                }
4560            }
4561
4562            next_offset += envelope_size;
4563            _next_ordinal_to_read += 1;
4564            if next_offset >= end_offset {
4565                return Ok(());
4566            }
4567
4568            // Decode unknown envelopes for gaps in ordinals.
4569            while _next_ordinal_to_read < 2 {
4570                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4571                _next_ordinal_to_read += 1;
4572                next_offset += envelope_size;
4573            }
4574
4575            let next_out_of_line = decoder.next_out_of_line();
4576            let handles_before = decoder.remaining_handles();
4577            if let Some((inlined, num_bytes, num_handles)) =
4578                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4579            {
4580                let member_inline_size = <fidl_fuchsia_bluetooth__common::Address as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4581                if inlined != (member_inline_size <= 4) {
4582                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4583                }
4584                let inner_offset;
4585                let mut inner_depth = depth.clone();
4586                if inlined {
4587                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4588                    inner_offset = next_offset;
4589                } else {
4590                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4591                    inner_depth.increment()?;
4592                }
4593                let val_ref = self.local_address.get_or_insert_with(|| {
4594                    fidl::new_empty!(fidl_fuchsia_bluetooth__common::Address, D)
4595                });
4596                fidl::decode!(
4597                    fidl_fuchsia_bluetooth__common::Address,
4598                    D,
4599                    val_ref,
4600                    decoder,
4601                    inner_offset,
4602                    inner_depth
4603                )?;
4604                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4605                {
4606                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4607                }
4608                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4609                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4610                }
4611            }
4612
4613            next_offset += envelope_size;
4614            _next_ordinal_to_read += 1;
4615            if next_offset >= end_offset {
4616                return Ok(());
4617            }
4618
4619            // Decode unknown envelopes for gaps in ordinals.
4620            while _next_ordinal_to_read < 3 {
4621                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4622                _next_ordinal_to_read += 1;
4623                next_offset += envelope_size;
4624            }
4625
4626            let next_out_of_line = decoder.next_out_of_line();
4627            let handles_before = decoder.remaining_handles();
4628            if let Some((inlined, num_bytes, num_handles)) =
4629                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4630            {
4631                let member_inline_size =
4632                    <fidl::encoding::BoundedString<248> as fidl::encoding::TypeMarker>::inline_size(
4633                        decoder.context,
4634                    );
4635                if inlined != (member_inline_size <= 4) {
4636                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4637                }
4638                let inner_offset;
4639                let mut inner_depth = depth.clone();
4640                if inlined {
4641                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4642                    inner_offset = next_offset;
4643                } else {
4644                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4645                    inner_depth.increment()?;
4646                }
4647                let val_ref = self
4648                    .name
4649                    .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::BoundedString<248>, D));
4650                fidl::decode!(
4651                    fidl::encoding::BoundedString<248>,
4652                    D,
4653                    val_ref,
4654                    decoder,
4655                    inner_offset,
4656                    inner_depth
4657                )?;
4658                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4659                {
4660                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4661                }
4662                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4663                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4664                }
4665            }
4666
4667            next_offset += envelope_size;
4668            _next_ordinal_to_read += 1;
4669            if next_offset >= end_offset {
4670                return Ok(());
4671            }
4672
4673            // Decode unknown envelopes for gaps in ordinals.
4674            while _next_ordinal_to_read < 6 {
4675                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4676                _next_ordinal_to_read += 1;
4677                next_offset += envelope_size;
4678            }
4679
4680            let next_out_of_line = decoder.next_out_of_line();
4681            let handles_before = decoder.remaining_handles();
4682            if let Some((inlined, num_bytes, num_handles)) =
4683                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4684            {
4685                let member_inline_size = <fidl_fuchsia_bluetooth__common::Address as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4686                if inlined != (member_inline_size <= 4) {
4687                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4688                }
4689                let inner_offset;
4690                let mut inner_depth = depth.clone();
4691                if inlined {
4692                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4693                    inner_offset = next_offset;
4694                } else {
4695                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4696                    inner_depth.increment()?;
4697                }
4698                let val_ref = self.address.get_or_insert_with(|| {
4699                    fidl::new_empty!(fidl_fuchsia_bluetooth__common::Address, D)
4700                });
4701                fidl::decode!(
4702                    fidl_fuchsia_bluetooth__common::Address,
4703                    D,
4704                    val_ref,
4705                    decoder,
4706                    inner_offset,
4707                    inner_depth
4708                )?;
4709                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4710                {
4711                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4712                }
4713                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4714                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4715                }
4716            }
4717
4718            next_offset += envelope_size;
4719            _next_ordinal_to_read += 1;
4720            if next_offset >= end_offset {
4721                return Ok(());
4722            }
4723
4724            // Decode unknown envelopes for gaps in ordinals.
4725            while _next_ordinal_to_read < 7 {
4726                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4727                _next_ordinal_to_read += 1;
4728                next_offset += envelope_size;
4729            }
4730
4731            let next_out_of_line = decoder.next_out_of_line();
4732            let handles_before = decoder.remaining_handles();
4733            if let Some((inlined, num_bytes, num_handles)) =
4734                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4735            {
4736                let member_inline_size =
4737                    <LeBondData as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4738                if inlined != (member_inline_size <= 4) {
4739                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4740                }
4741                let inner_offset;
4742                let mut inner_depth = depth.clone();
4743                if inlined {
4744                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4745                    inner_offset = next_offset;
4746                } else {
4747                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4748                    inner_depth.increment()?;
4749                }
4750                let val_ref = self.le_bond.get_or_insert_with(|| fidl::new_empty!(LeBondData, D));
4751                fidl::decode!(LeBondData, D, val_ref, decoder, inner_offset, inner_depth)?;
4752                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4753                {
4754                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4755                }
4756                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4757                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4758                }
4759            }
4760
4761            next_offset += envelope_size;
4762            _next_ordinal_to_read += 1;
4763            if next_offset >= end_offset {
4764                return Ok(());
4765            }
4766
4767            // Decode unknown envelopes for gaps in ordinals.
4768            while _next_ordinal_to_read < 8 {
4769                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4770                _next_ordinal_to_read += 1;
4771                next_offset += envelope_size;
4772            }
4773
4774            let next_out_of_line = decoder.next_out_of_line();
4775            let handles_before = decoder.remaining_handles();
4776            if let Some((inlined, num_bytes, num_handles)) =
4777                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4778            {
4779                let member_inline_size =
4780                    <BredrBondData as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4781                if inlined != (member_inline_size <= 4) {
4782                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4783                }
4784                let inner_offset;
4785                let mut inner_depth = depth.clone();
4786                if inlined {
4787                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4788                    inner_offset = next_offset;
4789                } else {
4790                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4791                    inner_depth.increment()?;
4792                }
4793                let val_ref =
4794                    self.bredr_bond.get_or_insert_with(|| fidl::new_empty!(BredrBondData, D));
4795                fidl::decode!(BredrBondData, D, val_ref, decoder, inner_offset, inner_depth)?;
4796                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4797                {
4798                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4799                }
4800                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4801                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4802                }
4803            }
4804
4805            next_offset += envelope_size;
4806
4807            // Decode the remaining unknown envelopes.
4808            while next_offset < end_offset {
4809                _next_ordinal_to_read += 1;
4810                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4811                next_offset += envelope_size;
4812            }
4813
4814            Ok(())
4815        }
4816    }
4817
4818    impl BredrBondData {
4819        #[inline(always)]
4820        fn max_ordinal_present(&self) -> u64 {
4821            if let Some(_) = self.link_key {
4822                return 3;
4823            }
4824            if let Some(_) = self.services {
4825                return 2;
4826            }
4827            if let Some(_) = self.role_preference {
4828                return 1;
4829            }
4830            0
4831        }
4832    }
4833
4834    impl fidl::encoding::ValueTypeMarker for BredrBondData {
4835        type Borrowed<'a> = &'a Self;
4836        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4837            value
4838        }
4839    }
4840
4841    unsafe impl fidl::encoding::TypeMarker for BredrBondData {
4842        type Owned = Self;
4843
4844        #[inline(always)]
4845        fn inline_align(_context: fidl::encoding::Context) -> usize {
4846            8
4847        }
4848
4849        #[inline(always)]
4850        fn inline_size(_context: fidl::encoding::Context) -> usize {
4851            16
4852        }
4853    }
4854
4855    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<BredrBondData, D>
4856        for &BredrBondData
4857    {
4858        unsafe fn encode(
4859            self,
4860            encoder: &mut fidl::encoding::Encoder<'_, D>,
4861            offset: usize,
4862            mut depth: fidl::encoding::Depth,
4863        ) -> fidl::Result<()> {
4864            encoder.debug_check_bounds::<BredrBondData>(offset);
4865            // Vector header
4866            let max_ordinal: u64 = self.max_ordinal_present();
4867            encoder.write_num(max_ordinal, offset);
4868            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
4869            // Calling encoder.out_of_line_offset(0) is not allowed.
4870            if max_ordinal == 0 {
4871                return Ok(());
4872            }
4873            depth.increment()?;
4874            let envelope_size = 8;
4875            let bytes_len = max_ordinal as usize * envelope_size;
4876            #[allow(unused_variables)]
4877            let offset = encoder.out_of_line_offset(bytes_len);
4878            let mut _prev_end_offset: usize = 0;
4879            if 1 > max_ordinal {
4880                return Ok(());
4881            }
4882
4883            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4884            // are envelope_size bytes.
4885            let cur_offset: usize = (1 - 1) * envelope_size;
4886
4887            // Zero reserved fields.
4888            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4889
4890            // Safety:
4891            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4892            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4893            //   envelope_size bytes, there is always sufficient room.
4894            fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_bluetooth__common::ConnectionRole, D>(
4895            self.role_preference.as_ref().map(<fidl_fuchsia_bluetooth__common::ConnectionRole as fidl::encoding::ValueTypeMarker>::borrow),
4896            encoder, offset + cur_offset, depth
4897        )?;
4898
4899            _prev_end_offset = cur_offset + envelope_size;
4900            if 2 > max_ordinal {
4901                return Ok(());
4902            }
4903
4904            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4905            // are envelope_size bytes.
4906            let cur_offset: usize = (2 - 1) * envelope_size;
4907
4908            // Zero reserved fields.
4909            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4910
4911            // Safety:
4912            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4913            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4914            //   envelope_size bytes, there is always sufficient room.
4915            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<fidl_fuchsia_bluetooth__common::Uuid, 65535>, D>(
4916            self.services.as_ref().map(<fidl::encoding::Vector<fidl_fuchsia_bluetooth__common::Uuid, 65535> as fidl::encoding::ValueTypeMarker>::borrow),
4917            encoder, offset + cur_offset, depth
4918        )?;
4919
4920            _prev_end_offset = cur_offset + envelope_size;
4921            if 3 > max_ordinal {
4922                return Ok(());
4923            }
4924
4925            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4926            // are envelope_size bytes.
4927            let cur_offset: usize = (3 - 1) * envelope_size;
4928
4929            // Zero reserved fields.
4930            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4931
4932            // Safety:
4933            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4934            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4935            //   envelope_size bytes, there is always sufficient room.
4936            fidl::encoding::encode_in_envelope_optional::<PeerKey, D>(
4937                self.link_key.as_ref().map(<PeerKey as fidl::encoding::ValueTypeMarker>::borrow),
4938                encoder,
4939                offset + cur_offset,
4940                depth,
4941            )?;
4942
4943            _prev_end_offset = cur_offset + envelope_size;
4944
4945            Ok(())
4946        }
4947    }
4948
4949    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for BredrBondData {
4950        #[inline(always)]
4951        fn new_empty() -> Self {
4952            Self::default()
4953        }
4954
4955        unsafe fn decode(
4956            &mut self,
4957            decoder: &mut fidl::encoding::Decoder<'_, D>,
4958            offset: usize,
4959            mut depth: fidl::encoding::Depth,
4960        ) -> fidl::Result<()> {
4961            decoder.debug_check_bounds::<Self>(offset);
4962            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
4963                None => return Err(fidl::Error::NotNullable),
4964                Some(len) => len,
4965            };
4966            // Calling decoder.out_of_line_offset(0) is not allowed.
4967            if len == 0 {
4968                return Ok(());
4969            };
4970            depth.increment()?;
4971            let envelope_size = 8;
4972            let bytes_len = len * envelope_size;
4973            let offset = decoder.out_of_line_offset(bytes_len)?;
4974            // Decode the envelope for each type.
4975            let mut _next_ordinal_to_read = 0;
4976            let mut next_offset = offset;
4977            let end_offset = offset + bytes_len;
4978            _next_ordinal_to_read += 1;
4979            if next_offset >= end_offset {
4980                return Ok(());
4981            }
4982
4983            // Decode unknown envelopes for gaps in ordinals.
4984            while _next_ordinal_to_read < 1 {
4985                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4986                _next_ordinal_to_read += 1;
4987                next_offset += envelope_size;
4988            }
4989
4990            let next_out_of_line = decoder.next_out_of_line();
4991            let handles_before = decoder.remaining_handles();
4992            if let Some((inlined, num_bytes, num_handles)) =
4993                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4994            {
4995                let member_inline_size = <fidl_fuchsia_bluetooth__common::ConnectionRole as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4996                if inlined != (member_inline_size <= 4) {
4997                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4998                }
4999                let inner_offset;
5000                let mut inner_depth = depth.clone();
5001                if inlined {
5002                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5003                    inner_offset = next_offset;
5004                } else {
5005                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5006                    inner_depth.increment()?;
5007                }
5008                let val_ref = self.role_preference.get_or_insert_with(|| {
5009                    fidl::new_empty!(fidl_fuchsia_bluetooth__common::ConnectionRole, D)
5010                });
5011                fidl::decode!(
5012                    fidl_fuchsia_bluetooth__common::ConnectionRole,
5013                    D,
5014                    val_ref,
5015                    decoder,
5016                    inner_offset,
5017                    inner_depth
5018                )?;
5019                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5020                {
5021                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5022                }
5023                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5024                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5025                }
5026            }
5027
5028            next_offset += envelope_size;
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 < 2 {
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::encoding::Vector<
5047                    fidl_fuchsia_bluetooth__common::Uuid,
5048                    65535,
5049                > as fidl::encoding::TypeMarker>::inline_size(
5050                    decoder.context
5051                );
5052                if inlined != (member_inline_size <= 4) {
5053                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5054                }
5055                let inner_offset;
5056                let mut inner_depth = depth.clone();
5057                if inlined {
5058                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5059                    inner_offset = next_offset;
5060                } else {
5061                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5062                    inner_depth.increment()?;
5063                }
5064                let val_ref =
5065                self.services.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<fidl_fuchsia_bluetooth__common::Uuid, 65535>, D));
5066                fidl::decode!(fidl::encoding::Vector<fidl_fuchsia_bluetooth__common::Uuid, 65535>, D, val_ref, decoder, inner_offset, inner_depth)?;
5067                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5068                {
5069                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5070                }
5071                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5072                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5073                }
5074            }
5075
5076            next_offset += envelope_size;
5077            _next_ordinal_to_read += 1;
5078            if next_offset >= end_offset {
5079                return Ok(());
5080            }
5081
5082            // Decode unknown envelopes for gaps in ordinals.
5083            while _next_ordinal_to_read < 3 {
5084                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5085                _next_ordinal_to_read += 1;
5086                next_offset += envelope_size;
5087            }
5088
5089            let next_out_of_line = decoder.next_out_of_line();
5090            let handles_before = decoder.remaining_handles();
5091            if let Some((inlined, num_bytes, num_handles)) =
5092                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5093            {
5094                let member_inline_size =
5095                    <PeerKey as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5096                if inlined != (member_inline_size <= 4) {
5097                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5098                }
5099                let inner_offset;
5100                let mut inner_depth = depth.clone();
5101                if inlined {
5102                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5103                    inner_offset = next_offset;
5104                } else {
5105                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5106                    inner_depth.increment()?;
5107                }
5108                let val_ref = self.link_key.get_or_insert_with(|| fidl::new_empty!(PeerKey, D));
5109                fidl::decode!(PeerKey, D, val_ref, decoder, inner_offset, inner_depth)?;
5110                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5111                {
5112                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5113                }
5114                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5115                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5116                }
5117            }
5118
5119            next_offset += envelope_size;
5120
5121            // Decode the remaining unknown envelopes.
5122            while next_offset < end_offset {
5123                _next_ordinal_to_read += 1;
5124                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5125                next_offset += envelope_size;
5126            }
5127
5128            Ok(())
5129        }
5130    }
5131
5132    impl HostData {
5133        #[inline(always)]
5134        fn max_ordinal_present(&self) -> u64 {
5135            if let Some(_) = self.irk {
5136                return 1;
5137            }
5138            0
5139        }
5140    }
5141
5142    impl fidl::encoding::ValueTypeMarker for HostData {
5143        type Borrowed<'a> = &'a Self;
5144        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
5145            value
5146        }
5147    }
5148
5149    unsafe impl fidl::encoding::TypeMarker for HostData {
5150        type Owned = Self;
5151
5152        #[inline(always)]
5153        fn inline_align(_context: fidl::encoding::Context) -> usize {
5154            8
5155        }
5156
5157        #[inline(always)]
5158        fn inline_size(_context: fidl::encoding::Context) -> usize {
5159            16
5160        }
5161    }
5162
5163    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<HostData, D> for &HostData {
5164        unsafe fn encode(
5165            self,
5166            encoder: &mut fidl::encoding::Encoder<'_, D>,
5167            offset: usize,
5168            mut depth: fidl::encoding::Depth,
5169        ) -> fidl::Result<()> {
5170            encoder.debug_check_bounds::<HostData>(offset);
5171            // Vector header
5172            let max_ordinal: u64 = self.max_ordinal_present();
5173            encoder.write_num(max_ordinal, offset);
5174            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
5175            // Calling encoder.out_of_line_offset(0) is not allowed.
5176            if max_ordinal == 0 {
5177                return Ok(());
5178            }
5179            depth.increment()?;
5180            let envelope_size = 8;
5181            let bytes_len = max_ordinal as usize * envelope_size;
5182            #[allow(unused_variables)]
5183            let offset = encoder.out_of_line_offset(bytes_len);
5184            let mut _prev_end_offset: usize = 0;
5185            if 1 > max_ordinal {
5186                return Ok(());
5187            }
5188
5189            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5190            // are envelope_size bytes.
5191            let cur_offset: usize = (1 - 1) * envelope_size;
5192
5193            // Zero reserved fields.
5194            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5195
5196            // Safety:
5197            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5198            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5199            //   envelope_size bytes, there is always sufficient room.
5200            fidl::encoding::encode_in_envelope_optional::<Key, D>(
5201                self.irk.as_ref().map(<Key as fidl::encoding::ValueTypeMarker>::borrow),
5202                encoder,
5203                offset + cur_offset,
5204                depth,
5205            )?;
5206
5207            _prev_end_offset = cur_offset + envelope_size;
5208
5209            Ok(())
5210        }
5211    }
5212
5213    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for HostData {
5214        #[inline(always)]
5215        fn new_empty() -> Self {
5216            Self::default()
5217        }
5218
5219        unsafe fn decode(
5220            &mut self,
5221            decoder: &mut fidl::encoding::Decoder<'_, D>,
5222            offset: usize,
5223            mut depth: fidl::encoding::Depth,
5224        ) -> fidl::Result<()> {
5225            decoder.debug_check_bounds::<Self>(offset);
5226            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
5227                None => return Err(fidl::Error::NotNullable),
5228                Some(len) => len,
5229            };
5230            // Calling decoder.out_of_line_offset(0) is not allowed.
5231            if len == 0 {
5232                return Ok(());
5233            };
5234            depth.increment()?;
5235            let envelope_size = 8;
5236            let bytes_len = len * envelope_size;
5237            let offset = decoder.out_of_line_offset(bytes_len)?;
5238            // Decode the envelope for each type.
5239            let mut _next_ordinal_to_read = 0;
5240            let mut next_offset = offset;
5241            let end_offset = offset + bytes_len;
5242            _next_ordinal_to_read += 1;
5243            if next_offset >= end_offset {
5244                return Ok(());
5245            }
5246
5247            // Decode unknown envelopes for gaps in ordinals.
5248            while _next_ordinal_to_read < 1 {
5249                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5250                _next_ordinal_to_read += 1;
5251                next_offset += envelope_size;
5252            }
5253
5254            let next_out_of_line = decoder.next_out_of_line();
5255            let handles_before = decoder.remaining_handles();
5256            if let Some((inlined, num_bytes, num_handles)) =
5257                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5258            {
5259                let member_inline_size =
5260                    <Key as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5261                if inlined != (member_inline_size <= 4) {
5262                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5263                }
5264                let inner_offset;
5265                let mut inner_depth = depth.clone();
5266                if inlined {
5267                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5268                    inner_offset = next_offset;
5269                } else {
5270                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5271                    inner_depth.increment()?;
5272                }
5273                let val_ref = self.irk.get_or_insert_with(|| fidl::new_empty!(Key, D));
5274                fidl::decode!(Key, D, val_ref, decoder, inner_offset, inner_depth)?;
5275                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5276                {
5277                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5278                }
5279                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5280                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5281                }
5282            }
5283
5284            next_offset += envelope_size;
5285
5286            // Decode the remaining unknown envelopes.
5287            while next_offset < end_offset {
5288                _next_ordinal_to_read += 1;
5289                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5290                next_offset += envelope_size;
5291            }
5292
5293            Ok(())
5294        }
5295    }
5296
5297    impl HostInfo {
5298        #[inline(always)]
5299        fn max_ordinal_present(&self) -> u64 {
5300            if let Some(_) = self.addresses {
5301                return 8;
5302            }
5303            if let Some(_) = self.discovering {
5304                return 7;
5305            }
5306            if let Some(_) = self.discoverable {
5307                return 6;
5308            }
5309            if let Some(_) = self.local_name {
5310                return 5;
5311            }
5312            if let Some(_) = self.active {
5313                return 4;
5314            }
5315            if let Some(_) = self.technology {
5316                return 2;
5317            }
5318            if let Some(_) = self.id {
5319                return 1;
5320            }
5321            0
5322        }
5323    }
5324
5325    impl fidl::encoding::ValueTypeMarker for HostInfo {
5326        type Borrowed<'a> = &'a Self;
5327        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
5328            value
5329        }
5330    }
5331
5332    unsafe impl fidl::encoding::TypeMarker for HostInfo {
5333        type Owned = Self;
5334
5335        #[inline(always)]
5336        fn inline_align(_context: fidl::encoding::Context) -> usize {
5337            8
5338        }
5339
5340        #[inline(always)]
5341        fn inline_size(_context: fidl::encoding::Context) -> usize {
5342            16
5343        }
5344    }
5345
5346    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<HostInfo, D> for &HostInfo {
5347        unsafe fn encode(
5348            self,
5349            encoder: &mut fidl::encoding::Encoder<'_, D>,
5350            offset: usize,
5351            mut depth: fidl::encoding::Depth,
5352        ) -> fidl::Result<()> {
5353            encoder.debug_check_bounds::<HostInfo>(offset);
5354            // Vector header
5355            let max_ordinal: u64 = self.max_ordinal_present();
5356            encoder.write_num(max_ordinal, offset);
5357            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
5358            // Calling encoder.out_of_line_offset(0) is not allowed.
5359            if max_ordinal == 0 {
5360                return Ok(());
5361            }
5362            depth.increment()?;
5363            let envelope_size = 8;
5364            let bytes_len = max_ordinal as usize * envelope_size;
5365            #[allow(unused_variables)]
5366            let offset = encoder.out_of_line_offset(bytes_len);
5367            let mut _prev_end_offset: usize = 0;
5368            if 1 > max_ordinal {
5369                return Ok(());
5370            }
5371
5372            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5373            // are envelope_size bytes.
5374            let cur_offset: usize = (1 - 1) * envelope_size;
5375
5376            // Zero reserved fields.
5377            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5378
5379            // Safety:
5380            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5381            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5382            //   envelope_size bytes, there is always sufficient room.
5383            fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_bluetooth__common::HostId, D>(
5384            self.id.as_ref().map(<fidl_fuchsia_bluetooth__common::HostId as fidl::encoding::ValueTypeMarker>::borrow),
5385            encoder, offset + cur_offset, depth
5386        )?;
5387
5388            _prev_end_offset = cur_offset + envelope_size;
5389            if 2 > max_ordinal {
5390                return Ok(());
5391            }
5392
5393            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5394            // are envelope_size bytes.
5395            let cur_offset: usize = (2 - 1) * envelope_size;
5396
5397            // Zero reserved fields.
5398            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5399
5400            // Safety:
5401            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5402            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5403            //   envelope_size bytes, there is always sufficient room.
5404            fidl::encoding::encode_in_envelope_optional::<TechnologyType, D>(
5405                self.technology
5406                    .as_ref()
5407                    .map(<TechnologyType as fidl::encoding::ValueTypeMarker>::borrow),
5408                encoder,
5409                offset + cur_offset,
5410                depth,
5411            )?;
5412
5413            _prev_end_offset = cur_offset + envelope_size;
5414            if 4 > max_ordinal {
5415                return Ok(());
5416            }
5417
5418            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5419            // are envelope_size bytes.
5420            let cur_offset: usize = (4 - 1) * envelope_size;
5421
5422            // Zero reserved fields.
5423            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5424
5425            // Safety:
5426            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5427            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5428            //   envelope_size bytes, there is always sufficient room.
5429            fidl::encoding::encode_in_envelope_optional::<bool, D>(
5430                self.active.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
5431                encoder,
5432                offset + cur_offset,
5433                depth,
5434            )?;
5435
5436            _prev_end_offset = cur_offset + envelope_size;
5437            if 5 > max_ordinal {
5438                return Ok(());
5439            }
5440
5441            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5442            // are envelope_size bytes.
5443            let cur_offset: usize = (5 - 1) * envelope_size;
5444
5445            // Zero reserved fields.
5446            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5447
5448            // Safety:
5449            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5450            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5451            //   envelope_size bytes, there is always sufficient room.
5452            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<248>, D>(
5453                self.local_name.as_ref().map(
5454                    <fidl::encoding::BoundedString<248> as fidl::encoding::ValueTypeMarker>::borrow,
5455                ),
5456                encoder,
5457                offset + cur_offset,
5458                depth,
5459            )?;
5460
5461            _prev_end_offset = cur_offset + envelope_size;
5462            if 6 > max_ordinal {
5463                return Ok(());
5464            }
5465
5466            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5467            // are envelope_size bytes.
5468            let cur_offset: usize = (6 - 1) * envelope_size;
5469
5470            // Zero reserved fields.
5471            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5472
5473            // Safety:
5474            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5475            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5476            //   envelope_size bytes, there is always sufficient room.
5477            fidl::encoding::encode_in_envelope_optional::<bool, D>(
5478                self.discoverable.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
5479                encoder,
5480                offset + cur_offset,
5481                depth,
5482            )?;
5483
5484            _prev_end_offset = cur_offset + envelope_size;
5485            if 7 > max_ordinal {
5486                return Ok(());
5487            }
5488
5489            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5490            // are envelope_size bytes.
5491            let cur_offset: usize = (7 - 1) * envelope_size;
5492
5493            // Zero reserved fields.
5494            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5495
5496            // Safety:
5497            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5498            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5499            //   envelope_size bytes, there is always sufficient room.
5500            fidl::encoding::encode_in_envelope_optional::<bool, D>(
5501                self.discovering.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
5502                encoder,
5503                offset + cur_offset,
5504                depth,
5505            )?;
5506
5507            _prev_end_offset = cur_offset + envelope_size;
5508            if 8 > max_ordinal {
5509                return Ok(());
5510            }
5511
5512            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5513            // are envelope_size bytes.
5514            let cur_offset: usize = (8 - 1) * envelope_size;
5515
5516            // Zero reserved fields.
5517            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5518
5519            // Safety:
5520            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5521            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5522            //   envelope_size bytes, there is always sufficient room.
5523            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedVector<fidl_fuchsia_bluetooth__common::Address>, D>(
5524            self.addresses.as_ref().map(<fidl::encoding::UnboundedVector<fidl_fuchsia_bluetooth__common::Address> as fidl::encoding::ValueTypeMarker>::borrow),
5525            encoder, offset + cur_offset, depth
5526        )?;
5527
5528            _prev_end_offset = cur_offset + envelope_size;
5529
5530            Ok(())
5531        }
5532    }
5533
5534    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for HostInfo {
5535        #[inline(always)]
5536        fn new_empty() -> Self {
5537            Self::default()
5538        }
5539
5540        unsafe fn decode(
5541            &mut self,
5542            decoder: &mut fidl::encoding::Decoder<'_, D>,
5543            offset: usize,
5544            mut depth: fidl::encoding::Depth,
5545        ) -> fidl::Result<()> {
5546            decoder.debug_check_bounds::<Self>(offset);
5547            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
5548                None => return Err(fidl::Error::NotNullable),
5549                Some(len) => len,
5550            };
5551            // Calling decoder.out_of_line_offset(0) is not allowed.
5552            if len == 0 {
5553                return Ok(());
5554            };
5555            depth.increment()?;
5556            let envelope_size = 8;
5557            let bytes_len = len * envelope_size;
5558            let offset = decoder.out_of_line_offset(bytes_len)?;
5559            // Decode the envelope for each type.
5560            let mut _next_ordinal_to_read = 0;
5561            let mut next_offset = offset;
5562            let end_offset = offset + bytes_len;
5563            _next_ordinal_to_read += 1;
5564            if next_offset >= end_offset {
5565                return Ok(());
5566            }
5567
5568            // Decode unknown envelopes for gaps in ordinals.
5569            while _next_ordinal_to_read < 1 {
5570                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5571                _next_ordinal_to_read += 1;
5572                next_offset += envelope_size;
5573            }
5574
5575            let next_out_of_line = decoder.next_out_of_line();
5576            let handles_before = decoder.remaining_handles();
5577            if let Some((inlined, num_bytes, num_handles)) =
5578                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5579            {
5580                let member_inline_size = <fidl_fuchsia_bluetooth__common::HostId as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5581                if inlined != (member_inline_size <= 4) {
5582                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5583                }
5584                let inner_offset;
5585                let mut inner_depth = depth.clone();
5586                if inlined {
5587                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5588                    inner_offset = next_offset;
5589                } else {
5590                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5591                    inner_depth.increment()?;
5592                }
5593                let val_ref = self.id.get_or_insert_with(|| {
5594                    fidl::new_empty!(fidl_fuchsia_bluetooth__common::HostId, D)
5595                });
5596                fidl::decode!(
5597                    fidl_fuchsia_bluetooth__common::HostId,
5598                    D,
5599                    val_ref,
5600                    decoder,
5601                    inner_offset,
5602                    inner_depth
5603                )?;
5604                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5605                {
5606                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5607                }
5608                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5609                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5610                }
5611            }
5612
5613            next_offset += envelope_size;
5614            _next_ordinal_to_read += 1;
5615            if next_offset >= end_offset {
5616                return Ok(());
5617            }
5618
5619            // Decode unknown envelopes for gaps in ordinals.
5620            while _next_ordinal_to_read < 2 {
5621                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5622                _next_ordinal_to_read += 1;
5623                next_offset += envelope_size;
5624            }
5625
5626            let next_out_of_line = decoder.next_out_of_line();
5627            let handles_before = decoder.remaining_handles();
5628            if let Some((inlined, num_bytes, num_handles)) =
5629                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5630            {
5631                let member_inline_size =
5632                    <TechnologyType as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5633                if inlined != (member_inline_size <= 4) {
5634                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5635                }
5636                let inner_offset;
5637                let mut inner_depth = depth.clone();
5638                if inlined {
5639                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5640                    inner_offset = next_offset;
5641                } else {
5642                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5643                    inner_depth.increment()?;
5644                }
5645                let val_ref =
5646                    self.technology.get_or_insert_with(|| fidl::new_empty!(TechnologyType, D));
5647                fidl::decode!(TechnologyType, D, val_ref, decoder, inner_offset, inner_depth)?;
5648                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5649                {
5650                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5651                }
5652                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5653                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5654                }
5655            }
5656
5657            next_offset += envelope_size;
5658            _next_ordinal_to_read += 1;
5659            if next_offset >= end_offset {
5660                return Ok(());
5661            }
5662
5663            // Decode unknown envelopes for gaps in ordinals.
5664            while _next_ordinal_to_read < 4 {
5665                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5666                _next_ordinal_to_read += 1;
5667                next_offset += envelope_size;
5668            }
5669
5670            let next_out_of_line = decoder.next_out_of_line();
5671            let handles_before = decoder.remaining_handles();
5672            if let Some((inlined, num_bytes, num_handles)) =
5673                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5674            {
5675                let member_inline_size =
5676                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5677                if inlined != (member_inline_size <= 4) {
5678                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5679                }
5680                let inner_offset;
5681                let mut inner_depth = depth.clone();
5682                if inlined {
5683                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5684                    inner_offset = next_offset;
5685                } else {
5686                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5687                    inner_depth.increment()?;
5688                }
5689                let val_ref = self.active.get_or_insert_with(|| fidl::new_empty!(bool, D));
5690                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
5691                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5692                {
5693                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5694                }
5695                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5696                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5697                }
5698            }
5699
5700            next_offset += envelope_size;
5701            _next_ordinal_to_read += 1;
5702            if next_offset >= end_offset {
5703                return Ok(());
5704            }
5705
5706            // Decode unknown envelopes for gaps in ordinals.
5707            while _next_ordinal_to_read < 5 {
5708                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5709                _next_ordinal_to_read += 1;
5710                next_offset += envelope_size;
5711            }
5712
5713            let next_out_of_line = decoder.next_out_of_line();
5714            let handles_before = decoder.remaining_handles();
5715            if let Some((inlined, num_bytes, num_handles)) =
5716                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5717            {
5718                let member_inline_size =
5719                    <fidl::encoding::BoundedString<248> as fidl::encoding::TypeMarker>::inline_size(
5720                        decoder.context,
5721                    );
5722                if inlined != (member_inline_size <= 4) {
5723                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5724                }
5725                let inner_offset;
5726                let mut inner_depth = depth.clone();
5727                if inlined {
5728                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5729                    inner_offset = next_offset;
5730                } else {
5731                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5732                    inner_depth.increment()?;
5733                }
5734                let val_ref = self
5735                    .local_name
5736                    .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::BoundedString<248>, D));
5737                fidl::decode!(
5738                    fidl::encoding::BoundedString<248>,
5739                    D,
5740                    val_ref,
5741                    decoder,
5742                    inner_offset,
5743                    inner_depth
5744                )?;
5745                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5746                {
5747                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5748                }
5749                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5750                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5751                }
5752            }
5753
5754            next_offset += envelope_size;
5755            _next_ordinal_to_read += 1;
5756            if next_offset >= end_offset {
5757                return Ok(());
5758            }
5759
5760            // Decode unknown envelopes for gaps in ordinals.
5761            while _next_ordinal_to_read < 6 {
5762                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5763                _next_ordinal_to_read += 1;
5764                next_offset += envelope_size;
5765            }
5766
5767            let next_out_of_line = decoder.next_out_of_line();
5768            let handles_before = decoder.remaining_handles();
5769            if let Some((inlined, num_bytes, num_handles)) =
5770                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5771            {
5772                let member_inline_size =
5773                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5774                if inlined != (member_inline_size <= 4) {
5775                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5776                }
5777                let inner_offset;
5778                let mut inner_depth = depth.clone();
5779                if inlined {
5780                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5781                    inner_offset = next_offset;
5782                } else {
5783                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5784                    inner_depth.increment()?;
5785                }
5786                let val_ref = self.discoverable.get_or_insert_with(|| fidl::new_empty!(bool, D));
5787                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
5788                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5789                {
5790                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5791                }
5792                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5793                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5794                }
5795            }
5796
5797            next_offset += envelope_size;
5798            _next_ordinal_to_read += 1;
5799            if next_offset >= end_offset {
5800                return Ok(());
5801            }
5802
5803            // Decode unknown envelopes for gaps in ordinals.
5804            while _next_ordinal_to_read < 7 {
5805                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5806                _next_ordinal_to_read += 1;
5807                next_offset += envelope_size;
5808            }
5809
5810            let next_out_of_line = decoder.next_out_of_line();
5811            let handles_before = decoder.remaining_handles();
5812            if let Some((inlined, num_bytes, num_handles)) =
5813                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5814            {
5815                let member_inline_size =
5816                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5817                if inlined != (member_inline_size <= 4) {
5818                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5819                }
5820                let inner_offset;
5821                let mut inner_depth = depth.clone();
5822                if inlined {
5823                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5824                    inner_offset = next_offset;
5825                } else {
5826                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5827                    inner_depth.increment()?;
5828                }
5829                let val_ref = self.discovering.get_or_insert_with(|| fidl::new_empty!(bool, D));
5830                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
5831                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5832                {
5833                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5834                }
5835                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5836                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5837                }
5838            }
5839
5840            next_offset += envelope_size;
5841            _next_ordinal_to_read += 1;
5842            if next_offset >= end_offset {
5843                return Ok(());
5844            }
5845
5846            // Decode unknown envelopes for gaps in ordinals.
5847            while _next_ordinal_to_read < 8 {
5848                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5849                _next_ordinal_to_read += 1;
5850                next_offset += envelope_size;
5851            }
5852
5853            let next_out_of_line = decoder.next_out_of_line();
5854            let handles_before = decoder.remaining_handles();
5855            if let Some((inlined, num_bytes, num_handles)) =
5856                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5857            {
5858                let member_inline_size = <fidl::encoding::UnboundedVector<
5859                    fidl_fuchsia_bluetooth__common::Address,
5860                > as fidl::encoding::TypeMarker>::inline_size(
5861                    decoder.context
5862                );
5863                if inlined != (member_inline_size <= 4) {
5864                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5865                }
5866                let inner_offset;
5867                let mut inner_depth = depth.clone();
5868                if inlined {
5869                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5870                    inner_offset = next_offset;
5871                } else {
5872                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5873                    inner_depth.increment()?;
5874                }
5875                let val_ref = self.addresses.get_or_insert_with(|| {
5876                    fidl::new_empty!(
5877                        fidl::encoding::UnboundedVector<fidl_fuchsia_bluetooth__common::Address>,
5878                        D
5879                    )
5880                });
5881                fidl::decode!(
5882                    fidl::encoding::UnboundedVector<fidl_fuchsia_bluetooth__common::Address>,
5883                    D,
5884                    val_ref,
5885                    decoder,
5886                    inner_offset,
5887                    inner_depth
5888                )?;
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
5900            // Decode the remaining unknown envelopes.
5901            while next_offset < end_offset {
5902                _next_ordinal_to_read += 1;
5903                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5904                next_offset += envelope_size;
5905            }
5906
5907            Ok(())
5908        }
5909    }
5910
5911    impl Identity {
5912        #[inline(always)]
5913        fn max_ordinal_present(&self) -> u64 {
5914            if let Some(_) = self.bonds {
5915                return 2;
5916            }
5917            if let Some(_) = self.host {
5918                return 1;
5919            }
5920            0
5921        }
5922    }
5923
5924    impl fidl::encoding::ValueTypeMarker for Identity {
5925        type Borrowed<'a> = &'a Self;
5926        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
5927            value
5928        }
5929    }
5930
5931    unsafe impl fidl::encoding::TypeMarker for Identity {
5932        type Owned = Self;
5933
5934        #[inline(always)]
5935        fn inline_align(_context: fidl::encoding::Context) -> usize {
5936            8
5937        }
5938
5939        #[inline(always)]
5940        fn inline_size(_context: fidl::encoding::Context) -> usize {
5941            16
5942        }
5943    }
5944
5945    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Identity, D> for &Identity {
5946        unsafe fn encode(
5947            self,
5948            encoder: &mut fidl::encoding::Encoder<'_, D>,
5949            offset: usize,
5950            mut depth: fidl::encoding::Depth,
5951        ) -> fidl::Result<()> {
5952            encoder.debug_check_bounds::<Identity>(offset);
5953            // Vector header
5954            let max_ordinal: u64 = self.max_ordinal_present();
5955            encoder.write_num(max_ordinal, offset);
5956            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
5957            // Calling encoder.out_of_line_offset(0) is not allowed.
5958            if max_ordinal == 0 {
5959                return Ok(());
5960            }
5961            depth.increment()?;
5962            let envelope_size = 8;
5963            let bytes_len = max_ordinal as usize * envelope_size;
5964            #[allow(unused_variables)]
5965            let offset = encoder.out_of_line_offset(bytes_len);
5966            let mut _prev_end_offset: usize = 0;
5967            if 1 > max_ordinal {
5968                return Ok(());
5969            }
5970
5971            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5972            // are envelope_size bytes.
5973            let cur_offset: usize = (1 - 1) * envelope_size;
5974
5975            // Zero reserved fields.
5976            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5977
5978            // Safety:
5979            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5980            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5981            //   envelope_size bytes, there is always sufficient room.
5982            fidl::encoding::encode_in_envelope_optional::<HostData, D>(
5983                self.host.as_ref().map(<HostData as fidl::encoding::ValueTypeMarker>::borrow),
5984                encoder,
5985                offset + cur_offset,
5986                depth,
5987            )?;
5988
5989            _prev_end_offset = cur_offset + envelope_size;
5990            if 2 > max_ordinal {
5991                return Ok(());
5992            }
5993
5994            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5995            // are envelope_size bytes.
5996            let cur_offset: usize = (2 - 1) * envelope_size;
5997
5998            // Zero reserved fields.
5999            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6000
6001            // Safety:
6002            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
6003            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
6004            //   envelope_size bytes, there is always sufficient room.
6005            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedVector<BondingData>, D>(
6006            self.bonds.as_ref().map(<fidl::encoding::UnboundedVector<BondingData> as fidl::encoding::ValueTypeMarker>::borrow),
6007            encoder, offset + cur_offset, depth
6008        )?;
6009
6010            _prev_end_offset = cur_offset + envelope_size;
6011
6012            Ok(())
6013        }
6014    }
6015
6016    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Identity {
6017        #[inline(always)]
6018        fn new_empty() -> Self {
6019            Self::default()
6020        }
6021
6022        unsafe fn decode(
6023            &mut self,
6024            decoder: &mut fidl::encoding::Decoder<'_, D>,
6025            offset: usize,
6026            mut depth: fidl::encoding::Depth,
6027        ) -> fidl::Result<()> {
6028            decoder.debug_check_bounds::<Self>(offset);
6029            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
6030                None => return Err(fidl::Error::NotNullable),
6031                Some(len) => len,
6032            };
6033            // Calling decoder.out_of_line_offset(0) is not allowed.
6034            if len == 0 {
6035                return Ok(());
6036            };
6037            depth.increment()?;
6038            let envelope_size = 8;
6039            let bytes_len = len * envelope_size;
6040            let offset = decoder.out_of_line_offset(bytes_len)?;
6041            // Decode the envelope for each type.
6042            let mut _next_ordinal_to_read = 0;
6043            let mut next_offset = offset;
6044            let end_offset = offset + bytes_len;
6045            _next_ordinal_to_read += 1;
6046            if next_offset >= end_offset {
6047                return Ok(());
6048            }
6049
6050            // Decode unknown envelopes for gaps in ordinals.
6051            while _next_ordinal_to_read < 1 {
6052                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6053                _next_ordinal_to_read += 1;
6054                next_offset += envelope_size;
6055            }
6056
6057            let next_out_of_line = decoder.next_out_of_line();
6058            let handles_before = decoder.remaining_handles();
6059            if let Some((inlined, num_bytes, num_handles)) =
6060                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6061            {
6062                let member_inline_size =
6063                    <HostData as fidl::encoding::TypeMarker>::inline_size(decoder.context);
6064                if inlined != (member_inline_size <= 4) {
6065                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6066                }
6067                let inner_offset;
6068                let mut inner_depth = depth.clone();
6069                if inlined {
6070                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6071                    inner_offset = next_offset;
6072                } else {
6073                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6074                    inner_depth.increment()?;
6075                }
6076                let val_ref = self.host.get_or_insert_with(|| fidl::new_empty!(HostData, D));
6077                fidl::decode!(HostData, D, val_ref, decoder, inner_offset, inner_depth)?;
6078                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6079                {
6080                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6081                }
6082                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6083                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6084                }
6085            }
6086
6087            next_offset += envelope_size;
6088            _next_ordinal_to_read += 1;
6089            if next_offset >= end_offset {
6090                return Ok(());
6091            }
6092
6093            // Decode unknown envelopes for gaps in ordinals.
6094            while _next_ordinal_to_read < 2 {
6095                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6096                _next_ordinal_to_read += 1;
6097                next_offset += envelope_size;
6098            }
6099
6100            let next_out_of_line = decoder.next_out_of_line();
6101            let handles_before = decoder.remaining_handles();
6102            if let Some((inlined, num_bytes, num_handles)) =
6103                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6104            {
6105                let member_inline_size = <fidl::encoding::UnboundedVector<BondingData> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
6106                if inlined != (member_inline_size <= 4) {
6107                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6108                }
6109                let inner_offset;
6110                let mut inner_depth = depth.clone();
6111                if inlined {
6112                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6113                    inner_offset = next_offset;
6114                } else {
6115                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6116                    inner_depth.increment()?;
6117                }
6118                let val_ref = self.bonds.get_or_insert_with(|| {
6119                    fidl::new_empty!(fidl::encoding::UnboundedVector<BondingData>, D)
6120                });
6121                fidl::decode!(
6122                    fidl::encoding::UnboundedVector<BondingData>,
6123                    D,
6124                    val_ref,
6125                    decoder,
6126                    inner_offset,
6127                    inner_depth
6128                )?;
6129                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6130                {
6131                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6132                }
6133                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6134                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6135                }
6136            }
6137
6138            next_offset += envelope_size;
6139
6140            // Decode the remaining unknown envelopes.
6141            while next_offset < end_offset {
6142                _next_ordinal_to_read += 1;
6143                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6144                next_offset += envelope_size;
6145            }
6146
6147            Ok(())
6148        }
6149    }
6150
6151    impl LeBondData {
6152        #[inline(always)]
6153        fn max_ordinal_present(&self) -> u64 {
6154            if let Some(_) = self.local_ltk {
6155                return 6;
6156            }
6157            if let Some(_) = self.peer_ltk {
6158                return 5;
6159            }
6160            if let Some(_) = self.csrk {
6161                return 4;
6162            }
6163            if let Some(_) = self.irk {
6164                return 3;
6165            }
6166            if let Some(_) = self.services {
6167                return 2;
6168            }
6169            if let Some(_) = self.connection_parameters {
6170                return 1;
6171            }
6172            0
6173        }
6174    }
6175
6176    impl fidl::encoding::ValueTypeMarker for LeBondData {
6177        type Borrowed<'a> = &'a Self;
6178        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
6179            value
6180        }
6181    }
6182
6183    unsafe impl fidl::encoding::TypeMarker for LeBondData {
6184        type Owned = Self;
6185
6186        #[inline(always)]
6187        fn inline_align(_context: fidl::encoding::Context) -> usize {
6188            8
6189        }
6190
6191        #[inline(always)]
6192        fn inline_size(_context: fidl::encoding::Context) -> usize {
6193            16
6194        }
6195    }
6196
6197    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<LeBondData, D>
6198        for &LeBondData
6199    {
6200        unsafe fn encode(
6201            self,
6202            encoder: &mut fidl::encoding::Encoder<'_, D>,
6203            offset: usize,
6204            mut depth: fidl::encoding::Depth,
6205        ) -> fidl::Result<()> {
6206            encoder.debug_check_bounds::<LeBondData>(offset);
6207            // Vector header
6208            let max_ordinal: u64 = self.max_ordinal_present();
6209            encoder.write_num(max_ordinal, offset);
6210            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
6211            // Calling encoder.out_of_line_offset(0) is not allowed.
6212            if max_ordinal == 0 {
6213                return Ok(());
6214            }
6215            depth.increment()?;
6216            let envelope_size = 8;
6217            let bytes_len = max_ordinal as usize * envelope_size;
6218            #[allow(unused_variables)]
6219            let offset = encoder.out_of_line_offset(bytes_len);
6220            let mut _prev_end_offset: usize = 0;
6221            if 1 > max_ordinal {
6222                return Ok(());
6223            }
6224
6225            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
6226            // are envelope_size bytes.
6227            let cur_offset: usize = (1 - 1) * envelope_size;
6228
6229            // Zero reserved fields.
6230            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6231
6232            // Safety:
6233            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
6234            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
6235            //   envelope_size bytes, there is always sufficient room.
6236            fidl::encoding::encode_in_envelope_optional::<LeConnectionParameters, D>(
6237                self.connection_parameters
6238                    .as_ref()
6239                    .map(<LeConnectionParameters as fidl::encoding::ValueTypeMarker>::borrow),
6240                encoder,
6241                offset + cur_offset,
6242                depth,
6243            )?;
6244
6245            _prev_end_offset = cur_offset + envelope_size;
6246            if 2 > max_ordinal {
6247                return Ok(());
6248            }
6249
6250            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
6251            // are envelope_size bytes.
6252            let cur_offset: usize = (2 - 1) * envelope_size;
6253
6254            // Zero reserved fields.
6255            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6256
6257            // Safety:
6258            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
6259            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
6260            //   envelope_size bytes, there is always sufficient room.
6261            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<fidl_fuchsia_bluetooth__common::Uuid, 65535>, D>(
6262            self.services.as_ref().map(<fidl::encoding::Vector<fidl_fuchsia_bluetooth__common::Uuid, 65535> as fidl::encoding::ValueTypeMarker>::borrow),
6263            encoder, offset + cur_offset, depth
6264        )?;
6265
6266            _prev_end_offset = cur_offset + envelope_size;
6267            if 3 > max_ordinal {
6268                return Ok(());
6269            }
6270
6271            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
6272            // are envelope_size bytes.
6273            let cur_offset: usize = (3 - 1) * envelope_size;
6274
6275            // Zero reserved fields.
6276            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6277
6278            // Safety:
6279            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
6280            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
6281            //   envelope_size bytes, there is always sufficient room.
6282            fidl::encoding::encode_in_envelope_optional::<PeerKey, D>(
6283                self.irk.as_ref().map(<PeerKey as fidl::encoding::ValueTypeMarker>::borrow),
6284                encoder,
6285                offset + cur_offset,
6286                depth,
6287            )?;
6288
6289            _prev_end_offset = cur_offset + envelope_size;
6290            if 4 > max_ordinal {
6291                return Ok(());
6292            }
6293
6294            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
6295            // are envelope_size bytes.
6296            let cur_offset: usize = (4 - 1) * envelope_size;
6297
6298            // Zero reserved fields.
6299            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6300
6301            // Safety:
6302            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
6303            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
6304            //   envelope_size bytes, there is always sufficient room.
6305            fidl::encoding::encode_in_envelope_optional::<PeerKey, D>(
6306                self.csrk.as_ref().map(<PeerKey as fidl::encoding::ValueTypeMarker>::borrow),
6307                encoder,
6308                offset + cur_offset,
6309                depth,
6310            )?;
6311
6312            _prev_end_offset = cur_offset + envelope_size;
6313            if 5 > max_ordinal {
6314                return Ok(());
6315            }
6316
6317            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
6318            // are envelope_size bytes.
6319            let cur_offset: usize = (5 - 1) * envelope_size;
6320
6321            // Zero reserved fields.
6322            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6323
6324            // Safety:
6325            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
6326            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
6327            //   envelope_size bytes, there is always sufficient room.
6328            fidl::encoding::encode_in_envelope_optional::<Ltk, D>(
6329                self.peer_ltk.as_ref().map(<Ltk as fidl::encoding::ValueTypeMarker>::borrow),
6330                encoder,
6331                offset + cur_offset,
6332                depth,
6333            )?;
6334
6335            _prev_end_offset = cur_offset + envelope_size;
6336            if 6 > max_ordinal {
6337                return Ok(());
6338            }
6339
6340            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
6341            // are envelope_size bytes.
6342            let cur_offset: usize = (6 - 1) * envelope_size;
6343
6344            // Zero reserved fields.
6345            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6346
6347            // Safety:
6348            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
6349            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
6350            //   envelope_size bytes, there is always sufficient room.
6351            fidl::encoding::encode_in_envelope_optional::<Ltk, D>(
6352                self.local_ltk.as_ref().map(<Ltk as fidl::encoding::ValueTypeMarker>::borrow),
6353                encoder,
6354                offset + cur_offset,
6355                depth,
6356            )?;
6357
6358            _prev_end_offset = cur_offset + envelope_size;
6359
6360            Ok(())
6361        }
6362    }
6363
6364    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for LeBondData {
6365        #[inline(always)]
6366        fn new_empty() -> Self {
6367            Self::default()
6368        }
6369
6370        unsafe fn decode(
6371            &mut self,
6372            decoder: &mut fidl::encoding::Decoder<'_, D>,
6373            offset: usize,
6374            mut depth: fidl::encoding::Depth,
6375        ) -> fidl::Result<()> {
6376            decoder.debug_check_bounds::<Self>(offset);
6377            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
6378                None => return Err(fidl::Error::NotNullable),
6379                Some(len) => len,
6380            };
6381            // Calling decoder.out_of_line_offset(0) is not allowed.
6382            if len == 0 {
6383                return Ok(());
6384            };
6385            depth.increment()?;
6386            let envelope_size = 8;
6387            let bytes_len = len * envelope_size;
6388            let offset = decoder.out_of_line_offset(bytes_len)?;
6389            // Decode the envelope for each type.
6390            let mut _next_ordinal_to_read = 0;
6391            let mut next_offset = offset;
6392            let end_offset = offset + bytes_len;
6393            _next_ordinal_to_read += 1;
6394            if next_offset >= end_offset {
6395                return Ok(());
6396            }
6397
6398            // Decode unknown envelopes for gaps in ordinals.
6399            while _next_ordinal_to_read < 1 {
6400                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6401                _next_ordinal_to_read += 1;
6402                next_offset += envelope_size;
6403            }
6404
6405            let next_out_of_line = decoder.next_out_of_line();
6406            let handles_before = decoder.remaining_handles();
6407            if let Some((inlined, num_bytes, num_handles)) =
6408                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6409            {
6410                let member_inline_size =
6411                    <LeConnectionParameters as fidl::encoding::TypeMarker>::inline_size(
6412                        decoder.context,
6413                    );
6414                if inlined != (member_inline_size <= 4) {
6415                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6416                }
6417                let inner_offset;
6418                let mut inner_depth = depth.clone();
6419                if inlined {
6420                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6421                    inner_offset = next_offset;
6422                } else {
6423                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6424                    inner_depth.increment()?;
6425                }
6426                let val_ref = self
6427                    .connection_parameters
6428                    .get_or_insert_with(|| fidl::new_empty!(LeConnectionParameters, D));
6429                fidl::decode!(
6430                    LeConnectionParameters,
6431                    D,
6432                    val_ref,
6433                    decoder,
6434                    inner_offset,
6435                    inner_depth
6436                )?;
6437                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6438                {
6439                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6440                }
6441                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6442                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6443                }
6444            }
6445
6446            next_offset += envelope_size;
6447            _next_ordinal_to_read += 1;
6448            if next_offset >= end_offset {
6449                return Ok(());
6450            }
6451
6452            // Decode unknown envelopes for gaps in ordinals.
6453            while _next_ordinal_to_read < 2 {
6454                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6455                _next_ordinal_to_read += 1;
6456                next_offset += envelope_size;
6457            }
6458
6459            let next_out_of_line = decoder.next_out_of_line();
6460            let handles_before = decoder.remaining_handles();
6461            if let Some((inlined, num_bytes, num_handles)) =
6462                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6463            {
6464                let member_inline_size = <fidl::encoding::Vector<
6465                    fidl_fuchsia_bluetooth__common::Uuid,
6466                    65535,
6467                > as fidl::encoding::TypeMarker>::inline_size(
6468                    decoder.context
6469                );
6470                if inlined != (member_inline_size <= 4) {
6471                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6472                }
6473                let inner_offset;
6474                let mut inner_depth = depth.clone();
6475                if inlined {
6476                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6477                    inner_offset = next_offset;
6478                } else {
6479                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6480                    inner_depth.increment()?;
6481                }
6482                let val_ref =
6483                self.services.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<fidl_fuchsia_bluetooth__common::Uuid, 65535>, D));
6484                fidl::decode!(fidl::encoding::Vector<fidl_fuchsia_bluetooth__common::Uuid, 65535>, D, val_ref, decoder, inner_offset, inner_depth)?;
6485                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6486                {
6487                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6488                }
6489                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6490                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6491                }
6492            }
6493
6494            next_offset += envelope_size;
6495            _next_ordinal_to_read += 1;
6496            if next_offset >= end_offset {
6497                return Ok(());
6498            }
6499
6500            // Decode unknown envelopes for gaps in ordinals.
6501            while _next_ordinal_to_read < 3 {
6502                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6503                _next_ordinal_to_read += 1;
6504                next_offset += envelope_size;
6505            }
6506
6507            let next_out_of_line = decoder.next_out_of_line();
6508            let handles_before = decoder.remaining_handles();
6509            if let Some((inlined, num_bytes, num_handles)) =
6510                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6511            {
6512                let member_inline_size =
6513                    <PeerKey as fidl::encoding::TypeMarker>::inline_size(decoder.context);
6514                if inlined != (member_inline_size <= 4) {
6515                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6516                }
6517                let inner_offset;
6518                let mut inner_depth = depth.clone();
6519                if inlined {
6520                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6521                    inner_offset = next_offset;
6522                } else {
6523                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6524                    inner_depth.increment()?;
6525                }
6526                let val_ref = self.irk.get_or_insert_with(|| fidl::new_empty!(PeerKey, D));
6527                fidl::decode!(PeerKey, D, val_ref, decoder, inner_offset, inner_depth)?;
6528                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6529                {
6530                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6531                }
6532                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6533                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6534                }
6535            }
6536
6537            next_offset += envelope_size;
6538            _next_ordinal_to_read += 1;
6539            if next_offset >= end_offset {
6540                return Ok(());
6541            }
6542
6543            // Decode unknown envelopes for gaps in ordinals.
6544            while _next_ordinal_to_read < 4 {
6545                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6546                _next_ordinal_to_read += 1;
6547                next_offset += envelope_size;
6548            }
6549
6550            let next_out_of_line = decoder.next_out_of_line();
6551            let handles_before = decoder.remaining_handles();
6552            if let Some((inlined, num_bytes, num_handles)) =
6553                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6554            {
6555                let member_inline_size =
6556                    <PeerKey as fidl::encoding::TypeMarker>::inline_size(decoder.context);
6557                if inlined != (member_inline_size <= 4) {
6558                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6559                }
6560                let inner_offset;
6561                let mut inner_depth = depth.clone();
6562                if inlined {
6563                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6564                    inner_offset = next_offset;
6565                } else {
6566                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6567                    inner_depth.increment()?;
6568                }
6569                let val_ref = self.csrk.get_or_insert_with(|| fidl::new_empty!(PeerKey, D));
6570                fidl::decode!(PeerKey, D, val_ref, decoder, inner_offset, inner_depth)?;
6571                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6572                {
6573                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6574                }
6575                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6576                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6577                }
6578            }
6579
6580            next_offset += envelope_size;
6581            _next_ordinal_to_read += 1;
6582            if next_offset >= end_offset {
6583                return Ok(());
6584            }
6585
6586            // Decode unknown envelopes for gaps in ordinals.
6587            while _next_ordinal_to_read < 5 {
6588                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6589                _next_ordinal_to_read += 1;
6590                next_offset += envelope_size;
6591            }
6592
6593            let next_out_of_line = decoder.next_out_of_line();
6594            let handles_before = decoder.remaining_handles();
6595            if let Some((inlined, num_bytes, num_handles)) =
6596                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6597            {
6598                let member_inline_size =
6599                    <Ltk as fidl::encoding::TypeMarker>::inline_size(decoder.context);
6600                if inlined != (member_inline_size <= 4) {
6601                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6602                }
6603                let inner_offset;
6604                let mut inner_depth = depth.clone();
6605                if inlined {
6606                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6607                    inner_offset = next_offset;
6608                } else {
6609                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6610                    inner_depth.increment()?;
6611                }
6612                let val_ref = self.peer_ltk.get_or_insert_with(|| fidl::new_empty!(Ltk, D));
6613                fidl::decode!(Ltk, D, val_ref, decoder, inner_offset, inner_depth)?;
6614                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6615                {
6616                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6617                }
6618                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6619                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6620                }
6621            }
6622
6623            next_offset += envelope_size;
6624            _next_ordinal_to_read += 1;
6625            if next_offset >= end_offset {
6626                return Ok(());
6627            }
6628
6629            // Decode unknown envelopes for gaps in ordinals.
6630            while _next_ordinal_to_read < 6 {
6631                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6632                _next_ordinal_to_read += 1;
6633                next_offset += envelope_size;
6634            }
6635
6636            let next_out_of_line = decoder.next_out_of_line();
6637            let handles_before = decoder.remaining_handles();
6638            if let Some((inlined, num_bytes, num_handles)) =
6639                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6640            {
6641                let member_inline_size =
6642                    <Ltk as fidl::encoding::TypeMarker>::inline_size(decoder.context);
6643                if inlined != (member_inline_size <= 4) {
6644                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6645                }
6646                let inner_offset;
6647                let mut inner_depth = depth.clone();
6648                if inlined {
6649                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6650                    inner_offset = next_offset;
6651                } else {
6652                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6653                    inner_depth.increment()?;
6654                }
6655                let val_ref = self.local_ltk.get_or_insert_with(|| fidl::new_empty!(Ltk, D));
6656                fidl::decode!(Ltk, D, val_ref, decoder, inner_offset, inner_depth)?;
6657                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6658                {
6659                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6660                }
6661                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6662                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6663                }
6664            }
6665
6666            next_offset += envelope_size;
6667
6668            // Decode the remaining unknown envelopes.
6669            while next_offset < end_offset {
6670                _next_ordinal_to_read += 1;
6671                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6672                next_offset += envelope_size;
6673            }
6674
6675            Ok(())
6676        }
6677    }
6678
6679    impl PairingOptions {
6680        #[inline(always)]
6681        fn max_ordinal_present(&self) -> u64 {
6682            if let Some(_) = self.transport {
6683                return 3;
6684            }
6685            if let Some(_) = self.bondable_mode {
6686                return 2;
6687            }
6688            if let Some(_) = self.le_security_level {
6689                return 1;
6690            }
6691            0
6692        }
6693    }
6694
6695    impl fidl::encoding::ValueTypeMarker for PairingOptions {
6696        type Borrowed<'a> = &'a Self;
6697        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
6698            value
6699        }
6700    }
6701
6702    unsafe impl fidl::encoding::TypeMarker for PairingOptions {
6703        type Owned = Self;
6704
6705        #[inline(always)]
6706        fn inline_align(_context: fidl::encoding::Context) -> usize {
6707            8
6708        }
6709
6710        #[inline(always)]
6711        fn inline_size(_context: fidl::encoding::Context) -> usize {
6712            16
6713        }
6714    }
6715
6716    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<PairingOptions, D>
6717        for &PairingOptions
6718    {
6719        unsafe fn encode(
6720            self,
6721            encoder: &mut fidl::encoding::Encoder<'_, D>,
6722            offset: usize,
6723            mut depth: fidl::encoding::Depth,
6724        ) -> fidl::Result<()> {
6725            encoder.debug_check_bounds::<PairingOptions>(offset);
6726            // Vector header
6727            let max_ordinal: u64 = self.max_ordinal_present();
6728            encoder.write_num(max_ordinal, offset);
6729            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
6730            // Calling encoder.out_of_line_offset(0) is not allowed.
6731            if max_ordinal == 0 {
6732                return Ok(());
6733            }
6734            depth.increment()?;
6735            let envelope_size = 8;
6736            let bytes_len = max_ordinal as usize * envelope_size;
6737            #[allow(unused_variables)]
6738            let offset = encoder.out_of_line_offset(bytes_len);
6739            let mut _prev_end_offset: usize = 0;
6740            if 1 > max_ordinal {
6741                return Ok(());
6742            }
6743
6744            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
6745            // are envelope_size bytes.
6746            let cur_offset: usize = (1 - 1) * envelope_size;
6747
6748            // Zero reserved fields.
6749            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6750
6751            // Safety:
6752            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
6753            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
6754            //   envelope_size bytes, there is always sufficient room.
6755            fidl::encoding::encode_in_envelope_optional::<PairingSecurityLevel, D>(
6756                self.le_security_level
6757                    .as_ref()
6758                    .map(<PairingSecurityLevel as fidl::encoding::ValueTypeMarker>::borrow),
6759                encoder,
6760                offset + cur_offset,
6761                depth,
6762            )?;
6763
6764            _prev_end_offset = cur_offset + envelope_size;
6765            if 2 > max_ordinal {
6766                return Ok(());
6767            }
6768
6769            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
6770            // are envelope_size bytes.
6771            let cur_offset: usize = (2 - 1) * envelope_size;
6772
6773            // Zero reserved fields.
6774            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6775
6776            // Safety:
6777            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
6778            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
6779            //   envelope_size bytes, there is always sufficient room.
6780            fidl::encoding::encode_in_envelope_optional::<BondableMode, D>(
6781                self.bondable_mode
6782                    .as_ref()
6783                    .map(<BondableMode as fidl::encoding::ValueTypeMarker>::borrow),
6784                encoder,
6785                offset + cur_offset,
6786                depth,
6787            )?;
6788
6789            _prev_end_offset = cur_offset + envelope_size;
6790            if 3 > max_ordinal {
6791                return Ok(());
6792            }
6793
6794            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
6795            // are envelope_size bytes.
6796            let cur_offset: usize = (3 - 1) * envelope_size;
6797
6798            // Zero reserved fields.
6799            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6800
6801            // Safety:
6802            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
6803            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
6804            //   envelope_size bytes, there is always sufficient room.
6805            fidl::encoding::encode_in_envelope_optional::<TechnologyType, D>(
6806                self.transport
6807                    .as_ref()
6808                    .map(<TechnologyType as fidl::encoding::ValueTypeMarker>::borrow),
6809                encoder,
6810                offset + cur_offset,
6811                depth,
6812            )?;
6813
6814            _prev_end_offset = cur_offset + envelope_size;
6815
6816            Ok(())
6817        }
6818    }
6819
6820    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for PairingOptions {
6821        #[inline(always)]
6822        fn new_empty() -> Self {
6823            Self::default()
6824        }
6825
6826        unsafe fn decode(
6827            &mut self,
6828            decoder: &mut fidl::encoding::Decoder<'_, D>,
6829            offset: usize,
6830            mut depth: fidl::encoding::Depth,
6831        ) -> fidl::Result<()> {
6832            decoder.debug_check_bounds::<Self>(offset);
6833            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
6834                None => return Err(fidl::Error::NotNullable),
6835                Some(len) => len,
6836            };
6837            // Calling decoder.out_of_line_offset(0) is not allowed.
6838            if len == 0 {
6839                return Ok(());
6840            };
6841            depth.increment()?;
6842            let envelope_size = 8;
6843            let bytes_len = len * envelope_size;
6844            let offset = decoder.out_of_line_offset(bytes_len)?;
6845            // Decode the envelope for each type.
6846            let mut _next_ordinal_to_read = 0;
6847            let mut next_offset = offset;
6848            let end_offset = offset + bytes_len;
6849            _next_ordinal_to_read += 1;
6850            if next_offset >= end_offset {
6851                return Ok(());
6852            }
6853
6854            // Decode unknown envelopes for gaps in ordinals.
6855            while _next_ordinal_to_read < 1 {
6856                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6857                _next_ordinal_to_read += 1;
6858                next_offset += envelope_size;
6859            }
6860
6861            let next_out_of_line = decoder.next_out_of_line();
6862            let handles_before = decoder.remaining_handles();
6863            if let Some((inlined, num_bytes, num_handles)) =
6864                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6865            {
6866                let member_inline_size =
6867                    <PairingSecurityLevel as fidl::encoding::TypeMarker>::inline_size(
6868                        decoder.context,
6869                    );
6870                if inlined != (member_inline_size <= 4) {
6871                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6872                }
6873                let inner_offset;
6874                let mut inner_depth = depth.clone();
6875                if inlined {
6876                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6877                    inner_offset = next_offset;
6878                } else {
6879                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6880                    inner_depth.increment()?;
6881                }
6882                let val_ref = self
6883                    .le_security_level
6884                    .get_or_insert_with(|| fidl::new_empty!(PairingSecurityLevel, D));
6885                fidl::decode!(
6886                    PairingSecurityLevel,
6887                    D,
6888                    val_ref,
6889                    decoder,
6890                    inner_offset,
6891                    inner_depth
6892                )?;
6893                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6894                {
6895                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6896                }
6897                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6898                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6899                }
6900            }
6901
6902            next_offset += envelope_size;
6903            _next_ordinal_to_read += 1;
6904            if next_offset >= end_offset {
6905                return Ok(());
6906            }
6907
6908            // Decode unknown envelopes for gaps in ordinals.
6909            while _next_ordinal_to_read < 2 {
6910                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6911                _next_ordinal_to_read += 1;
6912                next_offset += envelope_size;
6913            }
6914
6915            let next_out_of_line = decoder.next_out_of_line();
6916            let handles_before = decoder.remaining_handles();
6917            if let Some((inlined, num_bytes, num_handles)) =
6918                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6919            {
6920                let member_inline_size =
6921                    <BondableMode as fidl::encoding::TypeMarker>::inline_size(decoder.context);
6922                if inlined != (member_inline_size <= 4) {
6923                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6924                }
6925                let inner_offset;
6926                let mut inner_depth = depth.clone();
6927                if inlined {
6928                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6929                    inner_offset = next_offset;
6930                } else {
6931                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6932                    inner_depth.increment()?;
6933                }
6934                let val_ref =
6935                    self.bondable_mode.get_or_insert_with(|| fidl::new_empty!(BondableMode, D));
6936                fidl::decode!(BondableMode, D, val_ref, decoder, inner_offset, inner_depth)?;
6937                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6938                {
6939                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6940                }
6941                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6942                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6943                }
6944            }
6945
6946            next_offset += envelope_size;
6947            _next_ordinal_to_read += 1;
6948            if next_offset >= end_offset {
6949                return Ok(());
6950            }
6951
6952            // Decode unknown envelopes for gaps in ordinals.
6953            while _next_ordinal_to_read < 3 {
6954                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6955                _next_ordinal_to_read += 1;
6956                next_offset += envelope_size;
6957            }
6958
6959            let next_out_of_line = decoder.next_out_of_line();
6960            let handles_before = decoder.remaining_handles();
6961            if let Some((inlined, num_bytes, num_handles)) =
6962                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6963            {
6964                let member_inline_size =
6965                    <TechnologyType as fidl::encoding::TypeMarker>::inline_size(decoder.context);
6966                if inlined != (member_inline_size <= 4) {
6967                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6968                }
6969                let inner_offset;
6970                let mut inner_depth = depth.clone();
6971                if inlined {
6972                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6973                    inner_offset = next_offset;
6974                } else {
6975                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6976                    inner_depth.increment()?;
6977                }
6978                let val_ref =
6979                    self.transport.get_or_insert_with(|| fidl::new_empty!(TechnologyType, D));
6980                fidl::decode!(TechnologyType, D, val_ref, decoder, inner_offset, inner_depth)?;
6981                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6982                {
6983                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6984                }
6985                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6986                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6987                }
6988            }
6989
6990            next_offset += envelope_size;
6991
6992            // Decode the remaining unknown envelopes.
6993            while next_offset < end_offset {
6994                _next_ordinal_to_read += 1;
6995                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6996                next_offset += envelope_size;
6997            }
6998
6999            Ok(())
7000        }
7001    }
7002
7003    impl PairingRequestAcceptRequest {
7004        #[inline(always)]
7005        fn max_ordinal_present(&self) -> u64 {
7006            if let Some(_) = self.entered_passkey {
7007                return 1;
7008            }
7009            0
7010        }
7011    }
7012
7013    impl fidl::encoding::ValueTypeMarker for PairingRequestAcceptRequest {
7014        type Borrowed<'a> = &'a Self;
7015        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
7016            value
7017        }
7018    }
7019
7020    unsafe impl fidl::encoding::TypeMarker for PairingRequestAcceptRequest {
7021        type Owned = Self;
7022
7023        #[inline(always)]
7024        fn inline_align(_context: fidl::encoding::Context) -> usize {
7025            8
7026        }
7027
7028        #[inline(always)]
7029        fn inline_size(_context: fidl::encoding::Context) -> usize {
7030            16
7031        }
7032    }
7033
7034    unsafe impl<D: fidl::encoding::ResourceDialect>
7035        fidl::encoding::Encode<PairingRequestAcceptRequest, D> for &PairingRequestAcceptRequest
7036    {
7037        unsafe fn encode(
7038            self,
7039            encoder: &mut fidl::encoding::Encoder<'_, D>,
7040            offset: usize,
7041            mut depth: fidl::encoding::Depth,
7042        ) -> fidl::Result<()> {
7043            encoder.debug_check_bounds::<PairingRequestAcceptRequest>(offset);
7044            // Vector header
7045            let max_ordinal: u64 = self.max_ordinal_present();
7046            encoder.write_num(max_ordinal, offset);
7047            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
7048            // Calling encoder.out_of_line_offset(0) is not allowed.
7049            if max_ordinal == 0 {
7050                return Ok(());
7051            }
7052            depth.increment()?;
7053            let envelope_size = 8;
7054            let bytes_len = max_ordinal as usize * envelope_size;
7055            #[allow(unused_variables)]
7056            let offset = encoder.out_of_line_offset(bytes_len);
7057            let mut _prev_end_offset: usize = 0;
7058            if 1 > max_ordinal {
7059                return Ok(());
7060            }
7061
7062            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
7063            // are envelope_size bytes.
7064            let cur_offset: usize = (1 - 1) * envelope_size;
7065
7066            // Zero reserved fields.
7067            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7068
7069            // Safety:
7070            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
7071            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
7072            //   envelope_size bytes, there is always sufficient room.
7073            fidl::encoding::encode_in_envelope_optional::<u32, D>(
7074                self.entered_passkey.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
7075                encoder,
7076                offset + cur_offset,
7077                depth,
7078            )?;
7079
7080            _prev_end_offset = cur_offset + envelope_size;
7081
7082            Ok(())
7083        }
7084    }
7085
7086    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
7087        for PairingRequestAcceptRequest
7088    {
7089        #[inline(always)]
7090        fn new_empty() -> Self {
7091            Self::default()
7092        }
7093
7094        unsafe fn decode(
7095            &mut self,
7096            decoder: &mut fidl::encoding::Decoder<'_, D>,
7097            offset: usize,
7098            mut depth: fidl::encoding::Depth,
7099        ) -> fidl::Result<()> {
7100            decoder.debug_check_bounds::<Self>(offset);
7101            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
7102                None => return Err(fidl::Error::NotNullable),
7103                Some(len) => len,
7104            };
7105            // Calling decoder.out_of_line_offset(0) is not allowed.
7106            if len == 0 {
7107                return Ok(());
7108            };
7109            depth.increment()?;
7110            let envelope_size = 8;
7111            let bytes_len = len * envelope_size;
7112            let offset = decoder.out_of_line_offset(bytes_len)?;
7113            // Decode the envelope for each type.
7114            let mut _next_ordinal_to_read = 0;
7115            let mut next_offset = offset;
7116            let end_offset = offset + bytes_len;
7117            _next_ordinal_to_read += 1;
7118            if next_offset >= end_offset {
7119                return Ok(());
7120            }
7121
7122            // Decode unknown envelopes for gaps in ordinals.
7123            while _next_ordinal_to_read < 1 {
7124                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7125                _next_ordinal_to_read += 1;
7126                next_offset += envelope_size;
7127            }
7128
7129            let next_out_of_line = decoder.next_out_of_line();
7130            let handles_before = decoder.remaining_handles();
7131            if let Some((inlined, num_bytes, num_handles)) =
7132                fidl::encoding::decode_envelope_header(decoder, next_offset)?
7133            {
7134                let member_inline_size =
7135                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
7136                if inlined != (member_inline_size <= 4) {
7137                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
7138                }
7139                let inner_offset;
7140                let mut inner_depth = depth.clone();
7141                if inlined {
7142                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7143                    inner_offset = next_offset;
7144                } else {
7145                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7146                    inner_depth.increment()?;
7147                }
7148                let val_ref = self.entered_passkey.get_or_insert_with(|| fidl::new_empty!(u32, D));
7149                fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
7150                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7151                {
7152                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
7153                }
7154                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7155                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7156                }
7157            }
7158
7159            next_offset += envelope_size;
7160
7161            // Decode the remaining unknown envelopes.
7162            while next_offset < end_offset {
7163                _next_ordinal_to_read += 1;
7164                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7165                next_offset += envelope_size;
7166            }
7167
7168            Ok(())
7169        }
7170    }
7171
7172    impl Peer {
7173        #[inline(always)]
7174        fn max_ordinal_present(&self) -> u64 {
7175            if let Some(_) = self.bredr_services {
7176                return 13;
7177            }
7178            if let Some(_) = self.le_services {
7179                return 12;
7180            }
7181            if let Some(_) = self.services {
7182                return 11;
7183            }
7184            if let Some(_) = self.tx_power {
7185                return 10;
7186            }
7187            if let Some(_) = self.rssi {
7188                return 9;
7189            }
7190            if let Some(_) = self.device_class {
7191                return 8;
7192            }
7193            if let Some(_) = self.appearance {
7194                return 7;
7195            }
7196            if let Some(_) = self.name {
7197                return 6;
7198            }
7199            if let Some(_) = self.bonded {
7200                return 5;
7201            }
7202            if let Some(_) = self.connected {
7203                return 4;
7204            }
7205            if let Some(_) = self.technology {
7206                return 3;
7207            }
7208            if let Some(_) = self.address {
7209                return 2;
7210            }
7211            if let Some(_) = self.id {
7212                return 1;
7213            }
7214            0
7215        }
7216    }
7217
7218    impl fidl::encoding::ValueTypeMarker for Peer {
7219        type Borrowed<'a> = &'a Self;
7220        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
7221            value
7222        }
7223    }
7224
7225    unsafe impl fidl::encoding::TypeMarker for Peer {
7226        type Owned = Self;
7227
7228        #[inline(always)]
7229        fn inline_align(_context: fidl::encoding::Context) -> usize {
7230            8
7231        }
7232
7233        #[inline(always)]
7234        fn inline_size(_context: fidl::encoding::Context) -> usize {
7235            16
7236        }
7237    }
7238
7239    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Peer, D> for &Peer {
7240        unsafe fn encode(
7241            self,
7242            encoder: &mut fidl::encoding::Encoder<'_, D>,
7243            offset: usize,
7244            mut depth: fidl::encoding::Depth,
7245        ) -> fidl::Result<()> {
7246            encoder.debug_check_bounds::<Peer>(offset);
7247            // Vector header
7248            let max_ordinal: u64 = self.max_ordinal_present();
7249            encoder.write_num(max_ordinal, offset);
7250            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
7251            // Calling encoder.out_of_line_offset(0) is not allowed.
7252            if max_ordinal == 0 {
7253                return Ok(());
7254            }
7255            depth.increment()?;
7256            let envelope_size = 8;
7257            let bytes_len = max_ordinal as usize * envelope_size;
7258            #[allow(unused_variables)]
7259            let offset = encoder.out_of_line_offset(bytes_len);
7260            let mut _prev_end_offset: usize = 0;
7261            if 1 > max_ordinal {
7262                return Ok(());
7263            }
7264
7265            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
7266            // are envelope_size bytes.
7267            let cur_offset: usize = (1 - 1) * envelope_size;
7268
7269            // Zero reserved fields.
7270            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7271
7272            // Safety:
7273            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
7274            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
7275            //   envelope_size bytes, there is always sufficient room.
7276            fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_bluetooth__common::PeerId, D>(
7277            self.id.as_ref().map(<fidl_fuchsia_bluetooth__common::PeerId as fidl::encoding::ValueTypeMarker>::borrow),
7278            encoder, offset + cur_offset, depth
7279        )?;
7280
7281            _prev_end_offset = cur_offset + envelope_size;
7282            if 2 > max_ordinal {
7283                return Ok(());
7284            }
7285
7286            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
7287            // are envelope_size bytes.
7288            let cur_offset: usize = (2 - 1) * envelope_size;
7289
7290            // Zero reserved fields.
7291            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7292
7293            // Safety:
7294            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
7295            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
7296            //   envelope_size bytes, there is always sufficient room.
7297            fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_bluetooth__common::Address, D>(
7298            self.address.as_ref().map(<fidl_fuchsia_bluetooth__common::Address as fidl::encoding::ValueTypeMarker>::borrow),
7299            encoder, offset + cur_offset, depth
7300        )?;
7301
7302            _prev_end_offset = cur_offset + envelope_size;
7303            if 3 > max_ordinal {
7304                return Ok(());
7305            }
7306
7307            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
7308            // are envelope_size bytes.
7309            let cur_offset: usize = (3 - 1) * envelope_size;
7310
7311            // Zero reserved fields.
7312            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7313
7314            // Safety:
7315            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
7316            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
7317            //   envelope_size bytes, there is always sufficient room.
7318            fidl::encoding::encode_in_envelope_optional::<TechnologyType, D>(
7319                self.technology
7320                    .as_ref()
7321                    .map(<TechnologyType as fidl::encoding::ValueTypeMarker>::borrow),
7322                encoder,
7323                offset + cur_offset,
7324                depth,
7325            )?;
7326
7327            _prev_end_offset = cur_offset + envelope_size;
7328            if 4 > max_ordinal {
7329                return Ok(());
7330            }
7331
7332            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
7333            // are envelope_size bytes.
7334            let cur_offset: usize = (4 - 1) * envelope_size;
7335
7336            // Zero reserved fields.
7337            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7338
7339            // Safety:
7340            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
7341            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
7342            //   envelope_size bytes, there is always sufficient room.
7343            fidl::encoding::encode_in_envelope_optional::<bool, D>(
7344                self.connected.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
7345                encoder,
7346                offset + cur_offset,
7347                depth,
7348            )?;
7349
7350            _prev_end_offset = cur_offset + envelope_size;
7351            if 5 > max_ordinal {
7352                return Ok(());
7353            }
7354
7355            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
7356            // are envelope_size bytes.
7357            let cur_offset: usize = (5 - 1) * envelope_size;
7358
7359            // Zero reserved fields.
7360            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7361
7362            // Safety:
7363            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
7364            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
7365            //   envelope_size bytes, there is always sufficient room.
7366            fidl::encoding::encode_in_envelope_optional::<bool, D>(
7367                self.bonded.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
7368                encoder,
7369                offset + cur_offset,
7370                depth,
7371            )?;
7372
7373            _prev_end_offset = cur_offset + envelope_size;
7374            if 6 > max_ordinal {
7375                return Ok(());
7376            }
7377
7378            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
7379            // are envelope_size bytes.
7380            let cur_offset: usize = (6 - 1) * envelope_size;
7381
7382            // Zero reserved fields.
7383            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7384
7385            // Safety:
7386            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
7387            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
7388            //   envelope_size bytes, there is always sufficient room.
7389            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<248>, D>(
7390                self.name.as_ref().map(
7391                    <fidl::encoding::BoundedString<248> as fidl::encoding::ValueTypeMarker>::borrow,
7392                ),
7393                encoder,
7394                offset + cur_offset,
7395                depth,
7396            )?;
7397
7398            _prev_end_offset = cur_offset + envelope_size;
7399            if 7 > max_ordinal {
7400                return Ok(());
7401            }
7402
7403            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
7404            // are envelope_size bytes.
7405            let cur_offset: usize = (7 - 1) * envelope_size;
7406
7407            // Zero reserved fields.
7408            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7409
7410            // Safety:
7411            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
7412            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
7413            //   envelope_size bytes, there is always sufficient room.
7414            fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_bluetooth__common::Appearance, D>(
7415            self.appearance.as_ref().map(<fidl_fuchsia_bluetooth__common::Appearance as fidl::encoding::ValueTypeMarker>::borrow),
7416            encoder, offset + cur_offset, depth
7417        )?;
7418
7419            _prev_end_offset = cur_offset + envelope_size;
7420            if 8 > max_ordinal {
7421                return Ok(());
7422            }
7423
7424            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
7425            // are envelope_size bytes.
7426            let cur_offset: usize = (8 - 1) * envelope_size;
7427
7428            // Zero reserved fields.
7429            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7430
7431            // Safety:
7432            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
7433            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
7434            //   envelope_size bytes, there is always sufficient room.
7435            fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_bluetooth__common::DeviceClass, D>(
7436            self.device_class.as_ref().map(<fidl_fuchsia_bluetooth__common::DeviceClass as fidl::encoding::ValueTypeMarker>::borrow),
7437            encoder, offset + cur_offset, depth
7438        )?;
7439
7440            _prev_end_offset = cur_offset + envelope_size;
7441            if 9 > max_ordinal {
7442                return Ok(());
7443            }
7444
7445            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
7446            // are envelope_size bytes.
7447            let cur_offset: usize = (9 - 1) * envelope_size;
7448
7449            // Zero reserved fields.
7450            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7451
7452            // Safety:
7453            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
7454            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
7455            //   envelope_size bytes, there is always sufficient room.
7456            fidl::encoding::encode_in_envelope_optional::<i8, D>(
7457                self.rssi.as_ref().map(<i8 as fidl::encoding::ValueTypeMarker>::borrow),
7458                encoder,
7459                offset + cur_offset,
7460                depth,
7461            )?;
7462
7463            _prev_end_offset = cur_offset + envelope_size;
7464            if 10 > max_ordinal {
7465                return Ok(());
7466            }
7467
7468            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
7469            // are envelope_size bytes.
7470            let cur_offset: usize = (10 - 1) * envelope_size;
7471
7472            // Zero reserved fields.
7473            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7474
7475            // Safety:
7476            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
7477            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
7478            //   envelope_size bytes, there is always sufficient room.
7479            fidl::encoding::encode_in_envelope_optional::<i8, D>(
7480                self.tx_power.as_ref().map(<i8 as fidl::encoding::ValueTypeMarker>::borrow),
7481                encoder,
7482                offset + cur_offset,
7483                depth,
7484            )?;
7485
7486            _prev_end_offset = cur_offset + envelope_size;
7487            if 11 > max_ordinal {
7488                return Ok(());
7489            }
7490
7491            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
7492            // are envelope_size bytes.
7493            let cur_offset: usize = (11 - 1) * envelope_size;
7494
7495            // Zero reserved fields.
7496            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7497
7498            // Safety:
7499            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
7500            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
7501            //   envelope_size bytes, there is always sufficient room.
7502            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<fidl_fuchsia_bluetooth__common::Uuid, 65535>, D>(
7503            self.services.as_ref().map(<fidl::encoding::Vector<fidl_fuchsia_bluetooth__common::Uuid, 65535> as fidl::encoding::ValueTypeMarker>::borrow),
7504            encoder, offset + cur_offset, depth
7505        )?;
7506
7507            _prev_end_offset = cur_offset + envelope_size;
7508            if 12 > max_ordinal {
7509                return Ok(());
7510            }
7511
7512            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
7513            // are envelope_size bytes.
7514            let cur_offset: usize = (12 - 1) * envelope_size;
7515
7516            // Zero reserved fields.
7517            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7518
7519            // Safety:
7520            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
7521            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
7522            //   envelope_size bytes, there is always sufficient room.
7523            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<fidl_fuchsia_bluetooth__common::Uuid, 65535>, D>(
7524            self.le_services.as_ref().map(<fidl::encoding::Vector<fidl_fuchsia_bluetooth__common::Uuid, 65535> as fidl::encoding::ValueTypeMarker>::borrow),
7525            encoder, offset + cur_offset, depth
7526        )?;
7527
7528            _prev_end_offset = cur_offset + envelope_size;
7529            if 13 > max_ordinal {
7530                return Ok(());
7531            }
7532
7533            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
7534            // are envelope_size bytes.
7535            let cur_offset: usize = (13 - 1) * envelope_size;
7536
7537            // Zero reserved fields.
7538            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7539
7540            // Safety:
7541            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
7542            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
7543            //   envelope_size bytes, there is always sufficient room.
7544            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<fidl_fuchsia_bluetooth__common::Uuid, 65535>, D>(
7545            self.bredr_services.as_ref().map(<fidl::encoding::Vector<fidl_fuchsia_bluetooth__common::Uuid, 65535> as fidl::encoding::ValueTypeMarker>::borrow),
7546            encoder, offset + cur_offset, depth
7547        )?;
7548
7549            _prev_end_offset = cur_offset + envelope_size;
7550
7551            Ok(())
7552        }
7553    }
7554
7555    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Peer {
7556        #[inline(always)]
7557        fn new_empty() -> Self {
7558            Self::default()
7559        }
7560
7561        unsafe fn decode(
7562            &mut self,
7563            decoder: &mut fidl::encoding::Decoder<'_, D>,
7564            offset: usize,
7565            mut depth: fidl::encoding::Depth,
7566        ) -> fidl::Result<()> {
7567            decoder.debug_check_bounds::<Self>(offset);
7568            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
7569                None => return Err(fidl::Error::NotNullable),
7570                Some(len) => len,
7571            };
7572            // Calling decoder.out_of_line_offset(0) is not allowed.
7573            if len == 0 {
7574                return Ok(());
7575            };
7576            depth.increment()?;
7577            let envelope_size = 8;
7578            let bytes_len = len * envelope_size;
7579            let offset = decoder.out_of_line_offset(bytes_len)?;
7580            // Decode the envelope for each type.
7581            let mut _next_ordinal_to_read = 0;
7582            let mut next_offset = offset;
7583            let end_offset = offset + bytes_len;
7584            _next_ordinal_to_read += 1;
7585            if next_offset >= end_offset {
7586                return Ok(());
7587            }
7588
7589            // Decode unknown envelopes for gaps in ordinals.
7590            while _next_ordinal_to_read < 1 {
7591                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7592                _next_ordinal_to_read += 1;
7593                next_offset += envelope_size;
7594            }
7595
7596            let next_out_of_line = decoder.next_out_of_line();
7597            let handles_before = decoder.remaining_handles();
7598            if let Some((inlined, num_bytes, num_handles)) =
7599                fidl::encoding::decode_envelope_header(decoder, next_offset)?
7600            {
7601                let member_inline_size = <fidl_fuchsia_bluetooth__common::PeerId as fidl::encoding::TypeMarker>::inline_size(decoder.context);
7602                if inlined != (member_inline_size <= 4) {
7603                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
7604                }
7605                let inner_offset;
7606                let mut inner_depth = depth.clone();
7607                if inlined {
7608                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7609                    inner_offset = next_offset;
7610                } else {
7611                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7612                    inner_depth.increment()?;
7613                }
7614                let val_ref = self.id.get_or_insert_with(|| {
7615                    fidl::new_empty!(fidl_fuchsia_bluetooth__common::PeerId, D)
7616                });
7617                fidl::decode!(
7618                    fidl_fuchsia_bluetooth__common::PeerId,
7619                    D,
7620                    val_ref,
7621                    decoder,
7622                    inner_offset,
7623                    inner_depth
7624                )?;
7625                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7626                {
7627                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
7628                }
7629                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7630                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7631                }
7632            }
7633
7634            next_offset += envelope_size;
7635            _next_ordinal_to_read += 1;
7636            if next_offset >= end_offset {
7637                return Ok(());
7638            }
7639
7640            // Decode unknown envelopes for gaps in ordinals.
7641            while _next_ordinal_to_read < 2 {
7642                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7643                _next_ordinal_to_read += 1;
7644                next_offset += envelope_size;
7645            }
7646
7647            let next_out_of_line = decoder.next_out_of_line();
7648            let handles_before = decoder.remaining_handles();
7649            if let Some((inlined, num_bytes, num_handles)) =
7650                fidl::encoding::decode_envelope_header(decoder, next_offset)?
7651            {
7652                let member_inline_size = <fidl_fuchsia_bluetooth__common::Address as fidl::encoding::TypeMarker>::inline_size(decoder.context);
7653                if inlined != (member_inline_size <= 4) {
7654                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
7655                }
7656                let inner_offset;
7657                let mut inner_depth = depth.clone();
7658                if inlined {
7659                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7660                    inner_offset = next_offset;
7661                } else {
7662                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7663                    inner_depth.increment()?;
7664                }
7665                let val_ref = self.address.get_or_insert_with(|| {
7666                    fidl::new_empty!(fidl_fuchsia_bluetooth__common::Address, D)
7667                });
7668                fidl::decode!(
7669                    fidl_fuchsia_bluetooth__common::Address,
7670                    D,
7671                    val_ref,
7672                    decoder,
7673                    inner_offset,
7674                    inner_depth
7675                )?;
7676                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7677                {
7678                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
7679                }
7680                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7681                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7682                }
7683            }
7684
7685            next_offset += envelope_size;
7686            _next_ordinal_to_read += 1;
7687            if next_offset >= end_offset {
7688                return Ok(());
7689            }
7690
7691            // Decode unknown envelopes for gaps in ordinals.
7692            while _next_ordinal_to_read < 3 {
7693                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7694                _next_ordinal_to_read += 1;
7695                next_offset += envelope_size;
7696            }
7697
7698            let next_out_of_line = decoder.next_out_of_line();
7699            let handles_before = decoder.remaining_handles();
7700            if let Some((inlined, num_bytes, num_handles)) =
7701                fidl::encoding::decode_envelope_header(decoder, next_offset)?
7702            {
7703                let member_inline_size =
7704                    <TechnologyType as fidl::encoding::TypeMarker>::inline_size(decoder.context);
7705                if inlined != (member_inline_size <= 4) {
7706                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
7707                }
7708                let inner_offset;
7709                let mut inner_depth = depth.clone();
7710                if inlined {
7711                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7712                    inner_offset = next_offset;
7713                } else {
7714                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7715                    inner_depth.increment()?;
7716                }
7717                let val_ref =
7718                    self.technology.get_or_insert_with(|| fidl::new_empty!(TechnologyType, D));
7719                fidl::decode!(TechnologyType, D, val_ref, decoder, inner_offset, inner_depth)?;
7720                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7721                {
7722                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
7723                }
7724                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7725                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7726                }
7727            }
7728
7729            next_offset += envelope_size;
7730            _next_ordinal_to_read += 1;
7731            if next_offset >= end_offset {
7732                return Ok(());
7733            }
7734
7735            // Decode unknown envelopes for gaps in ordinals.
7736            while _next_ordinal_to_read < 4 {
7737                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7738                _next_ordinal_to_read += 1;
7739                next_offset += envelope_size;
7740            }
7741
7742            let next_out_of_line = decoder.next_out_of_line();
7743            let handles_before = decoder.remaining_handles();
7744            if let Some((inlined, num_bytes, num_handles)) =
7745                fidl::encoding::decode_envelope_header(decoder, next_offset)?
7746            {
7747                let member_inline_size =
7748                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
7749                if inlined != (member_inline_size <= 4) {
7750                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
7751                }
7752                let inner_offset;
7753                let mut inner_depth = depth.clone();
7754                if inlined {
7755                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7756                    inner_offset = next_offset;
7757                } else {
7758                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7759                    inner_depth.increment()?;
7760                }
7761                let val_ref = self.connected.get_or_insert_with(|| fidl::new_empty!(bool, D));
7762                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
7763                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7764                {
7765                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
7766                }
7767                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7768                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7769                }
7770            }
7771
7772            next_offset += envelope_size;
7773            _next_ordinal_to_read += 1;
7774            if next_offset >= end_offset {
7775                return Ok(());
7776            }
7777
7778            // Decode unknown envelopes for gaps in ordinals.
7779            while _next_ordinal_to_read < 5 {
7780                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7781                _next_ordinal_to_read += 1;
7782                next_offset += envelope_size;
7783            }
7784
7785            let next_out_of_line = decoder.next_out_of_line();
7786            let handles_before = decoder.remaining_handles();
7787            if let Some((inlined, num_bytes, num_handles)) =
7788                fidl::encoding::decode_envelope_header(decoder, next_offset)?
7789            {
7790                let member_inline_size =
7791                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
7792                if inlined != (member_inline_size <= 4) {
7793                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
7794                }
7795                let inner_offset;
7796                let mut inner_depth = depth.clone();
7797                if inlined {
7798                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7799                    inner_offset = next_offset;
7800                } else {
7801                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7802                    inner_depth.increment()?;
7803                }
7804                let val_ref = self.bonded.get_or_insert_with(|| fidl::new_empty!(bool, D));
7805                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
7806                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7807                {
7808                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
7809                }
7810                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7811                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7812                }
7813            }
7814
7815            next_offset += envelope_size;
7816            _next_ordinal_to_read += 1;
7817            if next_offset >= end_offset {
7818                return Ok(());
7819            }
7820
7821            // Decode unknown envelopes for gaps in ordinals.
7822            while _next_ordinal_to_read < 6 {
7823                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7824                _next_ordinal_to_read += 1;
7825                next_offset += envelope_size;
7826            }
7827
7828            let next_out_of_line = decoder.next_out_of_line();
7829            let handles_before = decoder.remaining_handles();
7830            if let Some((inlined, num_bytes, num_handles)) =
7831                fidl::encoding::decode_envelope_header(decoder, next_offset)?
7832            {
7833                let member_inline_size =
7834                    <fidl::encoding::BoundedString<248> as fidl::encoding::TypeMarker>::inline_size(
7835                        decoder.context,
7836                    );
7837                if inlined != (member_inline_size <= 4) {
7838                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
7839                }
7840                let inner_offset;
7841                let mut inner_depth = depth.clone();
7842                if inlined {
7843                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7844                    inner_offset = next_offset;
7845                } else {
7846                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7847                    inner_depth.increment()?;
7848                }
7849                let val_ref = self
7850                    .name
7851                    .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::BoundedString<248>, D));
7852                fidl::decode!(
7853                    fidl::encoding::BoundedString<248>,
7854                    D,
7855                    val_ref,
7856                    decoder,
7857                    inner_offset,
7858                    inner_depth
7859                )?;
7860                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7861                {
7862                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
7863                }
7864                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7865                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7866                }
7867            }
7868
7869            next_offset += envelope_size;
7870            _next_ordinal_to_read += 1;
7871            if next_offset >= end_offset {
7872                return Ok(());
7873            }
7874
7875            // Decode unknown envelopes for gaps in ordinals.
7876            while _next_ordinal_to_read < 7 {
7877                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7878                _next_ordinal_to_read += 1;
7879                next_offset += envelope_size;
7880            }
7881
7882            let next_out_of_line = decoder.next_out_of_line();
7883            let handles_before = decoder.remaining_handles();
7884            if let Some((inlined, num_bytes, num_handles)) =
7885                fidl::encoding::decode_envelope_header(decoder, next_offset)?
7886            {
7887                let member_inline_size = <fidl_fuchsia_bluetooth__common::Appearance as fidl::encoding::TypeMarker>::inline_size(decoder.context);
7888                if inlined != (member_inline_size <= 4) {
7889                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
7890                }
7891                let inner_offset;
7892                let mut inner_depth = depth.clone();
7893                if inlined {
7894                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7895                    inner_offset = next_offset;
7896                } else {
7897                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7898                    inner_depth.increment()?;
7899                }
7900                let val_ref = self.appearance.get_or_insert_with(|| {
7901                    fidl::new_empty!(fidl_fuchsia_bluetooth__common::Appearance, D)
7902                });
7903                fidl::decode!(
7904                    fidl_fuchsia_bluetooth__common::Appearance,
7905                    D,
7906                    val_ref,
7907                    decoder,
7908                    inner_offset,
7909                    inner_depth
7910                )?;
7911                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7912                {
7913                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
7914                }
7915                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7916                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7917                }
7918            }
7919
7920            next_offset += envelope_size;
7921            _next_ordinal_to_read += 1;
7922            if next_offset >= end_offset {
7923                return Ok(());
7924            }
7925
7926            // Decode unknown envelopes for gaps in ordinals.
7927            while _next_ordinal_to_read < 8 {
7928                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7929                _next_ordinal_to_read += 1;
7930                next_offset += envelope_size;
7931            }
7932
7933            let next_out_of_line = decoder.next_out_of_line();
7934            let handles_before = decoder.remaining_handles();
7935            if let Some((inlined, num_bytes, num_handles)) =
7936                fidl::encoding::decode_envelope_header(decoder, next_offset)?
7937            {
7938                let member_inline_size = <fidl_fuchsia_bluetooth__common::DeviceClass as fidl::encoding::TypeMarker>::inline_size(decoder.context);
7939                if inlined != (member_inline_size <= 4) {
7940                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
7941                }
7942                let inner_offset;
7943                let mut inner_depth = depth.clone();
7944                if inlined {
7945                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7946                    inner_offset = next_offset;
7947                } else {
7948                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7949                    inner_depth.increment()?;
7950                }
7951                let val_ref = self.device_class.get_or_insert_with(|| {
7952                    fidl::new_empty!(fidl_fuchsia_bluetooth__common::DeviceClass, D)
7953                });
7954                fidl::decode!(
7955                    fidl_fuchsia_bluetooth__common::DeviceClass,
7956                    D,
7957                    val_ref,
7958                    decoder,
7959                    inner_offset,
7960                    inner_depth
7961                )?;
7962                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7963                {
7964                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
7965                }
7966                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7967                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7968                }
7969            }
7970
7971            next_offset += envelope_size;
7972            _next_ordinal_to_read += 1;
7973            if next_offset >= end_offset {
7974                return Ok(());
7975            }
7976
7977            // Decode unknown envelopes for gaps in ordinals.
7978            while _next_ordinal_to_read < 9 {
7979                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7980                _next_ordinal_to_read += 1;
7981                next_offset += envelope_size;
7982            }
7983
7984            let next_out_of_line = decoder.next_out_of_line();
7985            let handles_before = decoder.remaining_handles();
7986            if let Some((inlined, num_bytes, num_handles)) =
7987                fidl::encoding::decode_envelope_header(decoder, next_offset)?
7988            {
7989                let member_inline_size =
7990                    <i8 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
7991                if inlined != (member_inline_size <= 4) {
7992                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
7993                }
7994                let inner_offset;
7995                let mut inner_depth = depth.clone();
7996                if inlined {
7997                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7998                    inner_offset = next_offset;
7999                } else {
8000                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8001                    inner_depth.increment()?;
8002                }
8003                let val_ref = self.rssi.get_or_insert_with(|| fidl::new_empty!(i8, D));
8004                fidl::decode!(i8, D, val_ref, decoder, inner_offset, inner_depth)?;
8005                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8006                {
8007                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
8008                }
8009                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8010                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8011                }
8012            }
8013
8014            next_offset += envelope_size;
8015            _next_ordinal_to_read += 1;
8016            if next_offset >= end_offset {
8017                return Ok(());
8018            }
8019
8020            // Decode unknown envelopes for gaps in ordinals.
8021            while _next_ordinal_to_read < 10 {
8022                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8023                _next_ordinal_to_read += 1;
8024                next_offset += envelope_size;
8025            }
8026
8027            let next_out_of_line = decoder.next_out_of_line();
8028            let handles_before = decoder.remaining_handles();
8029            if let Some((inlined, num_bytes, num_handles)) =
8030                fidl::encoding::decode_envelope_header(decoder, next_offset)?
8031            {
8032                let member_inline_size =
8033                    <i8 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
8034                if inlined != (member_inline_size <= 4) {
8035                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
8036                }
8037                let inner_offset;
8038                let mut inner_depth = depth.clone();
8039                if inlined {
8040                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8041                    inner_offset = next_offset;
8042                } else {
8043                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8044                    inner_depth.increment()?;
8045                }
8046                let val_ref = self.tx_power.get_or_insert_with(|| fidl::new_empty!(i8, D));
8047                fidl::decode!(i8, D, val_ref, decoder, inner_offset, inner_depth)?;
8048                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8049                {
8050                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
8051                }
8052                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8053                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8054                }
8055            }
8056
8057            next_offset += envelope_size;
8058            _next_ordinal_to_read += 1;
8059            if next_offset >= end_offset {
8060                return Ok(());
8061            }
8062
8063            // Decode unknown envelopes for gaps in ordinals.
8064            while _next_ordinal_to_read < 11 {
8065                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8066                _next_ordinal_to_read += 1;
8067                next_offset += envelope_size;
8068            }
8069
8070            let next_out_of_line = decoder.next_out_of_line();
8071            let handles_before = decoder.remaining_handles();
8072            if let Some((inlined, num_bytes, num_handles)) =
8073                fidl::encoding::decode_envelope_header(decoder, next_offset)?
8074            {
8075                let member_inline_size = <fidl::encoding::Vector<
8076                    fidl_fuchsia_bluetooth__common::Uuid,
8077                    65535,
8078                > as fidl::encoding::TypeMarker>::inline_size(
8079                    decoder.context
8080                );
8081                if inlined != (member_inline_size <= 4) {
8082                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
8083                }
8084                let inner_offset;
8085                let mut inner_depth = depth.clone();
8086                if inlined {
8087                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8088                    inner_offset = next_offset;
8089                } else {
8090                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8091                    inner_depth.increment()?;
8092                }
8093                let val_ref =
8094                self.services.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<fidl_fuchsia_bluetooth__common::Uuid, 65535>, D));
8095                fidl::decode!(fidl::encoding::Vector<fidl_fuchsia_bluetooth__common::Uuid, 65535>, D, val_ref, decoder, inner_offset, inner_depth)?;
8096                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8097                {
8098                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
8099                }
8100                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8101                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8102                }
8103            }
8104
8105            next_offset += envelope_size;
8106            _next_ordinal_to_read += 1;
8107            if next_offset >= end_offset {
8108                return Ok(());
8109            }
8110
8111            // Decode unknown envelopes for gaps in ordinals.
8112            while _next_ordinal_to_read < 12 {
8113                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8114                _next_ordinal_to_read += 1;
8115                next_offset += envelope_size;
8116            }
8117
8118            let next_out_of_line = decoder.next_out_of_line();
8119            let handles_before = decoder.remaining_handles();
8120            if let Some((inlined, num_bytes, num_handles)) =
8121                fidl::encoding::decode_envelope_header(decoder, next_offset)?
8122            {
8123                let member_inline_size = <fidl::encoding::Vector<
8124                    fidl_fuchsia_bluetooth__common::Uuid,
8125                    65535,
8126                > as fidl::encoding::TypeMarker>::inline_size(
8127                    decoder.context
8128                );
8129                if inlined != (member_inline_size <= 4) {
8130                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
8131                }
8132                let inner_offset;
8133                let mut inner_depth = depth.clone();
8134                if inlined {
8135                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8136                    inner_offset = next_offset;
8137                } else {
8138                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8139                    inner_depth.increment()?;
8140                }
8141                let val_ref =
8142                self.le_services.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<fidl_fuchsia_bluetooth__common::Uuid, 65535>, D));
8143                fidl::decode!(fidl::encoding::Vector<fidl_fuchsia_bluetooth__common::Uuid, 65535>, D, val_ref, decoder, inner_offset, inner_depth)?;
8144                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8145                {
8146                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
8147                }
8148                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8149                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8150                }
8151            }
8152
8153            next_offset += envelope_size;
8154            _next_ordinal_to_read += 1;
8155            if next_offset >= end_offset {
8156                return Ok(());
8157            }
8158
8159            // Decode unknown envelopes for gaps in ordinals.
8160            while _next_ordinal_to_read < 13 {
8161                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8162                _next_ordinal_to_read += 1;
8163                next_offset += envelope_size;
8164            }
8165
8166            let next_out_of_line = decoder.next_out_of_line();
8167            let handles_before = decoder.remaining_handles();
8168            if let Some((inlined, num_bytes, num_handles)) =
8169                fidl::encoding::decode_envelope_header(decoder, next_offset)?
8170            {
8171                let member_inline_size = <fidl::encoding::Vector<
8172                    fidl_fuchsia_bluetooth__common::Uuid,
8173                    65535,
8174                > as fidl::encoding::TypeMarker>::inline_size(
8175                    decoder.context
8176                );
8177                if inlined != (member_inline_size <= 4) {
8178                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
8179                }
8180                let inner_offset;
8181                let mut inner_depth = depth.clone();
8182                if inlined {
8183                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8184                    inner_offset = next_offset;
8185                } else {
8186                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8187                    inner_depth.increment()?;
8188                }
8189                let val_ref =
8190                self.bredr_services.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<fidl_fuchsia_bluetooth__common::Uuid, 65535>, D));
8191                fidl::decode!(fidl::encoding::Vector<fidl_fuchsia_bluetooth__common::Uuid, 65535>, D, val_ref, decoder, inner_offset, inner_depth)?;
8192                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8193                {
8194                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
8195                }
8196                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8197                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8198                }
8199            }
8200
8201            next_offset += envelope_size;
8202
8203            // Decode the remaining unknown envelopes.
8204            while next_offset < end_offset {
8205                _next_ordinal_to_read += 1;
8206                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8207                next_offset += envelope_size;
8208            }
8209
8210            Ok(())
8211        }
8212    }
8213
8214    impl Settings {
8215        #[inline(always)]
8216        fn max_ordinal_present(&self) -> u64 {
8217            if let Some(_) = self.bredr_security_mode {
8218                return 5;
8219            }
8220            if let Some(_) = self.le_security_mode {
8221                return 4;
8222            }
8223            if let Some(_) = self.bredr_connectable_mode {
8224                return 3;
8225            }
8226            if let Some(_) = self.le_background_scan {
8227                return 2;
8228            }
8229            if let Some(_) = self.le_privacy {
8230                return 1;
8231            }
8232            0
8233        }
8234    }
8235
8236    impl fidl::encoding::ValueTypeMarker for Settings {
8237        type Borrowed<'a> = &'a Self;
8238        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
8239            value
8240        }
8241    }
8242
8243    unsafe impl fidl::encoding::TypeMarker for Settings {
8244        type Owned = Self;
8245
8246        #[inline(always)]
8247        fn inline_align(_context: fidl::encoding::Context) -> usize {
8248            8
8249        }
8250
8251        #[inline(always)]
8252        fn inline_size(_context: fidl::encoding::Context) -> usize {
8253            16
8254        }
8255    }
8256
8257    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Settings, D> for &Settings {
8258        unsafe fn encode(
8259            self,
8260            encoder: &mut fidl::encoding::Encoder<'_, D>,
8261            offset: usize,
8262            mut depth: fidl::encoding::Depth,
8263        ) -> fidl::Result<()> {
8264            encoder.debug_check_bounds::<Settings>(offset);
8265            // Vector header
8266            let max_ordinal: u64 = self.max_ordinal_present();
8267            encoder.write_num(max_ordinal, offset);
8268            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
8269            // Calling encoder.out_of_line_offset(0) is not allowed.
8270            if max_ordinal == 0 {
8271                return Ok(());
8272            }
8273            depth.increment()?;
8274            let envelope_size = 8;
8275            let bytes_len = max_ordinal as usize * envelope_size;
8276            #[allow(unused_variables)]
8277            let offset = encoder.out_of_line_offset(bytes_len);
8278            let mut _prev_end_offset: usize = 0;
8279            if 1 > max_ordinal {
8280                return Ok(());
8281            }
8282
8283            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
8284            // are envelope_size bytes.
8285            let cur_offset: usize = (1 - 1) * envelope_size;
8286
8287            // Zero reserved fields.
8288            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
8289
8290            // Safety:
8291            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
8292            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
8293            //   envelope_size bytes, there is always sufficient room.
8294            fidl::encoding::encode_in_envelope_optional::<bool, D>(
8295                self.le_privacy.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
8296                encoder,
8297                offset + cur_offset,
8298                depth,
8299            )?;
8300
8301            _prev_end_offset = cur_offset + envelope_size;
8302            if 2 > max_ordinal {
8303                return Ok(());
8304            }
8305
8306            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
8307            // are envelope_size bytes.
8308            let cur_offset: usize = (2 - 1) * envelope_size;
8309
8310            // Zero reserved fields.
8311            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
8312
8313            // Safety:
8314            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
8315            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
8316            //   envelope_size bytes, there is always sufficient room.
8317            fidl::encoding::encode_in_envelope_optional::<bool, D>(
8318                self.le_background_scan
8319                    .as_ref()
8320                    .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
8321                encoder,
8322                offset + cur_offset,
8323                depth,
8324            )?;
8325
8326            _prev_end_offset = cur_offset + envelope_size;
8327            if 3 > max_ordinal {
8328                return Ok(());
8329            }
8330
8331            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
8332            // are envelope_size bytes.
8333            let cur_offset: usize = (3 - 1) * envelope_size;
8334
8335            // Zero reserved fields.
8336            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
8337
8338            // Safety:
8339            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
8340            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
8341            //   envelope_size bytes, there is always sufficient room.
8342            fidl::encoding::encode_in_envelope_optional::<bool, D>(
8343                self.bredr_connectable_mode
8344                    .as_ref()
8345                    .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
8346                encoder,
8347                offset + cur_offset,
8348                depth,
8349            )?;
8350
8351            _prev_end_offset = cur_offset + envelope_size;
8352            if 4 > max_ordinal {
8353                return Ok(());
8354            }
8355
8356            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
8357            // are envelope_size bytes.
8358            let cur_offset: usize = (4 - 1) * envelope_size;
8359
8360            // Zero reserved fields.
8361            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
8362
8363            // Safety:
8364            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
8365            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
8366            //   envelope_size bytes, there is always sufficient room.
8367            fidl::encoding::encode_in_envelope_optional::<LeSecurityMode, D>(
8368                self.le_security_mode
8369                    .as_ref()
8370                    .map(<LeSecurityMode as fidl::encoding::ValueTypeMarker>::borrow),
8371                encoder,
8372                offset + cur_offset,
8373                depth,
8374            )?;
8375
8376            _prev_end_offset = cur_offset + envelope_size;
8377            if 5 > max_ordinal {
8378                return Ok(());
8379            }
8380
8381            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
8382            // are envelope_size bytes.
8383            let cur_offset: usize = (5 - 1) * envelope_size;
8384
8385            // Zero reserved fields.
8386            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
8387
8388            // Safety:
8389            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
8390            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
8391            //   envelope_size bytes, there is always sufficient room.
8392            fidl::encoding::encode_in_envelope_optional::<BrEdrSecurityMode, D>(
8393                self.bredr_security_mode
8394                    .as_ref()
8395                    .map(<BrEdrSecurityMode as fidl::encoding::ValueTypeMarker>::borrow),
8396                encoder,
8397                offset + cur_offset,
8398                depth,
8399            )?;
8400
8401            _prev_end_offset = cur_offset + envelope_size;
8402
8403            Ok(())
8404        }
8405    }
8406
8407    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Settings {
8408        #[inline(always)]
8409        fn new_empty() -> Self {
8410            Self::default()
8411        }
8412
8413        unsafe fn decode(
8414            &mut self,
8415            decoder: &mut fidl::encoding::Decoder<'_, D>,
8416            offset: usize,
8417            mut depth: fidl::encoding::Depth,
8418        ) -> fidl::Result<()> {
8419            decoder.debug_check_bounds::<Self>(offset);
8420            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
8421                None => return Err(fidl::Error::NotNullable),
8422                Some(len) => len,
8423            };
8424            // Calling decoder.out_of_line_offset(0) is not allowed.
8425            if len == 0 {
8426                return Ok(());
8427            };
8428            depth.increment()?;
8429            let envelope_size = 8;
8430            let bytes_len = len * envelope_size;
8431            let offset = decoder.out_of_line_offset(bytes_len)?;
8432            // Decode the envelope for each type.
8433            let mut _next_ordinal_to_read = 0;
8434            let mut next_offset = offset;
8435            let end_offset = offset + bytes_len;
8436            _next_ordinal_to_read += 1;
8437            if next_offset >= end_offset {
8438                return Ok(());
8439            }
8440
8441            // Decode unknown envelopes for gaps in ordinals.
8442            while _next_ordinal_to_read < 1 {
8443                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8444                _next_ordinal_to_read += 1;
8445                next_offset += envelope_size;
8446            }
8447
8448            let next_out_of_line = decoder.next_out_of_line();
8449            let handles_before = decoder.remaining_handles();
8450            if let Some((inlined, num_bytes, num_handles)) =
8451                fidl::encoding::decode_envelope_header(decoder, next_offset)?
8452            {
8453                let member_inline_size =
8454                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
8455                if inlined != (member_inline_size <= 4) {
8456                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
8457                }
8458                let inner_offset;
8459                let mut inner_depth = depth.clone();
8460                if inlined {
8461                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8462                    inner_offset = next_offset;
8463                } else {
8464                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8465                    inner_depth.increment()?;
8466                }
8467                let val_ref = self.le_privacy.get_or_insert_with(|| fidl::new_empty!(bool, D));
8468                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
8469                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8470                {
8471                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
8472                }
8473                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8474                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8475                }
8476            }
8477
8478            next_offset += envelope_size;
8479            _next_ordinal_to_read += 1;
8480            if next_offset >= end_offset {
8481                return Ok(());
8482            }
8483
8484            // Decode unknown envelopes for gaps in ordinals.
8485            while _next_ordinal_to_read < 2 {
8486                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8487                _next_ordinal_to_read += 1;
8488                next_offset += envelope_size;
8489            }
8490
8491            let next_out_of_line = decoder.next_out_of_line();
8492            let handles_before = decoder.remaining_handles();
8493            if let Some((inlined, num_bytes, num_handles)) =
8494                fidl::encoding::decode_envelope_header(decoder, next_offset)?
8495            {
8496                let member_inline_size =
8497                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
8498                if inlined != (member_inline_size <= 4) {
8499                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
8500                }
8501                let inner_offset;
8502                let mut inner_depth = depth.clone();
8503                if inlined {
8504                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8505                    inner_offset = next_offset;
8506                } else {
8507                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8508                    inner_depth.increment()?;
8509                }
8510                let val_ref =
8511                    self.le_background_scan.get_or_insert_with(|| fidl::new_empty!(bool, D));
8512                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
8513                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8514                {
8515                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
8516                }
8517                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8518                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8519                }
8520            }
8521
8522            next_offset += envelope_size;
8523            _next_ordinal_to_read += 1;
8524            if next_offset >= end_offset {
8525                return Ok(());
8526            }
8527
8528            // Decode unknown envelopes for gaps in ordinals.
8529            while _next_ordinal_to_read < 3 {
8530                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8531                _next_ordinal_to_read += 1;
8532                next_offset += envelope_size;
8533            }
8534
8535            let next_out_of_line = decoder.next_out_of_line();
8536            let handles_before = decoder.remaining_handles();
8537            if let Some((inlined, num_bytes, num_handles)) =
8538                fidl::encoding::decode_envelope_header(decoder, next_offset)?
8539            {
8540                let member_inline_size =
8541                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
8542                if inlined != (member_inline_size <= 4) {
8543                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
8544                }
8545                let inner_offset;
8546                let mut inner_depth = depth.clone();
8547                if inlined {
8548                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8549                    inner_offset = next_offset;
8550                } else {
8551                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8552                    inner_depth.increment()?;
8553                }
8554                let val_ref =
8555                    self.bredr_connectable_mode.get_or_insert_with(|| fidl::new_empty!(bool, D));
8556                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
8557                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8558                {
8559                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
8560                }
8561                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8562                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8563                }
8564            }
8565
8566            next_offset += envelope_size;
8567            _next_ordinal_to_read += 1;
8568            if next_offset >= end_offset {
8569                return Ok(());
8570            }
8571
8572            // Decode unknown envelopes for gaps in ordinals.
8573            while _next_ordinal_to_read < 4 {
8574                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8575                _next_ordinal_to_read += 1;
8576                next_offset += envelope_size;
8577            }
8578
8579            let next_out_of_line = decoder.next_out_of_line();
8580            let handles_before = decoder.remaining_handles();
8581            if let Some((inlined, num_bytes, num_handles)) =
8582                fidl::encoding::decode_envelope_header(decoder, next_offset)?
8583            {
8584                let member_inline_size =
8585                    <LeSecurityMode as fidl::encoding::TypeMarker>::inline_size(decoder.context);
8586                if inlined != (member_inline_size <= 4) {
8587                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
8588                }
8589                let inner_offset;
8590                let mut inner_depth = depth.clone();
8591                if inlined {
8592                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8593                    inner_offset = next_offset;
8594                } else {
8595                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8596                    inner_depth.increment()?;
8597                }
8598                let val_ref = self
8599                    .le_security_mode
8600                    .get_or_insert_with(|| fidl::new_empty!(LeSecurityMode, D));
8601                fidl::decode!(LeSecurityMode, D, val_ref, decoder, inner_offset, inner_depth)?;
8602                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8603                {
8604                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
8605                }
8606                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8607                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8608                }
8609            }
8610
8611            next_offset += envelope_size;
8612            _next_ordinal_to_read += 1;
8613            if next_offset >= end_offset {
8614                return Ok(());
8615            }
8616
8617            // Decode unknown envelopes for gaps in ordinals.
8618            while _next_ordinal_to_read < 5 {
8619                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8620                _next_ordinal_to_read += 1;
8621                next_offset += envelope_size;
8622            }
8623
8624            let next_out_of_line = decoder.next_out_of_line();
8625            let handles_before = decoder.remaining_handles();
8626            if let Some((inlined, num_bytes, num_handles)) =
8627                fidl::encoding::decode_envelope_header(decoder, next_offset)?
8628            {
8629                let member_inline_size =
8630                    <BrEdrSecurityMode as fidl::encoding::TypeMarker>::inline_size(decoder.context);
8631                if inlined != (member_inline_size <= 4) {
8632                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
8633                }
8634                let inner_offset;
8635                let mut inner_depth = depth.clone();
8636                if inlined {
8637                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8638                    inner_offset = next_offset;
8639                } else {
8640                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8641                    inner_depth.increment()?;
8642                }
8643                let val_ref = self
8644                    .bredr_security_mode
8645                    .get_or_insert_with(|| fidl::new_empty!(BrEdrSecurityMode, D));
8646                fidl::decode!(BrEdrSecurityMode, D, val_ref, decoder, inner_offset, inner_depth)?;
8647                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8648                {
8649                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
8650                }
8651                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8652                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8653                }
8654            }
8655
8656            next_offset += envelope_size;
8657
8658            // Decode the remaining unknown envelopes.
8659            while next_offset < end_offset {
8660                _next_ordinal_to_read += 1;
8661                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8662                next_offset += envelope_size;
8663            }
8664
8665            Ok(())
8666        }
8667    }
8668
8669    impl fidl::encoding::ValueTypeMarker for PairingProperties {
8670        type Borrowed<'a> = &'a Self;
8671        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
8672            value
8673        }
8674    }
8675
8676    unsafe impl fidl::encoding::TypeMarker for PairingProperties {
8677        type Owned = Self;
8678
8679        #[inline(always)]
8680        fn inline_align(_context: fidl::encoding::Context) -> usize {
8681            8
8682        }
8683
8684        #[inline(always)]
8685        fn inline_size(_context: fidl::encoding::Context) -> usize {
8686            16
8687        }
8688    }
8689
8690    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<PairingProperties, D>
8691        for &PairingProperties
8692    {
8693        #[inline]
8694        unsafe fn encode(
8695            self,
8696            encoder: &mut fidl::encoding::Encoder<'_, D>,
8697            offset: usize,
8698            _depth: fidl::encoding::Depth,
8699        ) -> fidl::Result<()> {
8700            encoder.debug_check_bounds::<PairingProperties>(offset);
8701            encoder.write_num::<u64>(self.ordinal(), offset);
8702            match self {
8703                PairingProperties::Consent(ref val) => {
8704                    fidl::encoding::encode_in_envelope::<Consent, D>(
8705                        <Consent as fidl::encoding::ValueTypeMarker>::borrow(val),
8706                        encoder,
8707                        offset + 8,
8708                        _depth,
8709                    )
8710                }
8711                PairingProperties::PasskeyDisplay(ref val) => {
8712                    fidl::encoding::encode_in_envelope::<u32, D>(
8713                        <u32 as fidl::encoding::ValueTypeMarker>::borrow(val),
8714                        encoder,
8715                        offset + 8,
8716                        _depth,
8717                    )
8718                }
8719                PairingProperties::PasskeyConfirmation(ref val) => {
8720                    fidl::encoding::encode_in_envelope::<u32, D>(
8721                        <u32 as fidl::encoding::ValueTypeMarker>::borrow(val),
8722                        encoder,
8723                        offset + 8,
8724                        _depth,
8725                    )
8726                }
8727                PairingProperties::PasskeyEntry(ref val) => {
8728                    fidl::encoding::encode_in_envelope::<PasskeyEntry, D>(
8729                        <PasskeyEntry as fidl::encoding::ValueTypeMarker>::borrow(val),
8730                        encoder,
8731                        offset + 8,
8732                        _depth,
8733                    )
8734                }
8735                PairingProperties::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
8736            }
8737        }
8738    }
8739
8740    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for PairingProperties {
8741        #[inline(always)]
8742        fn new_empty() -> Self {
8743            Self::__SourceBreaking { unknown_ordinal: 0 }
8744        }
8745
8746        #[inline]
8747        unsafe fn decode(
8748            &mut self,
8749            decoder: &mut fidl::encoding::Decoder<'_, D>,
8750            offset: usize,
8751            mut depth: fidl::encoding::Depth,
8752        ) -> fidl::Result<()> {
8753            decoder.debug_check_bounds::<Self>(offset);
8754            #[allow(unused_variables)]
8755            let next_out_of_line = decoder.next_out_of_line();
8756            let handles_before = decoder.remaining_handles();
8757            let (ordinal, inlined, num_bytes, num_handles) =
8758                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
8759
8760            let member_inline_size = match ordinal {
8761                1 => <Consent as fidl::encoding::TypeMarker>::inline_size(decoder.context),
8762                2 => <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context),
8763                3 => <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context),
8764                4 => <PasskeyEntry as fidl::encoding::TypeMarker>::inline_size(decoder.context),
8765                0 => return Err(fidl::Error::UnknownUnionTag),
8766                _ => num_bytes as usize,
8767            };
8768
8769            if inlined != (member_inline_size <= 4) {
8770                return Err(fidl::Error::InvalidInlineBitInEnvelope);
8771            }
8772            let _inner_offset;
8773            if inlined {
8774                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
8775                _inner_offset = offset + 8;
8776            } else {
8777                depth.increment()?;
8778                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8779            }
8780            match ordinal {
8781                1 => {
8782                    #[allow(irrefutable_let_patterns)]
8783                    if let PairingProperties::Consent(_) = self {
8784                        // Do nothing, read the value into the object
8785                    } else {
8786                        // Initialize `self` to the right variant
8787                        *self = PairingProperties::Consent(fidl::new_empty!(Consent, D));
8788                    }
8789                    #[allow(irrefutable_let_patterns)]
8790                    if let PairingProperties::Consent(ref mut val) = self {
8791                        fidl::decode!(Consent, D, val, decoder, _inner_offset, depth)?;
8792                    } else {
8793                        unreachable!()
8794                    }
8795                }
8796                2 => {
8797                    #[allow(irrefutable_let_patterns)]
8798                    if let PairingProperties::PasskeyDisplay(_) = self {
8799                        // Do nothing, read the value into the object
8800                    } else {
8801                        // Initialize `self` to the right variant
8802                        *self = PairingProperties::PasskeyDisplay(fidl::new_empty!(u32, D));
8803                    }
8804                    #[allow(irrefutable_let_patterns)]
8805                    if let PairingProperties::PasskeyDisplay(ref mut val) = self {
8806                        fidl::decode!(u32, D, val, decoder, _inner_offset, depth)?;
8807                    } else {
8808                        unreachable!()
8809                    }
8810                }
8811                3 => {
8812                    #[allow(irrefutable_let_patterns)]
8813                    if let PairingProperties::PasskeyConfirmation(_) = self {
8814                        // Do nothing, read the value into the object
8815                    } else {
8816                        // Initialize `self` to the right variant
8817                        *self = PairingProperties::PasskeyConfirmation(fidl::new_empty!(u32, D));
8818                    }
8819                    #[allow(irrefutable_let_patterns)]
8820                    if let PairingProperties::PasskeyConfirmation(ref mut val) = self {
8821                        fidl::decode!(u32, D, val, decoder, _inner_offset, depth)?;
8822                    } else {
8823                        unreachable!()
8824                    }
8825                }
8826                4 => {
8827                    #[allow(irrefutable_let_patterns)]
8828                    if let PairingProperties::PasskeyEntry(_) = self {
8829                        // Do nothing, read the value into the object
8830                    } else {
8831                        // Initialize `self` to the right variant
8832                        *self = PairingProperties::PasskeyEntry(fidl::new_empty!(PasskeyEntry, D));
8833                    }
8834                    #[allow(irrefutable_let_patterns)]
8835                    if let PairingProperties::PasskeyEntry(ref mut val) = self {
8836                        fidl::decode!(PasskeyEntry, D, val, decoder, _inner_offset, depth)?;
8837                    } else {
8838                        unreachable!()
8839                    }
8840                }
8841                #[allow(deprecated)]
8842                ordinal => {
8843                    for _ in 0..num_handles {
8844                        decoder.drop_next_handle()?;
8845                    }
8846                    *self = PairingProperties::__SourceBreaking { unknown_ordinal: ordinal };
8847                }
8848            }
8849            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
8850                return Err(fidl::Error::InvalidNumBytesInEnvelope);
8851            }
8852            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8853                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8854            }
8855            Ok(())
8856        }
8857    }
8858}