Skip to main content

fidl_fuchsia_bluetooth__common/
fidl_fuchsia_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
11/// Alias for a Bluetooth device name.
12pub type DeviceName = String;
13
14pub type PeerIdString = String;
15
16pub type UuidString = String;
17
18pub const MAJOR_DEVICE_CLASS_AUDIO_VIDEO: u32 = 1024;
19
20pub const MAJOR_DEVICE_CLASS_COMPUTER: u32 = 256;
21
22pub const MAJOR_DEVICE_CLASS_HEALTH: u32 = 2304;
23
24pub const MAJOR_DEVICE_CLASS_IMAGING: u32 = 1536;
25
26pub const MAJOR_DEVICE_CLASS_LAN: u32 = 768;
27
28/// Constants for the major device class field. The major device class is defined by bits 12-8.
29pub const MAJOR_DEVICE_CLASS_MASK: u32 = 7936;
30
31pub const MAJOR_DEVICE_CLASS_MISCELLANEOUS: u32 = 0;
32
33pub const MAJOR_DEVICE_CLASS_PERIPHERAL: u32 = 1280;
34
35pub const MAJOR_DEVICE_CLASS_PHONE: u32 = 512;
36
37pub const MAJOR_DEVICE_CLASS_TOY: u32 = 2048;
38
39pub const MAJOR_DEVICE_CLASS_UNCATEGORIZED: u32 = 7936;
40
41pub const MAJOR_DEVICE_CLASS_WEARABLE: u32 = 1792;
42
43/// The maximum length of a device name. This value was selected based on the HCI and GAP
44/// specifications (v5.2, Vol 4, Part E, 7.3.11 and Vol 3, Part C, 12.1).
45pub const MAX_DEVICE_NAME_LENGTH: u8 = 248;
46
47/// The size of the standard string representation for a UUID. This value is based on the canonical
48/// 36-character 8-4-4-4-12 format defined in IETF RFC4122 Section 3.
49pub const UUID_STRING_REPRESENTATION_LENGTH: u8 = 36;
50
51#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
52#[repr(u8)]
53pub enum AddressType {
54    /// LE public device address or `BR/EDR` `BD_ADDR`.
55    Public = 1,
56    /// LE private or static random device address.
57    Random = 2,
58}
59
60impl AddressType {
61    #[inline]
62    pub fn from_primitive(prim: u8) -> Option<Self> {
63        match prim {
64            1 => Some(Self::Public),
65            2 => Some(Self::Random),
66            _ => None,
67        }
68    }
69
70    #[inline]
71    pub const fn into_primitive(self) -> u8 {
72        self as u8
73    }
74}
75
76/// Possible values for the LE Appearance property which describes the external
77/// appearance of a peer at a high level.
78/// (See the Bluetooth assigned-numbers document:
79/// https://www.bluetooth.com/specifications/gatt/viewer?attributeXmlFile=org.bluetooth.characteristic.gap.appearance.xml)
80/// This enum is flexible as newer devices may use new appearance values and in the future the
81/// assigned numbers document may have additional entries.
82#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
83pub enum Appearance {
84    Unknown,
85    Phone,
86    Computer,
87    Watch,
88    WatchSports,
89    Clock,
90    Display,
91    RemoteControl,
92    EyeGlasses,
93    Tag,
94    Keyring,
95    MediaPlayer,
96    BarcodeScanner,
97    Thermometer,
98    ThermometerEar,
99    HeartRateSensor,
100    HeartRateSensorBelt,
101    BloodPressure,
102    BloodPressureArm,
103    BloodPressureWrist,
104    Hid,
105    HidKeyboard,
106    HidMouse,
107    HidJoystick,
108    HidGamepad,
109    HidDigitizerTablet,
110    HidCardReader,
111    HidDigitalPen,
112    HidBarcodeScanner,
113    GlucoseMeter,
114    RunningWalkingSensor,
115    RunningWalkingSensorInShoe,
116    RunningWalkingSensorOnShoe,
117    RunningWalkingSensorOnHip,
118    Cycling,
119    CyclingComputer,
120    CyclingSpeedSensor,
121    CyclingCadenceSensor,
122    CyclingPowerSensor,
123    CyclingSpeedAndCadenceSensor,
124    PulseOximeter,
125    PulseOximeterFingertip,
126    PulseOximeterWrist,
127    WeightScale,
128    PersonalMobility,
129    PersonalMobilityWheelchair,
130    PersonalMobilityScooter,
131    GlucoseMonitor,
132    SportsActivity,
133    SportsActivityLocationDisplay,
134    SportsActivityLocationAndNavDisplay,
135    SportsActivityLocationPod,
136    SportsActivityLocationAndNavPod,
137    #[doc(hidden)]
138    __SourceBreaking {
139        unknown_ordinal: u16,
140    },
141}
142
143/// Pattern that matches an unknown `Appearance` member.
144#[macro_export]
145macro_rules! AppearanceUnknown {
146    () => {
147        _
148    };
149}
150
151impl Appearance {
152    #[inline]
153    pub fn from_primitive(prim: u16) -> Option<Self> {
154        match prim {
155            0 => Some(Self::Unknown),
156            64 => Some(Self::Phone),
157            128 => Some(Self::Computer),
158            192 => Some(Self::Watch),
159            193 => Some(Self::WatchSports),
160            256 => Some(Self::Clock),
161            320 => Some(Self::Display),
162            384 => Some(Self::RemoteControl),
163            448 => Some(Self::EyeGlasses),
164            512 => Some(Self::Tag),
165            576 => Some(Self::Keyring),
166            640 => Some(Self::MediaPlayer),
167            704 => Some(Self::BarcodeScanner),
168            768 => Some(Self::Thermometer),
169            769 => Some(Self::ThermometerEar),
170            832 => Some(Self::HeartRateSensor),
171            833 => Some(Self::HeartRateSensorBelt),
172            896 => Some(Self::BloodPressure),
173            897 => Some(Self::BloodPressureArm),
174            898 => Some(Self::BloodPressureWrist),
175            960 => Some(Self::Hid),
176            961 => Some(Self::HidKeyboard),
177            962 => Some(Self::HidMouse),
178            963 => Some(Self::HidJoystick),
179            964 => Some(Self::HidGamepad),
180            965 => Some(Self::HidDigitizerTablet),
181            966 => Some(Self::HidCardReader),
182            967 => Some(Self::HidDigitalPen),
183            968 => Some(Self::HidBarcodeScanner),
184            1024 => Some(Self::GlucoseMeter),
185            1088 => Some(Self::RunningWalkingSensor),
186            1089 => Some(Self::RunningWalkingSensorInShoe),
187            1090 => Some(Self::RunningWalkingSensorOnShoe),
188            1091 => Some(Self::RunningWalkingSensorOnHip),
189            1152 => Some(Self::Cycling),
190            1153 => Some(Self::CyclingComputer),
191            1154 => Some(Self::CyclingSpeedSensor),
192            1155 => Some(Self::CyclingCadenceSensor),
193            1156 => Some(Self::CyclingPowerSensor),
194            1157 => Some(Self::CyclingSpeedAndCadenceSensor),
195            3136 => Some(Self::PulseOximeter),
196            3137 => Some(Self::PulseOximeterFingertip),
197            3138 => Some(Self::PulseOximeterWrist),
198            3200 => Some(Self::WeightScale),
199            3264 => Some(Self::PersonalMobility),
200            3265 => Some(Self::PersonalMobilityWheelchair),
201            3266 => Some(Self::PersonalMobilityScooter),
202            3328 => Some(Self::GlucoseMonitor),
203            5184 => Some(Self::SportsActivity),
204            5185 => Some(Self::SportsActivityLocationDisplay),
205            5186 => Some(Self::SportsActivityLocationAndNavDisplay),
206            5187 => Some(Self::SportsActivityLocationPod),
207            5188 => Some(Self::SportsActivityLocationAndNavPod),
208            _ => None,
209        }
210    }
211
212    #[inline]
213    pub fn from_primitive_allow_unknown(prim: u16) -> Self {
214        match prim {
215            0 => Self::Unknown,
216            64 => Self::Phone,
217            128 => Self::Computer,
218            192 => Self::Watch,
219            193 => Self::WatchSports,
220            256 => Self::Clock,
221            320 => Self::Display,
222            384 => Self::RemoteControl,
223            448 => Self::EyeGlasses,
224            512 => Self::Tag,
225            576 => Self::Keyring,
226            640 => Self::MediaPlayer,
227            704 => Self::BarcodeScanner,
228            768 => Self::Thermometer,
229            769 => Self::ThermometerEar,
230            832 => Self::HeartRateSensor,
231            833 => Self::HeartRateSensorBelt,
232            896 => Self::BloodPressure,
233            897 => Self::BloodPressureArm,
234            898 => Self::BloodPressureWrist,
235            960 => Self::Hid,
236            961 => Self::HidKeyboard,
237            962 => Self::HidMouse,
238            963 => Self::HidJoystick,
239            964 => Self::HidGamepad,
240            965 => Self::HidDigitizerTablet,
241            966 => Self::HidCardReader,
242            967 => Self::HidDigitalPen,
243            968 => Self::HidBarcodeScanner,
244            1024 => Self::GlucoseMeter,
245            1088 => Self::RunningWalkingSensor,
246            1089 => Self::RunningWalkingSensorInShoe,
247            1090 => Self::RunningWalkingSensorOnShoe,
248            1091 => Self::RunningWalkingSensorOnHip,
249            1152 => Self::Cycling,
250            1153 => Self::CyclingComputer,
251            1154 => Self::CyclingSpeedSensor,
252            1155 => Self::CyclingCadenceSensor,
253            1156 => Self::CyclingPowerSensor,
254            1157 => Self::CyclingSpeedAndCadenceSensor,
255            3136 => Self::PulseOximeter,
256            3137 => Self::PulseOximeterFingertip,
257            3138 => Self::PulseOximeterWrist,
258            3200 => Self::WeightScale,
259            3264 => Self::PersonalMobility,
260            3265 => Self::PersonalMobilityWheelchair,
261            3266 => Self::PersonalMobilityScooter,
262            3328 => Self::GlucoseMonitor,
263            5184 => Self::SportsActivity,
264            5185 => Self::SportsActivityLocationDisplay,
265            5186 => Self::SportsActivityLocationAndNavDisplay,
266            5187 => Self::SportsActivityLocationPod,
267            5188 => Self::SportsActivityLocationAndNavPod,
268            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
269        }
270    }
271
272    #[inline]
273    pub fn unknown() -> Self {
274        Self::__SourceBreaking { unknown_ordinal: 0xffff }
275    }
276
277    #[inline]
278    pub const fn into_primitive(self) -> u16 {
279        match self {
280            Self::Unknown => 0,
281            Self::Phone => 64,
282            Self::Computer => 128,
283            Self::Watch => 192,
284            Self::WatchSports => 193,
285            Self::Clock => 256,
286            Self::Display => 320,
287            Self::RemoteControl => 384,
288            Self::EyeGlasses => 448,
289            Self::Tag => 512,
290            Self::Keyring => 576,
291            Self::MediaPlayer => 640,
292            Self::BarcodeScanner => 704,
293            Self::Thermometer => 768,
294            Self::ThermometerEar => 769,
295            Self::HeartRateSensor => 832,
296            Self::HeartRateSensorBelt => 833,
297            Self::BloodPressure => 896,
298            Self::BloodPressureArm => 897,
299            Self::BloodPressureWrist => 898,
300            Self::Hid => 960,
301            Self::HidKeyboard => 961,
302            Self::HidMouse => 962,
303            Self::HidJoystick => 963,
304            Self::HidGamepad => 964,
305            Self::HidDigitizerTablet => 965,
306            Self::HidCardReader => 966,
307            Self::HidDigitalPen => 967,
308            Self::HidBarcodeScanner => 968,
309            Self::GlucoseMeter => 1024,
310            Self::RunningWalkingSensor => 1088,
311            Self::RunningWalkingSensorInShoe => 1089,
312            Self::RunningWalkingSensorOnShoe => 1090,
313            Self::RunningWalkingSensorOnHip => 1091,
314            Self::Cycling => 1152,
315            Self::CyclingComputer => 1153,
316            Self::CyclingSpeedSensor => 1154,
317            Self::CyclingCadenceSensor => 1155,
318            Self::CyclingPowerSensor => 1156,
319            Self::CyclingSpeedAndCadenceSensor => 1157,
320            Self::PulseOximeter => 3136,
321            Self::PulseOximeterFingertip => 3137,
322            Self::PulseOximeterWrist => 3138,
323            Self::WeightScale => 3200,
324            Self::PersonalMobility => 3264,
325            Self::PersonalMobilityWheelchair => 3265,
326            Self::PersonalMobilityScooter => 3266,
327            Self::GlucoseMonitor => 3328,
328            Self::SportsActivity => 5184,
329            Self::SportsActivityLocationDisplay => 5185,
330            Self::SportsActivityLocationAndNavDisplay => 5186,
331            Self::SportsActivityLocationPod => 5187,
332            Self::SportsActivityLocationAndNavPod => 5188,
333            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
334        }
335    }
336
337    #[inline]
338    pub fn is_unknown(&self) -> bool {
339        match self {
340            Self::__SourceBreaking { unknown_ordinal: _ } => true,
341            _ => false,
342        }
343    }
344}
345
346/// Coding Format, as specified by the Bluetooth SIG (see Assigned Numbers document for values):
347/// https://www.bluetooth.com/specifications/assigned-numbers/
348#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
349pub enum AssignedCodingFormat {
350    ULawLog,
351    ALawLog,
352    Cvsd,
353    Transparent,
354    LinearPcm,
355    Msbc,
356    Lc3,
357    G729A,
358    #[doc(hidden)]
359    __SourceBreaking {
360        unknown_ordinal: u8,
361    },
362}
363
364/// Pattern that matches an unknown `AssignedCodingFormat` member.
365#[macro_export]
366macro_rules! AssignedCodingFormatUnknown {
367    () => {
368        _
369    };
370}
371
372impl AssignedCodingFormat {
373    #[inline]
374    pub fn from_primitive(prim: u8) -> Option<Self> {
375        match prim {
376            0 => Some(Self::ULawLog),
377            1 => Some(Self::ALawLog),
378            2 => Some(Self::Cvsd),
379            3 => Some(Self::Transparent),
380            4 => Some(Self::LinearPcm),
381            5 => Some(Self::Msbc),
382            6 => Some(Self::Lc3),
383            7 => Some(Self::G729A),
384            _ => None,
385        }
386    }
387
388    #[inline]
389    pub fn from_primitive_allow_unknown(prim: u8) -> Self {
390        match prim {
391            0 => Self::ULawLog,
392            1 => Self::ALawLog,
393            2 => Self::Cvsd,
394            3 => Self::Transparent,
395            4 => Self::LinearPcm,
396            5 => Self::Msbc,
397            6 => Self::Lc3,
398            7 => Self::G729A,
399            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
400        }
401    }
402
403    #[inline]
404    pub fn unknown() -> Self {
405        Self::__SourceBreaking { unknown_ordinal: 0xff }
406    }
407
408    #[inline]
409    pub const fn into_primitive(self) -> u8 {
410        match self {
411            Self::ULawLog => 0,
412            Self::ALawLog => 1,
413            Self::Cvsd => 2,
414            Self::Transparent => 3,
415            Self::LinearPcm => 4,
416            Self::Msbc => 5,
417            Self::Lc3 => 6,
418            Self::G729A => 7,
419            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
420        }
421    }
422
423    #[inline]
424    pub fn is_unknown(&self) -> bool {
425        match self {
426            Self::__SourceBreaking { unknown_ordinal: _ } => true,
427            _ => false,
428        }
429    }
430}
431
432/// The supported channel modes of operation of an L2CAP channel.
433///
434/// For BR/EDR, this is used to specify preferred and accepted L2CAP channel
435/// modes.  If the peer rejects a non-BASIC mode, the Bluetooth system will
436/// attempt to open the channel in BASIC mode instead.
437///
438/// For LE, this is used to specify the exact channel mode to use, if the
439/// peer rejects the requested mode, the channel will fail to be established.
440///
441/// For a description of each mode, see Bluetooth Spec v5.4, Vol 3, Part A, Sec 2.4.
442#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
443pub enum ChannelMode {
444    /// BR/EDR only.
445    Basic,
446    /// BR/EDR only.
447    EnhancedRetransmission,
448    /// LE only.
449    LeCreditBasedFlowControl,
450    /// LE_only.
451    EnhancedCreditBasedFlowControl,
452    #[doc(hidden)]
453    __SourceBreaking { unknown_ordinal: u32 },
454}
455
456/// Pattern that matches an unknown `ChannelMode` member.
457#[macro_export]
458macro_rules! ChannelModeUnknown {
459    () => {
460        _
461    };
462}
463
464impl ChannelMode {
465    #[inline]
466    pub fn from_primitive(prim: u32) -> Option<Self> {
467        match prim {
468            1 => Some(Self::Basic),
469            2 => Some(Self::EnhancedRetransmission),
470            3 => Some(Self::LeCreditBasedFlowControl),
471            4 => Some(Self::EnhancedCreditBasedFlowControl),
472            _ => None,
473        }
474    }
475
476    #[inline]
477    pub fn from_primitive_allow_unknown(prim: u32) -> Self {
478        match prim {
479            1 => Self::Basic,
480            2 => Self::EnhancedRetransmission,
481            3 => Self::LeCreditBasedFlowControl,
482            4 => Self::EnhancedCreditBasedFlowControl,
483            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
484        }
485    }
486
487    #[inline]
488    pub fn unknown() -> Self {
489        Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
490    }
491
492    #[inline]
493    pub const fn into_primitive(self) -> u32 {
494        match self {
495            Self::Basic => 1,
496            Self::EnhancedRetransmission => 2,
497            Self::LeCreditBasedFlowControl => 3,
498            Self::EnhancedCreditBasedFlowControl => 4,
499            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
500        }
501    }
502
503    #[inline]
504    pub fn is_unknown(&self) -> bool {
505        match self {
506            Self::__SourceBreaking { unknown_ordinal: _ } => true,
507            _ => false,
508        }
509    }
510}
511
512/// Refers to the role of a Bluetooth device (local or peer) in a physical channel piconet. See
513/// [Bluetooth Vocabulary Guide](https://cs.opensource.google/fuchsia/fuchsia/+/main:src/connectivity/bluetooth/docs/vocabulary.md)
514/// for more information.
515#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
516#[repr(u32)]
517pub enum ConnectionRole {
518    /// The role of the device that defines the piconet physical channel in BR/EDR or the
519    /// "initiating" device in LE.
520    Leader = 1,
521    /// The role of a device that synchronizes to the piconet physical channel in BR/EDR or the
522    /// "advertising" device in LE.
523    Follower = 2,
524}
525
526impl ConnectionRole {
527    #[inline]
528    pub fn from_primitive(prim: u32) -> Option<Self> {
529        match prim {
530            1 => Some(Self::Leader),
531            2 => Some(Self::Follower),
532            _ => None,
533        }
534    }
535
536    #[inline]
537    pub const fn into_primitive(self) -> u32 {
538        self as u32
539    }
540}
541
542/// Indicates direction of data in a stream. Note that these values do not correspond to constants
543/// from the Bluetooth Core specification.
544#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
545#[repr(u8)]
546pub enum DataDirection {
547    /// Host => Controller
548    Input = 1,
549    /// Controller => Host
550    Output = 2,
551}
552
553impl DataDirection {
554    #[inline]
555    pub fn from_primitive(prim: u8) -> Option<Self> {
556        match prim {
557            1 => Some(Self::Input),
558            2 => Some(Self::Output),
559            _ => None,
560        }
561    }
562
563    #[inline]
564    pub const fn into_primitive(self) -> u8 {
565        self as u8
566    }
567}
568
569#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
570#[repr(u32)]
571pub enum ErrorCode {
572    Unknown = 0,
573    Failed = 1,
574    Canceled = 2,
575    InProgress = 3,
576    TimedOut = 4,
577    NotFound = 5,
578    NotSupported = 6,
579    BluetoothNotAvailable = 7,
580    BadState = 8,
581    InvalidArguments = 9,
582    Already = 10,
583    ProtocolError = 11,
584}
585
586impl ErrorCode {
587    #[inline]
588    pub fn from_primitive(prim: u32) -> Option<Self> {
589        match prim {
590            0 => Some(Self::Unknown),
591            1 => Some(Self::Failed),
592            2 => Some(Self::Canceled),
593            3 => Some(Self::InProgress),
594            4 => Some(Self::TimedOut),
595            5 => Some(Self::NotFound),
596            6 => Some(Self::NotSupported),
597            7 => Some(Self::BluetoothNotAvailable),
598            8 => Some(Self::BadState),
599            9 => Some(Self::InvalidArguments),
600            10 => Some(Self::Already),
601            11 => Some(Self::ProtocolError),
602            _ => None,
603        }
604    }
605
606    #[inline]
607    pub const fn into_primitive(self) -> u32 {
608        self as u32
609    }
610}
611
612/// Logical transport types that may be used with encoded data streams. Note that these values do
613/// not correspond to constants from the Bluetooth Core specification, nor are BR/EDR values
614/// supported yet.
615#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
616pub enum LogicalTransportType {
617    /// LE CIS
618    LeCis,
619    /// LE BIS
620    LeBis,
621    #[doc(hidden)]
622    __SourceBreaking { unknown_ordinal: u8 },
623}
624
625/// Pattern that matches an unknown `LogicalTransportType` member.
626#[macro_export]
627macro_rules! LogicalTransportTypeUnknown {
628    () => {
629        _
630    };
631}
632
633impl LogicalTransportType {
634    #[inline]
635    pub fn from_primitive(prim: u8) -> Option<Self> {
636        match prim {
637            1 => Some(Self::LeCis),
638            2 => Some(Self::LeBis),
639            _ => None,
640        }
641    }
642
643    #[inline]
644    pub fn from_primitive_allow_unknown(prim: u8) -> Self {
645        match prim {
646            1 => Self::LeCis,
647            2 => Self::LeBis,
648            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
649        }
650    }
651
652    #[inline]
653    pub fn unknown() -> Self {
654        Self::__SourceBreaking { unknown_ordinal: 0xff }
655    }
656
657    #[inline]
658    pub const fn into_primitive(self) -> u8 {
659        match self {
660            Self::LeCis => 1,
661            Self::LeBis => 2,
662            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
663        }
664    }
665
666    #[inline]
667    pub fn is_unknown(&self) -> bool {
668        match self {
669            Self::__SourceBreaking { unknown_ordinal: _ } => true,
670            _ => false,
671        }
672    }
673}
674
675/// Represents a 48-bit Bluetooth Device Address.
676#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
677pub struct Address {
678    /// Type of the device address.
679    pub type_: AddressType,
680    /// The device address bytes in little-endian order.
681    pub bytes: [u8; 6],
682}
683
684impl fidl::Persistable for Address {}
685
686#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
687pub struct Bool {
688    pub value: bool,
689}
690
691impl fidl::Persistable for Bool {}
692
693#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
694pub struct ChannelSendRequest {
695    pub packets: Vec<Packet>,
696}
697
698impl fidl::Persistable for ChannelSendRequest {}
699
700#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
701pub struct ChannelReceiveResponse {
702    pub packets: Vec<Packet>,
703}
704
705impl fidl::Persistable for ChannelReceiveResponse {}
706
707/// The "Class of Device/Service" is a variable-format field that defines the category of a
708/// Bluetooth device. The bitfield is divided into segments called "major service class",
709/// "major device class", and "minor device class".
710///
711/// No assumptions about the specific functionality or characteristics of any application should be
712/// based solely on its inclusion within a Major or Minor device class. For more information, see
713/// https://www.bluetooth.com/specifications/assigned-numbers/baseband.
714#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
715#[repr(C)]
716pub struct DeviceClass {
717    pub value: u32,
718}
719
720impl fidl::Persistable for DeviceClass {}
721
722#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
723pub struct Error {
724    pub error_code: ErrorCode,
725    pub protocol_error_code: u32,
726    pub description: Option<String>,
727}
728
729impl fidl::Persistable for Error {}
730
731/// 64-bit unique value used by the system to identify host adapters.
732#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
733#[repr(C)]
734pub struct HostId {
735    pub value: u64,
736}
737
738impl fidl::Persistable for HostId {}
739
740#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
741#[repr(C)]
742pub struct Int8 {
743    pub value: i8,
744}
745
746impl fidl::Persistable for Int8 {}
747
748/// A payload of data sourced from or sent to a protocol or service on the
749/// remote peer.
750#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
751pub struct Packet {
752    pub packet: Vec<u8>,
753}
754
755impl fidl::Persistable for Packet {}
756
757/// 64-bit unique value used by the system to identify peer devices.
758#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
759#[repr(C)]
760pub struct PeerId {
761    pub value: u64,
762}
763
764impl fidl::Persistable for PeerId {}
765
766#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
767pub struct Status {
768    pub error: Option<Box<Error>>,
769}
770
771impl fidl::Persistable for Status {}
772
773#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
774#[repr(C)]
775pub struct UInt16 {
776    pub value: u16,
777}
778
779impl fidl::Persistable for UInt16 {}
780
781/// Represents a Bluetooth UUID in its 128-bit canonical form. While the Bluetooth standard supports
782/// 16- and 32-bit short form UUIDs over the wire, the Fuchsia FIDL libraries require all UUIDs to
783/// be represented in their canonical 128-bit form.
784#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
785#[repr(C)]
786pub struct Uuid {
787    /// The UUID bytes in little-endian order.
788    pub value: [u8; 16],
789}
790
791impl fidl::Persistable for Uuid {}
792
793/// The set of parameters to use or that were used to establish an L2CAP
794/// connection-oriented channel.
795#[derive(Clone, Debug, Default, PartialEq)]
796pub struct ChannelParameters {
797    /// Optional.
798    /// For BR/EDR: If not provided, BASIC will be used.
799    /// For LE: If not provided, LE_CREDIT_BASED_FLOW_CONTROL will be used.
800    pub channel_mode: Option<ChannelMode>,
801    /// Maximum packet size this profile is capable of accepting. Must be >= 48.
802    /// Optional. If not provided, the size will be determined by the Bluetooth
803    /// system. No guarantees are given regarding the size selected.
804    pub max_rx_packet_size: Option<u16>,
805    /// For BR/EDR: Minimum security requirements a link must have before this
806    /// channel can be created. The requirements provided here will be
807    /// attempted with the peer before the channel is established. If a peer
808    /// cannot provide the requirements, the channel is closed.
809    /// Optional. If not provided, then the only security property guaranteed
810    /// is encryption.
811    ///
812    /// For LE: Unused, must not be present.
813    pub security_requirements: Option<SecurityRequirements>,
814    /// For BR/EDR: The flush timeout indicates the maximum amount of time a
815    /// data packet should be buffered in the controller before it is dropped.
816    /// A flush timeout of infinity can be used to mark packets as flushable
817    /// without any particular flush timeout.
818    /// Range: 1ms - 1,279ms (or ∞). Rounded down.
819    /// Optional. If not provided, no flush timeout and packets are not flushable.
820    ///
821    /// For LE: Unused, must not be present.
822    pub flush_timeout: Option<i64>,
823    #[doc(hidden)]
824    pub __source_breaking: fidl::marker::SourceBreaking,
825}
826
827impl fidl::Persistable for ChannelParameters {}
828
829/// Identifies a codec and its configuration that may be used with a data stream.
830#[derive(Clone, Debug, Default, PartialEq)]
831pub struct CodecAttributes {
832    /// Coding format.
833    /// Required.
834    pub codec_id: Option<CodecId>,
835    /// Configuration data.
836    /// Optionally present, as determined by codec being used.
837    pub codec_configuration: Option<Vec<u8>>,
838    #[doc(hidden)]
839    pub __source_breaking: fidl::marker::SourceBreaking,
840}
841
842impl fidl::Persistable for CodecAttributes {}
843
844/// Set of low-level L2CAP channel parameters needed to transfer control of
845/// a channel to an offload processor.
846#[derive(Clone, Debug, Default, PartialEq)]
847pub struct L2capChannelOffloadParameters {
848    /// The HCI ACL connection handle to the peer over which this L2CAP channel exists.
849    /// Required.
850    pub acl_connection_handle: Option<u16>,
851    /// Required.
852    pub local_l2cap_channel_id: Option<u16>,
853    /// Required.
854    pub remote_l2cap_channel_id: Option<u16>,
855    /// The maximum payload size of a RX L2CAP PDU, not to be confused with the MTU of
856    /// application layer payloads.
857    /// Required.
858    pub local_l2cap_maximum_payload_size: Option<u16>,
859    /// The maximum paylod size of a TX L2CAP PDU, not to be confused with the MTU of
860    /// application layer payloads.
861    /// Required.
862    pub remote_l2cap_maximum_payload_size: Option<u16>,
863    /// The initial number of TX flow control credits received from the peer.
864    /// Optional. Not present for channels without flow control.
865    pub initial_tx_credits: Option<u16>,
866    #[doc(hidden)]
867    pub __source_breaking: fidl::marker::SourceBreaking,
868}
869
870impl fidl::Persistable for L2capChannelOffloadParameters {}
871
872/// Authentication and permission requirements to access an advertised service.
873/// BR/EDR only.
874#[derive(Clone, Debug, Default, PartialEq)]
875pub struct SecurityRequirements {
876    /// If present and true, the physical link must be authenticated with
877    /// on-path attacker protection to access this service.  If missing then
878    /// authentication is not required.
879    pub authentication_required: Option<bool>,
880    /// If present and true, the physical link must be encrypted with a Secure
881    /// Connections key to access this service if the host is capable.
882    /// Advertisement will fail if the host does not support Secure Connections.
883    /// See Bluetooth Spec v5.2, Vol 3, Part C, Sec 5.2.2.8.
884    pub secure_connections_required: Option<bool>,
885    #[doc(hidden)]
886    pub __source_breaking: fidl::marker::SourceBreaking,
887}
888
889impl fidl::Persistable for SecurityRequirements {}
890
891/// Vendor-defined coding format.
892#[derive(Clone, Debug, Default, PartialEq)]
893pub struct VendorCodingFormat {
894    /// Company ID, see Assigned Numbers document for values
895    /// https://www.bluetooth.com/specifications/assigned-numbers/
896    /// Required.
897    pub company_id: Option<u16>,
898    /// Vendor-defined codec ID.
899    /// Required.
900    pub vendor_id: Option<u16>,
901    #[doc(hidden)]
902    pub __source_breaking: fidl::marker::SourceBreaking,
903}
904
905impl fidl::Persistable for VendorCodingFormat {}
906
907/// Specifies a coding format.
908#[derive(Clone, Debug)]
909pub enum CodecId {
910    /// Coding format defined by Bluetooth SIG.
911    AssignedFormat(AssignedCodingFormat),
912    /// Coding format defined by vendor.
913    VendorFormat(VendorCodingFormat),
914    #[doc(hidden)]
915    __SourceBreaking { unknown_ordinal: u64 },
916}
917
918/// Pattern that matches an unknown `CodecId` member.
919#[macro_export]
920macro_rules! CodecIdUnknown {
921    () => {
922        _
923    };
924}
925
926// Custom PartialEq so that unknown variants are not equal to themselves.
927impl PartialEq for CodecId {
928    fn eq(&self, other: &Self) -> bool {
929        match (self, other) {
930            (Self::AssignedFormat(x), Self::AssignedFormat(y)) => *x == *y,
931            (Self::VendorFormat(x), Self::VendorFormat(y)) => *x == *y,
932            _ => false,
933        }
934    }
935}
936
937impl CodecId {
938    #[inline]
939    pub fn ordinal(&self) -> u64 {
940        match *self {
941            Self::AssignedFormat(_) => 1,
942            Self::VendorFormat(_) => 2,
943            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
944        }
945    }
946
947    #[inline]
948    pub fn unknown_variant_for_testing() -> Self {
949        Self::__SourceBreaking { unknown_ordinal: 0 }
950    }
951
952    #[inline]
953    pub fn is_unknown(&self) -> bool {
954        match self {
955            Self::__SourceBreaking { .. } => true,
956            _ => false,
957        }
958    }
959}
960
961impl fidl::Persistable for CodecId {}
962
963pub mod channel_ordinals {
964    pub const SEND_: u64 = 0x6fc4419c2e763324;
965    pub const RECEIVE: u64 = 0x3498d7bdb7cdbfd4;
966    pub const WATCH_CHANNEL_PARAMETERS: u64 = 0x5a0cec81d5076c12;
967}
968
969mod internal {
970    use super::*;
971    unsafe impl fidl::encoding::TypeMarker for AddressType {
972        type Owned = Self;
973
974        #[inline(always)]
975        fn inline_align(_context: fidl::encoding::Context) -> usize {
976            std::mem::align_of::<u8>()
977        }
978
979        #[inline(always)]
980        fn inline_size(_context: fidl::encoding::Context) -> usize {
981            std::mem::size_of::<u8>()
982        }
983
984        #[inline(always)]
985        fn encode_is_copy() -> bool {
986            true
987        }
988
989        #[inline(always)]
990        fn decode_is_copy() -> bool {
991            false
992        }
993    }
994
995    impl fidl::encoding::ValueTypeMarker for AddressType {
996        type Borrowed<'a> = Self;
997        #[inline(always)]
998        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
999            *value
1000        }
1001    }
1002
1003    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for AddressType {
1004        #[inline]
1005        unsafe fn encode(
1006            self,
1007            encoder: &mut fidl::encoding::Encoder<'_, D>,
1008            offset: usize,
1009            _depth: fidl::encoding::Depth,
1010        ) -> fidl::Result<()> {
1011            encoder.debug_check_bounds::<Self>(offset);
1012            encoder.write_num(self.into_primitive(), offset);
1013            Ok(())
1014        }
1015    }
1016
1017    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for AddressType {
1018        #[inline(always)]
1019        fn new_empty() -> Self {
1020            Self::Public
1021        }
1022
1023        #[inline]
1024        unsafe fn decode(
1025            &mut self,
1026            decoder: &mut fidl::encoding::Decoder<'_, D>,
1027            offset: usize,
1028            _depth: fidl::encoding::Depth,
1029        ) -> fidl::Result<()> {
1030            decoder.debug_check_bounds::<Self>(offset);
1031            let prim = decoder.read_num::<u8>(offset);
1032
1033            *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
1034            Ok(())
1035        }
1036    }
1037    unsafe impl fidl::encoding::TypeMarker for Appearance {
1038        type Owned = Self;
1039
1040        #[inline(always)]
1041        fn inline_align(_context: fidl::encoding::Context) -> usize {
1042            std::mem::align_of::<u16>()
1043        }
1044
1045        #[inline(always)]
1046        fn inline_size(_context: fidl::encoding::Context) -> usize {
1047            std::mem::size_of::<u16>()
1048        }
1049
1050        #[inline(always)]
1051        fn encode_is_copy() -> bool {
1052            false
1053        }
1054
1055        #[inline(always)]
1056        fn decode_is_copy() -> bool {
1057            false
1058        }
1059    }
1060
1061    impl fidl::encoding::ValueTypeMarker for Appearance {
1062        type Borrowed<'a> = Self;
1063        #[inline(always)]
1064        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1065            *value
1066        }
1067    }
1068
1069    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for Appearance {
1070        #[inline]
1071        unsafe fn encode(
1072            self,
1073            encoder: &mut fidl::encoding::Encoder<'_, D>,
1074            offset: usize,
1075            _depth: fidl::encoding::Depth,
1076        ) -> fidl::Result<()> {
1077            encoder.debug_check_bounds::<Self>(offset);
1078            encoder.write_num(self.into_primitive(), offset);
1079            Ok(())
1080        }
1081    }
1082
1083    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Appearance {
1084        #[inline(always)]
1085        fn new_empty() -> Self {
1086            Self::unknown()
1087        }
1088
1089        #[inline]
1090        unsafe fn decode(
1091            &mut self,
1092            decoder: &mut fidl::encoding::Decoder<'_, D>,
1093            offset: usize,
1094            _depth: fidl::encoding::Depth,
1095        ) -> fidl::Result<()> {
1096            decoder.debug_check_bounds::<Self>(offset);
1097            let prim = decoder.read_num::<u16>(offset);
1098
1099            *self = Self::from_primitive_allow_unknown(prim);
1100            Ok(())
1101        }
1102    }
1103    unsafe impl fidl::encoding::TypeMarker for AssignedCodingFormat {
1104        type Owned = Self;
1105
1106        #[inline(always)]
1107        fn inline_align(_context: fidl::encoding::Context) -> usize {
1108            std::mem::align_of::<u8>()
1109        }
1110
1111        #[inline(always)]
1112        fn inline_size(_context: fidl::encoding::Context) -> usize {
1113            std::mem::size_of::<u8>()
1114        }
1115
1116        #[inline(always)]
1117        fn encode_is_copy() -> bool {
1118            false
1119        }
1120
1121        #[inline(always)]
1122        fn decode_is_copy() -> bool {
1123            false
1124        }
1125    }
1126
1127    impl fidl::encoding::ValueTypeMarker for AssignedCodingFormat {
1128        type Borrowed<'a> = Self;
1129        #[inline(always)]
1130        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1131            *value
1132        }
1133    }
1134
1135    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
1136        for AssignedCodingFormat
1137    {
1138        #[inline]
1139        unsafe fn encode(
1140            self,
1141            encoder: &mut fidl::encoding::Encoder<'_, D>,
1142            offset: usize,
1143            _depth: fidl::encoding::Depth,
1144        ) -> fidl::Result<()> {
1145            encoder.debug_check_bounds::<Self>(offset);
1146            encoder.write_num(self.into_primitive(), offset);
1147            Ok(())
1148        }
1149    }
1150
1151    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for AssignedCodingFormat {
1152        #[inline(always)]
1153        fn new_empty() -> Self {
1154            Self::unknown()
1155        }
1156
1157        #[inline]
1158        unsafe fn decode(
1159            &mut self,
1160            decoder: &mut fidl::encoding::Decoder<'_, D>,
1161            offset: usize,
1162            _depth: fidl::encoding::Depth,
1163        ) -> fidl::Result<()> {
1164            decoder.debug_check_bounds::<Self>(offset);
1165            let prim = decoder.read_num::<u8>(offset);
1166
1167            *self = Self::from_primitive_allow_unknown(prim);
1168            Ok(())
1169        }
1170    }
1171    unsafe impl fidl::encoding::TypeMarker for ChannelMode {
1172        type Owned = Self;
1173
1174        #[inline(always)]
1175        fn inline_align(_context: fidl::encoding::Context) -> usize {
1176            std::mem::align_of::<u32>()
1177        }
1178
1179        #[inline(always)]
1180        fn inline_size(_context: fidl::encoding::Context) -> usize {
1181            std::mem::size_of::<u32>()
1182        }
1183
1184        #[inline(always)]
1185        fn encode_is_copy() -> bool {
1186            false
1187        }
1188
1189        #[inline(always)]
1190        fn decode_is_copy() -> bool {
1191            false
1192        }
1193    }
1194
1195    impl fidl::encoding::ValueTypeMarker for ChannelMode {
1196        type Borrowed<'a> = Self;
1197        #[inline(always)]
1198        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1199            *value
1200        }
1201    }
1202
1203    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for ChannelMode {
1204        #[inline]
1205        unsafe fn encode(
1206            self,
1207            encoder: &mut fidl::encoding::Encoder<'_, D>,
1208            offset: usize,
1209            _depth: fidl::encoding::Depth,
1210        ) -> fidl::Result<()> {
1211            encoder.debug_check_bounds::<Self>(offset);
1212            encoder.write_num(self.into_primitive(), offset);
1213            Ok(())
1214        }
1215    }
1216
1217    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ChannelMode {
1218        #[inline(always)]
1219        fn new_empty() -> Self {
1220            Self::unknown()
1221        }
1222
1223        #[inline]
1224        unsafe fn decode(
1225            &mut self,
1226            decoder: &mut fidl::encoding::Decoder<'_, D>,
1227            offset: usize,
1228            _depth: fidl::encoding::Depth,
1229        ) -> fidl::Result<()> {
1230            decoder.debug_check_bounds::<Self>(offset);
1231            let prim = decoder.read_num::<u32>(offset);
1232
1233            *self = Self::from_primitive_allow_unknown(prim);
1234            Ok(())
1235        }
1236    }
1237    unsafe impl fidl::encoding::TypeMarker for ConnectionRole {
1238        type Owned = Self;
1239
1240        #[inline(always)]
1241        fn inline_align(_context: fidl::encoding::Context) -> usize {
1242            std::mem::align_of::<u32>()
1243        }
1244
1245        #[inline(always)]
1246        fn inline_size(_context: fidl::encoding::Context) -> usize {
1247            std::mem::size_of::<u32>()
1248        }
1249
1250        #[inline(always)]
1251        fn encode_is_copy() -> bool {
1252            true
1253        }
1254
1255        #[inline(always)]
1256        fn decode_is_copy() -> bool {
1257            false
1258        }
1259    }
1260
1261    impl fidl::encoding::ValueTypeMarker for ConnectionRole {
1262        type Borrowed<'a> = Self;
1263        #[inline(always)]
1264        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1265            *value
1266        }
1267    }
1268
1269    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for ConnectionRole {
1270        #[inline]
1271        unsafe fn encode(
1272            self,
1273            encoder: &mut fidl::encoding::Encoder<'_, D>,
1274            offset: usize,
1275            _depth: fidl::encoding::Depth,
1276        ) -> fidl::Result<()> {
1277            encoder.debug_check_bounds::<Self>(offset);
1278            encoder.write_num(self.into_primitive(), offset);
1279            Ok(())
1280        }
1281    }
1282
1283    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ConnectionRole {
1284        #[inline(always)]
1285        fn new_empty() -> Self {
1286            Self::Leader
1287        }
1288
1289        #[inline]
1290        unsafe fn decode(
1291            &mut self,
1292            decoder: &mut fidl::encoding::Decoder<'_, D>,
1293            offset: usize,
1294            _depth: fidl::encoding::Depth,
1295        ) -> fidl::Result<()> {
1296            decoder.debug_check_bounds::<Self>(offset);
1297            let prim = decoder.read_num::<u32>(offset);
1298
1299            *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
1300            Ok(())
1301        }
1302    }
1303    unsafe impl fidl::encoding::TypeMarker for DataDirection {
1304        type Owned = Self;
1305
1306        #[inline(always)]
1307        fn inline_align(_context: fidl::encoding::Context) -> usize {
1308            std::mem::align_of::<u8>()
1309        }
1310
1311        #[inline(always)]
1312        fn inline_size(_context: fidl::encoding::Context) -> usize {
1313            std::mem::size_of::<u8>()
1314        }
1315
1316        #[inline(always)]
1317        fn encode_is_copy() -> bool {
1318            true
1319        }
1320
1321        #[inline(always)]
1322        fn decode_is_copy() -> bool {
1323            false
1324        }
1325    }
1326
1327    impl fidl::encoding::ValueTypeMarker for DataDirection {
1328        type Borrowed<'a> = Self;
1329        #[inline(always)]
1330        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1331            *value
1332        }
1333    }
1334
1335    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for DataDirection {
1336        #[inline]
1337        unsafe fn encode(
1338            self,
1339            encoder: &mut fidl::encoding::Encoder<'_, D>,
1340            offset: usize,
1341            _depth: fidl::encoding::Depth,
1342        ) -> fidl::Result<()> {
1343            encoder.debug_check_bounds::<Self>(offset);
1344            encoder.write_num(self.into_primitive(), offset);
1345            Ok(())
1346        }
1347    }
1348
1349    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for DataDirection {
1350        #[inline(always)]
1351        fn new_empty() -> Self {
1352            Self::Input
1353        }
1354
1355        #[inline]
1356        unsafe fn decode(
1357            &mut self,
1358            decoder: &mut fidl::encoding::Decoder<'_, D>,
1359            offset: usize,
1360            _depth: fidl::encoding::Depth,
1361        ) -> fidl::Result<()> {
1362            decoder.debug_check_bounds::<Self>(offset);
1363            let prim = decoder.read_num::<u8>(offset);
1364
1365            *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
1366            Ok(())
1367        }
1368    }
1369    unsafe impl fidl::encoding::TypeMarker for ErrorCode {
1370        type Owned = Self;
1371
1372        #[inline(always)]
1373        fn inline_align(_context: fidl::encoding::Context) -> usize {
1374            std::mem::align_of::<u32>()
1375        }
1376
1377        #[inline(always)]
1378        fn inline_size(_context: fidl::encoding::Context) -> usize {
1379            std::mem::size_of::<u32>()
1380        }
1381
1382        #[inline(always)]
1383        fn encode_is_copy() -> bool {
1384            true
1385        }
1386
1387        #[inline(always)]
1388        fn decode_is_copy() -> bool {
1389            false
1390        }
1391    }
1392
1393    impl fidl::encoding::ValueTypeMarker for ErrorCode {
1394        type Borrowed<'a> = Self;
1395        #[inline(always)]
1396        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1397            *value
1398        }
1399    }
1400
1401    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for ErrorCode {
1402        #[inline]
1403        unsafe fn encode(
1404            self,
1405            encoder: &mut fidl::encoding::Encoder<'_, D>,
1406            offset: usize,
1407            _depth: fidl::encoding::Depth,
1408        ) -> fidl::Result<()> {
1409            encoder.debug_check_bounds::<Self>(offset);
1410            encoder.write_num(self.into_primitive(), offset);
1411            Ok(())
1412        }
1413    }
1414
1415    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ErrorCode {
1416        #[inline(always)]
1417        fn new_empty() -> Self {
1418            Self::Unknown
1419        }
1420
1421        #[inline]
1422        unsafe fn decode(
1423            &mut self,
1424            decoder: &mut fidl::encoding::Decoder<'_, D>,
1425            offset: usize,
1426            _depth: fidl::encoding::Depth,
1427        ) -> fidl::Result<()> {
1428            decoder.debug_check_bounds::<Self>(offset);
1429            let prim = decoder.read_num::<u32>(offset);
1430
1431            *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
1432            Ok(())
1433        }
1434    }
1435    unsafe impl fidl::encoding::TypeMarker for LogicalTransportType {
1436        type Owned = Self;
1437
1438        #[inline(always)]
1439        fn inline_align(_context: fidl::encoding::Context) -> usize {
1440            std::mem::align_of::<u8>()
1441        }
1442
1443        #[inline(always)]
1444        fn inline_size(_context: fidl::encoding::Context) -> usize {
1445            std::mem::size_of::<u8>()
1446        }
1447
1448        #[inline(always)]
1449        fn encode_is_copy() -> bool {
1450            false
1451        }
1452
1453        #[inline(always)]
1454        fn decode_is_copy() -> bool {
1455            false
1456        }
1457    }
1458
1459    impl fidl::encoding::ValueTypeMarker for LogicalTransportType {
1460        type Borrowed<'a> = Self;
1461        #[inline(always)]
1462        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1463            *value
1464        }
1465    }
1466
1467    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
1468        for LogicalTransportType
1469    {
1470        #[inline]
1471        unsafe fn encode(
1472            self,
1473            encoder: &mut fidl::encoding::Encoder<'_, D>,
1474            offset: usize,
1475            _depth: fidl::encoding::Depth,
1476        ) -> fidl::Result<()> {
1477            encoder.debug_check_bounds::<Self>(offset);
1478            encoder.write_num(self.into_primitive(), offset);
1479            Ok(())
1480        }
1481    }
1482
1483    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for LogicalTransportType {
1484        #[inline(always)]
1485        fn new_empty() -> Self {
1486            Self::unknown()
1487        }
1488
1489        #[inline]
1490        unsafe fn decode(
1491            &mut self,
1492            decoder: &mut fidl::encoding::Decoder<'_, D>,
1493            offset: usize,
1494            _depth: fidl::encoding::Depth,
1495        ) -> fidl::Result<()> {
1496            decoder.debug_check_bounds::<Self>(offset);
1497            let prim = decoder.read_num::<u8>(offset);
1498
1499            *self = Self::from_primitive_allow_unknown(prim);
1500            Ok(())
1501        }
1502    }
1503
1504    impl fidl::encoding::ValueTypeMarker for Address {
1505        type Borrowed<'a> = &'a Self;
1506        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1507            value
1508        }
1509    }
1510
1511    unsafe impl fidl::encoding::TypeMarker for Address {
1512        type Owned = Self;
1513
1514        #[inline(always)]
1515        fn inline_align(_context: fidl::encoding::Context) -> usize {
1516            1
1517        }
1518
1519        #[inline(always)]
1520        fn inline_size(_context: fidl::encoding::Context) -> usize {
1521            7
1522        }
1523    }
1524
1525    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Address, D> for &Address {
1526        #[inline]
1527        unsafe fn encode(
1528            self,
1529            encoder: &mut fidl::encoding::Encoder<'_, D>,
1530            offset: usize,
1531            _depth: fidl::encoding::Depth,
1532        ) -> fidl::Result<()> {
1533            encoder.debug_check_bounds::<Address>(offset);
1534            // Delegate to tuple encoding.
1535            fidl::encoding::Encode::<Address, D>::encode(
1536                (
1537                    <AddressType as fidl::encoding::ValueTypeMarker>::borrow(&self.type_),
1538                    <fidl::encoding::Array<u8, 6> as fidl::encoding::ValueTypeMarker>::borrow(
1539                        &self.bytes,
1540                    ),
1541                ),
1542                encoder,
1543                offset,
1544                _depth,
1545            )
1546        }
1547    }
1548    unsafe impl<
1549        D: fidl::encoding::ResourceDialect,
1550        T0: fidl::encoding::Encode<AddressType, D>,
1551        T1: fidl::encoding::Encode<fidl::encoding::Array<u8, 6>, D>,
1552    > fidl::encoding::Encode<Address, D> for (T0, T1)
1553    {
1554        #[inline]
1555        unsafe fn encode(
1556            self,
1557            encoder: &mut fidl::encoding::Encoder<'_, D>,
1558            offset: usize,
1559            depth: fidl::encoding::Depth,
1560        ) -> fidl::Result<()> {
1561            encoder.debug_check_bounds::<Address>(offset);
1562            // Zero out padding regions. There's no need to apply masks
1563            // because the unmasked parts will be overwritten by fields.
1564            // Write the fields.
1565            self.0.encode(encoder, offset + 0, depth)?;
1566            self.1.encode(encoder, offset + 1, depth)?;
1567            Ok(())
1568        }
1569    }
1570
1571    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Address {
1572        #[inline(always)]
1573        fn new_empty() -> Self {
1574            Self {
1575                type_: fidl::new_empty!(AddressType, D),
1576                bytes: fidl::new_empty!(fidl::encoding::Array<u8, 6>, D),
1577            }
1578        }
1579
1580        #[inline]
1581        unsafe fn decode(
1582            &mut self,
1583            decoder: &mut fidl::encoding::Decoder<'_, D>,
1584            offset: usize,
1585            _depth: fidl::encoding::Depth,
1586        ) -> fidl::Result<()> {
1587            decoder.debug_check_bounds::<Self>(offset);
1588            // Verify that padding bytes are zero.
1589            fidl::decode!(AddressType, D, &mut self.type_, decoder, offset + 0, _depth)?;
1590            fidl::decode!(fidl::encoding::Array<u8, 6>, D, &mut self.bytes, decoder, offset + 1, _depth)?;
1591            Ok(())
1592        }
1593    }
1594
1595    impl fidl::encoding::ValueTypeMarker for Bool {
1596        type Borrowed<'a> = &'a Self;
1597        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1598            value
1599        }
1600    }
1601
1602    unsafe impl fidl::encoding::TypeMarker for Bool {
1603        type Owned = Self;
1604
1605        #[inline(always)]
1606        fn inline_align(_context: fidl::encoding::Context) -> usize {
1607            1
1608        }
1609
1610        #[inline(always)]
1611        fn inline_size(_context: fidl::encoding::Context) -> usize {
1612            1
1613        }
1614    }
1615
1616    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Bool, D> for &Bool {
1617        #[inline]
1618        unsafe fn encode(
1619            self,
1620            encoder: &mut fidl::encoding::Encoder<'_, D>,
1621            offset: usize,
1622            _depth: fidl::encoding::Depth,
1623        ) -> fidl::Result<()> {
1624            encoder.debug_check_bounds::<Bool>(offset);
1625            // Delegate to tuple encoding.
1626            fidl::encoding::Encode::<Bool, D>::encode(
1627                (<bool as fidl::encoding::ValueTypeMarker>::borrow(&self.value),),
1628                encoder,
1629                offset,
1630                _depth,
1631            )
1632        }
1633    }
1634    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<bool, D>>
1635        fidl::encoding::Encode<Bool, D> for (T0,)
1636    {
1637        #[inline]
1638        unsafe fn encode(
1639            self,
1640            encoder: &mut fidl::encoding::Encoder<'_, D>,
1641            offset: usize,
1642            depth: fidl::encoding::Depth,
1643        ) -> fidl::Result<()> {
1644            encoder.debug_check_bounds::<Bool>(offset);
1645            // Zero out padding regions. There's no need to apply masks
1646            // because the unmasked parts will be overwritten by fields.
1647            // Write the fields.
1648            self.0.encode(encoder, offset + 0, depth)?;
1649            Ok(())
1650        }
1651    }
1652
1653    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Bool {
1654        #[inline(always)]
1655        fn new_empty() -> Self {
1656            Self { value: fidl::new_empty!(bool, D) }
1657        }
1658
1659        #[inline]
1660        unsafe fn decode(
1661            &mut self,
1662            decoder: &mut fidl::encoding::Decoder<'_, D>,
1663            offset: usize,
1664            _depth: fidl::encoding::Depth,
1665        ) -> fidl::Result<()> {
1666            decoder.debug_check_bounds::<Self>(offset);
1667            // Verify that padding bytes are zero.
1668            fidl::decode!(bool, D, &mut self.value, decoder, offset + 0, _depth)?;
1669            Ok(())
1670        }
1671    }
1672
1673    impl fidl::encoding::ValueTypeMarker for ChannelSendRequest {
1674        type Borrowed<'a> = &'a Self;
1675        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1676            value
1677        }
1678    }
1679
1680    unsafe impl fidl::encoding::TypeMarker for ChannelSendRequest {
1681        type Owned = Self;
1682
1683        #[inline(always)]
1684        fn inline_align(_context: fidl::encoding::Context) -> usize {
1685            8
1686        }
1687
1688        #[inline(always)]
1689        fn inline_size(_context: fidl::encoding::Context) -> usize {
1690            16
1691        }
1692    }
1693
1694    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<ChannelSendRequest, D>
1695        for &ChannelSendRequest
1696    {
1697        #[inline]
1698        unsafe fn encode(
1699            self,
1700            encoder: &mut fidl::encoding::Encoder<'_, D>,
1701            offset: usize,
1702            _depth: fidl::encoding::Depth,
1703        ) -> fidl::Result<()> {
1704            encoder.debug_check_bounds::<ChannelSendRequest>(offset);
1705            // Delegate to tuple encoding.
1706            fidl::encoding::Encode::<ChannelSendRequest, D>::encode(
1707                (
1708                    <fidl::encoding::UnboundedVector<Packet> as fidl::encoding::ValueTypeMarker>::borrow(&self.packets),
1709                ),
1710                encoder, offset, _depth
1711            )
1712        }
1713    }
1714    unsafe impl<
1715        D: fidl::encoding::ResourceDialect,
1716        T0: fidl::encoding::Encode<fidl::encoding::UnboundedVector<Packet>, D>,
1717    > fidl::encoding::Encode<ChannelSendRequest, D> for (T0,)
1718    {
1719        #[inline]
1720        unsafe fn encode(
1721            self,
1722            encoder: &mut fidl::encoding::Encoder<'_, D>,
1723            offset: usize,
1724            depth: fidl::encoding::Depth,
1725        ) -> fidl::Result<()> {
1726            encoder.debug_check_bounds::<ChannelSendRequest>(offset);
1727            // Zero out padding regions. There's no need to apply masks
1728            // because the unmasked parts will be overwritten by fields.
1729            // Write the fields.
1730            self.0.encode(encoder, offset + 0, depth)?;
1731            Ok(())
1732        }
1733    }
1734
1735    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ChannelSendRequest {
1736        #[inline(always)]
1737        fn new_empty() -> Self {
1738            Self { packets: fidl::new_empty!(fidl::encoding::UnboundedVector<Packet>, D) }
1739        }
1740
1741        #[inline]
1742        unsafe fn decode(
1743            &mut self,
1744            decoder: &mut fidl::encoding::Decoder<'_, D>,
1745            offset: usize,
1746            _depth: fidl::encoding::Depth,
1747        ) -> fidl::Result<()> {
1748            decoder.debug_check_bounds::<Self>(offset);
1749            // Verify that padding bytes are zero.
1750            fidl::decode!(
1751                fidl::encoding::UnboundedVector<Packet>,
1752                D,
1753                &mut self.packets,
1754                decoder,
1755                offset + 0,
1756                _depth
1757            )?;
1758            Ok(())
1759        }
1760    }
1761
1762    impl fidl::encoding::ValueTypeMarker for ChannelReceiveResponse {
1763        type Borrowed<'a> = &'a Self;
1764        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1765            value
1766        }
1767    }
1768
1769    unsafe impl fidl::encoding::TypeMarker for ChannelReceiveResponse {
1770        type Owned = Self;
1771
1772        #[inline(always)]
1773        fn inline_align(_context: fidl::encoding::Context) -> usize {
1774            8
1775        }
1776
1777        #[inline(always)]
1778        fn inline_size(_context: fidl::encoding::Context) -> usize {
1779            16
1780        }
1781    }
1782
1783    unsafe impl<D: fidl::encoding::ResourceDialect>
1784        fidl::encoding::Encode<ChannelReceiveResponse, D> for &ChannelReceiveResponse
1785    {
1786        #[inline]
1787        unsafe fn encode(
1788            self,
1789            encoder: &mut fidl::encoding::Encoder<'_, D>,
1790            offset: usize,
1791            _depth: fidl::encoding::Depth,
1792        ) -> fidl::Result<()> {
1793            encoder.debug_check_bounds::<ChannelReceiveResponse>(offset);
1794            // Delegate to tuple encoding.
1795            fidl::encoding::Encode::<ChannelReceiveResponse, D>::encode(
1796                (
1797                    <fidl::encoding::UnboundedVector<Packet> as fidl::encoding::ValueTypeMarker>::borrow(&self.packets),
1798                ),
1799                encoder, offset, _depth
1800            )
1801        }
1802    }
1803    unsafe impl<
1804        D: fidl::encoding::ResourceDialect,
1805        T0: fidl::encoding::Encode<fidl::encoding::UnboundedVector<Packet>, D>,
1806    > fidl::encoding::Encode<ChannelReceiveResponse, D> for (T0,)
1807    {
1808        #[inline]
1809        unsafe fn encode(
1810            self,
1811            encoder: &mut fidl::encoding::Encoder<'_, D>,
1812            offset: usize,
1813            depth: fidl::encoding::Depth,
1814        ) -> fidl::Result<()> {
1815            encoder.debug_check_bounds::<ChannelReceiveResponse>(offset);
1816            // Zero out padding regions. There's no need to apply masks
1817            // because the unmasked parts will be overwritten by fields.
1818            // Write the fields.
1819            self.0.encode(encoder, offset + 0, depth)?;
1820            Ok(())
1821        }
1822    }
1823
1824    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1825        for ChannelReceiveResponse
1826    {
1827        #[inline(always)]
1828        fn new_empty() -> Self {
1829            Self { packets: fidl::new_empty!(fidl::encoding::UnboundedVector<Packet>, D) }
1830        }
1831
1832        #[inline]
1833        unsafe fn decode(
1834            &mut self,
1835            decoder: &mut fidl::encoding::Decoder<'_, D>,
1836            offset: usize,
1837            _depth: fidl::encoding::Depth,
1838        ) -> fidl::Result<()> {
1839            decoder.debug_check_bounds::<Self>(offset);
1840            // Verify that padding bytes are zero.
1841            fidl::decode!(
1842                fidl::encoding::UnboundedVector<Packet>,
1843                D,
1844                &mut self.packets,
1845                decoder,
1846                offset + 0,
1847                _depth
1848            )?;
1849            Ok(())
1850        }
1851    }
1852
1853    impl fidl::encoding::ValueTypeMarker for DeviceClass {
1854        type Borrowed<'a> = &'a Self;
1855        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1856            value
1857        }
1858    }
1859
1860    unsafe impl fidl::encoding::TypeMarker for DeviceClass {
1861        type Owned = Self;
1862
1863        #[inline(always)]
1864        fn inline_align(_context: fidl::encoding::Context) -> usize {
1865            4
1866        }
1867
1868        #[inline(always)]
1869        fn inline_size(_context: fidl::encoding::Context) -> usize {
1870            4
1871        }
1872        #[inline(always)]
1873        fn encode_is_copy() -> bool {
1874            true
1875        }
1876
1877        #[inline(always)]
1878        fn decode_is_copy() -> bool {
1879            true
1880        }
1881    }
1882
1883    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<DeviceClass, D>
1884        for &DeviceClass
1885    {
1886        #[inline]
1887        unsafe fn encode(
1888            self,
1889            encoder: &mut fidl::encoding::Encoder<'_, D>,
1890            offset: usize,
1891            _depth: fidl::encoding::Depth,
1892        ) -> fidl::Result<()> {
1893            encoder.debug_check_bounds::<DeviceClass>(offset);
1894            unsafe {
1895                // Copy the object into the buffer.
1896                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
1897                (buf_ptr as *mut DeviceClass).write_unaligned((self as *const DeviceClass).read());
1898                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
1899                // done second because the memcpy will write garbage to these bytes.
1900            }
1901            Ok(())
1902        }
1903    }
1904    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u32, D>>
1905        fidl::encoding::Encode<DeviceClass, D> for (T0,)
1906    {
1907        #[inline]
1908        unsafe fn encode(
1909            self,
1910            encoder: &mut fidl::encoding::Encoder<'_, D>,
1911            offset: usize,
1912            depth: fidl::encoding::Depth,
1913        ) -> fidl::Result<()> {
1914            encoder.debug_check_bounds::<DeviceClass>(offset);
1915            // Zero out padding regions. There's no need to apply masks
1916            // because the unmasked parts will be overwritten by fields.
1917            // Write the fields.
1918            self.0.encode(encoder, offset + 0, depth)?;
1919            Ok(())
1920        }
1921    }
1922
1923    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for DeviceClass {
1924        #[inline(always)]
1925        fn new_empty() -> Self {
1926            Self { value: fidl::new_empty!(u32, D) }
1927        }
1928
1929        #[inline]
1930        unsafe fn decode(
1931            &mut self,
1932            decoder: &mut fidl::encoding::Decoder<'_, D>,
1933            offset: usize,
1934            _depth: fidl::encoding::Depth,
1935        ) -> fidl::Result<()> {
1936            decoder.debug_check_bounds::<Self>(offset);
1937            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
1938            // Verify that padding bytes are zero.
1939            // Copy from the buffer into the object.
1940            unsafe {
1941                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
1942            }
1943            Ok(())
1944        }
1945    }
1946
1947    impl fidl::encoding::ValueTypeMarker for Error {
1948        type Borrowed<'a> = &'a Self;
1949        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1950            value
1951        }
1952    }
1953
1954    unsafe impl fidl::encoding::TypeMarker for Error {
1955        type Owned = Self;
1956
1957        #[inline(always)]
1958        fn inline_align(_context: fidl::encoding::Context) -> usize {
1959            8
1960        }
1961
1962        #[inline(always)]
1963        fn inline_size(_context: fidl::encoding::Context) -> usize {
1964            24
1965        }
1966    }
1967
1968    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Error, D> for &Error {
1969        #[inline]
1970        unsafe fn encode(
1971            self,
1972            encoder: &mut fidl::encoding::Encoder<'_, D>,
1973            offset: usize,
1974            _depth: fidl::encoding::Depth,
1975        ) -> fidl::Result<()> {
1976            encoder.debug_check_bounds::<Error>(offset);
1977            // Delegate to tuple encoding.
1978            fidl::encoding::Encode::<Error, D>::encode(
1979                (
1980                    <ErrorCode as fidl::encoding::ValueTypeMarker>::borrow(&self.error_code),
1981                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.protocol_error_code),
1982                    <fidl::encoding::Optional<fidl::encoding::UnboundedString> as fidl::encoding::ValueTypeMarker>::borrow(&self.description),
1983                ),
1984                encoder, offset, _depth
1985            )
1986        }
1987    }
1988    unsafe impl<
1989        D: fidl::encoding::ResourceDialect,
1990        T0: fidl::encoding::Encode<ErrorCode, D>,
1991        T1: fidl::encoding::Encode<u32, D>,
1992        T2: fidl::encoding::Encode<fidl::encoding::Optional<fidl::encoding::UnboundedString>, D>,
1993    > fidl::encoding::Encode<Error, D> for (T0, T1, T2)
1994    {
1995        #[inline]
1996        unsafe fn encode(
1997            self,
1998            encoder: &mut fidl::encoding::Encoder<'_, D>,
1999            offset: usize,
2000            depth: fidl::encoding::Depth,
2001        ) -> fidl::Result<()> {
2002            encoder.debug_check_bounds::<Error>(offset);
2003            // Zero out padding regions. There's no need to apply masks
2004            // because the unmasked parts will be overwritten by fields.
2005            // Write the fields.
2006            self.0.encode(encoder, offset + 0, depth)?;
2007            self.1.encode(encoder, offset + 4, depth)?;
2008            self.2.encode(encoder, offset + 8, depth)?;
2009            Ok(())
2010        }
2011    }
2012
2013    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Error {
2014        #[inline(always)]
2015        fn new_empty() -> Self {
2016            Self {
2017                error_code: fidl::new_empty!(ErrorCode, D),
2018                protocol_error_code: fidl::new_empty!(u32, D),
2019                description: fidl::new_empty!(
2020                    fidl::encoding::Optional<fidl::encoding::UnboundedString>,
2021                    D
2022                ),
2023            }
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            // Verify that padding bytes are zero.
2035            fidl::decode!(ErrorCode, D, &mut self.error_code, decoder, offset + 0, _depth)?;
2036            fidl::decode!(u32, D, &mut self.protocol_error_code, decoder, offset + 4, _depth)?;
2037            fidl::decode!(
2038                fidl::encoding::Optional<fidl::encoding::UnboundedString>,
2039                D,
2040                &mut self.description,
2041                decoder,
2042                offset + 8,
2043                _depth
2044            )?;
2045            Ok(())
2046        }
2047    }
2048
2049    impl fidl::encoding::ValueTypeMarker for HostId {
2050        type Borrowed<'a> = &'a Self;
2051        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2052            value
2053        }
2054    }
2055
2056    unsafe impl fidl::encoding::TypeMarker for HostId {
2057        type Owned = Self;
2058
2059        #[inline(always)]
2060        fn inline_align(_context: fidl::encoding::Context) -> usize {
2061            8
2062        }
2063
2064        #[inline(always)]
2065        fn inline_size(_context: fidl::encoding::Context) -> usize {
2066            8
2067        }
2068        #[inline(always)]
2069        fn encode_is_copy() -> bool {
2070            true
2071        }
2072
2073        #[inline(always)]
2074        fn decode_is_copy() -> bool {
2075            true
2076        }
2077    }
2078
2079    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<HostId, D> for &HostId {
2080        #[inline]
2081        unsafe fn encode(
2082            self,
2083            encoder: &mut fidl::encoding::Encoder<'_, D>,
2084            offset: usize,
2085            _depth: fidl::encoding::Depth,
2086        ) -> fidl::Result<()> {
2087            encoder.debug_check_bounds::<HostId>(offset);
2088            unsafe {
2089                // Copy the object into the buffer.
2090                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
2091                (buf_ptr as *mut HostId).write_unaligned((self as *const HostId).read());
2092                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
2093                // done second because the memcpy will write garbage to these bytes.
2094            }
2095            Ok(())
2096        }
2097    }
2098    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u64, D>>
2099        fidl::encoding::Encode<HostId, D> for (T0,)
2100    {
2101        #[inline]
2102        unsafe fn encode(
2103            self,
2104            encoder: &mut fidl::encoding::Encoder<'_, D>,
2105            offset: usize,
2106            depth: fidl::encoding::Depth,
2107        ) -> fidl::Result<()> {
2108            encoder.debug_check_bounds::<HostId>(offset);
2109            // Zero out padding regions. There's no need to apply masks
2110            // because the unmasked parts will be overwritten by fields.
2111            // Write the fields.
2112            self.0.encode(encoder, offset + 0, depth)?;
2113            Ok(())
2114        }
2115    }
2116
2117    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for HostId {
2118        #[inline(always)]
2119        fn new_empty() -> Self {
2120            Self { value: fidl::new_empty!(u64, D) }
2121        }
2122
2123        #[inline]
2124        unsafe fn decode(
2125            &mut self,
2126            decoder: &mut fidl::encoding::Decoder<'_, D>,
2127            offset: usize,
2128            _depth: fidl::encoding::Depth,
2129        ) -> fidl::Result<()> {
2130            decoder.debug_check_bounds::<Self>(offset);
2131            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
2132            // Verify that padding bytes are zero.
2133            // Copy from the buffer into the object.
2134            unsafe {
2135                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 8);
2136            }
2137            Ok(())
2138        }
2139    }
2140
2141    impl fidl::encoding::ValueTypeMarker for Int8 {
2142        type Borrowed<'a> = &'a Self;
2143        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2144            value
2145        }
2146    }
2147
2148    unsafe impl fidl::encoding::TypeMarker for Int8 {
2149        type Owned = Self;
2150
2151        #[inline(always)]
2152        fn inline_align(_context: fidl::encoding::Context) -> usize {
2153            1
2154        }
2155
2156        #[inline(always)]
2157        fn inline_size(_context: fidl::encoding::Context) -> usize {
2158            1
2159        }
2160        #[inline(always)]
2161        fn encode_is_copy() -> bool {
2162            true
2163        }
2164
2165        #[inline(always)]
2166        fn decode_is_copy() -> bool {
2167            true
2168        }
2169    }
2170
2171    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Int8, D> for &Int8 {
2172        #[inline]
2173        unsafe fn encode(
2174            self,
2175            encoder: &mut fidl::encoding::Encoder<'_, D>,
2176            offset: usize,
2177            _depth: fidl::encoding::Depth,
2178        ) -> fidl::Result<()> {
2179            encoder.debug_check_bounds::<Int8>(offset);
2180            unsafe {
2181                // Copy the object into the buffer.
2182                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
2183                (buf_ptr as *mut Int8).write_unaligned((self as *const Int8).read());
2184                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
2185                // done second because the memcpy will write garbage to these bytes.
2186            }
2187            Ok(())
2188        }
2189    }
2190    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<i8, D>>
2191        fidl::encoding::Encode<Int8, D> for (T0,)
2192    {
2193        #[inline]
2194        unsafe fn encode(
2195            self,
2196            encoder: &mut fidl::encoding::Encoder<'_, D>,
2197            offset: usize,
2198            depth: fidl::encoding::Depth,
2199        ) -> fidl::Result<()> {
2200            encoder.debug_check_bounds::<Int8>(offset);
2201            // Zero out padding regions. There's no need to apply masks
2202            // because the unmasked parts will be overwritten by fields.
2203            // Write the fields.
2204            self.0.encode(encoder, offset + 0, depth)?;
2205            Ok(())
2206        }
2207    }
2208
2209    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Int8 {
2210        #[inline(always)]
2211        fn new_empty() -> Self {
2212            Self { value: fidl::new_empty!(i8, D) }
2213        }
2214
2215        #[inline]
2216        unsafe fn decode(
2217            &mut self,
2218            decoder: &mut fidl::encoding::Decoder<'_, D>,
2219            offset: usize,
2220            _depth: fidl::encoding::Depth,
2221        ) -> fidl::Result<()> {
2222            decoder.debug_check_bounds::<Self>(offset);
2223            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
2224            // Verify that padding bytes are zero.
2225            // Copy from the buffer into the object.
2226            unsafe {
2227                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 1);
2228            }
2229            Ok(())
2230        }
2231    }
2232
2233    impl fidl::encoding::ValueTypeMarker for Packet {
2234        type Borrowed<'a> = &'a Self;
2235        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2236            value
2237        }
2238    }
2239
2240    unsafe impl fidl::encoding::TypeMarker for Packet {
2241        type Owned = Self;
2242
2243        #[inline(always)]
2244        fn inline_align(_context: fidl::encoding::Context) -> usize {
2245            8
2246        }
2247
2248        #[inline(always)]
2249        fn inline_size(_context: fidl::encoding::Context) -> usize {
2250            16
2251        }
2252    }
2253
2254    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Packet, D> for &Packet {
2255        #[inline]
2256        unsafe fn encode(
2257            self,
2258            encoder: &mut fidl::encoding::Encoder<'_, D>,
2259            offset: usize,
2260            _depth: fidl::encoding::Depth,
2261        ) -> fidl::Result<()> {
2262            encoder.debug_check_bounds::<Packet>(offset);
2263            // Delegate to tuple encoding.
2264            fidl::encoding::Encode::<Packet, D>::encode(
2265                (<fidl::encoding::UnboundedVector<u8> as fidl::encoding::ValueTypeMarker>::borrow(
2266                    &self.packet,
2267                ),),
2268                encoder,
2269                offset,
2270                _depth,
2271            )
2272        }
2273    }
2274    unsafe impl<
2275        D: fidl::encoding::ResourceDialect,
2276        T0: fidl::encoding::Encode<fidl::encoding::UnboundedVector<u8>, D>,
2277    > fidl::encoding::Encode<Packet, D> for (T0,)
2278    {
2279        #[inline]
2280        unsafe fn encode(
2281            self,
2282            encoder: &mut fidl::encoding::Encoder<'_, D>,
2283            offset: usize,
2284            depth: fidl::encoding::Depth,
2285        ) -> fidl::Result<()> {
2286            encoder.debug_check_bounds::<Packet>(offset);
2287            // Zero out padding regions. There's no need to apply masks
2288            // because the unmasked parts will be overwritten by fields.
2289            // Write the fields.
2290            self.0.encode(encoder, offset + 0, depth)?;
2291            Ok(())
2292        }
2293    }
2294
2295    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Packet {
2296        #[inline(always)]
2297        fn new_empty() -> Self {
2298            Self { packet: fidl::new_empty!(fidl::encoding::UnboundedVector<u8>, D) }
2299        }
2300
2301        #[inline]
2302        unsafe fn decode(
2303            &mut self,
2304            decoder: &mut fidl::encoding::Decoder<'_, D>,
2305            offset: usize,
2306            _depth: fidl::encoding::Depth,
2307        ) -> fidl::Result<()> {
2308            decoder.debug_check_bounds::<Self>(offset);
2309            // Verify that padding bytes are zero.
2310            fidl::decode!(
2311                fidl::encoding::UnboundedVector<u8>,
2312                D,
2313                &mut self.packet,
2314                decoder,
2315                offset + 0,
2316                _depth
2317            )?;
2318            Ok(())
2319        }
2320    }
2321
2322    impl fidl::encoding::ValueTypeMarker for PeerId {
2323        type Borrowed<'a> = &'a Self;
2324        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2325            value
2326        }
2327    }
2328
2329    unsafe impl fidl::encoding::TypeMarker for PeerId {
2330        type Owned = Self;
2331
2332        #[inline(always)]
2333        fn inline_align(_context: fidl::encoding::Context) -> usize {
2334            8
2335        }
2336
2337        #[inline(always)]
2338        fn inline_size(_context: fidl::encoding::Context) -> usize {
2339            8
2340        }
2341        #[inline(always)]
2342        fn encode_is_copy() -> bool {
2343            true
2344        }
2345
2346        #[inline(always)]
2347        fn decode_is_copy() -> bool {
2348            true
2349        }
2350    }
2351
2352    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<PeerId, D> for &PeerId {
2353        #[inline]
2354        unsafe fn encode(
2355            self,
2356            encoder: &mut fidl::encoding::Encoder<'_, D>,
2357            offset: usize,
2358            _depth: fidl::encoding::Depth,
2359        ) -> fidl::Result<()> {
2360            encoder.debug_check_bounds::<PeerId>(offset);
2361            unsafe {
2362                // Copy the object into the buffer.
2363                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
2364                (buf_ptr as *mut PeerId).write_unaligned((self as *const PeerId).read());
2365                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
2366                // done second because the memcpy will write garbage to these bytes.
2367            }
2368            Ok(())
2369        }
2370    }
2371    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u64, D>>
2372        fidl::encoding::Encode<PeerId, D> for (T0,)
2373    {
2374        #[inline]
2375        unsafe fn encode(
2376            self,
2377            encoder: &mut fidl::encoding::Encoder<'_, D>,
2378            offset: usize,
2379            depth: fidl::encoding::Depth,
2380        ) -> fidl::Result<()> {
2381            encoder.debug_check_bounds::<PeerId>(offset);
2382            // Zero out padding regions. There's no need to apply masks
2383            // because the unmasked parts will be overwritten by fields.
2384            // Write the fields.
2385            self.0.encode(encoder, offset + 0, depth)?;
2386            Ok(())
2387        }
2388    }
2389
2390    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for PeerId {
2391        #[inline(always)]
2392        fn new_empty() -> Self {
2393            Self { value: fidl::new_empty!(u64, D) }
2394        }
2395
2396        #[inline]
2397        unsafe fn decode(
2398            &mut self,
2399            decoder: &mut fidl::encoding::Decoder<'_, D>,
2400            offset: usize,
2401            _depth: fidl::encoding::Depth,
2402        ) -> fidl::Result<()> {
2403            decoder.debug_check_bounds::<Self>(offset);
2404            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
2405            // Verify that padding bytes are zero.
2406            // Copy from the buffer into the object.
2407            unsafe {
2408                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 8);
2409            }
2410            Ok(())
2411        }
2412    }
2413
2414    impl fidl::encoding::ValueTypeMarker for Status {
2415        type Borrowed<'a> = &'a Self;
2416        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2417            value
2418        }
2419    }
2420
2421    unsafe impl fidl::encoding::TypeMarker for Status {
2422        type Owned = Self;
2423
2424        #[inline(always)]
2425        fn inline_align(_context: fidl::encoding::Context) -> usize {
2426            8
2427        }
2428
2429        #[inline(always)]
2430        fn inline_size(_context: fidl::encoding::Context) -> usize {
2431            8
2432        }
2433    }
2434
2435    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Status, D> for &Status {
2436        #[inline]
2437        unsafe fn encode(
2438            self,
2439            encoder: &mut fidl::encoding::Encoder<'_, D>,
2440            offset: usize,
2441            _depth: fidl::encoding::Depth,
2442        ) -> fidl::Result<()> {
2443            encoder.debug_check_bounds::<Status>(offset);
2444            // Delegate to tuple encoding.
2445            fidl::encoding::Encode::<Status, D>::encode(
2446                (<fidl::encoding::Boxed<Error> as fidl::encoding::ValueTypeMarker>::borrow(
2447                    &self.error,
2448                ),),
2449                encoder,
2450                offset,
2451                _depth,
2452            )
2453        }
2454    }
2455    unsafe impl<
2456        D: fidl::encoding::ResourceDialect,
2457        T0: fidl::encoding::Encode<fidl::encoding::Boxed<Error>, D>,
2458    > fidl::encoding::Encode<Status, D> for (T0,)
2459    {
2460        #[inline]
2461        unsafe fn encode(
2462            self,
2463            encoder: &mut fidl::encoding::Encoder<'_, D>,
2464            offset: usize,
2465            depth: fidl::encoding::Depth,
2466        ) -> fidl::Result<()> {
2467            encoder.debug_check_bounds::<Status>(offset);
2468            // Zero out padding regions. There's no need to apply masks
2469            // because the unmasked parts will be overwritten by fields.
2470            // Write the fields.
2471            self.0.encode(encoder, offset + 0, depth)?;
2472            Ok(())
2473        }
2474    }
2475
2476    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Status {
2477        #[inline(always)]
2478        fn new_empty() -> Self {
2479            Self { error: fidl::new_empty!(fidl::encoding::Boxed<Error>, D) }
2480        }
2481
2482        #[inline]
2483        unsafe fn decode(
2484            &mut self,
2485            decoder: &mut fidl::encoding::Decoder<'_, D>,
2486            offset: usize,
2487            _depth: fidl::encoding::Depth,
2488        ) -> fidl::Result<()> {
2489            decoder.debug_check_bounds::<Self>(offset);
2490            // Verify that padding bytes are zero.
2491            fidl::decode!(
2492                fidl::encoding::Boxed<Error>,
2493                D,
2494                &mut self.error,
2495                decoder,
2496                offset + 0,
2497                _depth
2498            )?;
2499            Ok(())
2500        }
2501    }
2502
2503    impl fidl::encoding::ValueTypeMarker for UInt16 {
2504        type Borrowed<'a> = &'a Self;
2505        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2506            value
2507        }
2508    }
2509
2510    unsafe impl fidl::encoding::TypeMarker for UInt16 {
2511        type Owned = Self;
2512
2513        #[inline(always)]
2514        fn inline_align(_context: fidl::encoding::Context) -> usize {
2515            2
2516        }
2517
2518        #[inline(always)]
2519        fn inline_size(_context: fidl::encoding::Context) -> usize {
2520            2
2521        }
2522        #[inline(always)]
2523        fn encode_is_copy() -> bool {
2524            true
2525        }
2526
2527        #[inline(always)]
2528        fn decode_is_copy() -> bool {
2529            true
2530        }
2531    }
2532
2533    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<UInt16, D> for &UInt16 {
2534        #[inline]
2535        unsafe fn encode(
2536            self,
2537            encoder: &mut fidl::encoding::Encoder<'_, D>,
2538            offset: usize,
2539            _depth: fidl::encoding::Depth,
2540        ) -> fidl::Result<()> {
2541            encoder.debug_check_bounds::<UInt16>(offset);
2542            unsafe {
2543                // Copy the object into the buffer.
2544                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
2545                (buf_ptr as *mut UInt16).write_unaligned((self as *const UInt16).read());
2546                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
2547                // done second because the memcpy will write garbage to these bytes.
2548            }
2549            Ok(())
2550        }
2551    }
2552    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u16, D>>
2553        fidl::encoding::Encode<UInt16, D> for (T0,)
2554    {
2555        #[inline]
2556        unsafe fn encode(
2557            self,
2558            encoder: &mut fidl::encoding::Encoder<'_, D>,
2559            offset: usize,
2560            depth: fidl::encoding::Depth,
2561        ) -> fidl::Result<()> {
2562            encoder.debug_check_bounds::<UInt16>(offset);
2563            // Zero out padding regions. There's no need to apply masks
2564            // because the unmasked parts will be overwritten by fields.
2565            // Write the fields.
2566            self.0.encode(encoder, offset + 0, depth)?;
2567            Ok(())
2568        }
2569    }
2570
2571    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for UInt16 {
2572        #[inline(always)]
2573        fn new_empty() -> Self {
2574            Self { value: fidl::new_empty!(u16, D) }
2575        }
2576
2577        #[inline]
2578        unsafe fn decode(
2579            &mut self,
2580            decoder: &mut fidl::encoding::Decoder<'_, D>,
2581            offset: usize,
2582            _depth: fidl::encoding::Depth,
2583        ) -> fidl::Result<()> {
2584            decoder.debug_check_bounds::<Self>(offset);
2585            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
2586            // Verify that padding bytes are zero.
2587            // Copy from the buffer into the object.
2588            unsafe {
2589                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 2);
2590            }
2591            Ok(())
2592        }
2593    }
2594
2595    impl fidl::encoding::ValueTypeMarker for Uuid {
2596        type Borrowed<'a> = &'a Self;
2597        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2598            value
2599        }
2600    }
2601
2602    unsafe impl fidl::encoding::TypeMarker for Uuid {
2603        type Owned = Self;
2604
2605        #[inline(always)]
2606        fn inline_align(_context: fidl::encoding::Context) -> usize {
2607            1
2608        }
2609
2610        #[inline(always)]
2611        fn inline_size(_context: fidl::encoding::Context) -> usize {
2612            16
2613        }
2614        #[inline(always)]
2615        fn encode_is_copy() -> bool {
2616            true
2617        }
2618
2619        #[inline(always)]
2620        fn decode_is_copy() -> bool {
2621            true
2622        }
2623    }
2624
2625    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Uuid, D> for &Uuid {
2626        #[inline]
2627        unsafe fn encode(
2628            self,
2629            encoder: &mut fidl::encoding::Encoder<'_, D>,
2630            offset: usize,
2631            _depth: fidl::encoding::Depth,
2632        ) -> fidl::Result<()> {
2633            encoder.debug_check_bounds::<Uuid>(offset);
2634            unsafe {
2635                // Copy the object into the buffer.
2636                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
2637                (buf_ptr as *mut Uuid).write_unaligned((self as *const Uuid).read());
2638                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
2639                // done second because the memcpy will write garbage to these bytes.
2640            }
2641            Ok(())
2642        }
2643    }
2644    unsafe impl<
2645        D: fidl::encoding::ResourceDialect,
2646        T0: fidl::encoding::Encode<fidl::encoding::Array<u8, 16>, D>,
2647    > fidl::encoding::Encode<Uuid, D> for (T0,)
2648    {
2649        #[inline]
2650        unsafe fn encode(
2651            self,
2652            encoder: &mut fidl::encoding::Encoder<'_, D>,
2653            offset: usize,
2654            depth: fidl::encoding::Depth,
2655        ) -> fidl::Result<()> {
2656            encoder.debug_check_bounds::<Uuid>(offset);
2657            // Zero out padding regions. There's no need to apply masks
2658            // because the unmasked parts will be overwritten by fields.
2659            // Write the fields.
2660            self.0.encode(encoder, offset + 0, depth)?;
2661            Ok(())
2662        }
2663    }
2664
2665    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Uuid {
2666        #[inline(always)]
2667        fn new_empty() -> Self {
2668            Self { value: fidl::new_empty!(fidl::encoding::Array<u8, 16>, D) }
2669        }
2670
2671        #[inline]
2672        unsafe fn decode(
2673            &mut self,
2674            decoder: &mut fidl::encoding::Decoder<'_, D>,
2675            offset: usize,
2676            _depth: fidl::encoding::Depth,
2677        ) -> fidl::Result<()> {
2678            decoder.debug_check_bounds::<Self>(offset);
2679            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
2680            // Verify that padding bytes are zero.
2681            // Copy from the buffer into the object.
2682            unsafe {
2683                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 16);
2684            }
2685            Ok(())
2686        }
2687    }
2688
2689    impl ChannelParameters {
2690        #[inline(always)]
2691        fn max_ordinal_present(&self) -> u64 {
2692            if let Some(_) = self.flush_timeout {
2693                return 4;
2694            }
2695            if let Some(_) = self.security_requirements {
2696                return 3;
2697            }
2698            if let Some(_) = self.max_rx_packet_size {
2699                return 2;
2700            }
2701            if let Some(_) = self.channel_mode {
2702                return 1;
2703            }
2704            0
2705        }
2706    }
2707
2708    impl fidl::encoding::ValueTypeMarker for ChannelParameters {
2709        type Borrowed<'a> = &'a Self;
2710        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2711            value
2712        }
2713    }
2714
2715    unsafe impl fidl::encoding::TypeMarker for ChannelParameters {
2716        type Owned = Self;
2717
2718        #[inline(always)]
2719        fn inline_align(_context: fidl::encoding::Context) -> usize {
2720            8
2721        }
2722
2723        #[inline(always)]
2724        fn inline_size(_context: fidl::encoding::Context) -> usize {
2725            16
2726        }
2727    }
2728
2729    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<ChannelParameters, D>
2730        for &ChannelParameters
2731    {
2732        unsafe fn encode(
2733            self,
2734            encoder: &mut fidl::encoding::Encoder<'_, D>,
2735            offset: usize,
2736            mut depth: fidl::encoding::Depth,
2737        ) -> fidl::Result<()> {
2738            encoder.debug_check_bounds::<ChannelParameters>(offset);
2739            // Vector header
2740            let max_ordinal: u64 = self.max_ordinal_present();
2741            encoder.write_num(max_ordinal, offset);
2742            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
2743            // Calling encoder.out_of_line_offset(0) is not allowed.
2744            if max_ordinal == 0 {
2745                return Ok(());
2746            }
2747            depth.increment()?;
2748            let envelope_size = 8;
2749            let bytes_len = max_ordinal as usize * envelope_size;
2750            #[allow(unused_variables)]
2751            let offset = encoder.out_of_line_offset(bytes_len);
2752            let mut _prev_end_offset: usize = 0;
2753            if 1 > max_ordinal {
2754                return Ok(());
2755            }
2756
2757            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2758            // are envelope_size bytes.
2759            let cur_offset: usize = (1 - 1) * envelope_size;
2760
2761            // Zero reserved fields.
2762            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2763
2764            // Safety:
2765            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2766            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2767            //   envelope_size bytes, there is always sufficient room.
2768            fidl::encoding::encode_in_envelope_optional::<ChannelMode, D>(
2769                self.channel_mode
2770                    .as_ref()
2771                    .map(<ChannelMode as fidl::encoding::ValueTypeMarker>::borrow),
2772                encoder,
2773                offset + cur_offset,
2774                depth,
2775            )?;
2776
2777            _prev_end_offset = cur_offset + envelope_size;
2778            if 2 > max_ordinal {
2779                return Ok(());
2780            }
2781
2782            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2783            // are envelope_size bytes.
2784            let cur_offset: usize = (2 - 1) * envelope_size;
2785
2786            // Zero reserved fields.
2787            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2788
2789            // Safety:
2790            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2791            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2792            //   envelope_size bytes, there is always sufficient room.
2793            fidl::encoding::encode_in_envelope_optional::<u16, D>(
2794                self.max_rx_packet_size
2795                    .as_ref()
2796                    .map(<u16 as fidl::encoding::ValueTypeMarker>::borrow),
2797                encoder,
2798                offset + cur_offset,
2799                depth,
2800            )?;
2801
2802            _prev_end_offset = cur_offset + envelope_size;
2803            if 3 > max_ordinal {
2804                return Ok(());
2805            }
2806
2807            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2808            // are envelope_size bytes.
2809            let cur_offset: usize = (3 - 1) * envelope_size;
2810
2811            // Zero reserved fields.
2812            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2813
2814            // Safety:
2815            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2816            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2817            //   envelope_size bytes, there is always sufficient room.
2818            fidl::encoding::encode_in_envelope_optional::<SecurityRequirements, D>(
2819                self.security_requirements
2820                    .as_ref()
2821                    .map(<SecurityRequirements as fidl::encoding::ValueTypeMarker>::borrow),
2822                encoder,
2823                offset + cur_offset,
2824                depth,
2825            )?;
2826
2827            _prev_end_offset = cur_offset + envelope_size;
2828            if 4 > max_ordinal {
2829                return Ok(());
2830            }
2831
2832            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2833            // are envelope_size bytes.
2834            let cur_offset: usize = (4 - 1) * envelope_size;
2835
2836            // Zero reserved fields.
2837            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2838
2839            // Safety:
2840            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2841            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2842            //   envelope_size bytes, there is always sufficient room.
2843            fidl::encoding::encode_in_envelope_optional::<i64, D>(
2844                self.flush_timeout.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
2845                encoder,
2846                offset + cur_offset,
2847                depth,
2848            )?;
2849
2850            _prev_end_offset = cur_offset + envelope_size;
2851
2852            Ok(())
2853        }
2854    }
2855
2856    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ChannelParameters {
2857        #[inline(always)]
2858        fn new_empty() -> Self {
2859            Self::default()
2860        }
2861
2862        unsafe fn decode(
2863            &mut self,
2864            decoder: &mut fidl::encoding::Decoder<'_, D>,
2865            offset: usize,
2866            mut depth: fidl::encoding::Depth,
2867        ) -> fidl::Result<()> {
2868            decoder.debug_check_bounds::<Self>(offset);
2869            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
2870                None => return Err(fidl::Error::NotNullable),
2871                Some(len) => len,
2872            };
2873            // Calling decoder.out_of_line_offset(0) is not allowed.
2874            if len == 0 {
2875                return Ok(());
2876            };
2877            depth.increment()?;
2878            let envelope_size = 8;
2879            let bytes_len = len * envelope_size;
2880            let offset = decoder.out_of_line_offset(bytes_len)?;
2881            // Decode the envelope for each type.
2882            let mut _next_ordinal_to_read = 0;
2883            let mut next_offset = offset;
2884            let end_offset = offset + bytes_len;
2885            _next_ordinal_to_read += 1;
2886            if next_offset >= end_offset {
2887                return Ok(());
2888            }
2889
2890            // Decode unknown envelopes for gaps in ordinals.
2891            while _next_ordinal_to_read < 1 {
2892                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2893                _next_ordinal_to_read += 1;
2894                next_offset += envelope_size;
2895            }
2896
2897            let next_out_of_line = decoder.next_out_of_line();
2898            let handles_before = decoder.remaining_handles();
2899            if let Some((inlined, num_bytes, num_handles)) =
2900                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2901            {
2902                let member_inline_size =
2903                    <ChannelMode as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2904                if inlined != (member_inline_size <= 4) {
2905                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2906                }
2907                let inner_offset;
2908                let mut inner_depth = depth.clone();
2909                if inlined {
2910                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2911                    inner_offset = next_offset;
2912                } else {
2913                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2914                    inner_depth.increment()?;
2915                }
2916                let val_ref =
2917                    self.channel_mode.get_or_insert_with(|| fidl::new_empty!(ChannelMode, D));
2918                fidl::decode!(ChannelMode, D, val_ref, decoder, inner_offset, inner_depth)?;
2919                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2920                {
2921                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2922                }
2923                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2924                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2925                }
2926            }
2927
2928            next_offset += envelope_size;
2929            _next_ordinal_to_read += 1;
2930            if next_offset >= end_offset {
2931                return Ok(());
2932            }
2933
2934            // Decode unknown envelopes for gaps in ordinals.
2935            while _next_ordinal_to_read < 2 {
2936                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2937                _next_ordinal_to_read += 1;
2938                next_offset += envelope_size;
2939            }
2940
2941            let next_out_of_line = decoder.next_out_of_line();
2942            let handles_before = decoder.remaining_handles();
2943            if let Some((inlined, num_bytes, num_handles)) =
2944                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2945            {
2946                let member_inline_size =
2947                    <u16 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2948                if inlined != (member_inline_size <= 4) {
2949                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2950                }
2951                let inner_offset;
2952                let mut inner_depth = depth.clone();
2953                if inlined {
2954                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2955                    inner_offset = next_offset;
2956                } else {
2957                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2958                    inner_depth.increment()?;
2959                }
2960                let val_ref =
2961                    self.max_rx_packet_size.get_or_insert_with(|| fidl::new_empty!(u16, D));
2962                fidl::decode!(u16, D, val_ref, decoder, inner_offset, inner_depth)?;
2963                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2964                {
2965                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2966                }
2967                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2968                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2969                }
2970            }
2971
2972            next_offset += envelope_size;
2973            _next_ordinal_to_read += 1;
2974            if next_offset >= end_offset {
2975                return Ok(());
2976            }
2977
2978            // Decode unknown envelopes for gaps in ordinals.
2979            while _next_ordinal_to_read < 3 {
2980                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2981                _next_ordinal_to_read += 1;
2982                next_offset += envelope_size;
2983            }
2984
2985            let next_out_of_line = decoder.next_out_of_line();
2986            let handles_before = decoder.remaining_handles();
2987            if let Some((inlined, num_bytes, num_handles)) =
2988                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2989            {
2990                let member_inline_size =
2991                    <SecurityRequirements as fidl::encoding::TypeMarker>::inline_size(
2992                        decoder.context,
2993                    );
2994                if inlined != (member_inline_size <= 4) {
2995                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2996                }
2997                let inner_offset;
2998                let mut inner_depth = depth.clone();
2999                if inlined {
3000                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3001                    inner_offset = next_offset;
3002                } else {
3003                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3004                    inner_depth.increment()?;
3005                }
3006                let val_ref = self
3007                    .security_requirements
3008                    .get_or_insert_with(|| fidl::new_empty!(SecurityRequirements, D));
3009                fidl::decode!(
3010                    SecurityRequirements,
3011                    D,
3012                    val_ref,
3013                    decoder,
3014                    inner_offset,
3015                    inner_depth
3016                )?;
3017                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3018                {
3019                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3020                }
3021                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3022                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3023                }
3024            }
3025
3026            next_offset += envelope_size;
3027            _next_ordinal_to_read += 1;
3028            if next_offset >= end_offset {
3029                return Ok(());
3030            }
3031
3032            // Decode unknown envelopes for gaps in ordinals.
3033            while _next_ordinal_to_read < 4 {
3034                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3035                _next_ordinal_to_read += 1;
3036                next_offset += envelope_size;
3037            }
3038
3039            let next_out_of_line = decoder.next_out_of_line();
3040            let handles_before = decoder.remaining_handles();
3041            if let Some((inlined, num_bytes, num_handles)) =
3042                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3043            {
3044                let member_inline_size =
3045                    <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3046                if inlined != (member_inline_size <= 4) {
3047                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3048                }
3049                let inner_offset;
3050                let mut inner_depth = depth.clone();
3051                if inlined {
3052                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3053                    inner_offset = next_offset;
3054                } else {
3055                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3056                    inner_depth.increment()?;
3057                }
3058                let val_ref = self.flush_timeout.get_or_insert_with(|| fidl::new_empty!(i64, D));
3059                fidl::decode!(i64, D, val_ref, decoder, inner_offset, inner_depth)?;
3060                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3061                {
3062                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3063                }
3064                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3065                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3066                }
3067            }
3068
3069            next_offset += envelope_size;
3070
3071            // Decode the remaining unknown envelopes.
3072            while next_offset < end_offset {
3073                _next_ordinal_to_read += 1;
3074                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3075                next_offset += envelope_size;
3076            }
3077
3078            Ok(())
3079        }
3080    }
3081
3082    impl CodecAttributes {
3083        #[inline(always)]
3084        fn max_ordinal_present(&self) -> u64 {
3085            if let Some(_) = self.codec_configuration {
3086                return 2;
3087            }
3088            if let Some(_) = self.codec_id {
3089                return 1;
3090            }
3091            0
3092        }
3093    }
3094
3095    impl fidl::encoding::ValueTypeMarker for CodecAttributes {
3096        type Borrowed<'a> = &'a Self;
3097        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3098            value
3099        }
3100    }
3101
3102    unsafe impl fidl::encoding::TypeMarker for CodecAttributes {
3103        type Owned = Self;
3104
3105        #[inline(always)]
3106        fn inline_align(_context: fidl::encoding::Context) -> usize {
3107            8
3108        }
3109
3110        #[inline(always)]
3111        fn inline_size(_context: fidl::encoding::Context) -> usize {
3112            16
3113        }
3114    }
3115
3116    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<CodecAttributes, D>
3117        for &CodecAttributes
3118    {
3119        unsafe fn encode(
3120            self,
3121            encoder: &mut fidl::encoding::Encoder<'_, D>,
3122            offset: usize,
3123            mut depth: fidl::encoding::Depth,
3124        ) -> fidl::Result<()> {
3125            encoder.debug_check_bounds::<CodecAttributes>(offset);
3126            // Vector header
3127            let max_ordinal: u64 = self.max_ordinal_present();
3128            encoder.write_num(max_ordinal, offset);
3129            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
3130            // Calling encoder.out_of_line_offset(0) is not allowed.
3131            if max_ordinal == 0 {
3132                return Ok(());
3133            }
3134            depth.increment()?;
3135            let envelope_size = 8;
3136            let bytes_len = max_ordinal as usize * envelope_size;
3137            #[allow(unused_variables)]
3138            let offset = encoder.out_of_line_offset(bytes_len);
3139            let mut _prev_end_offset: usize = 0;
3140            if 1 > max_ordinal {
3141                return Ok(());
3142            }
3143
3144            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3145            // are envelope_size bytes.
3146            let cur_offset: usize = (1 - 1) * envelope_size;
3147
3148            // Zero reserved fields.
3149            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3150
3151            // Safety:
3152            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3153            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3154            //   envelope_size bytes, there is always sufficient room.
3155            fidl::encoding::encode_in_envelope_optional::<CodecId, D>(
3156                self.codec_id.as_ref().map(<CodecId as fidl::encoding::ValueTypeMarker>::borrow),
3157                encoder,
3158                offset + cur_offset,
3159                depth,
3160            )?;
3161
3162            _prev_end_offset = cur_offset + envelope_size;
3163            if 2 > max_ordinal {
3164                return Ok(());
3165            }
3166
3167            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3168            // are envelope_size bytes.
3169            let cur_offset: usize = (2 - 1) * envelope_size;
3170
3171            // Zero reserved fields.
3172            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3173
3174            // Safety:
3175            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3176            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3177            //   envelope_size bytes, there is always sufficient room.
3178            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedVector<u8>, D>(
3179            self.codec_configuration.as_ref().map(<fidl::encoding::UnboundedVector<u8> as fidl::encoding::ValueTypeMarker>::borrow),
3180            encoder, offset + cur_offset, depth
3181        )?;
3182
3183            _prev_end_offset = cur_offset + envelope_size;
3184
3185            Ok(())
3186        }
3187    }
3188
3189    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for CodecAttributes {
3190        #[inline(always)]
3191        fn new_empty() -> Self {
3192            Self::default()
3193        }
3194
3195        unsafe fn decode(
3196            &mut self,
3197            decoder: &mut fidl::encoding::Decoder<'_, D>,
3198            offset: usize,
3199            mut depth: fidl::encoding::Depth,
3200        ) -> fidl::Result<()> {
3201            decoder.debug_check_bounds::<Self>(offset);
3202            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
3203                None => return Err(fidl::Error::NotNullable),
3204                Some(len) => len,
3205            };
3206            // Calling decoder.out_of_line_offset(0) is not allowed.
3207            if len == 0 {
3208                return Ok(());
3209            };
3210            depth.increment()?;
3211            let envelope_size = 8;
3212            let bytes_len = len * envelope_size;
3213            let offset = decoder.out_of_line_offset(bytes_len)?;
3214            // Decode the envelope for each type.
3215            let mut _next_ordinal_to_read = 0;
3216            let mut next_offset = offset;
3217            let end_offset = offset + bytes_len;
3218            _next_ordinal_to_read += 1;
3219            if next_offset >= end_offset {
3220                return Ok(());
3221            }
3222
3223            // Decode unknown envelopes for gaps in ordinals.
3224            while _next_ordinal_to_read < 1 {
3225                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3226                _next_ordinal_to_read += 1;
3227                next_offset += envelope_size;
3228            }
3229
3230            let next_out_of_line = decoder.next_out_of_line();
3231            let handles_before = decoder.remaining_handles();
3232            if let Some((inlined, num_bytes, num_handles)) =
3233                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3234            {
3235                let member_inline_size =
3236                    <CodecId as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3237                if inlined != (member_inline_size <= 4) {
3238                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3239                }
3240                let inner_offset;
3241                let mut inner_depth = depth.clone();
3242                if inlined {
3243                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3244                    inner_offset = next_offset;
3245                } else {
3246                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3247                    inner_depth.increment()?;
3248                }
3249                let val_ref = self.codec_id.get_or_insert_with(|| fidl::new_empty!(CodecId, D));
3250                fidl::decode!(CodecId, D, val_ref, decoder, inner_offset, inner_depth)?;
3251                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3252                {
3253                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3254                }
3255                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3256                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3257                }
3258            }
3259
3260            next_offset += envelope_size;
3261            _next_ordinal_to_read += 1;
3262            if next_offset >= end_offset {
3263                return Ok(());
3264            }
3265
3266            // Decode unknown envelopes for gaps in ordinals.
3267            while _next_ordinal_to_read < 2 {
3268                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3269                _next_ordinal_to_read += 1;
3270                next_offset += envelope_size;
3271            }
3272
3273            let next_out_of_line = decoder.next_out_of_line();
3274            let handles_before = decoder.remaining_handles();
3275            if let Some((inlined, num_bytes, num_handles)) =
3276                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3277            {
3278                let member_inline_size = <fidl::encoding::UnboundedVector<u8> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3279                if inlined != (member_inline_size <= 4) {
3280                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3281                }
3282                let inner_offset;
3283                let mut inner_depth = depth.clone();
3284                if inlined {
3285                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3286                    inner_offset = next_offset;
3287                } else {
3288                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3289                    inner_depth.increment()?;
3290                }
3291                let val_ref = self.codec_configuration.get_or_insert_with(|| {
3292                    fidl::new_empty!(fidl::encoding::UnboundedVector<u8>, D)
3293                });
3294                fidl::decode!(
3295                    fidl::encoding::UnboundedVector<u8>,
3296                    D,
3297                    val_ref,
3298                    decoder,
3299                    inner_offset,
3300                    inner_depth
3301                )?;
3302                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3303                {
3304                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3305                }
3306                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3307                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3308                }
3309            }
3310
3311            next_offset += envelope_size;
3312
3313            // Decode the remaining unknown envelopes.
3314            while next_offset < end_offset {
3315                _next_ordinal_to_read += 1;
3316                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3317                next_offset += envelope_size;
3318            }
3319
3320            Ok(())
3321        }
3322    }
3323
3324    impl L2capChannelOffloadParameters {
3325        #[inline(always)]
3326        fn max_ordinal_present(&self) -> u64 {
3327            if let Some(_) = self.initial_tx_credits {
3328                return 6;
3329            }
3330            if let Some(_) = self.remote_l2cap_maximum_payload_size {
3331                return 5;
3332            }
3333            if let Some(_) = self.local_l2cap_maximum_payload_size {
3334                return 4;
3335            }
3336            if let Some(_) = self.remote_l2cap_channel_id {
3337                return 3;
3338            }
3339            if let Some(_) = self.local_l2cap_channel_id {
3340                return 2;
3341            }
3342            if let Some(_) = self.acl_connection_handle {
3343                return 1;
3344            }
3345            0
3346        }
3347    }
3348
3349    impl fidl::encoding::ValueTypeMarker for L2capChannelOffloadParameters {
3350        type Borrowed<'a> = &'a Self;
3351        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3352            value
3353        }
3354    }
3355
3356    unsafe impl fidl::encoding::TypeMarker for L2capChannelOffloadParameters {
3357        type Owned = Self;
3358
3359        #[inline(always)]
3360        fn inline_align(_context: fidl::encoding::Context) -> usize {
3361            8
3362        }
3363
3364        #[inline(always)]
3365        fn inline_size(_context: fidl::encoding::Context) -> usize {
3366            16
3367        }
3368    }
3369
3370    unsafe impl<D: fidl::encoding::ResourceDialect>
3371        fidl::encoding::Encode<L2capChannelOffloadParameters, D>
3372        for &L2capChannelOffloadParameters
3373    {
3374        unsafe fn encode(
3375            self,
3376            encoder: &mut fidl::encoding::Encoder<'_, D>,
3377            offset: usize,
3378            mut depth: fidl::encoding::Depth,
3379        ) -> fidl::Result<()> {
3380            encoder.debug_check_bounds::<L2capChannelOffloadParameters>(offset);
3381            // Vector header
3382            let max_ordinal: u64 = self.max_ordinal_present();
3383            encoder.write_num(max_ordinal, offset);
3384            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
3385            // Calling encoder.out_of_line_offset(0) is not allowed.
3386            if max_ordinal == 0 {
3387                return Ok(());
3388            }
3389            depth.increment()?;
3390            let envelope_size = 8;
3391            let bytes_len = max_ordinal as usize * envelope_size;
3392            #[allow(unused_variables)]
3393            let offset = encoder.out_of_line_offset(bytes_len);
3394            let mut _prev_end_offset: usize = 0;
3395            if 1 > max_ordinal {
3396                return Ok(());
3397            }
3398
3399            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3400            // are envelope_size bytes.
3401            let cur_offset: usize = (1 - 1) * envelope_size;
3402
3403            // Zero reserved fields.
3404            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3405
3406            // Safety:
3407            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3408            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3409            //   envelope_size bytes, there is always sufficient room.
3410            fidl::encoding::encode_in_envelope_optional::<u16, D>(
3411                self.acl_connection_handle
3412                    .as_ref()
3413                    .map(<u16 as fidl::encoding::ValueTypeMarker>::borrow),
3414                encoder,
3415                offset + cur_offset,
3416                depth,
3417            )?;
3418
3419            _prev_end_offset = cur_offset + envelope_size;
3420            if 2 > max_ordinal {
3421                return Ok(());
3422            }
3423
3424            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3425            // are envelope_size bytes.
3426            let cur_offset: usize = (2 - 1) * envelope_size;
3427
3428            // Zero reserved fields.
3429            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3430
3431            // Safety:
3432            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3433            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3434            //   envelope_size bytes, there is always sufficient room.
3435            fidl::encoding::encode_in_envelope_optional::<u16, D>(
3436                self.local_l2cap_channel_id
3437                    .as_ref()
3438                    .map(<u16 as fidl::encoding::ValueTypeMarker>::borrow),
3439                encoder,
3440                offset + cur_offset,
3441                depth,
3442            )?;
3443
3444            _prev_end_offset = cur_offset + envelope_size;
3445            if 3 > max_ordinal {
3446                return Ok(());
3447            }
3448
3449            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3450            // are envelope_size bytes.
3451            let cur_offset: usize = (3 - 1) * envelope_size;
3452
3453            // Zero reserved fields.
3454            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3455
3456            // Safety:
3457            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3458            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3459            //   envelope_size bytes, there is always sufficient room.
3460            fidl::encoding::encode_in_envelope_optional::<u16, D>(
3461                self.remote_l2cap_channel_id
3462                    .as_ref()
3463                    .map(<u16 as fidl::encoding::ValueTypeMarker>::borrow),
3464                encoder,
3465                offset + cur_offset,
3466                depth,
3467            )?;
3468
3469            _prev_end_offset = cur_offset + envelope_size;
3470            if 4 > max_ordinal {
3471                return Ok(());
3472            }
3473
3474            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3475            // are envelope_size bytes.
3476            let cur_offset: usize = (4 - 1) * envelope_size;
3477
3478            // Zero reserved fields.
3479            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3480
3481            // Safety:
3482            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3483            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3484            //   envelope_size bytes, there is always sufficient room.
3485            fidl::encoding::encode_in_envelope_optional::<u16, D>(
3486                self.local_l2cap_maximum_payload_size
3487                    .as_ref()
3488                    .map(<u16 as fidl::encoding::ValueTypeMarker>::borrow),
3489                encoder,
3490                offset + cur_offset,
3491                depth,
3492            )?;
3493
3494            _prev_end_offset = cur_offset + envelope_size;
3495            if 5 > max_ordinal {
3496                return Ok(());
3497            }
3498
3499            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3500            // are envelope_size bytes.
3501            let cur_offset: usize = (5 - 1) * envelope_size;
3502
3503            // Zero reserved fields.
3504            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3505
3506            // Safety:
3507            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3508            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3509            //   envelope_size bytes, there is always sufficient room.
3510            fidl::encoding::encode_in_envelope_optional::<u16, D>(
3511                self.remote_l2cap_maximum_payload_size
3512                    .as_ref()
3513                    .map(<u16 as fidl::encoding::ValueTypeMarker>::borrow),
3514                encoder,
3515                offset + cur_offset,
3516                depth,
3517            )?;
3518
3519            _prev_end_offset = cur_offset + envelope_size;
3520            if 6 > max_ordinal {
3521                return Ok(());
3522            }
3523
3524            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3525            // are envelope_size bytes.
3526            let cur_offset: usize = (6 - 1) * envelope_size;
3527
3528            // Zero reserved fields.
3529            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3530
3531            // Safety:
3532            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3533            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3534            //   envelope_size bytes, there is always sufficient room.
3535            fidl::encoding::encode_in_envelope_optional::<u16, D>(
3536                self.initial_tx_credits
3537                    .as_ref()
3538                    .map(<u16 as fidl::encoding::ValueTypeMarker>::borrow),
3539                encoder,
3540                offset + cur_offset,
3541                depth,
3542            )?;
3543
3544            _prev_end_offset = cur_offset + envelope_size;
3545
3546            Ok(())
3547        }
3548    }
3549
3550    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3551        for L2capChannelOffloadParameters
3552    {
3553        #[inline(always)]
3554        fn new_empty() -> Self {
3555            Self::default()
3556        }
3557
3558        unsafe fn decode(
3559            &mut self,
3560            decoder: &mut fidl::encoding::Decoder<'_, D>,
3561            offset: usize,
3562            mut depth: fidl::encoding::Depth,
3563        ) -> fidl::Result<()> {
3564            decoder.debug_check_bounds::<Self>(offset);
3565            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
3566                None => return Err(fidl::Error::NotNullable),
3567                Some(len) => len,
3568            };
3569            // Calling decoder.out_of_line_offset(0) is not allowed.
3570            if len == 0 {
3571                return Ok(());
3572            };
3573            depth.increment()?;
3574            let envelope_size = 8;
3575            let bytes_len = len * envelope_size;
3576            let offset = decoder.out_of_line_offset(bytes_len)?;
3577            // Decode the envelope for each type.
3578            let mut _next_ordinal_to_read = 0;
3579            let mut next_offset = offset;
3580            let end_offset = offset + bytes_len;
3581            _next_ordinal_to_read += 1;
3582            if next_offset >= end_offset {
3583                return Ok(());
3584            }
3585
3586            // Decode unknown envelopes for gaps in ordinals.
3587            while _next_ordinal_to_read < 1 {
3588                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3589                _next_ordinal_to_read += 1;
3590                next_offset += envelope_size;
3591            }
3592
3593            let next_out_of_line = decoder.next_out_of_line();
3594            let handles_before = decoder.remaining_handles();
3595            if let Some((inlined, num_bytes, num_handles)) =
3596                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3597            {
3598                let member_inline_size =
3599                    <u16 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3600                if inlined != (member_inline_size <= 4) {
3601                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3602                }
3603                let inner_offset;
3604                let mut inner_depth = depth.clone();
3605                if inlined {
3606                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3607                    inner_offset = next_offset;
3608                } else {
3609                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3610                    inner_depth.increment()?;
3611                }
3612                let val_ref =
3613                    self.acl_connection_handle.get_or_insert_with(|| fidl::new_empty!(u16, D));
3614                fidl::decode!(u16, D, val_ref, decoder, inner_offset, inner_depth)?;
3615                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3616                {
3617                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3618                }
3619                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3620                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3621                }
3622            }
3623
3624            next_offset += envelope_size;
3625            _next_ordinal_to_read += 1;
3626            if next_offset >= end_offset {
3627                return Ok(());
3628            }
3629
3630            // Decode unknown envelopes for gaps in ordinals.
3631            while _next_ordinal_to_read < 2 {
3632                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3633                _next_ordinal_to_read += 1;
3634                next_offset += envelope_size;
3635            }
3636
3637            let next_out_of_line = decoder.next_out_of_line();
3638            let handles_before = decoder.remaining_handles();
3639            if let Some((inlined, num_bytes, num_handles)) =
3640                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3641            {
3642                let member_inline_size =
3643                    <u16 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3644                if inlined != (member_inline_size <= 4) {
3645                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3646                }
3647                let inner_offset;
3648                let mut inner_depth = depth.clone();
3649                if inlined {
3650                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3651                    inner_offset = next_offset;
3652                } else {
3653                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3654                    inner_depth.increment()?;
3655                }
3656                let val_ref =
3657                    self.local_l2cap_channel_id.get_or_insert_with(|| fidl::new_empty!(u16, D));
3658                fidl::decode!(u16, D, val_ref, decoder, inner_offset, inner_depth)?;
3659                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3660                {
3661                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3662                }
3663                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3664                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3665                }
3666            }
3667
3668            next_offset += envelope_size;
3669            _next_ordinal_to_read += 1;
3670            if next_offset >= end_offset {
3671                return Ok(());
3672            }
3673
3674            // Decode unknown envelopes for gaps in ordinals.
3675            while _next_ordinal_to_read < 3 {
3676                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3677                _next_ordinal_to_read += 1;
3678                next_offset += envelope_size;
3679            }
3680
3681            let next_out_of_line = decoder.next_out_of_line();
3682            let handles_before = decoder.remaining_handles();
3683            if let Some((inlined, num_bytes, num_handles)) =
3684                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3685            {
3686                let member_inline_size =
3687                    <u16 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3688                if inlined != (member_inline_size <= 4) {
3689                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3690                }
3691                let inner_offset;
3692                let mut inner_depth = depth.clone();
3693                if inlined {
3694                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3695                    inner_offset = next_offset;
3696                } else {
3697                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3698                    inner_depth.increment()?;
3699                }
3700                let val_ref =
3701                    self.remote_l2cap_channel_id.get_or_insert_with(|| fidl::new_empty!(u16, D));
3702                fidl::decode!(u16, D, val_ref, decoder, inner_offset, inner_depth)?;
3703                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3704                {
3705                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3706                }
3707                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3708                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3709                }
3710            }
3711
3712            next_offset += envelope_size;
3713            _next_ordinal_to_read += 1;
3714            if next_offset >= end_offset {
3715                return Ok(());
3716            }
3717
3718            // Decode unknown envelopes for gaps in ordinals.
3719            while _next_ordinal_to_read < 4 {
3720                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3721                _next_ordinal_to_read += 1;
3722                next_offset += envelope_size;
3723            }
3724
3725            let next_out_of_line = decoder.next_out_of_line();
3726            let handles_before = decoder.remaining_handles();
3727            if let Some((inlined, num_bytes, num_handles)) =
3728                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3729            {
3730                let member_inline_size =
3731                    <u16 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3732                if inlined != (member_inline_size <= 4) {
3733                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3734                }
3735                let inner_offset;
3736                let mut inner_depth = depth.clone();
3737                if inlined {
3738                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3739                    inner_offset = next_offset;
3740                } else {
3741                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3742                    inner_depth.increment()?;
3743                }
3744                let val_ref = self
3745                    .local_l2cap_maximum_payload_size
3746                    .get_or_insert_with(|| fidl::new_empty!(u16, D));
3747                fidl::decode!(u16, D, val_ref, decoder, inner_offset, inner_depth)?;
3748                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3749                {
3750                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3751                }
3752                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3753                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3754                }
3755            }
3756
3757            next_offset += envelope_size;
3758            _next_ordinal_to_read += 1;
3759            if next_offset >= end_offset {
3760                return Ok(());
3761            }
3762
3763            // Decode unknown envelopes for gaps in ordinals.
3764            while _next_ordinal_to_read < 5 {
3765                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3766                _next_ordinal_to_read += 1;
3767                next_offset += envelope_size;
3768            }
3769
3770            let next_out_of_line = decoder.next_out_of_line();
3771            let handles_before = decoder.remaining_handles();
3772            if let Some((inlined, num_bytes, num_handles)) =
3773                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3774            {
3775                let member_inline_size =
3776                    <u16 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3777                if inlined != (member_inline_size <= 4) {
3778                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3779                }
3780                let inner_offset;
3781                let mut inner_depth = depth.clone();
3782                if inlined {
3783                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3784                    inner_offset = next_offset;
3785                } else {
3786                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3787                    inner_depth.increment()?;
3788                }
3789                let val_ref = self
3790                    .remote_l2cap_maximum_payload_size
3791                    .get_or_insert_with(|| fidl::new_empty!(u16, D));
3792                fidl::decode!(u16, D, val_ref, decoder, inner_offset, inner_depth)?;
3793                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3794                {
3795                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3796                }
3797                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3798                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3799                }
3800            }
3801
3802            next_offset += envelope_size;
3803            _next_ordinal_to_read += 1;
3804            if next_offset >= end_offset {
3805                return Ok(());
3806            }
3807
3808            // Decode unknown envelopes for gaps in ordinals.
3809            while _next_ordinal_to_read < 6 {
3810                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3811                _next_ordinal_to_read += 1;
3812                next_offset += envelope_size;
3813            }
3814
3815            let next_out_of_line = decoder.next_out_of_line();
3816            let handles_before = decoder.remaining_handles();
3817            if let Some((inlined, num_bytes, num_handles)) =
3818                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3819            {
3820                let member_inline_size =
3821                    <u16 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3822                if inlined != (member_inline_size <= 4) {
3823                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3824                }
3825                let inner_offset;
3826                let mut inner_depth = depth.clone();
3827                if inlined {
3828                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3829                    inner_offset = next_offset;
3830                } else {
3831                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3832                    inner_depth.increment()?;
3833                }
3834                let val_ref =
3835                    self.initial_tx_credits.get_or_insert_with(|| fidl::new_empty!(u16, D));
3836                fidl::decode!(u16, D, val_ref, decoder, inner_offset, inner_depth)?;
3837                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3838                {
3839                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3840                }
3841                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3842                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3843                }
3844            }
3845
3846            next_offset += envelope_size;
3847
3848            // Decode the remaining unknown envelopes.
3849            while next_offset < end_offset {
3850                _next_ordinal_to_read += 1;
3851                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3852                next_offset += envelope_size;
3853            }
3854
3855            Ok(())
3856        }
3857    }
3858
3859    impl SecurityRequirements {
3860        #[inline(always)]
3861        fn max_ordinal_present(&self) -> u64 {
3862            if let Some(_) = self.secure_connections_required {
3863                return 2;
3864            }
3865            if let Some(_) = self.authentication_required {
3866                return 1;
3867            }
3868            0
3869        }
3870    }
3871
3872    impl fidl::encoding::ValueTypeMarker for SecurityRequirements {
3873        type Borrowed<'a> = &'a Self;
3874        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3875            value
3876        }
3877    }
3878
3879    unsafe impl fidl::encoding::TypeMarker for SecurityRequirements {
3880        type Owned = Self;
3881
3882        #[inline(always)]
3883        fn inline_align(_context: fidl::encoding::Context) -> usize {
3884            8
3885        }
3886
3887        #[inline(always)]
3888        fn inline_size(_context: fidl::encoding::Context) -> usize {
3889            16
3890        }
3891    }
3892
3893    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<SecurityRequirements, D>
3894        for &SecurityRequirements
3895    {
3896        unsafe fn encode(
3897            self,
3898            encoder: &mut fidl::encoding::Encoder<'_, D>,
3899            offset: usize,
3900            mut depth: fidl::encoding::Depth,
3901        ) -> fidl::Result<()> {
3902            encoder.debug_check_bounds::<SecurityRequirements>(offset);
3903            // Vector header
3904            let max_ordinal: u64 = self.max_ordinal_present();
3905            encoder.write_num(max_ordinal, offset);
3906            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
3907            // Calling encoder.out_of_line_offset(0) is not allowed.
3908            if max_ordinal == 0 {
3909                return Ok(());
3910            }
3911            depth.increment()?;
3912            let envelope_size = 8;
3913            let bytes_len = max_ordinal as usize * envelope_size;
3914            #[allow(unused_variables)]
3915            let offset = encoder.out_of_line_offset(bytes_len);
3916            let mut _prev_end_offset: usize = 0;
3917            if 1 > max_ordinal {
3918                return Ok(());
3919            }
3920
3921            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3922            // are envelope_size bytes.
3923            let cur_offset: usize = (1 - 1) * envelope_size;
3924
3925            // Zero reserved fields.
3926            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3927
3928            // Safety:
3929            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3930            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3931            //   envelope_size bytes, there is always sufficient room.
3932            fidl::encoding::encode_in_envelope_optional::<bool, D>(
3933                self.authentication_required
3934                    .as_ref()
3935                    .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
3936                encoder,
3937                offset + cur_offset,
3938                depth,
3939            )?;
3940
3941            _prev_end_offset = cur_offset + envelope_size;
3942            if 2 > max_ordinal {
3943                return Ok(());
3944            }
3945
3946            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3947            // are envelope_size bytes.
3948            let cur_offset: usize = (2 - 1) * envelope_size;
3949
3950            // Zero reserved fields.
3951            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3952
3953            // Safety:
3954            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3955            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3956            //   envelope_size bytes, there is always sufficient room.
3957            fidl::encoding::encode_in_envelope_optional::<bool, D>(
3958                self.secure_connections_required
3959                    .as_ref()
3960                    .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
3961                encoder,
3962                offset + cur_offset,
3963                depth,
3964            )?;
3965
3966            _prev_end_offset = cur_offset + envelope_size;
3967
3968            Ok(())
3969        }
3970    }
3971
3972    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SecurityRequirements {
3973        #[inline(always)]
3974        fn new_empty() -> Self {
3975            Self::default()
3976        }
3977
3978        unsafe fn decode(
3979            &mut self,
3980            decoder: &mut fidl::encoding::Decoder<'_, D>,
3981            offset: usize,
3982            mut depth: fidl::encoding::Depth,
3983        ) -> fidl::Result<()> {
3984            decoder.debug_check_bounds::<Self>(offset);
3985            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
3986                None => return Err(fidl::Error::NotNullable),
3987                Some(len) => len,
3988            };
3989            // Calling decoder.out_of_line_offset(0) is not allowed.
3990            if len == 0 {
3991                return Ok(());
3992            };
3993            depth.increment()?;
3994            let envelope_size = 8;
3995            let bytes_len = len * envelope_size;
3996            let offset = decoder.out_of_line_offset(bytes_len)?;
3997            // Decode the envelope for each type.
3998            let mut _next_ordinal_to_read = 0;
3999            let mut next_offset = offset;
4000            let end_offset = offset + bytes_len;
4001            _next_ordinal_to_read += 1;
4002            if next_offset >= end_offset {
4003                return Ok(());
4004            }
4005
4006            // Decode unknown envelopes for gaps in ordinals.
4007            while _next_ordinal_to_read < 1 {
4008                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4009                _next_ordinal_to_read += 1;
4010                next_offset += envelope_size;
4011            }
4012
4013            let next_out_of_line = decoder.next_out_of_line();
4014            let handles_before = decoder.remaining_handles();
4015            if let Some((inlined, num_bytes, num_handles)) =
4016                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4017            {
4018                let member_inline_size =
4019                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4020                if inlined != (member_inline_size <= 4) {
4021                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4022                }
4023                let inner_offset;
4024                let mut inner_depth = depth.clone();
4025                if inlined {
4026                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4027                    inner_offset = next_offset;
4028                } else {
4029                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4030                    inner_depth.increment()?;
4031                }
4032                let val_ref =
4033                    self.authentication_required.get_or_insert_with(|| fidl::new_empty!(bool, D));
4034                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
4035                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4036                {
4037                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4038                }
4039                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4040                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4041                }
4042            }
4043
4044            next_offset += envelope_size;
4045            _next_ordinal_to_read += 1;
4046            if next_offset >= end_offset {
4047                return Ok(());
4048            }
4049
4050            // Decode unknown envelopes for gaps in ordinals.
4051            while _next_ordinal_to_read < 2 {
4052                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4053                _next_ordinal_to_read += 1;
4054                next_offset += envelope_size;
4055            }
4056
4057            let next_out_of_line = decoder.next_out_of_line();
4058            let handles_before = decoder.remaining_handles();
4059            if let Some((inlined, num_bytes, num_handles)) =
4060                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4061            {
4062                let member_inline_size =
4063                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4064                if inlined != (member_inline_size <= 4) {
4065                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4066                }
4067                let inner_offset;
4068                let mut inner_depth = depth.clone();
4069                if inlined {
4070                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4071                    inner_offset = next_offset;
4072                } else {
4073                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4074                    inner_depth.increment()?;
4075                }
4076                let val_ref = self
4077                    .secure_connections_required
4078                    .get_or_insert_with(|| fidl::new_empty!(bool, D));
4079                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
4080                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4081                {
4082                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4083                }
4084                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4085                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4086                }
4087            }
4088
4089            next_offset += envelope_size;
4090
4091            // Decode the remaining unknown envelopes.
4092            while next_offset < end_offset {
4093                _next_ordinal_to_read += 1;
4094                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4095                next_offset += envelope_size;
4096            }
4097
4098            Ok(())
4099        }
4100    }
4101
4102    impl VendorCodingFormat {
4103        #[inline(always)]
4104        fn max_ordinal_present(&self) -> u64 {
4105            if let Some(_) = self.vendor_id {
4106                return 2;
4107            }
4108            if let Some(_) = self.company_id {
4109                return 1;
4110            }
4111            0
4112        }
4113    }
4114
4115    impl fidl::encoding::ValueTypeMarker for VendorCodingFormat {
4116        type Borrowed<'a> = &'a Self;
4117        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4118            value
4119        }
4120    }
4121
4122    unsafe impl fidl::encoding::TypeMarker for VendorCodingFormat {
4123        type Owned = Self;
4124
4125        #[inline(always)]
4126        fn inline_align(_context: fidl::encoding::Context) -> usize {
4127            8
4128        }
4129
4130        #[inline(always)]
4131        fn inline_size(_context: fidl::encoding::Context) -> usize {
4132            16
4133        }
4134    }
4135
4136    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<VendorCodingFormat, D>
4137        for &VendorCodingFormat
4138    {
4139        unsafe fn encode(
4140            self,
4141            encoder: &mut fidl::encoding::Encoder<'_, D>,
4142            offset: usize,
4143            mut depth: fidl::encoding::Depth,
4144        ) -> fidl::Result<()> {
4145            encoder.debug_check_bounds::<VendorCodingFormat>(offset);
4146            // Vector header
4147            let max_ordinal: u64 = self.max_ordinal_present();
4148            encoder.write_num(max_ordinal, offset);
4149            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
4150            // Calling encoder.out_of_line_offset(0) is not allowed.
4151            if max_ordinal == 0 {
4152                return Ok(());
4153            }
4154            depth.increment()?;
4155            let envelope_size = 8;
4156            let bytes_len = max_ordinal as usize * envelope_size;
4157            #[allow(unused_variables)]
4158            let offset = encoder.out_of_line_offset(bytes_len);
4159            let mut _prev_end_offset: usize = 0;
4160            if 1 > max_ordinal {
4161                return Ok(());
4162            }
4163
4164            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4165            // are envelope_size bytes.
4166            let cur_offset: usize = (1 - 1) * envelope_size;
4167
4168            // Zero reserved fields.
4169            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4170
4171            // Safety:
4172            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4173            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4174            //   envelope_size bytes, there is always sufficient room.
4175            fidl::encoding::encode_in_envelope_optional::<u16, D>(
4176                self.company_id.as_ref().map(<u16 as fidl::encoding::ValueTypeMarker>::borrow),
4177                encoder,
4178                offset + cur_offset,
4179                depth,
4180            )?;
4181
4182            _prev_end_offset = cur_offset + envelope_size;
4183            if 2 > max_ordinal {
4184                return Ok(());
4185            }
4186
4187            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4188            // are envelope_size bytes.
4189            let cur_offset: usize = (2 - 1) * envelope_size;
4190
4191            // Zero reserved fields.
4192            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4193
4194            // Safety:
4195            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4196            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4197            //   envelope_size bytes, there is always sufficient room.
4198            fidl::encoding::encode_in_envelope_optional::<u16, D>(
4199                self.vendor_id.as_ref().map(<u16 as fidl::encoding::ValueTypeMarker>::borrow),
4200                encoder,
4201                offset + cur_offset,
4202                depth,
4203            )?;
4204
4205            _prev_end_offset = cur_offset + envelope_size;
4206
4207            Ok(())
4208        }
4209    }
4210
4211    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for VendorCodingFormat {
4212        #[inline(always)]
4213        fn new_empty() -> Self {
4214            Self::default()
4215        }
4216
4217        unsafe fn decode(
4218            &mut self,
4219            decoder: &mut fidl::encoding::Decoder<'_, D>,
4220            offset: usize,
4221            mut depth: fidl::encoding::Depth,
4222        ) -> fidl::Result<()> {
4223            decoder.debug_check_bounds::<Self>(offset);
4224            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
4225                None => return Err(fidl::Error::NotNullable),
4226                Some(len) => len,
4227            };
4228            // Calling decoder.out_of_line_offset(0) is not allowed.
4229            if len == 0 {
4230                return Ok(());
4231            };
4232            depth.increment()?;
4233            let envelope_size = 8;
4234            let bytes_len = len * envelope_size;
4235            let offset = decoder.out_of_line_offset(bytes_len)?;
4236            // Decode the envelope for each type.
4237            let mut _next_ordinal_to_read = 0;
4238            let mut next_offset = offset;
4239            let end_offset = offset + bytes_len;
4240            _next_ordinal_to_read += 1;
4241            if next_offset >= end_offset {
4242                return Ok(());
4243            }
4244
4245            // Decode unknown envelopes for gaps in ordinals.
4246            while _next_ordinal_to_read < 1 {
4247                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4248                _next_ordinal_to_read += 1;
4249                next_offset += envelope_size;
4250            }
4251
4252            let next_out_of_line = decoder.next_out_of_line();
4253            let handles_before = decoder.remaining_handles();
4254            if let Some((inlined, num_bytes, num_handles)) =
4255                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4256            {
4257                let member_inline_size =
4258                    <u16 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4259                if inlined != (member_inline_size <= 4) {
4260                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4261                }
4262                let inner_offset;
4263                let mut inner_depth = depth.clone();
4264                if inlined {
4265                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4266                    inner_offset = next_offset;
4267                } else {
4268                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4269                    inner_depth.increment()?;
4270                }
4271                let val_ref = self.company_id.get_or_insert_with(|| fidl::new_empty!(u16, D));
4272                fidl::decode!(u16, D, val_ref, decoder, inner_offset, inner_depth)?;
4273                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4274                {
4275                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4276                }
4277                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4278                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4279                }
4280            }
4281
4282            next_offset += envelope_size;
4283            _next_ordinal_to_read += 1;
4284            if next_offset >= end_offset {
4285                return Ok(());
4286            }
4287
4288            // Decode unknown envelopes for gaps in ordinals.
4289            while _next_ordinal_to_read < 2 {
4290                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4291                _next_ordinal_to_read += 1;
4292                next_offset += envelope_size;
4293            }
4294
4295            let next_out_of_line = decoder.next_out_of_line();
4296            let handles_before = decoder.remaining_handles();
4297            if let Some((inlined, num_bytes, num_handles)) =
4298                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4299            {
4300                let member_inline_size =
4301                    <u16 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4302                if inlined != (member_inline_size <= 4) {
4303                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4304                }
4305                let inner_offset;
4306                let mut inner_depth = depth.clone();
4307                if inlined {
4308                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4309                    inner_offset = next_offset;
4310                } else {
4311                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4312                    inner_depth.increment()?;
4313                }
4314                let val_ref = self.vendor_id.get_or_insert_with(|| fidl::new_empty!(u16, D));
4315                fidl::decode!(u16, D, val_ref, decoder, inner_offset, inner_depth)?;
4316                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4317                {
4318                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4319                }
4320                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4321                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4322                }
4323            }
4324
4325            next_offset += envelope_size;
4326
4327            // Decode the remaining unknown envelopes.
4328            while next_offset < end_offset {
4329                _next_ordinal_to_read += 1;
4330                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4331                next_offset += envelope_size;
4332            }
4333
4334            Ok(())
4335        }
4336    }
4337
4338    impl fidl::encoding::ValueTypeMarker for CodecId {
4339        type Borrowed<'a> = &'a Self;
4340        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4341            value
4342        }
4343    }
4344
4345    unsafe impl fidl::encoding::TypeMarker for CodecId {
4346        type Owned = Self;
4347
4348        #[inline(always)]
4349        fn inline_align(_context: fidl::encoding::Context) -> usize {
4350            8
4351        }
4352
4353        #[inline(always)]
4354        fn inline_size(_context: fidl::encoding::Context) -> usize {
4355            16
4356        }
4357    }
4358
4359    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<CodecId, D> for &CodecId {
4360        #[inline]
4361        unsafe fn encode(
4362            self,
4363            encoder: &mut fidl::encoding::Encoder<'_, D>,
4364            offset: usize,
4365            _depth: fidl::encoding::Depth,
4366        ) -> fidl::Result<()> {
4367            encoder.debug_check_bounds::<CodecId>(offset);
4368            encoder.write_num::<u64>(self.ordinal(), offset);
4369            match self {
4370                CodecId::AssignedFormat(ref val) => {
4371                    fidl::encoding::encode_in_envelope::<AssignedCodingFormat, D>(
4372                        <AssignedCodingFormat as fidl::encoding::ValueTypeMarker>::borrow(val),
4373                        encoder,
4374                        offset + 8,
4375                        _depth,
4376                    )
4377                }
4378                CodecId::VendorFormat(ref val) => {
4379                    fidl::encoding::encode_in_envelope::<VendorCodingFormat, D>(
4380                        <VendorCodingFormat as fidl::encoding::ValueTypeMarker>::borrow(val),
4381                        encoder,
4382                        offset + 8,
4383                        _depth,
4384                    )
4385                }
4386                CodecId::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
4387            }
4388        }
4389    }
4390
4391    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for CodecId {
4392        #[inline(always)]
4393        fn new_empty() -> Self {
4394            Self::__SourceBreaking { unknown_ordinal: 0 }
4395        }
4396
4397        #[inline]
4398        unsafe fn decode(
4399            &mut self,
4400            decoder: &mut fidl::encoding::Decoder<'_, D>,
4401            offset: usize,
4402            mut depth: fidl::encoding::Depth,
4403        ) -> fidl::Result<()> {
4404            decoder.debug_check_bounds::<Self>(offset);
4405            #[allow(unused_variables)]
4406            let next_out_of_line = decoder.next_out_of_line();
4407            let handles_before = decoder.remaining_handles();
4408            let (ordinal, inlined, num_bytes, num_handles) =
4409                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
4410
4411            let member_inline_size = match ordinal {
4412                1 => <AssignedCodingFormat as fidl::encoding::TypeMarker>::inline_size(
4413                    decoder.context,
4414                ),
4415                2 => {
4416                    <VendorCodingFormat as fidl::encoding::TypeMarker>::inline_size(decoder.context)
4417                }
4418                0 => return Err(fidl::Error::UnknownUnionTag),
4419                _ => num_bytes as usize,
4420            };
4421
4422            if inlined != (member_inline_size <= 4) {
4423                return Err(fidl::Error::InvalidInlineBitInEnvelope);
4424            }
4425            let _inner_offset;
4426            if inlined {
4427                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
4428                _inner_offset = offset + 8;
4429            } else {
4430                depth.increment()?;
4431                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4432            }
4433            match ordinal {
4434                1 => {
4435                    #[allow(irrefutable_let_patterns)]
4436                    if let CodecId::AssignedFormat(_) = self {
4437                        // Do nothing, read the value into the object
4438                    } else {
4439                        // Initialize `self` to the right variant
4440                        *self = CodecId::AssignedFormat(fidl::new_empty!(AssignedCodingFormat, D));
4441                    }
4442                    #[allow(irrefutable_let_patterns)]
4443                    if let CodecId::AssignedFormat(ref mut val) = self {
4444                        fidl::decode!(AssignedCodingFormat, D, val, decoder, _inner_offset, depth)?;
4445                    } else {
4446                        unreachable!()
4447                    }
4448                }
4449                2 => {
4450                    #[allow(irrefutable_let_patterns)]
4451                    if let CodecId::VendorFormat(_) = self {
4452                        // Do nothing, read the value into the object
4453                    } else {
4454                        // Initialize `self` to the right variant
4455                        *self = CodecId::VendorFormat(fidl::new_empty!(VendorCodingFormat, D));
4456                    }
4457                    #[allow(irrefutable_let_patterns)]
4458                    if let CodecId::VendorFormat(ref mut val) = self {
4459                        fidl::decode!(VendorCodingFormat, D, val, decoder, _inner_offset, depth)?;
4460                    } else {
4461                        unreachable!()
4462                    }
4463                }
4464                #[allow(deprecated)]
4465                ordinal => {
4466                    for _ in 0..num_handles {
4467                        decoder.drop_next_handle()?;
4468                    }
4469                    *self = CodecId::__SourceBreaking { unknown_ordinal: ordinal };
4470                }
4471            }
4472            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
4473                return Err(fidl::Error::InvalidNumBytesInEnvelope);
4474            }
4475            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4476                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4477            }
4478            Ok(())
4479        }
4480    }
4481}