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/// Authentication and permission requirements to access an advertised service.
845/// BR/EDR only.
846#[derive(Clone, Debug, Default, PartialEq)]
847pub struct SecurityRequirements {
848    /// If present and true, the physical link must be authenticated with
849    /// on-path attacker protection to access this service.  If missing then
850    /// authentication is not required.
851    pub authentication_required: Option<bool>,
852    /// If present and true, the physical link must be encrypted with a Secure
853    /// Connections key to access this service if the host is capable.
854    /// Advertisement will fail if the host does not support Secure Connections.
855    /// See Bluetooth Spec v5.2, Vol 3, Part C, Sec 5.2.2.8.
856    pub secure_connections_required: Option<bool>,
857    #[doc(hidden)]
858    pub __source_breaking: fidl::marker::SourceBreaking,
859}
860
861impl fidl::Persistable for SecurityRequirements {}
862
863/// Vendor-defined coding format.
864#[derive(Clone, Debug, Default, PartialEq)]
865pub struct VendorCodingFormat {
866    /// Company ID, see Assigned Numbers document for values
867    /// https://www.bluetooth.com/specifications/assigned-numbers/
868    /// Required.
869    pub company_id: Option<u16>,
870    /// Vendor-defined codec ID.
871    /// Required.
872    pub vendor_id: Option<u16>,
873    #[doc(hidden)]
874    pub __source_breaking: fidl::marker::SourceBreaking,
875}
876
877impl fidl::Persistable for VendorCodingFormat {}
878
879/// Specifies a coding format.
880#[derive(Clone, Debug)]
881pub enum CodecId {
882    /// Coding format defined by Bluetooth SIG.
883    AssignedFormat(AssignedCodingFormat),
884    /// Coding format defined by vendor.
885    VendorFormat(VendorCodingFormat),
886    #[doc(hidden)]
887    __SourceBreaking { unknown_ordinal: u64 },
888}
889
890/// Pattern that matches an unknown `CodecId` member.
891#[macro_export]
892macro_rules! CodecIdUnknown {
893    () => {
894        _
895    };
896}
897
898// Custom PartialEq so that unknown variants are not equal to themselves.
899impl PartialEq for CodecId {
900    fn eq(&self, other: &Self) -> bool {
901        match (self, other) {
902            (Self::AssignedFormat(x), Self::AssignedFormat(y)) => *x == *y,
903            (Self::VendorFormat(x), Self::VendorFormat(y)) => *x == *y,
904            _ => false,
905        }
906    }
907}
908
909impl CodecId {
910    #[inline]
911    pub fn ordinal(&self) -> u64 {
912        match *self {
913            Self::AssignedFormat(_) => 1,
914            Self::VendorFormat(_) => 2,
915            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
916        }
917    }
918
919    #[inline]
920    pub fn unknown_variant_for_testing() -> Self {
921        Self::__SourceBreaking { unknown_ordinal: 0 }
922    }
923
924    #[inline]
925    pub fn is_unknown(&self) -> bool {
926        match self {
927            Self::__SourceBreaking { .. } => true,
928            _ => false,
929        }
930    }
931}
932
933impl fidl::Persistable for CodecId {}
934
935mod internal {
936    use super::*;
937    unsafe impl fidl::encoding::TypeMarker for AddressType {
938        type Owned = Self;
939
940        #[inline(always)]
941        fn inline_align(_context: fidl::encoding::Context) -> usize {
942            std::mem::align_of::<u8>()
943        }
944
945        #[inline(always)]
946        fn inline_size(_context: fidl::encoding::Context) -> usize {
947            std::mem::size_of::<u8>()
948        }
949
950        #[inline(always)]
951        fn encode_is_copy() -> bool {
952            true
953        }
954
955        #[inline(always)]
956        fn decode_is_copy() -> bool {
957            false
958        }
959    }
960
961    impl fidl::encoding::ValueTypeMarker for AddressType {
962        type Borrowed<'a> = Self;
963        #[inline(always)]
964        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
965            *value
966        }
967    }
968
969    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for AddressType {
970        #[inline]
971        unsafe fn encode(
972            self,
973            encoder: &mut fidl::encoding::Encoder<'_, D>,
974            offset: usize,
975            _depth: fidl::encoding::Depth,
976        ) -> fidl::Result<()> {
977            encoder.debug_check_bounds::<Self>(offset);
978            encoder.write_num(self.into_primitive(), offset);
979            Ok(())
980        }
981    }
982
983    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for AddressType {
984        #[inline(always)]
985        fn new_empty() -> Self {
986            Self::Public
987        }
988
989        #[inline]
990        unsafe fn decode(
991            &mut self,
992            decoder: &mut fidl::encoding::Decoder<'_, D>,
993            offset: usize,
994            _depth: fidl::encoding::Depth,
995        ) -> fidl::Result<()> {
996            decoder.debug_check_bounds::<Self>(offset);
997            let prim = decoder.read_num::<u8>(offset);
998
999            *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
1000            Ok(())
1001        }
1002    }
1003    unsafe impl fidl::encoding::TypeMarker for Appearance {
1004        type Owned = Self;
1005
1006        #[inline(always)]
1007        fn inline_align(_context: fidl::encoding::Context) -> usize {
1008            std::mem::align_of::<u16>()
1009        }
1010
1011        #[inline(always)]
1012        fn inline_size(_context: fidl::encoding::Context) -> usize {
1013            std::mem::size_of::<u16>()
1014        }
1015
1016        #[inline(always)]
1017        fn encode_is_copy() -> bool {
1018            false
1019        }
1020
1021        #[inline(always)]
1022        fn decode_is_copy() -> bool {
1023            false
1024        }
1025    }
1026
1027    impl fidl::encoding::ValueTypeMarker for Appearance {
1028        type Borrowed<'a> = Self;
1029        #[inline(always)]
1030        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1031            *value
1032        }
1033    }
1034
1035    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for Appearance {
1036        #[inline]
1037        unsafe fn encode(
1038            self,
1039            encoder: &mut fidl::encoding::Encoder<'_, D>,
1040            offset: usize,
1041            _depth: fidl::encoding::Depth,
1042        ) -> fidl::Result<()> {
1043            encoder.debug_check_bounds::<Self>(offset);
1044            encoder.write_num(self.into_primitive(), offset);
1045            Ok(())
1046        }
1047    }
1048
1049    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Appearance {
1050        #[inline(always)]
1051        fn new_empty() -> Self {
1052            Self::unknown()
1053        }
1054
1055        #[inline]
1056        unsafe fn decode(
1057            &mut self,
1058            decoder: &mut fidl::encoding::Decoder<'_, D>,
1059            offset: usize,
1060            _depth: fidl::encoding::Depth,
1061        ) -> fidl::Result<()> {
1062            decoder.debug_check_bounds::<Self>(offset);
1063            let prim = decoder.read_num::<u16>(offset);
1064
1065            *self = Self::from_primitive_allow_unknown(prim);
1066            Ok(())
1067        }
1068    }
1069    unsafe impl fidl::encoding::TypeMarker for AssignedCodingFormat {
1070        type Owned = Self;
1071
1072        #[inline(always)]
1073        fn inline_align(_context: fidl::encoding::Context) -> usize {
1074            std::mem::align_of::<u8>()
1075        }
1076
1077        #[inline(always)]
1078        fn inline_size(_context: fidl::encoding::Context) -> usize {
1079            std::mem::size_of::<u8>()
1080        }
1081
1082        #[inline(always)]
1083        fn encode_is_copy() -> bool {
1084            false
1085        }
1086
1087        #[inline(always)]
1088        fn decode_is_copy() -> bool {
1089            false
1090        }
1091    }
1092
1093    impl fidl::encoding::ValueTypeMarker for AssignedCodingFormat {
1094        type Borrowed<'a> = Self;
1095        #[inline(always)]
1096        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1097            *value
1098        }
1099    }
1100
1101    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
1102        for AssignedCodingFormat
1103    {
1104        #[inline]
1105        unsafe fn encode(
1106            self,
1107            encoder: &mut fidl::encoding::Encoder<'_, D>,
1108            offset: usize,
1109            _depth: fidl::encoding::Depth,
1110        ) -> fidl::Result<()> {
1111            encoder.debug_check_bounds::<Self>(offset);
1112            encoder.write_num(self.into_primitive(), offset);
1113            Ok(())
1114        }
1115    }
1116
1117    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for AssignedCodingFormat {
1118        #[inline(always)]
1119        fn new_empty() -> Self {
1120            Self::unknown()
1121        }
1122
1123        #[inline]
1124        unsafe fn decode(
1125            &mut self,
1126            decoder: &mut fidl::encoding::Decoder<'_, D>,
1127            offset: usize,
1128            _depth: fidl::encoding::Depth,
1129        ) -> fidl::Result<()> {
1130            decoder.debug_check_bounds::<Self>(offset);
1131            let prim = decoder.read_num::<u8>(offset);
1132
1133            *self = Self::from_primitive_allow_unknown(prim);
1134            Ok(())
1135        }
1136    }
1137    unsafe impl fidl::encoding::TypeMarker for ChannelMode {
1138        type Owned = Self;
1139
1140        #[inline(always)]
1141        fn inline_align(_context: fidl::encoding::Context) -> usize {
1142            std::mem::align_of::<u32>()
1143        }
1144
1145        #[inline(always)]
1146        fn inline_size(_context: fidl::encoding::Context) -> usize {
1147            std::mem::size_of::<u32>()
1148        }
1149
1150        #[inline(always)]
1151        fn encode_is_copy() -> bool {
1152            false
1153        }
1154
1155        #[inline(always)]
1156        fn decode_is_copy() -> bool {
1157            false
1158        }
1159    }
1160
1161    impl fidl::encoding::ValueTypeMarker for ChannelMode {
1162        type Borrowed<'a> = Self;
1163        #[inline(always)]
1164        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1165            *value
1166        }
1167    }
1168
1169    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for ChannelMode {
1170        #[inline]
1171        unsafe fn encode(
1172            self,
1173            encoder: &mut fidl::encoding::Encoder<'_, D>,
1174            offset: usize,
1175            _depth: fidl::encoding::Depth,
1176        ) -> fidl::Result<()> {
1177            encoder.debug_check_bounds::<Self>(offset);
1178            encoder.write_num(self.into_primitive(), offset);
1179            Ok(())
1180        }
1181    }
1182
1183    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ChannelMode {
1184        #[inline(always)]
1185        fn new_empty() -> Self {
1186            Self::unknown()
1187        }
1188
1189        #[inline]
1190        unsafe fn decode(
1191            &mut self,
1192            decoder: &mut fidl::encoding::Decoder<'_, D>,
1193            offset: usize,
1194            _depth: fidl::encoding::Depth,
1195        ) -> fidl::Result<()> {
1196            decoder.debug_check_bounds::<Self>(offset);
1197            let prim = decoder.read_num::<u32>(offset);
1198
1199            *self = Self::from_primitive_allow_unknown(prim);
1200            Ok(())
1201        }
1202    }
1203    unsafe impl fidl::encoding::TypeMarker for ConnectionRole {
1204        type Owned = Self;
1205
1206        #[inline(always)]
1207        fn inline_align(_context: fidl::encoding::Context) -> usize {
1208            std::mem::align_of::<u32>()
1209        }
1210
1211        #[inline(always)]
1212        fn inline_size(_context: fidl::encoding::Context) -> usize {
1213            std::mem::size_of::<u32>()
1214        }
1215
1216        #[inline(always)]
1217        fn encode_is_copy() -> bool {
1218            true
1219        }
1220
1221        #[inline(always)]
1222        fn decode_is_copy() -> bool {
1223            false
1224        }
1225    }
1226
1227    impl fidl::encoding::ValueTypeMarker for ConnectionRole {
1228        type Borrowed<'a> = Self;
1229        #[inline(always)]
1230        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1231            *value
1232        }
1233    }
1234
1235    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for ConnectionRole {
1236        #[inline]
1237        unsafe fn encode(
1238            self,
1239            encoder: &mut fidl::encoding::Encoder<'_, D>,
1240            offset: usize,
1241            _depth: fidl::encoding::Depth,
1242        ) -> fidl::Result<()> {
1243            encoder.debug_check_bounds::<Self>(offset);
1244            encoder.write_num(self.into_primitive(), offset);
1245            Ok(())
1246        }
1247    }
1248
1249    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ConnectionRole {
1250        #[inline(always)]
1251        fn new_empty() -> Self {
1252            Self::Leader
1253        }
1254
1255        #[inline]
1256        unsafe fn decode(
1257            &mut self,
1258            decoder: &mut fidl::encoding::Decoder<'_, D>,
1259            offset: usize,
1260            _depth: fidl::encoding::Depth,
1261        ) -> fidl::Result<()> {
1262            decoder.debug_check_bounds::<Self>(offset);
1263            let prim = decoder.read_num::<u32>(offset);
1264
1265            *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
1266            Ok(())
1267        }
1268    }
1269    unsafe impl fidl::encoding::TypeMarker for DataDirection {
1270        type Owned = Self;
1271
1272        #[inline(always)]
1273        fn inline_align(_context: fidl::encoding::Context) -> usize {
1274            std::mem::align_of::<u8>()
1275        }
1276
1277        #[inline(always)]
1278        fn inline_size(_context: fidl::encoding::Context) -> usize {
1279            std::mem::size_of::<u8>()
1280        }
1281
1282        #[inline(always)]
1283        fn encode_is_copy() -> bool {
1284            true
1285        }
1286
1287        #[inline(always)]
1288        fn decode_is_copy() -> bool {
1289            false
1290        }
1291    }
1292
1293    impl fidl::encoding::ValueTypeMarker for DataDirection {
1294        type Borrowed<'a> = Self;
1295        #[inline(always)]
1296        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1297            *value
1298        }
1299    }
1300
1301    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for DataDirection {
1302        #[inline]
1303        unsafe fn encode(
1304            self,
1305            encoder: &mut fidl::encoding::Encoder<'_, D>,
1306            offset: usize,
1307            _depth: fidl::encoding::Depth,
1308        ) -> fidl::Result<()> {
1309            encoder.debug_check_bounds::<Self>(offset);
1310            encoder.write_num(self.into_primitive(), offset);
1311            Ok(())
1312        }
1313    }
1314
1315    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for DataDirection {
1316        #[inline(always)]
1317        fn new_empty() -> Self {
1318            Self::Input
1319        }
1320
1321        #[inline]
1322        unsafe fn decode(
1323            &mut self,
1324            decoder: &mut fidl::encoding::Decoder<'_, D>,
1325            offset: usize,
1326            _depth: fidl::encoding::Depth,
1327        ) -> fidl::Result<()> {
1328            decoder.debug_check_bounds::<Self>(offset);
1329            let prim = decoder.read_num::<u8>(offset);
1330
1331            *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
1332            Ok(())
1333        }
1334    }
1335    unsafe impl fidl::encoding::TypeMarker for ErrorCode {
1336        type Owned = Self;
1337
1338        #[inline(always)]
1339        fn inline_align(_context: fidl::encoding::Context) -> usize {
1340            std::mem::align_of::<u32>()
1341        }
1342
1343        #[inline(always)]
1344        fn inline_size(_context: fidl::encoding::Context) -> usize {
1345            std::mem::size_of::<u32>()
1346        }
1347
1348        #[inline(always)]
1349        fn encode_is_copy() -> bool {
1350            true
1351        }
1352
1353        #[inline(always)]
1354        fn decode_is_copy() -> bool {
1355            false
1356        }
1357    }
1358
1359    impl fidl::encoding::ValueTypeMarker for ErrorCode {
1360        type Borrowed<'a> = Self;
1361        #[inline(always)]
1362        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1363            *value
1364        }
1365    }
1366
1367    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for ErrorCode {
1368        #[inline]
1369        unsafe fn encode(
1370            self,
1371            encoder: &mut fidl::encoding::Encoder<'_, D>,
1372            offset: usize,
1373            _depth: fidl::encoding::Depth,
1374        ) -> fidl::Result<()> {
1375            encoder.debug_check_bounds::<Self>(offset);
1376            encoder.write_num(self.into_primitive(), offset);
1377            Ok(())
1378        }
1379    }
1380
1381    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ErrorCode {
1382        #[inline(always)]
1383        fn new_empty() -> Self {
1384            Self::Unknown
1385        }
1386
1387        #[inline]
1388        unsafe fn decode(
1389            &mut self,
1390            decoder: &mut fidl::encoding::Decoder<'_, D>,
1391            offset: usize,
1392            _depth: fidl::encoding::Depth,
1393        ) -> fidl::Result<()> {
1394            decoder.debug_check_bounds::<Self>(offset);
1395            let prim = decoder.read_num::<u32>(offset);
1396
1397            *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
1398            Ok(())
1399        }
1400    }
1401    unsafe impl fidl::encoding::TypeMarker for LogicalTransportType {
1402        type Owned = Self;
1403
1404        #[inline(always)]
1405        fn inline_align(_context: fidl::encoding::Context) -> usize {
1406            std::mem::align_of::<u8>()
1407        }
1408
1409        #[inline(always)]
1410        fn inline_size(_context: fidl::encoding::Context) -> usize {
1411            std::mem::size_of::<u8>()
1412        }
1413
1414        #[inline(always)]
1415        fn encode_is_copy() -> bool {
1416            false
1417        }
1418
1419        #[inline(always)]
1420        fn decode_is_copy() -> bool {
1421            false
1422        }
1423    }
1424
1425    impl fidl::encoding::ValueTypeMarker for LogicalTransportType {
1426        type Borrowed<'a> = Self;
1427        #[inline(always)]
1428        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1429            *value
1430        }
1431    }
1432
1433    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
1434        for LogicalTransportType
1435    {
1436        #[inline]
1437        unsafe fn encode(
1438            self,
1439            encoder: &mut fidl::encoding::Encoder<'_, D>,
1440            offset: usize,
1441            _depth: fidl::encoding::Depth,
1442        ) -> fidl::Result<()> {
1443            encoder.debug_check_bounds::<Self>(offset);
1444            encoder.write_num(self.into_primitive(), offset);
1445            Ok(())
1446        }
1447    }
1448
1449    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for LogicalTransportType {
1450        #[inline(always)]
1451        fn new_empty() -> Self {
1452            Self::unknown()
1453        }
1454
1455        #[inline]
1456        unsafe fn decode(
1457            &mut self,
1458            decoder: &mut fidl::encoding::Decoder<'_, D>,
1459            offset: usize,
1460            _depth: fidl::encoding::Depth,
1461        ) -> fidl::Result<()> {
1462            decoder.debug_check_bounds::<Self>(offset);
1463            let prim = decoder.read_num::<u8>(offset);
1464
1465            *self = Self::from_primitive_allow_unknown(prim);
1466            Ok(())
1467        }
1468    }
1469
1470    impl fidl::encoding::ValueTypeMarker for Address {
1471        type Borrowed<'a> = &'a Self;
1472        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1473            value
1474        }
1475    }
1476
1477    unsafe impl fidl::encoding::TypeMarker for Address {
1478        type Owned = Self;
1479
1480        #[inline(always)]
1481        fn inline_align(_context: fidl::encoding::Context) -> usize {
1482            1
1483        }
1484
1485        #[inline(always)]
1486        fn inline_size(_context: fidl::encoding::Context) -> usize {
1487            7
1488        }
1489    }
1490
1491    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Address, D> for &Address {
1492        #[inline]
1493        unsafe fn encode(
1494            self,
1495            encoder: &mut fidl::encoding::Encoder<'_, D>,
1496            offset: usize,
1497            _depth: fidl::encoding::Depth,
1498        ) -> fidl::Result<()> {
1499            encoder.debug_check_bounds::<Address>(offset);
1500            // Delegate to tuple encoding.
1501            fidl::encoding::Encode::<Address, D>::encode(
1502                (
1503                    <AddressType as fidl::encoding::ValueTypeMarker>::borrow(&self.type_),
1504                    <fidl::encoding::Array<u8, 6> as fidl::encoding::ValueTypeMarker>::borrow(
1505                        &self.bytes,
1506                    ),
1507                ),
1508                encoder,
1509                offset,
1510                _depth,
1511            )
1512        }
1513    }
1514    unsafe impl<
1515            D: fidl::encoding::ResourceDialect,
1516            T0: fidl::encoding::Encode<AddressType, D>,
1517            T1: fidl::encoding::Encode<fidl::encoding::Array<u8, 6>, D>,
1518        > fidl::encoding::Encode<Address, D> for (T0, T1)
1519    {
1520        #[inline]
1521        unsafe fn encode(
1522            self,
1523            encoder: &mut fidl::encoding::Encoder<'_, D>,
1524            offset: usize,
1525            depth: fidl::encoding::Depth,
1526        ) -> fidl::Result<()> {
1527            encoder.debug_check_bounds::<Address>(offset);
1528            // Zero out padding regions. There's no need to apply masks
1529            // because the unmasked parts will be overwritten by fields.
1530            // Write the fields.
1531            self.0.encode(encoder, offset + 0, depth)?;
1532            self.1.encode(encoder, offset + 1, depth)?;
1533            Ok(())
1534        }
1535    }
1536
1537    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Address {
1538        #[inline(always)]
1539        fn new_empty() -> Self {
1540            Self {
1541                type_: fidl::new_empty!(AddressType, D),
1542                bytes: fidl::new_empty!(fidl::encoding::Array<u8, 6>, D),
1543            }
1544        }
1545
1546        #[inline]
1547        unsafe fn decode(
1548            &mut self,
1549            decoder: &mut fidl::encoding::Decoder<'_, D>,
1550            offset: usize,
1551            _depth: fidl::encoding::Depth,
1552        ) -> fidl::Result<()> {
1553            decoder.debug_check_bounds::<Self>(offset);
1554            // Verify that padding bytes are zero.
1555            fidl::decode!(AddressType, D, &mut self.type_, decoder, offset + 0, _depth)?;
1556            fidl::decode!(fidl::encoding::Array<u8, 6>, D, &mut self.bytes, decoder, offset + 1, _depth)?;
1557            Ok(())
1558        }
1559    }
1560
1561    impl fidl::encoding::ValueTypeMarker for Bool {
1562        type Borrowed<'a> = &'a Self;
1563        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1564            value
1565        }
1566    }
1567
1568    unsafe impl fidl::encoding::TypeMarker for Bool {
1569        type Owned = Self;
1570
1571        #[inline(always)]
1572        fn inline_align(_context: fidl::encoding::Context) -> usize {
1573            1
1574        }
1575
1576        #[inline(always)]
1577        fn inline_size(_context: fidl::encoding::Context) -> usize {
1578            1
1579        }
1580    }
1581
1582    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Bool, D> for &Bool {
1583        #[inline]
1584        unsafe fn encode(
1585            self,
1586            encoder: &mut fidl::encoding::Encoder<'_, D>,
1587            offset: usize,
1588            _depth: fidl::encoding::Depth,
1589        ) -> fidl::Result<()> {
1590            encoder.debug_check_bounds::<Bool>(offset);
1591            // Delegate to tuple encoding.
1592            fidl::encoding::Encode::<Bool, D>::encode(
1593                (<bool as fidl::encoding::ValueTypeMarker>::borrow(&self.value),),
1594                encoder,
1595                offset,
1596                _depth,
1597            )
1598        }
1599    }
1600    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<bool, D>>
1601        fidl::encoding::Encode<Bool, D> for (T0,)
1602    {
1603        #[inline]
1604        unsafe fn encode(
1605            self,
1606            encoder: &mut fidl::encoding::Encoder<'_, D>,
1607            offset: usize,
1608            depth: fidl::encoding::Depth,
1609        ) -> fidl::Result<()> {
1610            encoder.debug_check_bounds::<Bool>(offset);
1611            // Zero out padding regions. There's no need to apply masks
1612            // because the unmasked parts will be overwritten by fields.
1613            // Write the fields.
1614            self.0.encode(encoder, offset + 0, depth)?;
1615            Ok(())
1616        }
1617    }
1618
1619    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Bool {
1620        #[inline(always)]
1621        fn new_empty() -> Self {
1622            Self { value: fidl::new_empty!(bool, D) }
1623        }
1624
1625        #[inline]
1626        unsafe fn decode(
1627            &mut self,
1628            decoder: &mut fidl::encoding::Decoder<'_, D>,
1629            offset: usize,
1630            _depth: fidl::encoding::Depth,
1631        ) -> fidl::Result<()> {
1632            decoder.debug_check_bounds::<Self>(offset);
1633            // Verify that padding bytes are zero.
1634            fidl::decode!(bool, D, &mut self.value, decoder, offset + 0, _depth)?;
1635            Ok(())
1636        }
1637    }
1638
1639    impl fidl::encoding::ValueTypeMarker for ChannelSendRequest {
1640        type Borrowed<'a> = &'a Self;
1641        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1642            value
1643        }
1644    }
1645
1646    unsafe impl fidl::encoding::TypeMarker for ChannelSendRequest {
1647        type Owned = Self;
1648
1649        #[inline(always)]
1650        fn inline_align(_context: fidl::encoding::Context) -> usize {
1651            8
1652        }
1653
1654        #[inline(always)]
1655        fn inline_size(_context: fidl::encoding::Context) -> usize {
1656            16
1657        }
1658    }
1659
1660    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<ChannelSendRequest, D>
1661        for &ChannelSendRequest
1662    {
1663        #[inline]
1664        unsafe fn encode(
1665            self,
1666            encoder: &mut fidl::encoding::Encoder<'_, D>,
1667            offset: usize,
1668            _depth: fidl::encoding::Depth,
1669        ) -> fidl::Result<()> {
1670            encoder.debug_check_bounds::<ChannelSendRequest>(offset);
1671            // Delegate to tuple encoding.
1672            fidl::encoding::Encode::<ChannelSendRequest, D>::encode(
1673                (
1674                    <fidl::encoding::UnboundedVector<Packet> as fidl::encoding::ValueTypeMarker>::borrow(&self.packets),
1675                ),
1676                encoder, offset, _depth
1677            )
1678        }
1679    }
1680    unsafe impl<
1681            D: fidl::encoding::ResourceDialect,
1682            T0: fidl::encoding::Encode<fidl::encoding::UnboundedVector<Packet>, D>,
1683        > fidl::encoding::Encode<ChannelSendRequest, D> for (T0,)
1684    {
1685        #[inline]
1686        unsafe fn encode(
1687            self,
1688            encoder: &mut fidl::encoding::Encoder<'_, D>,
1689            offset: usize,
1690            depth: fidl::encoding::Depth,
1691        ) -> fidl::Result<()> {
1692            encoder.debug_check_bounds::<ChannelSendRequest>(offset);
1693            // Zero out padding regions. There's no need to apply masks
1694            // because the unmasked parts will be overwritten by fields.
1695            // Write the fields.
1696            self.0.encode(encoder, offset + 0, depth)?;
1697            Ok(())
1698        }
1699    }
1700
1701    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ChannelSendRequest {
1702        #[inline(always)]
1703        fn new_empty() -> Self {
1704            Self { packets: fidl::new_empty!(fidl::encoding::UnboundedVector<Packet>, D) }
1705        }
1706
1707        #[inline]
1708        unsafe fn decode(
1709            &mut self,
1710            decoder: &mut fidl::encoding::Decoder<'_, D>,
1711            offset: usize,
1712            _depth: fidl::encoding::Depth,
1713        ) -> fidl::Result<()> {
1714            decoder.debug_check_bounds::<Self>(offset);
1715            // Verify that padding bytes are zero.
1716            fidl::decode!(
1717                fidl::encoding::UnboundedVector<Packet>,
1718                D,
1719                &mut self.packets,
1720                decoder,
1721                offset + 0,
1722                _depth
1723            )?;
1724            Ok(())
1725        }
1726    }
1727
1728    impl fidl::encoding::ValueTypeMarker for ChannelReceiveResponse {
1729        type Borrowed<'a> = &'a Self;
1730        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1731            value
1732        }
1733    }
1734
1735    unsafe impl fidl::encoding::TypeMarker for ChannelReceiveResponse {
1736        type Owned = Self;
1737
1738        #[inline(always)]
1739        fn inline_align(_context: fidl::encoding::Context) -> usize {
1740            8
1741        }
1742
1743        #[inline(always)]
1744        fn inline_size(_context: fidl::encoding::Context) -> usize {
1745            16
1746        }
1747    }
1748
1749    unsafe impl<D: fidl::encoding::ResourceDialect>
1750        fidl::encoding::Encode<ChannelReceiveResponse, D> for &ChannelReceiveResponse
1751    {
1752        #[inline]
1753        unsafe fn encode(
1754            self,
1755            encoder: &mut fidl::encoding::Encoder<'_, D>,
1756            offset: usize,
1757            _depth: fidl::encoding::Depth,
1758        ) -> fidl::Result<()> {
1759            encoder.debug_check_bounds::<ChannelReceiveResponse>(offset);
1760            // Delegate to tuple encoding.
1761            fidl::encoding::Encode::<ChannelReceiveResponse, D>::encode(
1762                (
1763                    <fidl::encoding::UnboundedVector<Packet> as fidl::encoding::ValueTypeMarker>::borrow(&self.packets),
1764                ),
1765                encoder, offset, _depth
1766            )
1767        }
1768    }
1769    unsafe impl<
1770            D: fidl::encoding::ResourceDialect,
1771            T0: fidl::encoding::Encode<fidl::encoding::UnboundedVector<Packet>, D>,
1772        > fidl::encoding::Encode<ChannelReceiveResponse, D> for (T0,)
1773    {
1774        #[inline]
1775        unsafe fn encode(
1776            self,
1777            encoder: &mut fidl::encoding::Encoder<'_, D>,
1778            offset: usize,
1779            depth: fidl::encoding::Depth,
1780        ) -> fidl::Result<()> {
1781            encoder.debug_check_bounds::<ChannelReceiveResponse>(offset);
1782            // Zero out padding regions. There's no need to apply masks
1783            // because the unmasked parts will be overwritten by fields.
1784            // Write the fields.
1785            self.0.encode(encoder, offset + 0, depth)?;
1786            Ok(())
1787        }
1788    }
1789
1790    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1791        for ChannelReceiveResponse
1792    {
1793        #[inline(always)]
1794        fn new_empty() -> Self {
1795            Self { packets: fidl::new_empty!(fidl::encoding::UnboundedVector<Packet>, D) }
1796        }
1797
1798        #[inline]
1799        unsafe fn decode(
1800            &mut self,
1801            decoder: &mut fidl::encoding::Decoder<'_, D>,
1802            offset: usize,
1803            _depth: fidl::encoding::Depth,
1804        ) -> fidl::Result<()> {
1805            decoder.debug_check_bounds::<Self>(offset);
1806            // Verify that padding bytes are zero.
1807            fidl::decode!(
1808                fidl::encoding::UnboundedVector<Packet>,
1809                D,
1810                &mut self.packets,
1811                decoder,
1812                offset + 0,
1813                _depth
1814            )?;
1815            Ok(())
1816        }
1817    }
1818
1819    impl fidl::encoding::ValueTypeMarker for DeviceClass {
1820        type Borrowed<'a> = &'a Self;
1821        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1822            value
1823        }
1824    }
1825
1826    unsafe impl fidl::encoding::TypeMarker for DeviceClass {
1827        type Owned = Self;
1828
1829        #[inline(always)]
1830        fn inline_align(_context: fidl::encoding::Context) -> usize {
1831            4
1832        }
1833
1834        #[inline(always)]
1835        fn inline_size(_context: fidl::encoding::Context) -> usize {
1836            4
1837        }
1838        #[inline(always)]
1839        fn encode_is_copy() -> bool {
1840            true
1841        }
1842
1843        #[inline(always)]
1844        fn decode_is_copy() -> bool {
1845            true
1846        }
1847    }
1848
1849    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<DeviceClass, D>
1850        for &DeviceClass
1851    {
1852        #[inline]
1853        unsafe fn encode(
1854            self,
1855            encoder: &mut fidl::encoding::Encoder<'_, D>,
1856            offset: usize,
1857            _depth: fidl::encoding::Depth,
1858        ) -> fidl::Result<()> {
1859            encoder.debug_check_bounds::<DeviceClass>(offset);
1860            unsafe {
1861                // Copy the object into the buffer.
1862                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
1863                (buf_ptr as *mut DeviceClass).write_unaligned((self as *const DeviceClass).read());
1864                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
1865                // done second because the memcpy will write garbage to these bytes.
1866            }
1867            Ok(())
1868        }
1869    }
1870    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u32, D>>
1871        fidl::encoding::Encode<DeviceClass, D> for (T0,)
1872    {
1873        #[inline]
1874        unsafe fn encode(
1875            self,
1876            encoder: &mut fidl::encoding::Encoder<'_, D>,
1877            offset: usize,
1878            depth: fidl::encoding::Depth,
1879        ) -> fidl::Result<()> {
1880            encoder.debug_check_bounds::<DeviceClass>(offset);
1881            // Zero out padding regions. There's no need to apply masks
1882            // because the unmasked parts will be overwritten by fields.
1883            // Write the fields.
1884            self.0.encode(encoder, offset + 0, depth)?;
1885            Ok(())
1886        }
1887    }
1888
1889    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for DeviceClass {
1890        #[inline(always)]
1891        fn new_empty() -> Self {
1892            Self { value: fidl::new_empty!(u32, D) }
1893        }
1894
1895        #[inline]
1896        unsafe fn decode(
1897            &mut self,
1898            decoder: &mut fidl::encoding::Decoder<'_, D>,
1899            offset: usize,
1900            _depth: fidl::encoding::Depth,
1901        ) -> fidl::Result<()> {
1902            decoder.debug_check_bounds::<Self>(offset);
1903            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
1904            // Verify that padding bytes are zero.
1905            // Copy from the buffer into the object.
1906            unsafe {
1907                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
1908            }
1909            Ok(())
1910        }
1911    }
1912
1913    impl fidl::encoding::ValueTypeMarker for Error {
1914        type Borrowed<'a> = &'a Self;
1915        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1916            value
1917        }
1918    }
1919
1920    unsafe impl fidl::encoding::TypeMarker for Error {
1921        type Owned = Self;
1922
1923        #[inline(always)]
1924        fn inline_align(_context: fidl::encoding::Context) -> usize {
1925            8
1926        }
1927
1928        #[inline(always)]
1929        fn inline_size(_context: fidl::encoding::Context) -> usize {
1930            24
1931        }
1932    }
1933
1934    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Error, D> for &Error {
1935        #[inline]
1936        unsafe fn encode(
1937            self,
1938            encoder: &mut fidl::encoding::Encoder<'_, D>,
1939            offset: usize,
1940            _depth: fidl::encoding::Depth,
1941        ) -> fidl::Result<()> {
1942            encoder.debug_check_bounds::<Error>(offset);
1943            // Delegate to tuple encoding.
1944            fidl::encoding::Encode::<Error, D>::encode(
1945                (
1946                    <ErrorCode as fidl::encoding::ValueTypeMarker>::borrow(&self.error_code),
1947                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.protocol_error_code),
1948                    <fidl::encoding::Optional<fidl::encoding::UnboundedString> as fidl::encoding::ValueTypeMarker>::borrow(&self.description),
1949                ),
1950                encoder, offset, _depth
1951            )
1952        }
1953    }
1954    unsafe impl<
1955            D: fidl::encoding::ResourceDialect,
1956            T0: fidl::encoding::Encode<ErrorCode, D>,
1957            T1: fidl::encoding::Encode<u32, D>,
1958            T2: fidl::encoding::Encode<fidl::encoding::Optional<fidl::encoding::UnboundedString>, D>,
1959        > fidl::encoding::Encode<Error, D> for (T0, T1, T2)
1960    {
1961        #[inline]
1962        unsafe fn encode(
1963            self,
1964            encoder: &mut fidl::encoding::Encoder<'_, D>,
1965            offset: usize,
1966            depth: fidl::encoding::Depth,
1967        ) -> fidl::Result<()> {
1968            encoder.debug_check_bounds::<Error>(offset);
1969            // Zero out padding regions. There's no need to apply masks
1970            // because the unmasked parts will be overwritten by fields.
1971            // Write the fields.
1972            self.0.encode(encoder, offset + 0, depth)?;
1973            self.1.encode(encoder, offset + 4, depth)?;
1974            self.2.encode(encoder, offset + 8, depth)?;
1975            Ok(())
1976        }
1977    }
1978
1979    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Error {
1980        #[inline(always)]
1981        fn new_empty() -> Self {
1982            Self {
1983                error_code: fidl::new_empty!(ErrorCode, D),
1984                protocol_error_code: fidl::new_empty!(u32, D),
1985                description: fidl::new_empty!(
1986                    fidl::encoding::Optional<fidl::encoding::UnboundedString>,
1987                    D
1988                ),
1989            }
1990        }
1991
1992        #[inline]
1993        unsafe fn decode(
1994            &mut self,
1995            decoder: &mut fidl::encoding::Decoder<'_, D>,
1996            offset: usize,
1997            _depth: fidl::encoding::Depth,
1998        ) -> fidl::Result<()> {
1999            decoder.debug_check_bounds::<Self>(offset);
2000            // Verify that padding bytes are zero.
2001            fidl::decode!(ErrorCode, D, &mut self.error_code, decoder, offset + 0, _depth)?;
2002            fidl::decode!(u32, D, &mut self.protocol_error_code, decoder, offset + 4, _depth)?;
2003            fidl::decode!(
2004                fidl::encoding::Optional<fidl::encoding::UnboundedString>,
2005                D,
2006                &mut self.description,
2007                decoder,
2008                offset + 8,
2009                _depth
2010            )?;
2011            Ok(())
2012        }
2013    }
2014
2015    impl fidl::encoding::ValueTypeMarker for HostId {
2016        type Borrowed<'a> = &'a Self;
2017        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2018            value
2019        }
2020    }
2021
2022    unsafe impl fidl::encoding::TypeMarker for HostId {
2023        type Owned = Self;
2024
2025        #[inline(always)]
2026        fn inline_align(_context: fidl::encoding::Context) -> usize {
2027            8
2028        }
2029
2030        #[inline(always)]
2031        fn inline_size(_context: fidl::encoding::Context) -> usize {
2032            8
2033        }
2034        #[inline(always)]
2035        fn encode_is_copy() -> bool {
2036            true
2037        }
2038
2039        #[inline(always)]
2040        fn decode_is_copy() -> bool {
2041            true
2042        }
2043    }
2044
2045    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<HostId, D> for &HostId {
2046        #[inline]
2047        unsafe fn encode(
2048            self,
2049            encoder: &mut fidl::encoding::Encoder<'_, D>,
2050            offset: usize,
2051            _depth: fidl::encoding::Depth,
2052        ) -> fidl::Result<()> {
2053            encoder.debug_check_bounds::<HostId>(offset);
2054            unsafe {
2055                // Copy the object into the buffer.
2056                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
2057                (buf_ptr as *mut HostId).write_unaligned((self as *const HostId).read());
2058                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
2059                // done second because the memcpy will write garbage to these bytes.
2060            }
2061            Ok(())
2062        }
2063    }
2064    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u64, D>>
2065        fidl::encoding::Encode<HostId, D> for (T0,)
2066    {
2067        #[inline]
2068        unsafe fn encode(
2069            self,
2070            encoder: &mut fidl::encoding::Encoder<'_, D>,
2071            offset: usize,
2072            depth: fidl::encoding::Depth,
2073        ) -> fidl::Result<()> {
2074            encoder.debug_check_bounds::<HostId>(offset);
2075            // Zero out padding regions. There's no need to apply masks
2076            // because the unmasked parts will be overwritten by fields.
2077            // Write the fields.
2078            self.0.encode(encoder, offset + 0, depth)?;
2079            Ok(())
2080        }
2081    }
2082
2083    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for HostId {
2084        #[inline(always)]
2085        fn new_empty() -> Self {
2086            Self { value: fidl::new_empty!(u64, D) }
2087        }
2088
2089        #[inline]
2090        unsafe fn decode(
2091            &mut self,
2092            decoder: &mut fidl::encoding::Decoder<'_, D>,
2093            offset: usize,
2094            _depth: fidl::encoding::Depth,
2095        ) -> fidl::Result<()> {
2096            decoder.debug_check_bounds::<Self>(offset);
2097            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
2098            // Verify that padding bytes are zero.
2099            // Copy from the buffer into the object.
2100            unsafe {
2101                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 8);
2102            }
2103            Ok(())
2104        }
2105    }
2106
2107    impl fidl::encoding::ValueTypeMarker for Int8 {
2108        type Borrowed<'a> = &'a Self;
2109        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2110            value
2111        }
2112    }
2113
2114    unsafe impl fidl::encoding::TypeMarker for Int8 {
2115        type Owned = Self;
2116
2117        #[inline(always)]
2118        fn inline_align(_context: fidl::encoding::Context) -> usize {
2119            1
2120        }
2121
2122        #[inline(always)]
2123        fn inline_size(_context: fidl::encoding::Context) -> usize {
2124            1
2125        }
2126        #[inline(always)]
2127        fn encode_is_copy() -> bool {
2128            true
2129        }
2130
2131        #[inline(always)]
2132        fn decode_is_copy() -> bool {
2133            true
2134        }
2135    }
2136
2137    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Int8, D> for &Int8 {
2138        #[inline]
2139        unsafe fn encode(
2140            self,
2141            encoder: &mut fidl::encoding::Encoder<'_, D>,
2142            offset: usize,
2143            _depth: fidl::encoding::Depth,
2144        ) -> fidl::Result<()> {
2145            encoder.debug_check_bounds::<Int8>(offset);
2146            unsafe {
2147                // Copy the object into the buffer.
2148                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
2149                (buf_ptr as *mut Int8).write_unaligned((self as *const Int8).read());
2150                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
2151                // done second because the memcpy will write garbage to these bytes.
2152            }
2153            Ok(())
2154        }
2155    }
2156    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<i8, D>>
2157        fidl::encoding::Encode<Int8, D> for (T0,)
2158    {
2159        #[inline]
2160        unsafe fn encode(
2161            self,
2162            encoder: &mut fidl::encoding::Encoder<'_, D>,
2163            offset: usize,
2164            depth: fidl::encoding::Depth,
2165        ) -> fidl::Result<()> {
2166            encoder.debug_check_bounds::<Int8>(offset);
2167            // Zero out padding regions. There's no need to apply masks
2168            // because the unmasked parts will be overwritten by fields.
2169            // Write the fields.
2170            self.0.encode(encoder, offset + 0, depth)?;
2171            Ok(())
2172        }
2173    }
2174
2175    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Int8 {
2176        #[inline(always)]
2177        fn new_empty() -> Self {
2178            Self { value: fidl::new_empty!(i8, D) }
2179        }
2180
2181        #[inline]
2182        unsafe fn decode(
2183            &mut self,
2184            decoder: &mut fidl::encoding::Decoder<'_, D>,
2185            offset: usize,
2186            _depth: fidl::encoding::Depth,
2187        ) -> fidl::Result<()> {
2188            decoder.debug_check_bounds::<Self>(offset);
2189            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
2190            // Verify that padding bytes are zero.
2191            // Copy from the buffer into the object.
2192            unsafe {
2193                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 1);
2194            }
2195            Ok(())
2196        }
2197    }
2198
2199    impl fidl::encoding::ValueTypeMarker for Packet {
2200        type Borrowed<'a> = &'a Self;
2201        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2202            value
2203        }
2204    }
2205
2206    unsafe impl fidl::encoding::TypeMarker for Packet {
2207        type Owned = Self;
2208
2209        #[inline(always)]
2210        fn inline_align(_context: fidl::encoding::Context) -> usize {
2211            8
2212        }
2213
2214        #[inline(always)]
2215        fn inline_size(_context: fidl::encoding::Context) -> usize {
2216            16
2217        }
2218    }
2219
2220    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Packet, D> for &Packet {
2221        #[inline]
2222        unsafe fn encode(
2223            self,
2224            encoder: &mut fidl::encoding::Encoder<'_, D>,
2225            offset: usize,
2226            _depth: fidl::encoding::Depth,
2227        ) -> fidl::Result<()> {
2228            encoder.debug_check_bounds::<Packet>(offset);
2229            // Delegate to tuple encoding.
2230            fidl::encoding::Encode::<Packet, D>::encode(
2231                (<fidl::encoding::UnboundedVector<u8> as fidl::encoding::ValueTypeMarker>::borrow(
2232                    &self.packet,
2233                ),),
2234                encoder,
2235                offset,
2236                _depth,
2237            )
2238        }
2239    }
2240    unsafe impl<
2241            D: fidl::encoding::ResourceDialect,
2242            T0: fidl::encoding::Encode<fidl::encoding::UnboundedVector<u8>, D>,
2243        > fidl::encoding::Encode<Packet, D> for (T0,)
2244    {
2245        #[inline]
2246        unsafe fn encode(
2247            self,
2248            encoder: &mut fidl::encoding::Encoder<'_, D>,
2249            offset: usize,
2250            depth: fidl::encoding::Depth,
2251        ) -> fidl::Result<()> {
2252            encoder.debug_check_bounds::<Packet>(offset);
2253            // Zero out padding regions. There's no need to apply masks
2254            // because the unmasked parts will be overwritten by fields.
2255            // Write the fields.
2256            self.0.encode(encoder, offset + 0, depth)?;
2257            Ok(())
2258        }
2259    }
2260
2261    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Packet {
2262        #[inline(always)]
2263        fn new_empty() -> Self {
2264            Self { packet: fidl::new_empty!(fidl::encoding::UnboundedVector<u8>, D) }
2265        }
2266
2267        #[inline]
2268        unsafe fn decode(
2269            &mut self,
2270            decoder: &mut fidl::encoding::Decoder<'_, D>,
2271            offset: usize,
2272            _depth: fidl::encoding::Depth,
2273        ) -> fidl::Result<()> {
2274            decoder.debug_check_bounds::<Self>(offset);
2275            // Verify that padding bytes are zero.
2276            fidl::decode!(
2277                fidl::encoding::UnboundedVector<u8>,
2278                D,
2279                &mut self.packet,
2280                decoder,
2281                offset + 0,
2282                _depth
2283            )?;
2284            Ok(())
2285        }
2286    }
2287
2288    impl fidl::encoding::ValueTypeMarker for PeerId {
2289        type Borrowed<'a> = &'a Self;
2290        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2291            value
2292        }
2293    }
2294
2295    unsafe impl fidl::encoding::TypeMarker for PeerId {
2296        type Owned = Self;
2297
2298        #[inline(always)]
2299        fn inline_align(_context: fidl::encoding::Context) -> usize {
2300            8
2301        }
2302
2303        #[inline(always)]
2304        fn inline_size(_context: fidl::encoding::Context) -> usize {
2305            8
2306        }
2307        #[inline(always)]
2308        fn encode_is_copy() -> bool {
2309            true
2310        }
2311
2312        #[inline(always)]
2313        fn decode_is_copy() -> bool {
2314            true
2315        }
2316    }
2317
2318    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<PeerId, D> for &PeerId {
2319        #[inline]
2320        unsafe fn encode(
2321            self,
2322            encoder: &mut fidl::encoding::Encoder<'_, D>,
2323            offset: usize,
2324            _depth: fidl::encoding::Depth,
2325        ) -> fidl::Result<()> {
2326            encoder.debug_check_bounds::<PeerId>(offset);
2327            unsafe {
2328                // Copy the object into the buffer.
2329                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
2330                (buf_ptr as *mut PeerId).write_unaligned((self as *const PeerId).read());
2331                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
2332                // done second because the memcpy will write garbage to these bytes.
2333            }
2334            Ok(())
2335        }
2336    }
2337    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u64, D>>
2338        fidl::encoding::Encode<PeerId, D> for (T0,)
2339    {
2340        #[inline]
2341        unsafe fn encode(
2342            self,
2343            encoder: &mut fidl::encoding::Encoder<'_, D>,
2344            offset: usize,
2345            depth: fidl::encoding::Depth,
2346        ) -> fidl::Result<()> {
2347            encoder.debug_check_bounds::<PeerId>(offset);
2348            // Zero out padding regions. There's no need to apply masks
2349            // because the unmasked parts will be overwritten by fields.
2350            // Write the fields.
2351            self.0.encode(encoder, offset + 0, depth)?;
2352            Ok(())
2353        }
2354    }
2355
2356    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for PeerId {
2357        #[inline(always)]
2358        fn new_empty() -> Self {
2359            Self { value: fidl::new_empty!(u64, D) }
2360        }
2361
2362        #[inline]
2363        unsafe fn decode(
2364            &mut self,
2365            decoder: &mut fidl::encoding::Decoder<'_, D>,
2366            offset: usize,
2367            _depth: fidl::encoding::Depth,
2368        ) -> fidl::Result<()> {
2369            decoder.debug_check_bounds::<Self>(offset);
2370            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
2371            // Verify that padding bytes are zero.
2372            // Copy from the buffer into the object.
2373            unsafe {
2374                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 8);
2375            }
2376            Ok(())
2377        }
2378    }
2379
2380    impl fidl::encoding::ValueTypeMarker for Status {
2381        type Borrowed<'a> = &'a Self;
2382        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2383            value
2384        }
2385    }
2386
2387    unsafe impl fidl::encoding::TypeMarker for Status {
2388        type Owned = Self;
2389
2390        #[inline(always)]
2391        fn inline_align(_context: fidl::encoding::Context) -> usize {
2392            8
2393        }
2394
2395        #[inline(always)]
2396        fn inline_size(_context: fidl::encoding::Context) -> usize {
2397            8
2398        }
2399    }
2400
2401    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Status, D> for &Status {
2402        #[inline]
2403        unsafe fn encode(
2404            self,
2405            encoder: &mut fidl::encoding::Encoder<'_, D>,
2406            offset: usize,
2407            _depth: fidl::encoding::Depth,
2408        ) -> fidl::Result<()> {
2409            encoder.debug_check_bounds::<Status>(offset);
2410            // Delegate to tuple encoding.
2411            fidl::encoding::Encode::<Status, D>::encode(
2412                (<fidl::encoding::Boxed<Error> as fidl::encoding::ValueTypeMarker>::borrow(
2413                    &self.error,
2414                ),),
2415                encoder,
2416                offset,
2417                _depth,
2418            )
2419        }
2420    }
2421    unsafe impl<
2422            D: fidl::encoding::ResourceDialect,
2423            T0: fidl::encoding::Encode<fidl::encoding::Boxed<Error>, D>,
2424        > fidl::encoding::Encode<Status, D> for (T0,)
2425    {
2426        #[inline]
2427        unsafe fn encode(
2428            self,
2429            encoder: &mut fidl::encoding::Encoder<'_, D>,
2430            offset: usize,
2431            depth: fidl::encoding::Depth,
2432        ) -> fidl::Result<()> {
2433            encoder.debug_check_bounds::<Status>(offset);
2434            // Zero out padding regions. There's no need to apply masks
2435            // because the unmasked parts will be overwritten by fields.
2436            // Write the fields.
2437            self.0.encode(encoder, offset + 0, depth)?;
2438            Ok(())
2439        }
2440    }
2441
2442    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Status {
2443        #[inline(always)]
2444        fn new_empty() -> Self {
2445            Self { error: fidl::new_empty!(fidl::encoding::Boxed<Error>, D) }
2446        }
2447
2448        #[inline]
2449        unsafe fn decode(
2450            &mut self,
2451            decoder: &mut fidl::encoding::Decoder<'_, D>,
2452            offset: usize,
2453            _depth: fidl::encoding::Depth,
2454        ) -> fidl::Result<()> {
2455            decoder.debug_check_bounds::<Self>(offset);
2456            // Verify that padding bytes are zero.
2457            fidl::decode!(
2458                fidl::encoding::Boxed<Error>,
2459                D,
2460                &mut self.error,
2461                decoder,
2462                offset + 0,
2463                _depth
2464            )?;
2465            Ok(())
2466        }
2467    }
2468
2469    impl fidl::encoding::ValueTypeMarker for UInt16 {
2470        type Borrowed<'a> = &'a Self;
2471        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2472            value
2473        }
2474    }
2475
2476    unsafe impl fidl::encoding::TypeMarker for UInt16 {
2477        type Owned = Self;
2478
2479        #[inline(always)]
2480        fn inline_align(_context: fidl::encoding::Context) -> usize {
2481            2
2482        }
2483
2484        #[inline(always)]
2485        fn inline_size(_context: fidl::encoding::Context) -> usize {
2486            2
2487        }
2488        #[inline(always)]
2489        fn encode_is_copy() -> bool {
2490            true
2491        }
2492
2493        #[inline(always)]
2494        fn decode_is_copy() -> bool {
2495            true
2496        }
2497    }
2498
2499    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<UInt16, D> for &UInt16 {
2500        #[inline]
2501        unsafe fn encode(
2502            self,
2503            encoder: &mut fidl::encoding::Encoder<'_, D>,
2504            offset: usize,
2505            _depth: fidl::encoding::Depth,
2506        ) -> fidl::Result<()> {
2507            encoder.debug_check_bounds::<UInt16>(offset);
2508            unsafe {
2509                // Copy the object into the buffer.
2510                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
2511                (buf_ptr as *mut UInt16).write_unaligned((self as *const UInt16).read());
2512                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
2513                // done second because the memcpy will write garbage to these bytes.
2514            }
2515            Ok(())
2516        }
2517    }
2518    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u16, D>>
2519        fidl::encoding::Encode<UInt16, D> for (T0,)
2520    {
2521        #[inline]
2522        unsafe fn encode(
2523            self,
2524            encoder: &mut fidl::encoding::Encoder<'_, D>,
2525            offset: usize,
2526            depth: fidl::encoding::Depth,
2527        ) -> fidl::Result<()> {
2528            encoder.debug_check_bounds::<UInt16>(offset);
2529            // Zero out padding regions. There's no need to apply masks
2530            // because the unmasked parts will be overwritten by fields.
2531            // Write the fields.
2532            self.0.encode(encoder, offset + 0, depth)?;
2533            Ok(())
2534        }
2535    }
2536
2537    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for UInt16 {
2538        #[inline(always)]
2539        fn new_empty() -> Self {
2540            Self { value: fidl::new_empty!(u16, D) }
2541        }
2542
2543        #[inline]
2544        unsafe fn decode(
2545            &mut self,
2546            decoder: &mut fidl::encoding::Decoder<'_, D>,
2547            offset: usize,
2548            _depth: fidl::encoding::Depth,
2549        ) -> fidl::Result<()> {
2550            decoder.debug_check_bounds::<Self>(offset);
2551            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
2552            // Verify that padding bytes are zero.
2553            // Copy from the buffer into the object.
2554            unsafe {
2555                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 2);
2556            }
2557            Ok(())
2558        }
2559    }
2560
2561    impl fidl::encoding::ValueTypeMarker for Uuid {
2562        type Borrowed<'a> = &'a Self;
2563        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2564            value
2565        }
2566    }
2567
2568    unsafe impl fidl::encoding::TypeMarker for Uuid {
2569        type Owned = Self;
2570
2571        #[inline(always)]
2572        fn inline_align(_context: fidl::encoding::Context) -> usize {
2573            1
2574        }
2575
2576        #[inline(always)]
2577        fn inline_size(_context: fidl::encoding::Context) -> usize {
2578            16
2579        }
2580        #[inline(always)]
2581        fn encode_is_copy() -> bool {
2582            true
2583        }
2584
2585        #[inline(always)]
2586        fn decode_is_copy() -> bool {
2587            true
2588        }
2589    }
2590
2591    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Uuid, D> for &Uuid {
2592        #[inline]
2593        unsafe fn encode(
2594            self,
2595            encoder: &mut fidl::encoding::Encoder<'_, D>,
2596            offset: usize,
2597            _depth: fidl::encoding::Depth,
2598        ) -> fidl::Result<()> {
2599            encoder.debug_check_bounds::<Uuid>(offset);
2600            unsafe {
2601                // Copy the object into the buffer.
2602                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
2603                (buf_ptr as *mut Uuid).write_unaligned((self as *const Uuid).read());
2604                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
2605                // done second because the memcpy will write garbage to these bytes.
2606            }
2607            Ok(())
2608        }
2609    }
2610    unsafe impl<
2611            D: fidl::encoding::ResourceDialect,
2612            T0: fidl::encoding::Encode<fidl::encoding::Array<u8, 16>, D>,
2613        > fidl::encoding::Encode<Uuid, D> for (T0,)
2614    {
2615        #[inline]
2616        unsafe fn encode(
2617            self,
2618            encoder: &mut fidl::encoding::Encoder<'_, D>,
2619            offset: usize,
2620            depth: fidl::encoding::Depth,
2621        ) -> fidl::Result<()> {
2622            encoder.debug_check_bounds::<Uuid>(offset);
2623            // Zero out padding regions. There's no need to apply masks
2624            // because the unmasked parts will be overwritten by fields.
2625            // Write the fields.
2626            self.0.encode(encoder, offset + 0, depth)?;
2627            Ok(())
2628        }
2629    }
2630
2631    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Uuid {
2632        #[inline(always)]
2633        fn new_empty() -> Self {
2634            Self { value: fidl::new_empty!(fidl::encoding::Array<u8, 16>, D) }
2635        }
2636
2637        #[inline]
2638        unsafe fn decode(
2639            &mut self,
2640            decoder: &mut fidl::encoding::Decoder<'_, D>,
2641            offset: usize,
2642            _depth: fidl::encoding::Depth,
2643        ) -> fidl::Result<()> {
2644            decoder.debug_check_bounds::<Self>(offset);
2645            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
2646            // Verify that padding bytes are zero.
2647            // Copy from the buffer into the object.
2648            unsafe {
2649                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 16);
2650            }
2651            Ok(())
2652        }
2653    }
2654
2655    impl ChannelParameters {
2656        #[inline(always)]
2657        fn max_ordinal_present(&self) -> u64 {
2658            if let Some(_) = self.flush_timeout {
2659                return 4;
2660            }
2661            if let Some(_) = self.security_requirements {
2662                return 3;
2663            }
2664            if let Some(_) = self.max_rx_packet_size {
2665                return 2;
2666            }
2667            if let Some(_) = self.channel_mode {
2668                return 1;
2669            }
2670            0
2671        }
2672    }
2673
2674    impl fidl::encoding::ValueTypeMarker for ChannelParameters {
2675        type Borrowed<'a> = &'a Self;
2676        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2677            value
2678        }
2679    }
2680
2681    unsafe impl fidl::encoding::TypeMarker for ChannelParameters {
2682        type Owned = Self;
2683
2684        #[inline(always)]
2685        fn inline_align(_context: fidl::encoding::Context) -> usize {
2686            8
2687        }
2688
2689        #[inline(always)]
2690        fn inline_size(_context: fidl::encoding::Context) -> usize {
2691            16
2692        }
2693    }
2694
2695    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<ChannelParameters, D>
2696        for &ChannelParameters
2697    {
2698        unsafe fn encode(
2699            self,
2700            encoder: &mut fidl::encoding::Encoder<'_, D>,
2701            offset: usize,
2702            mut depth: fidl::encoding::Depth,
2703        ) -> fidl::Result<()> {
2704            encoder.debug_check_bounds::<ChannelParameters>(offset);
2705            // Vector header
2706            let max_ordinal: u64 = self.max_ordinal_present();
2707            encoder.write_num(max_ordinal, offset);
2708            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
2709            // Calling encoder.out_of_line_offset(0) is not allowed.
2710            if max_ordinal == 0 {
2711                return Ok(());
2712            }
2713            depth.increment()?;
2714            let envelope_size = 8;
2715            let bytes_len = max_ordinal as usize * envelope_size;
2716            #[allow(unused_variables)]
2717            let offset = encoder.out_of_line_offset(bytes_len);
2718            let mut _prev_end_offset: usize = 0;
2719            if 1 > max_ordinal {
2720                return Ok(());
2721            }
2722
2723            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2724            // are envelope_size bytes.
2725            let cur_offset: usize = (1 - 1) * envelope_size;
2726
2727            // Zero reserved fields.
2728            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2729
2730            // Safety:
2731            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2732            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2733            //   envelope_size bytes, there is always sufficient room.
2734            fidl::encoding::encode_in_envelope_optional::<ChannelMode, D>(
2735                self.channel_mode
2736                    .as_ref()
2737                    .map(<ChannelMode as fidl::encoding::ValueTypeMarker>::borrow),
2738                encoder,
2739                offset + cur_offset,
2740                depth,
2741            )?;
2742
2743            _prev_end_offset = cur_offset + envelope_size;
2744            if 2 > max_ordinal {
2745                return Ok(());
2746            }
2747
2748            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2749            // are envelope_size bytes.
2750            let cur_offset: usize = (2 - 1) * envelope_size;
2751
2752            // Zero reserved fields.
2753            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2754
2755            // Safety:
2756            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2757            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2758            //   envelope_size bytes, there is always sufficient room.
2759            fidl::encoding::encode_in_envelope_optional::<u16, D>(
2760                self.max_rx_packet_size
2761                    .as_ref()
2762                    .map(<u16 as fidl::encoding::ValueTypeMarker>::borrow),
2763                encoder,
2764                offset + cur_offset,
2765                depth,
2766            )?;
2767
2768            _prev_end_offset = cur_offset + envelope_size;
2769            if 3 > max_ordinal {
2770                return Ok(());
2771            }
2772
2773            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2774            // are envelope_size bytes.
2775            let cur_offset: usize = (3 - 1) * envelope_size;
2776
2777            // Zero reserved fields.
2778            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2779
2780            // Safety:
2781            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2782            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2783            //   envelope_size bytes, there is always sufficient room.
2784            fidl::encoding::encode_in_envelope_optional::<SecurityRequirements, D>(
2785                self.security_requirements
2786                    .as_ref()
2787                    .map(<SecurityRequirements as fidl::encoding::ValueTypeMarker>::borrow),
2788                encoder,
2789                offset + cur_offset,
2790                depth,
2791            )?;
2792
2793            _prev_end_offset = cur_offset + envelope_size;
2794            if 4 > max_ordinal {
2795                return Ok(());
2796            }
2797
2798            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2799            // are envelope_size bytes.
2800            let cur_offset: usize = (4 - 1) * envelope_size;
2801
2802            // Zero reserved fields.
2803            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2804
2805            // Safety:
2806            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2807            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2808            //   envelope_size bytes, there is always sufficient room.
2809            fidl::encoding::encode_in_envelope_optional::<i64, D>(
2810                self.flush_timeout.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
2811                encoder,
2812                offset + cur_offset,
2813                depth,
2814            )?;
2815
2816            _prev_end_offset = cur_offset + envelope_size;
2817
2818            Ok(())
2819        }
2820    }
2821
2822    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ChannelParameters {
2823        #[inline(always)]
2824        fn new_empty() -> Self {
2825            Self::default()
2826        }
2827
2828        unsafe fn decode(
2829            &mut self,
2830            decoder: &mut fidl::encoding::Decoder<'_, D>,
2831            offset: usize,
2832            mut depth: fidl::encoding::Depth,
2833        ) -> fidl::Result<()> {
2834            decoder.debug_check_bounds::<Self>(offset);
2835            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
2836                None => return Err(fidl::Error::NotNullable),
2837                Some(len) => len,
2838            };
2839            // Calling decoder.out_of_line_offset(0) is not allowed.
2840            if len == 0 {
2841                return Ok(());
2842            };
2843            depth.increment()?;
2844            let envelope_size = 8;
2845            let bytes_len = len * envelope_size;
2846            let offset = decoder.out_of_line_offset(bytes_len)?;
2847            // Decode the envelope for each type.
2848            let mut _next_ordinal_to_read = 0;
2849            let mut next_offset = offset;
2850            let end_offset = offset + bytes_len;
2851            _next_ordinal_to_read += 1;
2852            if next_offset >= end_offset {
2853                return Ok(());
2854            }
2855
2856            // Decode unknown envelopes for gaps in ordinals.
2857            while _next_ordinal_to_read < 1 {
2858                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2859                _next_ordinal_to_read += 1;
2860                next_offset += envelope_size;
2861            }
2862
2863            let next_out_of_line = decoder.next_out_of_line();
2864            let handles_before = decoder.remaining_handles();
2865            if let Some((inlined, num_bytes, num_handles)) =
2866                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2867            {
2868                let member_inline_size =
2869                    <ChannelMode as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2870                if inlined != (member_inline_size <= 4) {
2871                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2872                }
2873                let inner_offset;
2874                let mut inner_depth = depth.clone();
2875                if inlined {
2876                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2877                    inner_offset = next_offset;
2878                } else {
2879                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2880                    inner_depth.increment()?;
2881                }
2882                let val_ref =
2883                    self.channel_mode.get_or_insert_with(|| fidl::new_empty!(ChannelMode, D));
2884                fidl::decode!(ChannelMode, D, val_ref, decoder, inner_offset, inner_depth)?;
2885                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2886                {
2887                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2888                }
2889                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2890                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2891                }
2892            }
2893
2894            next_offset += envelope_size;
2895            _next_ordinal_to_read += 1;
2896            if next_offset >= end_offset {
2897                return Ok(());
2898            }
2899
2900            // Decode unknown envelopes for gaps in ordinals.
2901            while _next_ordinal_to_read < 2 {
2902                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2903                _next_ordinal_to_read += 1;
2904                next_offset += envelope_size;
2905            }
2906
2907            let next_out_of_line = decoder.next_out_of_line();
2908            let handles_before = decoder.remaining_handles();
2909            if let Some((inlined, num_bytes, num_handles)) =
2910                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2911            {
2912                let member_inline_size =
2913                    <u16 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2914                if inlined != (member_inline_size <= 4) {
2915                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2916                }
2917                let inner_offset;
2918                let mut inner_depth = depth.clone();
2919                if inlined {
2920                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2921                    inner_offset = next_offset;
2922                } else {
2923                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2924                    inner_depth.increment()?;
2925                }
2926                let val_ref =
2927                    self.max_rx_packet_size.get_or_insert_with(|| fidl::new_empty!(u16, D));
2928                fidl::decode!(u16, D, val_ref, decoder, inner_offset, inner_depth)?;
2929                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2930                {
2931                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2932                }
2933                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2934                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2935                }
2936            }
2937
2938            next_offset += envelope_size;
2939            _next_ordinal_to_read += 1;
2940            if next_offset >= end_offset {
2941                return Ok(());
2942            }
2943
2944            // Decode unknown envelopes for gaps in ordinals.
2945            while _next_ordinal_to_read < 3 {
2946                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2947                _next_ordinal_to_read += 1;
2948                next_offset += envelope_size;
2949            }
2950
2951            let next_out_of_line = decoder.next_out_of_line();
2952            let handles_before = decoder.remaining_handles();
2953            if let Some((inlined, num_bytes, num_handles)) =
2954                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2955            {
2956                let member_inline_size =
2957                    <SecurityRequirements as fidl::encoding::TypeMarker>::inline_size(
2958                        decoder.context,
2959                    );
2960                if inlined != (member_inline_size <= 4) {
2961                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2962                }
2963                let inner_offset;
2964                let mut inner_depth = depth.clone();
2965                if inlined {
2966                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2967                    inner_offset = next_offset;
2968                } else {
2969                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2970                    inner_depth.increment()?;
2971                }
2972                let val_ref = self
2973                    .security_requirements
2974                    .get_or_insert_with(|| fidl::new_empty!(SecurityRequirements, D));
2975                fidl::decode!(
2976                    SecurityRequirements,
2977                    D,
2978                    val_ref,
2979                    decoder,
2980                    inner_offset,
2981                    inner_depth
2982                )?;
2983                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2984                {
2985                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2986                }
2987                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2988                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2989                }
2990            }
2991
2992            next_offset += envelope_size;
2993            _next_ordinal_to_read += 1;
2994            if next_offset >= end_offset {
2995                return Ok(());
2996            }
2997
2998            // Decode unknown envelopes for gaps in ordinals.
2999            while _next_ordinal_to_read < 4 {
3000                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3001                _next_ordinal_to_read += 1;
3002                next_offset += envelope_size;
3003            }
3004
3005            let next_out_of_line = decoder.next_out_of_line();
3006            let handles_before = decoder.remaining_handles();
3007            if let Some((inlined, num_bytes, num_handles)) =
3008                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3009            {
3010                let member_inline_size =
3011                    <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3012                if inlined != (member_inline_size <= 4) {
3013                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3014                }
3015                let inner_offset;
3016                let mut inner_depth = depth.clone();
3017                if inlined {
3018                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3019                    inner_offset = next_offset;
3020                } else {
3021                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3022                    inner_depth.increment()?;
3023                }
3024                let val_ref = self.flush_timeout.get_or_insert_with(|| fidl::new_empty!(i64, D));
3025                fidl::decode!(i64, D, val_ref, decoder, inner_offset, inner_depth)?;
3026                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3027                {
3028                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3029                }
3030                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3031                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3032                }
3033            }
3034
3035            next_offset += envelope_size;
3036
3037            // Decode the remaining unknown envelopes.
3038            while next_offset < end_offset {
3039                _next_ordinal_to_read += 1;
3040                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3041                next_offset += envelope_size;
3042            }
3043
3044            Ok(())
3045        }
3046    }
3047
3048    impl CodecAttributes {
3049        #[inline(always)]
3050        fn max_ordinal_present(&self) -> u64 {
3051            if let Some(_) = self.codec_configuration {
3052                return 2;
3053            }
3054            if let Some(_) = self.codec_id {
3055                return 1;
3056            }
3057            0
3058        }
3059    }
3060
3061    impl fidl::encoding::ValueTypeMarker for CodecAttributes {
3062        type Borrowed<'a> = &'a Self;
3063        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3064            value
3065        }
3066    }
3067
3068    unsafe impl fidl::encoding::TypeMarker for CodecAttributes {
3069        type Owned = Self;
3070
3071        #[inline(always)]
3072        fn inline_align(_context: fidl::encoding::Context) -> usize {
3073            8
3074        }
3075
3076        #[inline(always)]
3077        fn inline_size(_context: fidl::encoding::Context) -> usize {
3078            16
3079        }
3080    }
3081
3082    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<CodecAttributes, D>
3083        for &CodecAttributes
3084    {
3085        unsafe fn encode(
3086            self,
3087            encoder: &mut fidl::encoding::Encoder<'_, D>,
3088            offset: usize,
3089            mut depth: fidl::encoding::Depth,
3090        ) -> fidl::Result<()> {
3091            encoder.debug_check_bounds::<CodecAttributes>(offset);
3092            // Vector header
3093            let max_ordinal: u64 = self.max_ordinal_present();
3094            encoder.write_num(max_ordinal, offset);
3095            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
3096            // Calling encoder.out_of_line_offset(0) is not allowed.
3097            if max_ordinal == 0 {
3098                return Ok(());
3099            }
3100            depth.increment()?;
3101            let envelope_size = 8;
3102            let bytes_len = max_ordinal as usize * envelope_size;
3103            #[allow(unused_variables)]
3104            let offset = encoder.out_of_line_offset(bytes_len);
3105            let mut _prev_end_offset: usize = 0;
3106            if 1 > max_ordinal {
3107                return Ok(());
3108            }
3109
3110            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3111            // are envelope_size bytes.
3112            let cur_offset: usize = (1 - 1) * envelope_size;
3113
3114            // Zero reserved fields.
3115            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3116
3117            // Safety:
3118            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3119            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3120            //   envelope_size bytes, there is always sufficient room.
3121            fidl::encoding::encode_in_envelope_optional::<CodecId, D>(
3122                self.codec_id.as_ref().map(<CodecId as fidl::encoding::ValueTypeMarker>::borrow),
3123                encoder,
3124                offset + cur_offset,
3125                depth,
3126            )?;
3127
3128            _prev_end_offset = cur_offset + envelope_size;
3129            if 2 > max_ordinal {
3130                return Ok(());
3131            }
3132
3133            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3134            // are envelope_size bytes.
3135            let cur_offset: usize = (2 - 1) * envelope_size;
3136
3137            // Zero reserved fields.
3138            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3139
3140            // Safety:
3141            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3142            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3143            //   envelope_size bytes, there is always sufficient room.
3144            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedVector<u8>, D>(
3145            self.codec_configuration.as_ref().map(<fidl::encoding::UnboundedVector<u8> as fidl::encoding::ValueTypeMarker>::borrow),
3146            encoder, offset + cur_offset, depth
3147        )?;
3148
3149            _prev_end_offset = cur_offset + envelope_size;
3150
3151            Ok(())
3152        }
3153    }
3154
3155    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for CodecAttributes {
3156        #[inline(always)]
3157        fn new_empty() -> Self {
3158            Self::default()
3159        }
3160
3161        unsafe fn decode(
3162            &mut self,
3163            decoder: &mut fidl::encoding::Decoder<'_, D>,
3164            offset: usize,
3165            mut depth: fidl::encoding::Depth,
3166        ) -> fidl::Result<()> {
3167            decoder.debug_check_bounds::<Self>(offset);
3168            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
3169                None => return Err(fidl::Error::NotNullable),
3170                Some(len) => len,
3171            };
3172            // Calling decoder.out_of_line_offset(0) is not allowed.
3173            if len == 0 {
3174                return Ok(());
3175            };
3176            depth.increment()?;
3177            let envelope_size = 8;
3178            let bytes_len = len * envelope_size;
3179            let offset = decoder.out_of_line_offset(bytes_len)?;
3180            // Decode the envelope for each type.
3181            let mut _next_ordinal_to_read = 0;
3182            let mut next_offset = offset;
3183            let end_offset = offset + bytes_len;
3184            _next_ordinal_to_read += 1;
3185            if next_offset >= end_offset {
3186                return Ok(());
3187            }
3188
3189            // Decode unknown envelopes for gaps in ordinals.
3190            while _next_ordinal_to_read < 1 {
3191                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3192                _next_ordinal_to_read += 1;
3193                next_offset += envelope_size;
3194            }
3195
3196            let next_out_of_line = decoder.next_out_of_line();
3197            let handles_before = decoder.remaining_handles();
3198            if let Some((inlined, num_bytes, num_handles)) =
3199                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3200            {
3201                let member_inline_size =
3202                    <CodecId as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3203                if inlined != (member_inline_size <= 4) {
3204                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3205                }
3206                let inner_offset;
3207                let mut inner_depth = depth.clone();
3208                if inlined {
3209                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3210                    inner_offset = next_offset;
3211                } else {
3212                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3213                    inner_depth.increment()?;
3214                }
3215                let val_ref = self.codec_id.get_or_insert_with(|| fidl::new_empty!(CodecId, D));
3216                fidl::decode!(CodecId, D, val_ref, decoder, inner_offset, inner_depth)?;
3217                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3218                {
3219                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3220                }
3221                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3222                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3223                }
3224            }
3225
3226            next_offset += envelope_size;
3227            _next_ordinal_to_read += 1;
3228            if next_offset >= end_offset {
3229                return Ok(());
3230            }
3231
3232            // Decode unknown envelopes for gaps in ordinals.
3233            while _next_ordinal_to_read < 2 {
3234                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3235                _next_ordinal_to_read += 1;
3236                next_offset += envelope_size;
3237            }
3238
3239            let next_out_of_line = decoder.next_out_of_line();
3240            let handles_before = decoder.remaining_handles();
3241            if let Some((inlined, num_bytes, num_handles)) =
3242                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3243            {
3244                let member_inline_size = <fidl::encoding::UnboundedVector<u8> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3245                if inlined != (member_inline_size <= 4) {
3246                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3247                }
3248                let inner_offset;
3249                let mut inner_depth = depth.clone();
3250                if inlined {
3251                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3252                    inner_offset = next_offset;
3253                } else {
3254                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3255                    inner_depth.increment()?;
3256                }
3257                let val_ref = self.codec_configuration.get_or_insert_with(|| {
3258                    fidl::new_empty!(fidl::encoding::UnboundedVector<u8>, D)
3259                });
3260                fidl::decode!(
3261                    fidl::encoding::UnboundedVector<u8>,
3262                    D,
3263                    val_ref,
3264                    decoder,
3265                    inner_offset,
3266                    inner_depth
3267                )?;
3268                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3269                {
3270                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3271                }
3272                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3273                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3274                }
3275            }
3276
3277            next_offset += envelope_size;
3278
3279            // Decode the remaining unknown envelopes.
3280            while next_offset < end_offset {
3281                _next_ordinal_to_read += 1;
3282                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3283                next_offset += envelope_size;
3284            }
3285
3286            Ok(())
3287        }
3288    }
3289
3290    impl SecurityRequirements {
3291        #[inline(always)]
3292        fn max_ordinal_present(&self) -> u64 {
3293            if let Some(_) = self.secure_connections_required {
3294                return 2;
3295            }
3296            if let Some(_) = self.authentication_required {
3297                return 1;
3298            }
3299            0
3300        }
3301    }
3302
3303    impl fidl::encoding::ValueTypeMarker for SecurityRequirements {
3304        type Borrowed<'a> = &'a Self;
3305        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3306            value
3307        }
3308    }
3309
3310    unsafe impl fidl::encoding::TypeMarker for SecurityRequirements {
3311        type Owned = Self;
3312
3313        #[inline(always)]
3314        fn inline_align(_context: fidl::encoding::Context) -> usize {
3315            8
3316        }
3317
3318        #[inline(always)]
3319        fn inline_size(_context: fidl::encoding::Context) -> usize {
3320            16
3321        }
3322    }
3323
3324    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<SecurityRequirements, D>
3325        for &SecurityRequirements
3326    {
3327        unsafe fn encode(
3328            self,
3329            encoder: &mut fidl::encoding::Encoder<'_, D>,
3330            offset: usize,
3331            mut depth: fidl::encoding::Depth,
3332        ) -> fidl::Result<()> {
3333            encoder.debug_check_bounds::<SecurityRequirements>(offset);
3334            // Vector header
3335            let max_ordinal: u64 = self.max_ordinal_present();
3336            encoder.write_num(max_ordinal, offset);
3337            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
3338            // Calling encoder.out_of_line_offset(0) is not allowed.
3339            if max_ordinal == 0 {
3340                return Ok(());
3341            }
3342            depth.increment()?;
3343            let envelope_size = 8;
3344            let bytes_len = max_ordinal as usize * envelope_size;
3345            #[allow(unused_variables)]
3346            let offset = encoder.out_of_line_offset(bytes_len);
3347            let mut _prev_end_offset: usize = 0;
3348            if 1 > max_ordinal {
3349                return Ok(());
3350            }
3351
3352            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3353            // are envelope_size bytes.
3354            let cur_offset: usize = (1 - 1) * envelope_size;
3355
3356            // Zero reserved fields.
3357            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3358
3359            // Safety:
3360            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3361            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3362            //   envelope_size bytes, there is always sufficient room.
3363            fidl::encoding::encode_in_envelope_optional::<bool, D>(
3364                self.authentication_required
3365                    .as_ref()
3366                    .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
3367                encoder,
3368                offset + cur_offset,
3369                depth,
3370            )?;
3371
3372            _prev_end_offset = cur_offset + envelope_size;
3373            if 2 > max_ordinal {
3374                return Ok(());
3375            }
3376
3377            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3378            // are envelope_size bytes.
3379            let cur_offset: usize = (2 - 1) * envelope_size;
3380
3381            // Zero reserved fields.
3382            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3383
3384            // Safety:
3385            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3386            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3387            //   envelope_size bytes, there is always sufficient room.
3388            fidl::encoding::encode_in_envelope_optional::<bool, D>(
3389                self.secure_connections_required
3390                    .as_ref()
3391                    .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
3392                encoder,
3393                offset + cur_offset,
3394                depth,
3395            )?;
3396
3397            _prev_end_offset = cur_offset + envelope_size;
3398
3399            Ok(())
3400        }
3401    }
3402
3403    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SecurityRequirements {
3404        #[inline(always)]
3405        fn new_empty() -> Self {
3406            Self::default()
3407        }
3408
3409        unsafe fn decode(
3410            &mut self,
3411            decoder: &mut fidl::encoding::Decoder<'_, D>,
3412            offset: usize,
3413            mut depth: fidl::encoding::Depth,
3414        ) -> fidl::Result<()> {
3415            decoder.debug_check_bounds::<Self>(offset);
3416            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
3417                None => return Err(fidl::Error::NotNullable),
3418                Some(len) => len,
3419            };
3420            // Calling decoder.out_of_line_offset(0) is not allowed.
3421            if len == 0 {
3422                return Ok(());
3423            };
3424            depth.increment()?;
3425            let envelope_size = 8;
3426            let bytes_len = len * envelope_size;
3427            let offset = decoder.out_of_line_offset(bytes_len)?;
3428            // Decode the envelope for each type.
3429            let mut _next_ordinal_to_read = 0;
3430            let mut next_offset = offset;
3431            let end_offset = offset + bytes_len;
3432            _next_ordinal_to_read += 1;
3433            if next_offset >= end_offset {
3434                return Ok(());
3435            }
3436
3437            // Decode unknown envelopes for gaps in ordinals.
3438            while _next_ordinal_to_read < 1 {
3439                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3440                _next_ordinal_to_read += 1;
3441                next_offset += envelope_size;
3442            }
3443
3444            let next_out_of_line = decoder.next_out_of_line();
3445            let handles_before = decoder.remaining_handles();
3446            if let Some((inlined, num_bytes, num_handles)) =
3447                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3448            {
3449                let member_inline_size =
3450                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3451                if inlined != (member_inline_size <= 4) {
3452                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3453                }
3454                let inner_offset;
3455                let mut inner_depth = depth.clone();
3456                if inlined {
3457                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3458                    inner_offset = next_offset;
3459                } else {
3460                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3461                    inner_depth.increment()?;
3462                }
3463                let val_ref =
3464                    self.authentication_required.get_or_insert_with(|| fidl::new_empty!(bool, D));
3465                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
3466                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3467                {
3468                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3469                }
3470                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3471                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3472                }
3473            }
3474
3475            next_offset += envelope_size;
3476            _next_ordinal_to_read += 1;
3477            if next_offset >= end_offset {
3478                return Ok(());
3479            }
3480
3481            // Decode unknown envelopes for gaps in ordinals.
3482            while _next_ordinal_to_read < 2 {
3483                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3484                _next_ordinal_to_read += 1;
3485                next_offset += envelope_size;
3486            }
3487
3488            let next_out_of_line = decoder.next_out_of_line();
3489            let handles_before = decoder.remaining_handles();
3490            if let Some((inlined, num_bytes, num_handles)) =
3491                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3492            {
3493                let member_inline_size =
3494                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3495                if inlined != (member_inline_size <= 4) {
3496                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3497                }
3498                let inner_offset;
3499                let mut inner_depth = depth.clone();
3500                if inlined {
3501                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3502                    inner_offset = next_offset;
3503                } else {
3504                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3505                    inner_depth.increment()?;
3506                }
3507                let val_ref = self
3508                    .secure_connections_required
3509                    .get_or_insert_with(|| fidl::new_empty!(bool, D));
3510                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
3511                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3512                {
3513                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3514                }
3515                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3516                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3517                }
3518            }
3519
3520            next_offset += envelope_size;
3521
3522            // Decode the remaining unknown envelopes.
3523            while next_offset < end_offset {
3524                _next_ordinal_to_read += 1;
3525                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3526                next_offset += envelope_size;
3527            }
3528
3529            Ok(())
3530        }
3531    }
3532
3533    impl VendorCodingFormat {
3534        #[inline(always)]
3535        fn max_ordinal_present(&self) -> u64 {
3536            if let Some(_) = self.vendor_id {
3537                return 2;
3538            }
3539            if let Some(_) = self.company_id {
3540                return 1;
3541            }
3542            0
3543        }
3544    }
3545
3546    impl fidl::encoding::ValueTypeMarker for VendorCodingFormat {
3547        type Borrowed<'a> = &'a Self;
3548        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3549            value
3550        }
3551    }
3552
3553    unsafe impl fidl::encoding::TypeMarker for VendorCodingFormat {
3554        type Owned = Self;
3555
3556        #[inline(always)]
3557        fn inline_align(_context: fidl::encoding::Context) -> usize {
3558            8
3559        }
3560
3561        #[inline(always)]
3562        fn inline_size(_context: fidl::encoding::Context) -> usize {
3563            16
3564        }
3565    }
3566
3567    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<VendorCodingFormat, D>
3568        for &VendorCodingFormat
3569    {
3570        unsafe fn encode(
3571            self,
3572            encoder: &mut fidl::encoding::Encoder<'_, D>,
3573            offset: usize,
3574            mut depth: fidl::encoding::Depth,
3575        ) -> fidl::Result<()> {
3576            encoder.debug_check_bounds::<VendorCodingFormat>(offset);
3577            // Vector header
3578            let max_ordinal: u64 = self.max_ordinal_present();
3579            encoder.write_num(max_ordinal, offset);
3580            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
3581            // Calling encoder.out_of_line_offset(0) is not allowed.
3582            if max_ordinal == 0 {
3583                return Ok(());
3584            }
3585            depth.increment()?;
3586            let envelope_size = 8;
3587            let bytes_len = max_ordinal as usize * envelope_size;
3588            #[allow(unused_variables)]
3589            let offset = encoder.out_of_line_offset(bytes_len);
3590            let mut _prev_end_offset: usize = 0;
3591            if 1 > max_ordinal {
3592                return Ok(());
3593            }
3594
3595            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3596            // are envelope_size bytes.
3597            let cur_offset: usize = (1 - 1) * envelope_size;
3598
3599            // Zero reserved fields.
3600            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3601
3602            // Safety:
3603            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3604            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3605            //   envelope_size bytes, there is always sufficient room.
3606            fidl::encoding::encode_in_envelope_optional::<u16, D>(
3607                self.company_id.as_ref().map(<u16 as fidl::encoding::ValueTypeMarker>::borrow),
3608                encoder,
3609                offset + cur_offset,
3610                depth,
3611            )?;
3612
3613            _prev_end_offset = cur_offset + envelope_size;
3614            if 2 > max_ordinal {
3615                return Ok(());
3616            }
3617
3618            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3619            // are envelope_size bytes.
3620            let cur_offset: usize = (2 - 1) * envelope_size;
3621
3622            // Zero reserved fields.
3623            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3624
3625            // Safety:
3626            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3627            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3628            //   envelope_size bytes, there is always sufficient room.
3629            fidl::encoding::encode_in_envelope_optional::<u16, D>(
3630                self.vendor_id.as_ref().map(<u16 as fidl::encoding::ValueTypeMarker>::borrow),
3631                encoder,
3632                offset + cur_offset,
3633                depth,
3634            )?;
3635
3636            _prev_end_offset = cur_offset + envelope_size;
3637
3638            Ok(())
3639        }
3640    }
3641
3642    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for VendorCodingFormat {
3643        #[inline(always)]
3644        fn new_empty() -> Self {
3645            Self::default()
3646        }
3647
3648        unsafe fn decode(
3649            &mut self,
3650            decoder: &mut fidl::encoding::Decoder<'_, D>,
3651            offset: usize,
3652            mut depth: fidl::encoding::Depth,
3653        ) -> fidl::Result<()> {
3654            decoder.debug_check_bounds::<Self>(offset);
3655            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
3656                None => return Err(fidl::Error::NotNullable),
3657                Some(len) => len,
3658            };
3659            // Calling decoder.out_of_line_offset(0) is not allowed.
3660            if len == 0 {
3661                return Ok(());
3662            };
3663            depth.increment()?;
3664            let envelope_size = 8;
3665            let bytes_len = len * envelope_size;
3666            let offset = decoder.out_of_line_offset(bytes_len)?;
3667            // Decode the envelope for each type.
3668            let mut _next_ordinal_to_read = 0;
3669            let mut next_offset = offset;
3670            let end_offset = offset + bytes_len;
3671            _next_ordinal_to_read += 1;
3672            if next_offset >= end_offset {
3673                return Ok(());
3674            }
3675
3676            // Decode unknown envelopes for gaps in ordinals.
3677            while _next_ordinal_to_read < 1 {
3678                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3679                _next_ordinal_to_read += 1;
3680                next_offset += envelope_size;
3681            }
3682
3683            let next_out_of_line = decoder.next_out_of_line();
3684            let handles_before = decoder.remaining_handles();
3685            if let Some((inlined, num_bytes, num_handles)) =
3686                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3687            {
3688                let member_inline_size =
3689                    <u16 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3690                if inlined != (member_inline_size <= 4) {
3691                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3692                }
3693                let inner_offset;
3694                let mut inner_depth = depth.clone();
3695                if inlined {
3696                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3697                    inner_offset = next_offset;
3698                } else {
3699                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3700                    inner_depth.increment()?;
3701                }
3702                let val_ref = self.company_id.get_or_insert_with(|| fidl::new_empty!(u16, D));
3703                fidl::decode!(u16, D, val_ref, decoder, inner_offset, inner_depth)?;
3704                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3705                {
3706                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3707                }
3708                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3709                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3710                }
3711            }
3712
3713            next_offset += envelope_size;
3714            _next_ordinal_to_read += 1;
3715            if next_offset >= end_offset {
3716                return Ok(());
3717            }
3718
3719            // Decode unknown envelopes for gaps in ordinals.
3720            while _next_ordinal_to_read < 2 {
3721                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3722                _next_ordinal_to_read += 1;
3723                next_offset += envelope_size;
3724            }
3725
3726            let next_out_of_line = decoder.next_out_of_line();
3727            let handles_before = decoder.remaining_handles();
3728            if let Some((inlined, num_bytes, num_handles)) =
3729                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3730            {
3731                let member_inline_size =
3732                    <u16 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3733                if inlined != (member_inline_size <= 4) {
3734                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3735                }
3736                let inner_offset;
3737                let mut inner_depth = depth.clone();
3738                if inlined {
3739                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3740                    inner_offset = next_offset;
3741                } else {
3742                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3743                    inner_depth.increment()?;
3744                }
3745                let val_ref = self.vendor_id.get_or_insert_with(|| fidl::new_empty!(u16, D));
3746                fidl::decode!(u16, D, val_ref, decoder, inner_offset, inner_depth)?;
3747                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3748                {
3749                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3750                }
3751                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3752                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3753                }
3754            }
3755
3756            next_offset += envelope_size;
3757
3758            // Decode the remaining unknown envelopes.
3759            while next_offset < end_offset {
3760                _next_ordinal_to_read += 1;
3761                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3762                next_offset += envelope_size;
3763            }
3764
3765            Ok(())
3766        }
3767    }
3768
3769    impl fidl::encoding::ValueTypeMarker for CodecId {
3770        type Borrowed<'a> = &'a Self;
3771        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3772            value
3773        }
3774    }
3775
3776    unsafe impl fidl::encoding::TypeMarker for CodecId {
3777        type Owned = Self;
3778
3779        #[inline(always)]
3780        fn inline_align(_context: fidl::encoding::Context) -> usize {
3781            8
3782        }
3783
3784        #[inline(always)]
3785        fn inline_size(_context: fidl::encoding::Context) -> usize {
3786            16
3787        }
3788    }
3789
3790    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<CodecId, D> for &CodecId {
3791        #[inline]
3792        unsafe fn encode(
3793            self,
3794            encoder: &mut fidl::encoding::Encoder<'_, D>,
3795            offset: usize,
3796            _depth: fidl::encoding::Depth,
3797        ) -> fidl::Result<()> {
3798            encoder.debug_check_bounds::<CodecId>(offset);
3799            encoder.write_num::<u64>(self.ordinal(), offset);
3800            match self {
3801                CodecId::AssignedFormat(ref val) => {
3802                    fidl::encoding::encode_in_envelope::<AssignedCodingFormat, D>(
3803                        <AssignedCodingFormat as fidl::encoding::ValueTypeMarker>::borrow(val),
3804                        encoder,
3805                        offset + 8,
3806                        _depth,
3807                    )
3808                }
3809                CodecId::VendorFormat(ref val) => {
3810                    fidl::encoding::encode_in_envelope::<VendorCodingFormat, D>(
3811                        <VendorCodingFormat as fidl::encoding::ValueTypeMarker>::borrow(val),
3812                        encoder,
3813                        offset + 8,
3814                        _depth,
3815                    )
3816                }
3817                CodecId::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
3818            }
3819        }
3820    }
3821
3822    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for CodecId {
3823        #[inline(always)]
3824        fn new_empty() -> Self {
3825            Self::__SourceBreaking { unknown_ordinal: 0 }
3826        }
3827
3828        #[inline]
3829        unsafe fn decode(
3830            &mut self,
3831            decoder: &mut fidl::encoding::Decoder<'_, D>,
3832            offset: usize,
3833            mut depth: fidl::encoding::Depth,
3834        ) -> fidl::Result<()> {
3835            decoder.debug_check_bounds::<Self>(offset);
3836            #[allow(unused_variables)]
3837            let next_out_of_line = decoder.next_out_of_line();
3838            let handles_before = decoder.remaining_handles();
3839            let (ordinal, inlined, num_bytes, num_handles) =
3840                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
3841
3842            let member_inline_size = match ordinal {
3843                1 => <AssignedCodingFormat as fidl::encoding::TypeMarker>::inline_size(
3844                    decoder.context,
3845                ),
3846                2 => {
3847                    <VendorCodingFormat as fidl::encoding::TypeMarker>::inline_size(decoder.context)
3848                }
3849                0 => return Err(fidl::Error::UnknownUnionTag),
3850                _ => num_bytes as usize,
3851            };
3852
3853            if inlined != (member_inline_size <= 4) {
3854                return Err(fidl::Error::InvalidInlineBitInEnvelope);
3855            }
3856            let _inner_offset;
3857            if inlined {
3858                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
3859                _inner_offset = offset + 8;
3860            } else {
3861                depth.increment()?;
3862                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3863            }
3864            match ordinal {
3865                1 => {
3866                    #[allow(irrefutable_let_patterns)]
3867                    if let CodecId::AssignedFormat(_) = self {
3868                        // Do nothing, read the value into the object
3869                    } else {
3870                        // Initialize `self` to the right variant
3871                        *self = CodecId::AssignedFormat(fidl::new_empty!(AssignedCodingFormat, D));
3872                    }
3873                    #[allow(irrefutable_let_patterns)]
3874                    if let CodecId::AssignedFormat(ref mut val) = self {
3875                        fidl::decode!(AssignedCodingFormat, D, val, decoder, _inner_offset, depth)?;
3876                    } else {
3877                        unreachable!()
3878                    }
3879                }
3880                2 => {
3881                    #[allow(irrefutable_let_patterns)]
3882                    if let CodecId::VendorFormat(_) = self {
3883                        // Do nothing, read the value into the object
3884                    } else {
3885                        // Initialize `self` to the right variant
3886                        *self = CodecId::VendorFormat(fidl::new_empty!(VendorCodingFormat, D));
3887                    }
3888                    #[allow(irrefutable_let_patterns)]
3889                    if let CodecId::VendorFormat(ref mut val) = self {
3890                        fidl::decode!(VendorCodingFormat, D, val, decoder, _inner_offset, depth)?;
3891                    } else {
3892                        unreachable!()
3893                    }
3894                }
3895                #[allow(deprecated)]
3896                ordinal => {
3897                    for _ in 0..num_handles {
3898                        decoder.drop_next_handle()?;
3899                    }
3900                    *self = CodecId::__SourceBreaking { unknown_ordinal: ordinal };
3901                }
3902            }
3903            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
3904                return Err(fidl::Error::InvalidNumBytesInEnvelope);
3905            }
3906            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3907                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3908            }
3909            Ok(())
3910        }
3911    }
3912}