fidl_fuchsia_hardware_bluetooth_common/
fidl_fuchsia_hardware_bluetooth_common.rs

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