1#![warn(clippy::all)]
4#![allow(unused_parens, unused_mut, unused_imports, nonstandard_style)]
5
6use bitflags::bitflags;
7use fidl::encoding::{MessageBufFor, ProxyChannelBox, ResourceDialect};
8use futures::future::{self, MaybeDone, TryFutureExt};
9use zx_status;
10
11pub 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
28pub 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
43pub const MAX_DEVICE_NAME_LENGTH: u8 = 248;
46
47pub 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 Public = 1,
56 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 #[deprecated = "Strict enums should not use `is_unknown`"]
76 #[inline]
77 pub fn is_unknown(&self) -> bool {
78 false
79 }
80}
81
82#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
89pub enum Appearance {
90 Unknown,
91 Phone,
92 Computer,
93 Watch,
94 WatchSports,
95 Clock,
96 Display,
97 RemoteControl,
98 EyeGlasses,
99 Tag,
100 Keyring,
101 MediaPlayer,
102 BarcodeScanner,
103 Thermometer,
104 ThermometerEar,
105 HeartRateSensor,
106 HeartRateSensorBelt,
107 BloodPressure,
108 BloodPressureArm,
109 BloodPressureWrist,
110 Hid,
111 HidKeyboard,
112 HidMouse,
113 HidJoystick,
114 HidGamepad,
115 HidDigitizerTablet,
116 HidCardReader,
117 HidDigitalPen,
118 HidBarcodeScanner,
119 GlucoseMeter,
120 RunningWalkingSensor,
121 RunningWalkingSensorInShoe,
122 RunningWalkingSensorOnShoe,
123 RunningWalkingSensorOnHip,
124 Cycling,
125 CyclingComputer,
126 CyclingSpeedSensor,
127 CyclingCadenceSensor,
128 CyclingPowerSensor,
129 CyclingSpeedAndCadenceSensor,
130 PulseOximeter,
131 PulseOximeterFingertip,
132 PulseOximeterWrist,
133 WeightScale,
134 PersonalMobility,
135 PersonalMobilityWheelchair,
136 PersonalMobilityScooter,
137 GlucoseMonitor,
138 SportsActivity,
139 SportsActivityLocationDisplay,
140 SportsActivityLocationAndNavDisplay,
141 SportsActivityLocationPod,
142 SportsActivityLocationAndNavPod,
143 #[doc(hidden)]
144 __SourceBreaking {
145 unknown_ordinal: u16,
146 },
147}
148
149#[macro_export]
151macro_rules! AppearanceUnknown {
152 () => {
153 _
154 };
155}
156
157impl Appearance {
158 #[inline]
159 pub fn from_primitive(prim: u16) -> Option<Self> {
160 match prim {
161 0 => Some(Self::Unknown),
162 64 => Some(Self::Phone),
163 128 => Some(Self::Computer),
164 192 => Some(Self::Watch),
165 193 => Some(Self::WatchSports),
166 256 => Some(Self::Clock),
167 320 => Some(Self::Display),
168 384 => Some(Self::RemoteControl),
169 448 => Some(Self::EyeGlasses),
170 512 => Some(Self::Tag),
171 576 => Some(Self::Keyring),
172 640 => Some(Self::MediaPlayer),
173 704 => Some(Self::BarcodeScanner),
174 768 => Some(Self::Thermometer),
175 769 => Some(Self::ThermometerEar),
176 832 => Some(Self::HeartRateSensor),
177 833 => Some(Self::HeartRateSensorBelt),
178 896 => Some(Self::BloodPressure),
179 897 => Some(Self::BloodPressureArm),
180 898 => Some(Self::BloodPressureWrist),
181 960 => Some(Self::Hid),
182 961 => Some(Self::HidKeyboard),
183 962 => Some(Self::HidMouse),
184 963 => Some(Self::HidJoystick),
185 964 => Some(Self::HidGamepad),
186 965 => Some(Self::HidDigitizerTablet),
187 966 => Some(Self::HidCardReader),
188 967 => Some(Self::HidDigitalPen),
189 968 => Some(Self::HidBarcodeScanner),
190 1024 => Some(Self::GlucoseMeter),
191 1088 => Some(Self::RunningWalkingSensor),
192 1089 => Some(Self::RunningWalkingSensorInShoe),
193 1090 => Some(Self::RunningWalkingSensorOnShoe),
194 1091 => Some(Self::RunningWalkingSensorOnHip),
195 1152 => Some(Self::Cycling),
196 1153 => Some(Self::CyclingComputer),
197 1154 => Some(Self::CyclingSpeedSensor),
198 1155 => Some(Self::CyclingCadenceSensor),
199 1156 => Some(Self::CyclingPowerSensor),
200 1157 => Some(Self::CyclingSpeedAndCadenceSensor),
201 3136 => Some(Self::PulseOximeter),
202 3137 => Some(Self::PulseOximeterFingertip),
203 3138 => Some(Self::PulseOximeterWrist),
204 3200 => Some(Self::WeightScale),
205 3264 => Some(Self::PersonalMobility),
206 3265 => Some(Self::PersonalMobilityWheelchair),
207 3266 => Some(Self::PersonalMobilityScooter),
208 3328 => Some(Self::GlucoseMonitor),
209 5184 => Some(Self::SportsActivity),
210 5185 => Some(Self::SportsActivityLocationDisplay),
211 5186 => Some(Self::SportsActivityLocationAndNavDisplay),
212 5187 => Some(Self::SportsActivityLocationPod),
213 5188 => Some(Self::SportsActivityLocationAndNavPod),
214 _ => None,
215 }
216 }
217
218 #[inline]
219 pub fn from_primitive_allow_unknown(prim: u16) -> Self {
220 match prim {
221 0 => Self::Unknown,
222 64 => Self::Phone,
223 128 => Self::Computer,
224 192 => Self::Watch,
225 193 => Self::WatchSports,
226 256 => Self::Clock,
227 320 => Self::Display,
228 384 => Self::RemoteControl,
229 448 => Self::EyeGlasses,
230 512 => Self::Tag,
231 576 => Self::Keyring,
232 640 => Self::MediaPlayer,
233 704 => Self::BarcodeScanner,
234 768 => Self::Thermometer,
235 769 => Self::ThermometerEar,
236 832 => Self::HeartRateSensor,
237 833 => Self::HeartRateSensorBelt,
238 896 => Self::BloodPressure,
239 897 => Self::BloodPressureArm,
240 898 => Self::BloodPressureWrist,
241 960 => Self::Hid,
242 961 => Self::HidKeyboard,
243 962 => Self::HidMouse,
244 963 => Self::HidJoystick,
245 964 => Self::HidGamepad,
246 965 => Self::HidDigitizerTablet,
247 966 => Self::HidCardReader,
248 967 => Self::HidDigitalPen,
249 968 => Self::HidBarcodeScanner,
250 1024 => Self::GlucoseMeter,
251 1088 => Self::RunningWalkingSensor,
252 1089 => Self::RunningWalkingSensorInShoe,
253 1090 => Self::RunningWalkingSensorOnShoe,
254 1091 => Self::RunningWalkingSensorOnHip,
255 1152 => Self::Cycling,
256 1153 => Self::CyclingComputer,
257 1154 => Self::CyclingSpeedSensor,
258 1155 => Self::CyclingCadenceSensor,
259 1156 => Self::CyclingPowerSensor,
260 1157 => Self::CyclingSpeedAndCadenceSensor,
261 3136 => Self::PulseOximeter,
262 3137 => Self::PulseOximeterFingertip,
263 3138 => Self::PulseOximeterWrist,
264 3200 => Self::WeightScale,
265 3264 => Self::PersonalMobility,
266 3265 => Self::PersonalMobilityWheelchair,
267 3266 => Self::PersonalMobilityScooter,
268 3328 => Self::GlucoseMonitor,
269 5184 => Self::SportsActivity,
270 5185 => Self::SportsActivityLocationDisplay,
271 5186 => Self::SportsActivityLocationAndNavDisplay,
272 5187 => Self::SportsActivityLocationPod,
273 5188 => Self::SportsActivityLocationAndNavPod,
274 unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
275 }
276 }
277
278 #[inline]
279 pub fn unknown() -> Self {
280 Self::__SourceBreaking { unknown_ordinal: 0xffff }
281 }
282
283 #[inline]
284 pub const fn into_primitive(self) -> u16 {
285 match self {
286 Self::Unknown => 0,
287 Self::Phone => 64,
288 Self::Computer => 128,
289 Self::Watch => 192,
290 Self::WatchSports => 193,
291 Self::Clock => 256,
292 Self::Display => 320,
293 Self::RemoteControl => 384,
294 Self::EyeGlasses => 448,
295 Self::Tag => 512,
296 Self::Keyring => 576,
297 Self::MediaPlayer => 640,
298 Self::BarcodeScanner => 704,
299 Self::Thermometer => 768,
300 Self::ThermometerEar => 769,
301 Self::HeartRateSensor => 832,
302 Self::HeartRateSensorBelt => 833,
303 Self::BloodPressure => 896,
304 Self::BloodPressureArm => 897,
305 Self::BloodPressureWrist => 898,
306 Self::Hid => 960,
307 Self::HidKeyboard => 961,
308 Self::HidMouse => 962,
309 Self::HidJoystick => 963,
310 Self::HidGamepad => 964,
311 Self::HidDigitizerTablet => 965,
312 Self::HidCardReader => 966,
313 Self::HidDigitalPen => 967,
314 Self::HidBarcodeScanner => 968,
315 Self::GlucoseMeter => 1024,
316 Self::RunningWalkingSensor => 1088,
317 Self::RunningWalkingSensorInShoe => 1089,
318 Self::RunningWalkingSensorOnShoe => 1090,
319 Self::RunningWalkingSensorOnHip => 1091,
320 Self::Cycling => 1152,
321 Self::CyclingComputer => 1153,
322 Self::CyclingSpeedSensor => 1154,
323 Self::CyclingCadenceSensor => 1155,
324 Self::CyclingPowerSensor => 1156,
325 Self::CyclingSpeedAndCadenceSensor => 1157,
326 Self::PulseOximeter => 3136,
327 Self::PulseOximeterFingertip => 3137,
328 Self::PulseOximeterWrist => 3138,
329 Self::WeightScale => 3200,
330 Self::PersonalMobility => 3264,
331 Self::PersonalMobilityWheelchair => 3265,
332 Self::PersonalMobilityScooter => 3266,
333 Self::GlucoseMonitor => 3328,
334 Self::SportsActivity => 5184,
335 Self::SportsActivityLocationDisplay => 5185,
336 Self::SportsActivityLocationAndNavDisplay => 5186,
337 Self::SportsActivityLocationPod => 5187,
338 Self::SportsActivityLocationAndNavPod => 5188,
339 Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
340 }
341 }
342
343 #[inline]
344 pub fn is_unknown(&self) -> bool {
345 match self {
346 Self::__SourceBreaking { unknown_ordinal: _ } => true,
347 _ => false,
348 }
349 }
350}
351
352#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
355pub enum AssignedCodingFormat {
356 ULawLog,
357 ALawLog,
358 Cvsd,
359 Transparent,
360 LinearPcm,
361 Msbc,
362 Lc3,
363 G729A,
364 #[doc(hidden)]
365 __SourceBreaking {
366 unknown_ordinal: u8,
367 },
368}
369
370#[macro_export]
372macro_rules! AssignedCodingFormatUnknown {
373 () => {
374 _
375 };
376}
377
378impl AssignedCodingFormat {
379 #[inline]
380 pub fn from_primitive(prim: u8) -> Option<Self> {
381 match prim {
382 0 => Some(Self::ULawLog),
383 1 => Some(Self::ALawLog),
384 2 => Some(Self::Cvsd),
385 3 => Some(Self::Transparent),
386 4 => Some(Self::LinearPcm),
387 5 => Some(Self::Msbc),
388 6 => Some(Self::Lc3),
389 7 => Some(Self::G729A),
390 _ => None,
391 }
392 }
393
394 #[inline]
395 pub fn from_primitive_allow_unknown(prim: u8) -> Self {
396 match prim {
397 0 => Self::ULawLog,
398 1 => Self::ALawLog,
399 2 => Self::Cvsd,
400 3 => Self::Transparent,
401 4 => Self::LinearPcm,
402 5 => Self::Msbc,
403 6 => Self::Lc3,
404 7 => Self::G729A,
405 unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
406 }
407 }
408
409 #[inline]
410 pub fn unknown() -> Self {
411 Self::__SourceBreaking { unknown_ordinal: 0xff }
412 }
413
414 #[inline]
415 pub const fn into_primitive(self) -> u8 {
416 match self {
417 Self::ULawLog => 0,
418 Self::ALawLog => 1,
419 Self::Cvsd => 2,
420 Self::Transparent => 3,
421 Self::LinearPcm => 4,
422 Self::Msbc => 5,
423 Self::Lc3 => 6,
424 Self::G729A => 7,
425 Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
426 }
427 }
428
429 #[inline]
430 pub fn is_unknown(&self) -> bool {
431 match self {
432 Self::__SourceBreaking { unknown_ordinal: _ } => true,
433 _ => false,
434 }
435 }
436}
437
438#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
449pub enum ChannelMode {
450 Basic,
452 EnhancedRetransmission,
454 LeCreditBasedFlowControl,
456 EnhancedCreditBasedFlowControl,
458 #[doc(hidden)]
459 __SourceBreaking { unknown_ordinal: u32 },
460}
461
462#[macro_export]
464macro_rules! ChannelModeUnknown {
465 () => {
466 _
467 };
468}
469
470impl ChannelMode {
471 #[inline]
472 pub fn from_primitive(prim: u32) -> Option<Self> {
473 match prim {
474 1 => Some(Self::Basic),
475 2 => Some(Self::EnhancedRetransmission),
476 3 => Some(Self::LeCreditBasedFlowControl),
477 4 => Some(Self::EnhancedCreditBasedFlowControl),
478 _ => None,
479 }
480 }
481
482 #[inline]
483 pub fn from_primitive_allow_unknown(prim: u32) -> Self {
484 match prim {
485 1 => Self::Basic,
486 2 => Self::EnhancedRetransmission,
487 3 => Self::LeCreditBasedFlowControl,
488 4 => Self::EnhancedCreditBasedFlowControl,
489 unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
490 }
491 }
492
493 #[inline]
494 pub fn unknown() -> Self {
495 Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
496 }
497
498 #[inline]
499 pub const fn into_primitive(self) -> u32 {
500 match self {
501 Self::Basic => 1,
502 Self::EnhancedRetransmission => 2,
503 Self::LeCreditBasedFlowControl => 3,
504 Self::EnhancedCreditBasedFlowControl => 4,
505 Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
506 }
507 }
508
509 #[inline]
510 pub fn is_unknown(&self) -> bool {
511 match self {
512 Self::__SourceBreaking { unknown_ordinal: _ } => true,
513 _ => false,
514 }
515 }
516}
517
518#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
522#[repr(u32)]
523pub enum ConnectionRole {
524 Leader = 1,
527 Follower = 2,
530}
531
532impl ConnectionRole {
533 #[inline]
534 pub fn from_primitive(prim: u32) -> Option<Self> {
535 match prim {
536 1 => Some(Self::Leader),
537 2 => Some(Self::Follower),
538 _ => None,
539 }
540 }
541
542 #[inline]
543 pub const fn into_primitive(self) -> u32 {
544 self as u32
545 }
546
547 #[deprecated = "Strict enums should not use `is_unknown`"]
548 #[inline]
549 pub fn is_unknown(&self) -> bool {
550 false
551 }
552}
553
554#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
557#[repr(u8)]
558pub enum DataDirection {
559 Input = 1,
561 Output = 2,
563}
564
565impl DataDirection {
566 #[inline]
567 pub fn from_primitive(prim: u8) -> Option<Self> {
568 match prim {
569 1 => Some(Self::Input),
570 2 => Some(Self::Output),
571 _ => None,
572 }
573 }
574
575 #[inline]
576 pub const fn into_primitive(self) -> u8 {
577 self as u8
578 }
579
580 #[deprecated = "Strict enums should not use `is_unknown`"]
581 #[inline]
582 pub fn is_unknown(&self) -> bool {
583 false
584 }
585}
586
587#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
588#[repr(u32)]
589pub enum ErrorCode {
590 Unknown = 0,
591 Failed = 1,
592 Canceled = 2,
593 InProgress = 3,
594 TimedOut = 4,
595 NotFound = 5,
596 NotSupported = 6,
597 BluetoothNotAvailable = 7,
598 BadState = 8,
599 InvalidArguments = 9,
600 Already = 10,
601 ProtocolError = 11,
602}
603
604impl ErrorCode {
605 #[inline]
606 pub fn from_primitive(prim: u32) -> Option<Self> {
607 match prim {
608 0 => Some(Self::Unknown),
609 1 => Some(Self::Failed),
610 2 => Some(Self::Canceled),
611 3 => Some(Self::InProgress),
612 4 => Some(Self::TimedOut),
613 5 => Some(Self::NotFound),
614 6 => Some(Self::NotSupported),
615 7 => Some(Self::BluetoothNotAvailable),
616 8 => Some(Self::BadState),
617 9 => Some(Self::InvalidArguments),
618 10 => Some(Self::Already),
619 11 => Some(Self::ProtocolError),
620 _ => None,
621 }
622 }
623
624 #[inline]
625 pub const fn into_primitive(self) -> u32 {
626 self as u32
627 }
628
629 #[deprecated = "Strict enums should not use `is_unknown`"]
630 #[inline]
631 pub fn is_unknown(&self) -> bool {
632 false
633 }
634}
635
636#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
640pub enum LogicalTransportType {
641 LeCis,
643 LeBis,
645 #[doc(hidden)]
646 __SourceBreaking { unknown_ordinal: u8 },
647}
648
649#[macro_export]
651macro_rules! LogicalTransportTypeUnknown {
652 () => {
653 _
654 };
655}
656
657impl LogicalTransportType {
658 #[inline]
659 pub fn from_primitive(prim: u8) -> Option<Self> {
660 match prim {
661 1 => Some(Self::LeCis),
662 2 => Some(Self::LeBis),
663 _ => None,
664 }
665 }
666
667 #[inline]
668 pub fn from_primitive_allow_unknown(prim: u8) -> Self {
669 match prim {
670 1 => Self::LeCis,
671 2 => Self::LeBis,
672 unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
673 }
674 }
675
676 #[inline]
677 pub fn unknown() -> Self {
678 Self::__SourceBreaking { unknown_ordinal: 0xff }
679 }
680
681 #[inline]
682 pub const fn into_primitive(self) -> u8 {
683 match self {
684 Self::LeCis => 1,
685 Self::LeBis => 2,
686 Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
687 }
688 }
689
690 #[inline]
691 pub fn is_unknown(&self) -> bool {
692 match self {
693 Self::__SourceBreaking { unknown_ordinal: _ } => true,
694 _ => false,
695 }
696 }
697}
698
699#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
701pub struct Address {
702 pub type_: AddressType,
704 pub bytes: [u8; 6],
706}
707
708impl fidl::Persistable for Address {}
709
710#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
711pub struct Bool {
712 pub value: bool,
713}
714
715impl fidl::Persistable for Bool {}
716
717#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
718pub struct ChannelSendRequest {
719 pub packets: Vec<Packet>,
720}
721
722impl fidl::Persistable for ChannelSendRequest {}
723
724#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
725pub struct ChannelReceiveResponse {
726 pub packets: Vec<Packet>,
727}
728
729impl fidl::Persistable for ChannelReceiveResponse {}
730
731#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
739#[repr(C)]
740pub struct DeviceClass {
741 pub value: u32,
742}
743
744impl fidl::Persistable for DeviceClass {}
745
746#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
747pub struct Error {
748 pub error_code: ErrorCode,
749 pub protocol_error_code: u32,
750 pub description: Option<String>,
751}
752
753impl fidl::Persistable for Error {}
754
755#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
757#[repr(C)]
758pub struct HostId {
759 pub value: u64,
760}
761
762impl fidl::Persistable for HostId {}
763
764#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
765#[repr(C)]
766pub struct Int8 {
767 pub value: i8,
768}
769
770impl fidl::Persistable for Int8 {}
771
772#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
775pub struct Packet {
776 pub packet: Vec<u8>,
777}
778
779impl fidl::Persistable for Packet {}
780
781#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
783#[repr(C)]
784pub struct PeerId {
785 pub value: u64,
786}
787
788impl fidl::Persistable for PeerId {}
789
790#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
791pub struct Status {
792 pub error: Option<Box<Error>>,
793}
794
795impl fidl::Persistable for Status {}
796
797#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
798#[repr(C)]
799pub struct UInt16 {
800 pub value: u16,
801}
802
803impl fidl::Persistable for UInt16 {}
804
805#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
809#[repr(C)]
810pub struct Uuid {
811 pub value: [u8; 16],
813}
814
815impl fidl::Persistable for Uuid {}
816
817#[derive(Clone, Debug, Default, PartialEq)]
820pub struct ChannelParameters {
821 pub channel_mode: Option<ChannelMode>,
825 pub max_rx_packet_size: Option<u16>,
829 pub security_requirements: Option<SecurityRequirements>,
838 pub flush_timeout: Option<i64>,
847 #[doc(hidden)]
848 pub __source_breaking: fidl::marker::SourceBreaking,
849}
850
851impl fidl::Persistable for ChannelParameters {}
852
853#[derive(Clone, Debug, Default, PartialEq)]
855pub struct CodecAttributes {
856 pub codec_id: Option<CodecId>,
859 pub codec_configuration: Option<Vec<u8>>,
862 #[doc(hidden)]
863 pub __source_breaking: fidl::marker::SourceBreaking,
864}
865
866impl fidl::Persistable for CodecAttributes {}
867
868#[derive(Clone, Debug, Default, PartialEq)]
871pub struct SecurityRequirements {
872 pub authentication_required: Option<bool>,
876 pub secure_connections_required: Option<bool>,
881 #[doc(hidden)]
882 pub __source_breaking: fidl::marker::SourceBreaking,
883}
884
885impl fidl::Persistable for SecurityRequirements {}
886
887#[derive(Clone, Debug, Default, PartialEq)]
889pub struct VendorCodingFormat {
890 pub company_id: Option<u16>,
894 pub vendor_id: Option<u16>,
897 #[doc(hidden)]
898 pub __source_breaking: fidl::marker::SourceBreaking,
899}
900
901impl fidl::Persistable for VendorCodingFormat {}
902
903#[derive(Clone, Debug)]
905pub enum CodecId {
906 AssignedFormat(AssignedCodingFormat),
908 VendorFormat(VendorCodingFormat),
910 #[doc(hidden)]
911 __SourceBreaking { unknown_ordinal: u64 },
912}
913
914#[macro_export]
916macro_rules! CodecIdUnknown {
917 () => {
918 _
919 };
920}
921
922impl PartialEq for CodecId {
924 fn eq(&self, other: &Self) -> bool {
925 match (self, other) {
926 (Self::AssignedFormat(x), Self::AssignedFormat(y)) => *x == *y,
927 (Self::VendorFormat(x), Self::VendorFormat(y)) => *x == *y,
928 _ => false,
929 }
930 }
931}
932
933impl CodecId {
934 #[inline]
935 pub fn ordinal(&self) -> u64 {
936 match *self {
937 Self::AssignedFormat(_) => 1,
938 Self::VendorFormat(_) => 2,
939 Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
940 }
941 }
942
943 #[inline]
944 pub fn unknown_variant_for_testing() -> Self {
945 Self::__SourceBreaking { unknown_ordinal: 0 }
946 }
947
948 #[inline]
949 pub fn is_unknown(&self) -> bool {
950 match self {
951 Self::__SourceBreaking { .. } => true,
952 _ => false,
953 }
954 }
955}
956
957impl fidl::Persistable for CodecId {}
958
959mod internal {
960 use super::*;
961 unsafe impl fidl::encoding::TypeMarker for AddressType {
962 type Owned = Self;
963
964 #[inline(always)]
965 fn inline_align(_context: fidl::encoding::Context) -> usize {
966 std::mem::align_of::<u8>()
967 }
968
969 #[inline(always)]
970 fn inline_size(_context: fidl::encoding::Context) -> usize {
971 std::mem::size_of::<u8>()
972 }
973
974 #[inline(always)]
975 fn encode_is_copy() -> bool {
976 true
977 }
978
979 #[inline(always)]
980 fn decode_is_copy() -> bool {
981 false
982 }
983 }
984
985 impl fidl::encoding::ValueTypeMarker for AddressType {
986 type Borrowed<'a> = Self;
987 #[inline(always)]
988 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
989 *value
990 }
991 }
992
993 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for AddressType {
994 #[inline]
995 unsafe fn encode(
996 self,
997 encoder: &mut fidl::encoding::Encoder<'_, D>,
998 offset: usize,
999 _depth: fidl::encoding::Depth,
1000 ) -> fidl::Result<()> {
1001 encoder.debug_check_bounds::<Self>(offset);
1002 encoder.write_num(self.into_primitive(), offset);
1003 Ok(())
1004 }
1005 }
1006
1007 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for AddressType {
1008 #[inline(always)]
1009 fn new_empty() -> Self {
1010 Self::Public
1011 }
1012
1013 #[inline]
1014 unsafe fn decode(
1015 &mut self,
1016 decoder: &mut fidl::encoding::Decoder<'_, D>,
1017 offset: usize,
1018 _depth: fidl::encoding::Depth,
1019 ) -> fidl::Result<()> {
1020 decoder.debug_check_bounds::<Self>(offset);
1021 let prim = decoder.read_num::<u8>(offset);
1022
1023 *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
1024 Ok(())
1025 }
1026 }
1027 unsafe impl fidl::encoding::TypeMarker for Appearance {
1028 type Owned = Self;
1029
1030 #[inline(always)]
1031 fn inline_align(_context: fidl::encoding::Context) -> usize {
1032 std::mem::align_of::<u16>()
1033 }
1034
1035 #[inline(always)]
1036 fn inline_size(_context: fidl::encoding::Context) -> usize {
1037 std::mem::size_of::<u16>()
1038 }
1039
1040 #[inline(always)]
1041 fn encode_is_copy() -> bool {
1042 false
1043 }
1044
1045 #[inline(always)]
1046 fn decode_is_copy() -> bool {
1047 false
1048 }
1049 }
1050
1051 impl fidl::encoding::ValueTypeMarker for Appearance {
1052 type Borrowed<'a> = Self;
1053 #[inline(always)]
1054 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1055 *value
1056 }
1057 }
1058
1059 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for Appearance {
1060 #[inline]
1061 unsafe fn encode(
1062 self,
1063 encoder: &mut fidl::encoding::Encoder<'_, D>,
1064 offset: usize,
1065 _depth: fidl::encoding::Depth,
1066 ) -> fidl::Result<()> {
1067 encoder.debug_check_bounds::<Self>(offset);
1068 encoder.write_num(self.into_primitive(), offset);
1069 Ok(())
1070 }
1071 }
1072
1073 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Appearance {
1074 #[inline(always)]
1075 fn new_empty() -> Self {
1076 Self::unknown()
1077 }
1078
1079 #[inline]
1080 unsafe fn decode(
1081 &mut self,
1082 decoder: &mut fidl::encoding::Decoder<'_, D>,
1083 offset: usize,
1084 _depth: fidl::encoding::Depth,
1085 ) -> fidl::Result<()> {
1086 decoder.debug_check_bounds::<Self>(offset);
1087 let prim = decoder.read_num::<u16>(offset);
1088
1089 *self = Self::from_primitive_allow_unknown(prim);
1090 Ok(())
1091 }
1092 }
1093 unsafe impl fidl::encoding::TypeMarker for AssignedCodingFormat {
1094 type Owned = Self;
1095
1096 #[inline(always)]
1097 fn inline_align(_context: fidl::encoding::Context) -> usize {
1098 std::mem::align_of::<u8>()
1099 }
1100
1101 #[inline(always)]
1102 fn inline_size(_context: fidl::encoding::Context) -> usize {
1103 std::mem::size_of::<u8>()
1104 }
1105
1106 #[inline(always)]
1107 fn encode_is_copy() -> bool {
1108 false
1109 }
1110
1111 #[inline(always)]
1112 fn decode_is_copy() -> bool {
1113 false
1114 }
1115 }
1116
1117 impl fidl::encoding::ValueTypeMarker for AssignedCodingFormat {
1118 type Borrowed<'a> = Self;
1119 #[inline(always)]
1120 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1121 *value
1122 }
1123 }
1124
1125 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
1126 for AssignedCodingFormat
1127 {
1128 #[inline]
1129 unsafe fn encode(
1130 self,
1131 encoder: &mut fidl::encoding::Encoder<'_, D>,
1132 offset: usize,
1133 _depth: fidl::encoding::Depth,
1134 ) -> fidl::Result<()> {
1135 encoder.debug_check_bounds::<Self>(offset);
1136 encoder.write_num(self.into_primitive(), offset);
1137 Ok(())
1138 }
1139 }
1140
1141 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for AssignedCodingFormat {
1142 #[inline(always)]
1143 fn new_empty() -> Self {
1144 Self::unknown()
1145 }
1146
1147 #[inline]
1148 unsafe fn decode(
1149 &mut self,
1150 decoder: &mut fidl::encoding::Decoder<'_, D>,
1151 offset: usize,
1152 _depth: fidl::encoding::Depth,
1153 ) -> fidl::Result<()> {
1154 decoder.debug_check_bounds::<Self>(offset);
1155 let prim = decoder.read_num::<u8>(offset);
1156
1157 *self = Self::from_primitive_allow_unknown(prim);
1158 Ok(())
1159 }
1160 }
1161 unsafe impl fidl::encoding::TypeMarker for ChannelMode {
1162 type Owned = Self;
1163
1164 #[inline(always)]
1165 fn inline_align(_context: fidl::encoding::Context) -> usize {
1166 std::mem::align_of::<u32>()
1167 }
1168
1169 #[inline(always)]
1170 fn inline_size(_context: fidl::encoding::Context) -> usize {
1171 std::mem::size_of::<u32>()
1172 }
1173
1174 #[inline(always)]
1175 fn encode_is_copy() -> bool {
1176 false
1177 }
1178
1179 #[inline(always)]
1180 fn decode_is_copy() -> bool {
1181 false
1182 }
1183 }
1184
1185 impl fidl::encoding::ValueTypeMarker for ChannelMode {
1186 type Borrowed<'a> = Self;
1187 #[inline(always)]
1188 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1189 *value
1190 }
1191 }
1192
1193 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for ChannelMode {
1194 #[inline]
1195 unsafe fn encode(
1196 self,
1197 encoder: &mut fidl::encoding::Encoder<'_, D>,
1198 offset: usize,
1199 _depth: fidl::encoding::Depth,
1200 ) -> fidl::Result<()> {
1201 encoder.debug_check_bounds::<Self>(offset);
1202 encoder.write_num(self.into_primitive(), offset);
1203 Ok(())
1204 }
1205 }
1206
1207 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ChannelMode {
1208 #[inline(always)]
1209 fn new_empty() -> Self {
1210 Self::unknown()
1211 }
1212
1213 #[inline]
1214 unsafe fn decode(
1215 &mut self,
1216 decoder: &mut fidl::encoding::Decoder<'_, D>,
1217 offset: usize,
1218 _depth: fidl::encoding::Depth,
1219 ) -> fidl::Result<()> {
1220 decoder.debug_check_bounds::<Self>(offset);
1221 let prim = decoder.read_num::<u32>(offset);
1222
1223 *self = Self::from_primitive_allow_unknown(prim);
1224 Ok(())
1225 }
1226 }
1227 unsafe impl fidl::encoding::TypeMarker for ConnectionRole {
1228 type Owned = Self;
1229
1230 #[inline(always)]
1231 fn inline_align(_context: fidl::encoding::Context) -> usize {
1232 std::mem::align_of::<u32>()
1233 }
1234
1235 #[inline(always)]
1236 fn inline_size(_context: fidl::encoding::Context) -> usize {
1237 std::mem::size_of::<u32>()
1238 }
1239
1240 #[inline(always)]
1241 fn encode_is_copy() -> bool {
1242 true
1243 }
1244
1245 #[inline(always)]
1246 fn decode_is_copy() -> bool {
1247 false
1248 }
1249 }
1250
1251 impl fidl::encoding::ValueTypeMarker for ConnectionRole {
1252 type Borrowed<'a> = Self;
1253 #[inline(always)]
1254 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1255 *value
1256 }
1257 }
1258
1259 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for ConnectionRole {
1260 #[inline]
1261 unsafe fn encode(
1262 self,
1263 encoder: &mut fidl::encoding::Encoder<'_, D>,
1264 offset: usize,
1265 _depth: fidl::encoding::Depth,
1266 ) -> fidl::Result<()> {
1267 encoder.debug_check_bounds::<Self>(offset);
1268 encoder.write_num(self.into_primitive(), offset);
1269 Ok(())
1270 }
1271 }
1272
1273 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ConnectionRole {
1274 #[inline(always)]
1275 fn new_empty() -> Self {
1276 Self::Leader
1277 }
1278
1279 #[inline]
1280 unsafe fn decode(
1281 &mut self,
1282 decoder: &mut fidl::encoding::Decoder<'_, D>,
1283 offset: usize,
1284 _depth: fidl::encoding::Depth,
1285 ) -> fidl::Result<()> {
1286 decoder.debug_check_bounds::<Self>(offset);
1287 let prim = decoder.read_num::<u32>(offset);
1288
1289 *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
1290 Ok(())
1291 }
1292 }
1293 unsafe impl fidl::encoding::TypeMarker for DataDirection {
1294 type Owned = Self;
1295
1296 #[inline(always)]
1297 fn inline_align(_context: fidl::encoding::Context) -> usize {
1298 std::mem::align_of::<u8>()
1299 }
1300
1301 #[inline(always)]
1302 fn inline_size(_context: fidl::encoding::Context) -> usize {
1303 std::mem::size_of::<u8>()
1304 }
1305
1306 #[inline(always)]
1307 fn encode_is_copy() -> bool {
1308 true
1309 }
1310
1311 #[inline(always)]
1312 fn decode_is_copy() -> bool {
1313 false
1314 }
1315 }
1316
1317 impl fidl::encoding::ValueTypeMarker for DataDirection {
1318 type Borrowed<'a> = Self;
1319 #[inline(always)]
1320 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1321 *value
1322 }
1323 }
1324
1325 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for DataDirection {
1326 #[inline]
1327 unsafe fn encode(
1328 self,
1329 encoder: &mut fidl::encoding::Encoder<'_, D>,
1330 offset: usize,
1331 _depth: fidl::encoding::Depth,
1332 ) -> fidl::Result<()> {
1333 encoder.debug_check_bounds::<Self>(offset);
1334 encoder.write_num(self.into_primitive(), offset);
1335 Ok(())
1336 }
1337 }
1338
1339 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for DataDirection {
1340 #[inline(always)]
1341 fn new_empty() -> Self {
1342 Self::Input
1343 }
1344
1345 #[inline]
1346 unsafe fn decode(
1347 &mut self,
1348 decoder: &mut fidl::encoding::Decoder<'_, D>,
1349 offset: usize,
1350 _depth: fidl::encoding::Depth,
1351 ) -> fidl::Result<()> {
1352 decoder.debug_check_bounds::<Self>(offset);
1353 let prim = decoder.read_num::<u8>(offset);
1354
1355 *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
1356 Ok(())
1357 }
1358 }
1359 unsafe impl fidl::encoding::TypeMarker for ErrorCode {
1360 type Owned = Self;
1361
1362 #[inline(always)]
1363 fn inline_align(_context: fidl::encoding::Context) -> usize {
1364 std::mem::align_of::<u32>()
1365 }
1366
1367 #[inline(always)]
1368 fn inline_size(_context: fidl::encoding::Context) -> usize {
1369 std::mem::size_of::<u32>()
1370 }
1371
1372 #[inline(always)]
1373 fn encode_is_copy() -> bool {
1374 true
1375 }
1376
1377 #[inline(always)]
1378 fn decode_is_copy() -> bool {
1379 false
1380 }
1381 }
1382
1383 impl fidl::encoding::ValueTypeMarker for ErrorCode {
1384 type Borrowed<'a> = Self;
1385 #[inline(always)]
1386 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1387 *value
1388 }
1389 }
1390
1391 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for ErrorCode {
1392 #[inline]
1393 unsafe fn encode(
1394 self,
1395 encoder: &mut fidl::encoding::Encoder<'_, D>,
1396 offset: usize,
1397 _depth: fidl::encoding::Depth,
1398 ) -> fidl::Result<()> {
1399 encoder.debug_check_bounds::<Self>(offset);
1400 encoder.write_num(self.into_primitive(), offset);
1401 Ok(())
1402 }
1403 }
1404
1405 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ErrorCode {
1406 #[inline(always)]
1407 fn new_empty() -> Self {
1408 Self::Unknown
1409 }
1410
1411 #[inline]
1412 unsafe fn decode(
1413 &mut self,
1414 decoder: &mut fidl::encoding::Decoder<'_, D>,
1415 offset: usize,
1416 _depth: fidl::encoding::Depth,
1417 ) -> fidl::Result<()> {
1418 decoder.debug_check_bounds::<Self>(offset);
1419 let prim = decoder.read_num::<u32>(offset);
1420
1421 *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
1422 Ok(())
1423 }
1424 }
1425 unsafe impl fidl::encoding::TypeMarker for LogicalTransportType {
1426 type Owned = Self;
1427
1428 #[inline(always)]
1429 fn inline_align(_context: fidl::encoding::Context) -> usize {
1430 std::mem::align_of::<u8>()
1431 }
1432
1433 #[inline(always)]
1434 fn inline_size(_context: fidl::encoding::Context) -> usize {
1435 std::mem::size_of::<u8>()
1436 }
1437
1438 #[inline(always)]
1439 fn encode_is_copy() -> bool {
1440 false
1441 }
1442
1443 #[inline(always)]
1444 fn decode_is_copy() -> bool {
1445 false
1446 }
1447 }
1448
1449 impl fidl::encoding::ValueTypeMarker for LogicalTransportType {
1450 type Borrowed<'a> = Self;
1451 #[inline(always)]
1452 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1453 *value
1454 }
1455 }
1456
1457 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
1458 for LogicalTransportType
1459 {
1460 #[inline]
1461 unsafe fn encode(
1462 self,
1463 encoder: &mut fidl::encoding::Encoder<'_, D>,
1464 offset: usize,
1465 _depth: fidl::encoding::Depth,
1466 ) -> fidl::Result<()> {
1467 encoder.debug_check_bounds::<Self>(offset);
1468 encoder.write_num(self.into_primitive(), offset);
1469 Ok(())
1470 }
1471 }
1472
1473 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for LogicalTransportType {
1474 #[inline(always)]
1475 fn new_empty() -> Self {
1476 Self::unknown()
1477 }
1478
1479 #[inline]
1480 unsafe fn decode(
1481 &mut self,
1482 decoder: &mut fidl::encoding::Decoder<'_, D>,
1483 offset: usize,
1484 _depth: fidl::encoding::Depth,
1485 ) -> fidl::Result<()> {
1486 decoder.debug_check_bounds::<Self>(offset);
1487 let prim = decoder.read_num::<u8>(offset);
1488
1489 *self = Self::from_primitive_allow_unknown(prim);
1490 Ok(())
1491 }
1492 }
1493
1494 impl fidl::encoding::ValueTypeMarker for Address {
1495 type Borrowed<'a> = &'a Self;
1496 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1497 value
1498 }
1499 }
1500
1501 unsafe impl fidl::encoding::TypeMarker for Address {
1502 type Owned = Self;
1503
1504 #[inline(always)]
1505 fn inline_align(_context: fidl::encoding::Context) -> usize {
1506 1
1507 }
1508
1509 #[inline(always)]
1510 fn inline_size(_context: fidl::encoding::Context) -> usize {
1511 7
1512 }
1513 }
1514
1515 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Address, D> for &Address {
1516 #[inline]
1517 unsafe fn encode(
1518 self,
1519 encoder: &mut fidl::encoding::Encoder<'_, D>,
1520 offset: usize,
1521 _depth: fidl::encoding::Depth,
1522 ) -> fidl::Result<()> {
1523 encoder.debug_check_bounds::<Address>(offset);
1524 fidl::encoding::Encode::<Address, D>::encode(
1526 (
1527 <AddressType as fidl::encoding::ValueTypeMarker>::borrow(&self.type_),
1528 <fidl::encoding::Array<u8, 6> as fidl::encoding::ValueTypeMarker>::borrow(
1529 &self.bytes,
1530 ),
1531 ),
1532 encoder,
1533 offset,
1534 _depth,
1535 )
1536 }
1537 }
1538 unsafe impl<
1539 D: fidl::encoding::ResourceDialect,
1540 T0: fidl::encoding::Encode<AddressType, D>,
1541 T1: fidl::encoding::Encode<fidl::encoding::Array<u8, 6>, D>,
1542 > fidl::encoding::Encode<Address, D> for (T0, T1)
1543 {
1544 #[inline]
1545 unsafe fn encode(
1546 self,
1547 encoder: &mut fidl::encoding::Encoder<'_, D>,
1548 offset: usize,
1549 depth: fidl::encoding::Depth,
1550 ) -> fidl::Result<()> {
1551 encoder.debug_check_bounds::<Address>(offset);
1552 self.0.encode(encoder, offset + 0, depth)?;
1556 self.1.encode(encoder, offset + 1, depth)?;
1557 Ok(())
1558 }
1559 }
1560
1561 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Address {
1562 #[inline(always)]
1563 fn new_empty() -> Self {
1564 Self {
1565 type_: fidl::new_empty!(AddressType, D),
1566 bytes: fidl::new_empty!(fidl::encoding::Array<u8, 6>, D),
1567 }
1568 }
1569
1570 #[inline]
1571 unsafe fn decode(
1572 &mut self,
1573 decoder: &mut fidl::encoding::Decoder<'_, D>,
1574 offset: usize,
1575 _depth: fidl::encoding::Depth,
1576 ) -> fidl::Result<()> {
1577 decoder.debug_check_bounds::<Self>(offset);
1578 fidl::decode!(AddressType, D, &mut self.type_, decoder, offset + 0, _depth)?;
1580 fidl::decode!(fidl::encoding::Array<u8, 6>, D, &mut self.bytes, decoder, offset + 1, _depth)?;
1581 Ok(())
1582 }
1583 }
1584
1585 impl fidl::encoding::ValueTypeMarker for Bool {
1586 type Borrowed<'a> = &'a Self;
1587 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1588 value
1589 }
1590 }
1591
1592 unsafe impl fidl::encoding::TypeMarker for Bool {
1593 type Owned = Self;
1594
1595 #[inline(always)]
1596 fn inline_align(_context: fidl::encoding::Context) -> usize {
1597 1
1598 }
1599
1600 #[inline(always)]
1601 fn inline_size(_context: fidl::encoding::Context) -> usize {
1602 1
1603 }
1604 }
1605
1606 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Bool, D> for &Bool {
1607 #[inline]
1608 unsafe fn encode(
1609 self,
1610 encoder: &mut fidl::encoding::Encoder<'_, D>,
1611 offset: usize,
1612 _depth: fidl::encoding::Depth,
1613 ) -> fidl::Result<()> {
1614 encoder.debug_check_bounds::<Bool>(offset);
1615 fidl::encoding::Encode::<Bool, D>::encode(
1617 (<bool as fidl::encoding::ValueTypeMarker>::borrow(&self.value),),
1618 encoder,
1619 offset,
1620 _depth,
1621 )
1622 }
1623 }
1624 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<bool, D>>
1625 fidl::encoding::Encode<Bool, D> for (T0,)
1626 {
1627 #[inline]
1628 unsafe fn encode(
1629 self,
1630 encoder: &mut fidl::encoding::Encoder<'_, D>,
1631 offset: usize,
1632 depth: fidl::encoding::Depth,
1633 ) -> fidl::Result<()> {
1634 encoder.debug_check_bounds::<Bool>(offset);
1635 self.0.encode(encoder, offset + 0, depth)?;
1639 Ok(())
1640 }
1641 }
1642
1643 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Bool {
1644 #[inline(always)]
1645 fn new_empty() -> Self {
1646 Self { value: fidl::new_empty!(bool, D) }
1647 }
1648
1649 #[inline]
1650 unsafe fn decode(
1651 &mut self,
1652 decoder: &mut fidl::encoding::Decoder<'_, D>,
1653 offset: usize,
1654 _depth: fidl::encoding::Depth,
1655 ) -> fidl::Result<()> {
1656 decoder.debug_check_bounds::<Self>(offset);
1657 fidl::decode!(bool, D, &mut self.value, decoder, offset + 0, _depth)?;
1659 Ok(())
1660 }
1661 }
1662
1663 impl fidl::encoding::ValueTypeMarker for ChannelSendRequest {
1664 type Borrowed<'a> = &'a Self;
1665 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1666 value
1667 }
1668 }
1669
1670 unsafe impl fidl::encoding::TypeMarker for ChannelSendRequest {
1671 type Owned = Self;
1672
1673 #[inline(always)]
1674 fn inline_align(_context: fidl::encoding::Context) -> usize {
1675 8
1676 }
1677
1678 #[inline(always)]
1679 fn inline_size(_context: fidl::encoding::Context) -> usize {
1680 16
1681 }
1682 }
1683
1684 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<ChannelSendRequest, D>
1685 for &ChannelSendRequest
1686 {
1687 #[inline]
1688 unsafe fn encode(
1689 self,
1690 encoder: &mut fidl::encoding::Encoder<'_, D>,
1691 offset: usize,
1692 _depth: fidl::encoding::Depth,
1693 ) -> fidl::Result<()> {
1694 encoder.debug_check_bounds::<ChannelSendRequest>(offset);
1695 fidl::encoding::Encode::<ChannelSendRequest, D>::encode(
1697 (
1698 <fidl::encoding::UnboundedVector<Packet> as fidl::encoding::ValueTypeMarker>::borrow(&self.packets),
1699 ),
1700 encoder, offset, _depth
1701 )
1702 }
1703 }
1704 unsafe impl<
1705 D: fidl::encoding::ResourceDialect,
1706 T0: fidl::encoding::Encode<fidl::encoding::UnboundedVector<Packet>, D>,
1707 > fidl::encoding::Encode<ChannelSendRequest, D> for (T0,)
1708 {
1709 #[inline]
1710 unsafe fn encode(
1711 self,
1712 encoder: &mut fidl::encoding::Encoder<'_, D>,
1713 offset: usize,
1714 depth: fidl::encoding::Depth,
1715 ) -> fidl::Result<()> {
1716 encoder.debug_check_bounds::<ChannelSendRequest>(offset);
1717 self.0.encode(encoder, offset + 0, depth)?;
1721 Ok(())
1722 }
1723 }
1724
1725 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ChannelSendRequest {
1726 #[inline(always)]
1727 fn new_empty() -> Self {
1728 Self { packets: fidl::new_empty!(fidl::encoding::UnboundedVector<Packet>, D) }
1729 }
1730
1731 #[inline]
1732 unsafe fn decode(
1733 &mut self,
1734 decoder: &mut fidl::encoding::Decoder<'_, D>,
1735 offset: usize,
1736 _depth: fidl::encoding::Depth,
1737 ) -> fidl::Result<()> {
1738 decoder.debug_check_bounds::<Self>(offset);
1739 fidl::decode!(
1741 fidl::encoding::UnboundedVector<Packet>,
1742 D,
1743 &mut self.packets,
1744 decoder,
1745 offset + 0,
1746 _depth
1747 )?;
1748 Ok(())
1749 }
1750 }
1751
1752 impl fidl::encoding::ValueTypeMarker for ChannelReceiveResponse {
1753 type Borrowed<'a> = &'a Self;
1754 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1755 value
1756 }
1757 }
1758
1759 unsafe impl fidl::encoding::TypeMarker for ChannelReceiveResponse {
1760 type Owned = Self;
1761
1762 #[inline(always)]
1763 fn inline_align(_context: fidl::encoding::Context) -> usize {
1764 8
1765 }
1766
1767 #[inline(always)]
1768 fn inline_size(_context: fidl::encoding::Context) -> usize {
1769 16
1770 }
1771 }
1772
1773 unsafe impl<D: fidl::encoding::ResourceDialect>
1774 fidl::encoding::Encode<ChannelReceiveResponse, D> for &ChannelReceiveResponse
1775 {
1776 #[inline]
1777 unsafe fn encode(
1778 self,
1779 encoder: &mut fidl::encoding::Encoder<'_, D>,
1780 offset: usize,
1781 _depth: fidl::encoding::Depth,
1782 ) -> fidl::Result<()> {
1783 encoder.debug_check_bounds::<ChannelReceiveResponse>(offset);
1784 fidl::encoding::Encode::<ChannelReceiveResponse, D>::encode(
1786 (
1787 <fidl::encoding::UnboundedVector<Packet> as fidl::encoding::ValueTypeMarker>::borrow(&self.packets),
1788 ),
1789 encoder, offset, _depth
1790 )
1791 }
1792 }
1793 unsafe impl<
1794 D: fidl::encoding::ResourceDialect,
1795 T0: fidl::encoding::Encode<fidl::encoding::UnboundedVector<Packet>, D>,
1796 > fidl::encoding::Encode<ChannelReceiveResponse, D> for (T0,)
1797 {
1798 #[inline]
1799 unsafe fn encode(
1800 self,
1801 encoder: &mut fidl::encoding::Encoder<'_, D>,
1802 offset: usize,
1803 depth: fidl::encoding::Depth,
1804 ) -> fidl::Result<()> {
1805 encoder.debug_check_bounds::<ChannelReceiveResponse>(offset);
1806 self.0.encode(encoder, offset + 0, depth)?;
1810 Ok(())
1811 }
1812 }
1813
1814 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1815 for ChannelReceiveResponse
1816 {
1817 #[inline(always)]
1818 fn new_empty() -> Self {
1819 Self { packets: fidl::new_empty!(fidl::encoding::UnboundedVector<Packet>, D) }
1820 }
1821
1822 #[inline]
1823 unsafe fn decode(
1824 &mut self,
1825 decoder: &mut fidl::encoding::Decoder<'_, D>,
1826 offset: usize,
1827 _depth: fidl::encoding::Depth,
1828 ) -> fidl::Result<()> {
1829 decoder.debug_check_bounds::<Self>(offset);
1830 fidl::decode!(
1832 fidl::encoding::UnboundedVector<Packet>,
1833 D,
1834 &mut self.packets,
1835 decoder,
1836 offset + 0,
1837 _depth
1838 )?;
1839 Ok(())
1840 }
1841 }
1842
1843 impl fidl::encoding::ValueTypeMarker for DeviceClass {
1844 type Borrowed<'a> = &'a Self;
1845 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1846 value
1847 }
1848 }
1849
1850 unsafe impl fidl::encoding::TypeMarker for DeviceClass {
1851 type Owned = Self;
1852
1853 #[inline(always)]
1854 fn inline_align(_context: fidl::encoding::Context) -> usize {
1855 4
1856 }
1857
1858 #[inline(always)]
1859 fn inline_size(_context: fidl::encoding::Context) -> usize {
1860 4
1861 }
1862 #[inline(always)]
1863 fn encode_is_copy() -> bool {
1864 true
1865 }
1866
1867 #[inline(always)]
1868 fn decode_is_copy() -> bool {
1869 true
1870 }
1871 }
1872
1873 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<DeviceClass, D>
1874 for &DeviceClass
1875 {
1876 #[inline]
1877 unsafe fn encode(
1878 self,
1879 encoder: &mut fidl::encoding::Encoder<'_, D>,
1880 offset: usize,
1881 _depth: fidl::encoding::Depth,
1882 ) -> fidl::Result<()> {
1883 encoder.debug_check_bounds::<DeviceClass>(offset);
1884 unsafe {
1885 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
1887 (buf_ptr as *mut DeviceClass).write_unaligned((self as *const DeviceClass).read());
1888 }
1891 Ok(())
1892 }
1893 }
1894 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u32, D>>
1895 fidl::encoding::Encode<DeviceClass, D> for (T0,)
1896 {
1897 #[inline]
1898 unsafe fn encode(
1899 self,
1900 encoder: &mut fidl::encoding::Encoder<'_, D>,
1901 offset: usize,
1902 depth: fidl::encoding::Depth,
1903 ) -> fidl::Result<()> {
1904 encoder.debug_check_bounds::<DeviceClass>(offset);
1905 self.0.encode(encoder, offset + 0, depth)?;
1909 Ok(())
1910 }
1911 }
1912
1913 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for DeviceClass {
1914 #[inline(always)]
1915 fn new_empty() -> Self {
1916 Self { value: fidl::new_empty!(u32, D) }
1917 }
1918
1919 #[inline]
1920 unsafe fn decode(
1921 &mut self,
1922 decoder: &mut fidl::encoding::Decoder<'_, D>,
1923 offset: usize,
1924 _depth: fidl::encoding::Depth,
1925 ) -> fidl::Result<()> {
1926 decoder.debug_check_bounds::<Self>(offset);
1927 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
1928 unsafe {
1931 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
1932 }
1933 Ok(())
1934 }
1935 }
1936
1937 impl fidl::encoding::ValueTypeMarker for Error {
1938 type Borrowed<'a> = &'a Self;
1939 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1940 value
1941 }
1942 }
1943
1944 unsafe impl fidl::encoding::TypeMarker for Error {
1945 type Owned = Self;
1946
1947 #[inline(always)]
1948 fn inline_align(_context: fidl::encoding::Context) -> usize {
1949 8
1950 }
1951
1952 #[inline(always)]
1953 fn inline_size(_context: fidl::encoding::Context) -> usize {
1954 24
1955 }
1956 }
1957
1958 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Error, D> for &Error {
1959 #[inline]
1960 unsafe fn encode(
1961 self,
1962 encoder: &mut fidl::encoding::Encoder<'_, D>,
1963 offset: usize,
1964 _depth: fidl::encoding::Depth,
1965 ) -> fidl::Result<()> {
1966 encoder.debug_check_bounds::<Error>(offset);
1967 fidl::encoding::Encode::<Error, D>::encode(
1969 (
1970 <ErrorCode as fidl::encoding::ValueTypeMarker>::borrow(&self.error_code),
1971 <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.protocol_error_code),
1972 <fidl::encoding::Optional<fidl::encoding::UnboundedString> as fidl::encoding::ValueTypeMarker>::borrow(&self.description),
1973 ),
1974 encoder, offset, _depth
1975 )
1976 }
1977 }
1978 unsafe impl<
1979 D: fidl::encoding::ResourceDialect,
1980 T0: fidl::encoding::Encode<ErrorCode, D>,
1981 T1: fidl::encoding::Encode<u32, D>,
1982 T2: fidl::encoding::Encode<fidl::encoding::Optional<fidl::encoding::UnboundedString>, D>,
1983 > fidl::encoding::Encode<Error, D> for (T0, T1, T2)
1984 {
1985 #[inline]
1986 unsafe fn encode(
1987 self,
1988 encoder: &mut fidl::encoding::Encoder<'_, D>,
1989 offset: usize,
1990 depth: fidl::encoding::Depth,
1991 ) -> fidl::Result<()> {
1992 encoder.debug_check_bounds::<Error>(offset);
1993 self.0.encode(encoder, offset + 0, depth)?;
1997 self.1.encode(encoder, offset + 4, depth)?;
1998 self.2.encode(encoder, offset + 8, depth)?;
1999 Ok(())
2000 }
2001 }
2002
2003 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Error {
2004 #[inline(always)]
2005 fn new_empty() -> Self {
2006 Self {
2007 error_code: fidl::new_empty!(ErrorCode, D),
2008 protocol_error_code: fidl::new_empty!(u32, D),
2009 description: fidl::new_empty!(
2010 fidl::encoding::Optional<fidl::encoding::UnboundedString>,
2011 D
2012 ),
2013 }
2014 }
2015
2016 #[inline]
2017 unsafe fn decode(
2018 &mut self,
2019 decoder: &mut fidl::encoding::Decoder<'_, D>,
2020 offset: usize,
2021 _depth: fidl::encoding::Depth,
2022 ) -> fidl::Result<()> {
2023 decoder.debug_check_bounds::<Self>(offset);
2024 fidl::decode!(ErrorCode, D, &mut self.error_code, decoder, offset + 0, _depth)?;
2026 fidl::decode!(u32, D, &mut self.protocol_error_code, decoder, offset + 4, _depth)?;
2027 fidl::decode!(
2028 fidl::encoding::Optional<fidl::encoding::UnboundedString>,
2029 D,
2030 &mut self.description,
2031 decoder,
2032 offset + 8,
2033 _depth
2034 )?;
2035 Ok(())
2036 }
2037 }
2038
2039 impl fidl::encoding::ValueTypeMarker for HostId {
2040 type Borrowed<'a> = &'a Self;
2041 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2042 value
2043 }
2044 }
2045
2046 unsafe impl fidl::encoding::TypeMarker for HostId {
2047 type Owned = Self;
2048
2049 #[inline(always)]
2050 fn inline_align(_context: fidl::encoding::Context) -> usize {
2051 8
2052 }
2053
2054 #[inline(always)]
2055 fn inline_size(_context: fidl::encoding::Context) -> usize {
2056 8
2057 }
2058 #[inline(always)]
2059 fn encode_is_copy() -> bool {
2060 true
2061 }
2062
2063 #[inline(always)]
2064 fn decode_is_copy() -> bool {
2065 true
2066 }
2067 }
2068
2069 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<HostId, D> for &HostId {
2070 #[inline]
2071 unsafe fn encode(
2072 self,
2073 encoder: &mut fidl::encoding::Encoder<'_, D>,
2074 offset: usize,
2075 _depth: fidl::encoding::Depth,
2076 ) -> fidl::Result<()> {
2077 encoder.debug_check_bounds::<HostId>(offset);
2078 unsafe {
2079 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
2081 (buf_ptr as *mut HostId).write_unaligned((self as *const HostId).read());
2082 }
2085 Ok(())
2086 }
2087 }
2088 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u64, D>>
2089 fidl::encoding::Encode<HostId, D> for (T0,)
2090 {
2091 #[inline]
2092 unsafe fn encode(
2093 self,
2094 encoder: &mut fidl::encoding::Encoder<'_, D>,
2095 offset: usize,
2096 depth: fidl::encoding::Depth,
2097 ) -> fidl::Result<()> {
2098 encoder.debug_check_bounds::<HostId>(offset);
2099 self.0.encode(encoder, offset + 0, depth)?;
2103 Ok(())
2104 }
2105 }
2106
2107 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for HostId {
2108 #[inline(always)]
2109 fn new_empty() -> Self {
2110 Self { value: fidl::new_empty!(u64, D) }
2111 }
2112
2113 #[inline]
2114 unsafe fn decode(
2115 &mut self,
2116 decoder: &mut fidl::encoding::Decoder<'_, D>,
2117 offset: usize,
2118 _depth: fidl::encoding::Depth,
2119 ) -> fidl::Result<()> {
2120 decoder.debug_check_bounds::<Self>(offset);
2121 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
2122 unsafe {
2125 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 8);
2126 }
2127 Ok(())
2128 }
2129 }
2130
2131 impl fidl::encoding::ValueTypeMarker for Int8 {
2132 type Borrowed<'a> = &'a Self;
2133 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2134 value
2135 }
2136 }
2137
2138 unsafe impl fidl::encoding::TypeMarker for Int8 {
2139 type Owned = Self;
2140
2141 #[inline(always)]
2142 fn inline_align(_context: fidl::encoding::Context) -> usize {
2143 1
2144 }
2145
2146 #[inline(always)]
2147 fn inline_size(_context: fidl::encoding::Context) -> usize {
2148 1
2149 }
2150 #[inline(always)]
2151 fn encode_is_copy() -> bool {
2152 true
2153 }
2154
2155 #[inline(always)]
2156 fn decode_is_copy() -> bool {
2157 true
2158 }
2159 }
2160
2161 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Int8, D> for &Int8 {
2162 #[inline]
2163 unsafe fn encode(
2164 self,
2165 encoder: &mut fidl::encoding::Encoder<'_, D>,
2166 offset: usize,
2167 _depth: fidl::encoding::Depth,
2168 ) -> fidl::Result<()> {
2169 encoder.debug_check_bounds::<Int8>(offset);
2170 unsafe {
2171 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
2173 (buf_ptr as *mut Int8).write_unaligned((self as *const Int8).read());
2174 }
2177 Ok(())
2178 }
2179 }
2180 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<i8, D>>
2181 fidl::encoding::Encode<Int8, D> for (T0,)
2182 {
2183 #[inline]
2184 unsafe fn encode(
2185 self,
2186 encoder: &mut fidl::encoding::Encoder<'_, D>,
2187 offset: usize,
2188 depth: fidl::encoding::Depth,
2189 ) -> fidl::Result<()> {
2190 encoder.debug_check_bounds::<Int8>(offset);
2191 self.0.encode(encoder, offset + 0, depth)?;
2195 Ok(())
2196 }
2197 }
2198
2199 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Int8 {
2200 #[inline(always)]
2201 fn new_empty() -> Self {
2202 Self { value: fidl::new_empty!(i8, D) }
2203 }
2204
2205 #[inline]
2206 unsafe fn decode(
2207 &mut self,
2208 decoder: &mut fidl::encoding::Decoder<'_, D>,
2209 offset: usize,
2210 _depth: fidl::encoding::Depth,
2211 ) -> fidl::Result<()> {
2212 decoder.debug_check_bounds::<Self>(offset);
2213 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
2214 unsafe {
2217 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 1);
2218 }
2219 Ok(())
2220 }
2221 }
2222
2223 impl fidl::encoding::ValueTypeMarker for Packet {
2224 type Borrowed<'a> = &'a Self;
2225 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2226 value
2227 }
2228 }
2229
2230 unsafe impl fidl::encoding::TypeMarker for Packet {
2231 type Owned = Self;
2232
2233 #[inline(always)]
2234 fn inline_align(_context: fidl::encoding::Context) -> usize {
2235 8
2236 }
2237
2238 #[inline(always)]
2239 fn inline_size(_context: fidl::encoding::Context) -> usize {
2240 16
2241 }
2242 }
2243
2244 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Packet, D> for &Packet {
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 fidl::encoding::Encode::<Packet, D>::encode(
2255 (<fidl::encoding::UnboundedVector<u8> as fidl::encoding::ValueTypeMarker>::borrow(
2256 &self.packet,
2257 ),),
2258 encoder,
2259 offset,
2260 _depth,
2261 )
2262 }
2263 }
2264 unsafe impl<
2265 D: fidl::encoding::ResourceDialect,
2266 T0: fidl::encoding::Encode<fidl::encoding::UnboundedVector<u8>, D>,
2267 > fidl::encoding::Encode<Packet, D> for (T0,)
2268 {
2269 #[inline]
2270 unsafe fn encode(
2271 self,
2272 encoder: &mut fidl::encoding::Encoder<'_, D>,
2273 offset: usize,
2274 depth: fidl::encoding::Depth,
2275 ) -> fidl::Result<()> {
2276 encoder.debug_check_bounds::<Packet>(offset);
2277 self.0.encode(encoder, offset + 0, depth)?;
2281 Ok(())
2282 }
2283 }
2284
2285 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Packet {
2286 #[inline(always)]
2287 fn new_empty() -> Self {
2288 Self { packet: fidl::new_empty!(fidl::encoding::UnboundedVector<u8>, D) }
2289 }
2290
2291 #[inline]
2292 unsafe fn decode(
2293 &mut self,
2294 decoder: &mut fidl::encoding::Decoder<'_, D>,
2295 offset: usize,
2296 _depth: fidl::encoding::Depth,
2297 ) -> fidl::Result<()> {
2298 decoder.debug_check_bounds::<Self>(offset);
2299 fidl::decode!(
2301 fidl::encoding::UnboundedVector<u8>,
2302 D,
2303 &mut self.packet,
2304 decoder,
2305 offset + 0,
2306 _depth
2307 )?;
2308 Ok(())
2309 }
2310 }
2311
2312 impl fidl::encoding::ValueTypeMarker for PeerId {
2313 type Borrowed<'a> = &'a Self;
2314 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2315 value
2316 }
2317 }
2318
2319 unsafe impl fidl::encoding::TypeMarker for PeerId {
2320 type Owned = Self;
2321
2322 #[inline(always)]
2323 fn inline_align(_context: fidl::encoding::Context) -> usize {
2324 8
2325 }
2326
2327 #[inline(always)]
2328 fn inline_size(_context: fidl::encoding::Context) -> usize {
2329 8
2330 }
2331 #[inline(always)]
2332 fn encode_is_copy() -> bool {
2333 true
2334 }
2335
2336 #[inline(always)]
2337 fn decode_is_copy() -> bool {
2338 true
2339 }
2340 }
2341
2342 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<PeerId, D> for &PeerId {
2343 #[inline]
2344 unsafe fn encode(
2345 self,
2346 encoder: &mut fidl::encoding::Encoder<'_, D>,
2347 offset: usize,
2348 _depth: fidl::encoding::Depth,
2349 ) -> fidl::Result<()> {
2350 encoder.debug_check_bounds::<PeerId>(offset);
2351 unsafe {
2352 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
2354 (buf_ptr as *mut PeerId).write_unaligned((self as *const PeerId).read());
2355 }
2358 Ok(())
2359 }
2360 }
2361 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u64, D>>
2362 fidl::encoding::Encode<PeerId, D> for (T0,)
2363 {
2364 #[inline]
2365 unsafe fn encode(
2366 self,
2367 encoder: &mut fidl::encoding::Encoder<'_, D>,
2368 offset: usize,
2369 depth: fidl::encoding::Depth,
2370 ) -> fidl::Result<()> {
2371 encoder.debug_check_bounds::<PeerId>(offset);
2372 self.0.encode(encoder, offset + 0, depth)?;
2376 Ok(())
2377 }
2378 }
2379
2380 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for PeerId {
2381 #[inline(always)]
2382 fn new_empty() -> Self {
2383 Self { value: fidl::new_empty!(u64, D) }
2384 }
2385
2386 #[inline]
2387 unsafe fn decode(
2388 &mut self,
2389 decoder: &mut fidl::encoding::Decoder<'_, D>,
2390 offset: usize,
2391 _depth: fidl::encoding::Depth,
2392 ) -> fidl::Result<()> {
2393 decoder.debug_check_bounds::<Self>(offset);
2394 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
2395 unsafe {
2398 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 8);
2399 }
2400 Ok(())
2401 }
2402 }
2403
2404 impl fidl::encoding::ValueTypeMarker for Status {
2405 type Borrowed<'a> = &'a Self;
2406 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2407 value
2408 }
2409 }
2410
2411 unsafe impl fidl::encoding::TypeMarker for Status {
2412 type Owned = Self;
2413
2414 #[inline(always)]
2415 fn inline_align(_context: fidl::encoding::Context) -> usize {
2416 8
2417 }
2418
2419 #[inline(always)]
2420 fn inline_size(_context: fidl::encoding::Context) -> usize {
2421 8
2422 }
2423 }
2424
2425 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Status, D> for &Status {
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 fidl::encoding::Encode::<Status, D>::encode(
2436 (<fidl::encoding::Boxed<Error> as fidl::encoding::ValueTypeMarker>::borrow(
2437 &self.error,
2438 ),),
2439 encoder,
2440 offset,
2441 _depth,
2442 )
2443 }
2444 }
2445 unsafe impl<
2446 D: fidl::encoding::ResourceDialect,
2447 T0: fidl::encoding::Encode<fidl::encoding::Boxed<Error>, D>,
2448 > fidl::encoding::Encode<Status, D> for (T0,)
2449 {
2450 #[inline]
2451 unsafe fn encode(
2452 self,
2453 encoder: &mut fidl::encoding::Encoder<'_, D>,
2454 offset: usize,
2455 depth: fidl::encoding::Depth,
2456 ) -> fidl::Result<()> {
2457 encoder.debug_check_bounds::<Status>(offset);
2458 self.0.encode(encoder, offset + 0, depth)?;
2462 Ok(())
2463 }
2464 }
2465
2466 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Status {
2467 #[inline(always)]
2468 fn new_empty() -> Self {
2469 Self { error: fidl::new_empty!(fidl::encoding::Boxed<Error>, D) }
2470 }
2471
2472 #[inline]
2473 unsafe fn decode(
2474 &mut self,
2475 decoder: &mut fidl::encoding::Decoder<'_, D>,
2476 offset: usize,
2477 _depth: fidl::encoding::Depth,
2478 ) -> fidl::Result<()> {
2479 decoder.debug_check_bounds::<Self>(offset);
2480 fidl::decode!(
2482 fidl::encoding::Boxed<Error>,
2483 D,
2484 &mut self.error,
2485 decoder,
2486 offset + 0,
2487 _depth
2488 )?;
2489 Ok(())
2490 }
2491 }
2492
2493 impl fidl::encoding::ValueTypeMarker for UInt16 {
2494 type Borrowed<'a> = &'a Self;
2495 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2496 value
2497 }
2498 }
2499
2500 unsafe impl fidl::encoding::TypeMarker for UInt16 {
2501 type Owned = Self;
2502
2503 #[inline(always)]
2504 fn inline_align(_context: fidl::encoding::Context) -> usize {
2505 2
2506 }
2507
2508 #[inline(always)]
2509 fn inline_size(_context: fidl::encoding::Context) -> usize {
2510 2
2511 }
2512 #[inline(always)]
2513 fn encode_is_copy() -> bool {
2514 true
2515 }
2516
2517 #[inline(always)]
2518 fn decode_is_copy() -> bool {
2519 true
2520 }
2521 }
2522
2523 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<UInt16, D> for &UInt16 {
2524 #[inline]
2525 unsafe fn encode(
2526 self,
2527 encoder: &mut fidl::encoding::Encoder<'_, D>,
2528 offset: usize,
2529 _depth: fidl::encoding::Depth,
2530 ) -> fidl::Result<()> {
2531 encoder.debug_check_bounds::<UInt16>(offset);
2532 unsafe {
2533 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
2535 (buf_ptr as *mut UInt16).write_unaligned((self as *const UInt16).read());
2536 }
2539 Ok(())
2540 }
2541 }
2542 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u16, D>>
2543 fidl::encoding::Encode<UInt16, D> for (T0,)
2544 {
2545 #[inline]
2546 unsafe fn encode(
2547 self,
2548 encoder: &mut fidl::encoding::Encoder<'_, D>,
2549 offset: usize,
2550 depth: fidl::encoding::Depth,
2551 ) -> fidl::Result<()> {
2552 encoder.debug_check_bounds::<UInt16>(offset);
2553 self.0.encode(encoder, offset + 0, depth)?;
2557 Ok(())
2558 }
2559 }
2560
2561 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for UInt16 {
2562 #[inline(always)]
2563 fn new_empty() -> Self {
2564 Self { value: fidl::new_empty!(u16, D) }
2565 }
2566
2567 #[inline]
2568 unsafe fn decode(
2569 &mut self,
2570 decoder: &mut fidl::encoding::Decoder<'_, D>,
2571 offset: usize,
2572 _depth: fidl::encoding::Depth,
2573 ) -> fidl::Result<()> {
2574 decoder.debug_check_bounds::<Self>(offset);
2575 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
2576 unsafe {
2579 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 2);
2580 }
2581 Ok(())
2582 }
2583 }
2584
2585 impl fidl::encoding::ValueTypeMarker for Uuid {
2586 type Borrowed<'a> = &'a Self;
2587 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2588 value
2589 }
2590 }
2591
2592 unsafe impl fidl::encoding::TypeMarker for Uuid {
2593 type Owned = Self;
2594
2595 #[inline(always)]
2596 fn inline_align(_context: fidl::encoding::Context) -> usize {
2597 1
2598 }
2599
2600 #[inline(always)]
2601 fn inline_size(_context: fidl::encoding::Context) -> usize {
2602 16
2603 }
2604 #[inline(always)]
2605 fn encode_is_copy() -> bool {
2606 true
2607 }
2608
2609 #[inline(always)]
2610 fn decode_is_copy() -> bool {
2611 true
2612 }
2613 }
2614
2615 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Uuid, D> for &Uuid {
2616 #[inline]
2617 unsafe fn encode(
2618 self,
2619 encoder: &mut fidl::encoding::Encoder<'_, D>,
2620 offset: usize,
2621 _depth: fidl::encoding::Depth,
2622 ) -> fidl::Result<()> {
2623 encoder.debug_check_bounds::<Uuid>(offset);
2624 unsafe {
2625 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
2627 (buf_ptr as *mut Uuid).write_unaligned((self as *const Uuid).read());
2628 }
2631 Ok(())
2632 }
2633 }
2634 unsafe impl<
2635 D: fidl::encoding::ResourceDialect,
2636 T0: fidl::encoding::Encode<fidl::encoding::Array<u8, 16>, D>,
2637 > fidl::encoding::Encode<Uuid, D> for (T0,)
2638 {
2639 #[inline]
2640 unsafe fn encode(
2641 self,
2642 encoder: &mut fidl::encoding::Encoder<'_, D>,
2643 offset: usize,
2644 depth: fidl::encoding::Depth,
2645 ) -> fidl::Result<()> {
2646 encoder.debug_check_bounds::<Uuid>(offset);
2647 self.0.encode(encoder, offset + 0, depth)?;
2651 Ok(())
2652 }
2653 }
2654
2655 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Uuid {
2656 #[inline(always)]
2657 fn new_empty() -> Self {
2658 Self { value: fidl::new_empty!(fidl::encoding::Array<u8, 16>, D) }
2659 }
2660
2661 #[inline]
2662 unsafe fn decode(
2663 &mut self,
2664 decoder: &mut fidl::encoding::Decoder<'_, D>,
2665 offset: usize,
2666 _depth: fidl::encoding::Depth,
2667 ) -> fidl::Result<()> {
2668 decoder.debug_check_bounds::<Self>(offset);
2669 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
2670 unsafe {
2673 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 16);
2674 }
2675 Ok(())
2676 }
2677 }
2678
2679 impl ChannelParameters {
2680 #[inline(always)]
2681 fn max_ordinal_present(&self) -> u64 {
2682 if let Some(_) = self.flush_timeout {
2683 return 4;
2684 }
2685 if let Some(_) = self.security_requirements {
2686 return 3;
2687 }
2688 if let Some(_) = self.max_rx_packet_size {
2689 return 2;
2690 }
2691 if let Some(_) = self.channel_mode {
2692 return 1;
2693 }
2694 0
2695 }
2696 }
2697
2698 impl fidl::encoding::ValueTypeMarker for ChannelParameters {
2699 type Borrowed<'a> = &'a Self;
2700 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2701 value
2702 }
2703 }
2704
2705 unsafe impl fidl::encoding::TypeMarker for ChannelParameters {
2706 type Owned = Self;
2707
2708 #[inline(always)]
2709 fn inline_align(_context: fidl::encoding::Context) -> usize {
2710 8
2711 }
2712
2713 #[inline(always)]
2714 fn inline_size(_context: fidl::encoding::Context) -> usize {
2715 16
2716 }
2717 }
2718
2719 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<ChannelParameters, D>
2720 for &ChannelParameters
2721 {
2722 unsafe fn encode(
2723 self,
2724 encoder: &mut fidl::encoding::Encoder<'_, D>,
2725 offset: usize,
2726 mut depth: fidl::encoding::Depth,
2727 ) -> fidl::Result<()> {
2728 encoder.debug_check_bounds::<ChannelParameters>(offset);
2729 let max_ordinal: u64 = self.max_ordinal_present();
2731 encoder.write_num(max_ordinal, offset);
2732 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
2733 if max_ordinal == 0 {
2735 return Ok(());
2736 }
2737 depth.increment()?;
2738 let envelope_size = 8;
2739 let bytes_len = max_ordinal as usize * envelope_size;
2740 #[allow(unused_variables)]
2741 let offset = encoder.out_of_line_offset(bytes_len);
2742 let mut _prev_end_offset: usize = 0;
2743 if 1 > max_ordinal {
2744 return Ok(());
2745 }
2746
2747 let cur_offset: usize = (1 - 1) * envelope_size;
2750
2751 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2753
2754 fidl::encoding::encode_in_envelope_optional::<ChannelMode, D>(
2759 self.channel_mode
2760 .as_ref()
2761 .map(<ChannelMode as fidl::encoding::ValueTypeMarker>::borrow),
2762 encoder,
2763 offset + cur_offset,
2764 depth,
2765 )?;
2766
2767 _prev_end_offset = cur_offset + envelope_size;
2768 if 2 > max_ordinal {
2769 return Ok(());
2770 }
2771
2772 let cur_offset: usize = (2 - 1) * envelope_size;
2775
2776 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2778
2779 fidl::encoding::encode_in_envelope_optional::<u16, D>(
2784 self.max_rx_packet_size
2785 .as_ref()
2786 .map(<u16 as fidl::encoding::ValueTypeMarker>::borrow),
2787 encoder,
2788 offset + cur_offset,
2789 depth,
2790 )?;
2791
2792 _prev_end_offset = cur_offset + envelope_size;
2793 if 3 > max_ordinal {
2794 return Ok(());
2795 }
2796
2797 let cur_offset: usize = (3 - 1) * envelope_size;
2800
2801 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2803
2804 fidl::encoding::encode_in_envelope_optional::<SecurityRequirements, D>(
2809 self.security_requirements
2810 .as_ref()
2811 .map(<SecurityRequirements as fidl::encoding::ValueTypeMarker>::borrow),
2812 encoder,
2813 offset + cur_offset,
2814 depth,
2815 )?;
2816
2817 _prev_end_offset = cur_offset + envelope_size;
2818 if 4 > max_ordinal {
2819 return Ok(());
2820 }
2821
2822 let cur_offset: usize = (4 - 1) * envelope_size;
2825
2826 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2828
2829 fidl::encoding::encode_in_envelope_optional::<i64, D>(
2834 self.flush_timeout.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
2835 encoder,
2836 offset + cur_offset,
2837 depth,
2838 )?;
2839
2840 _prev_end_offset = cur_offset + envelope_size;
2841
2842 Ok(())
2843 }
2844 }
2845
2846 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ChannelParameters {
2847 #[inline(always)]
2848 fn new_empty() -> Self {
2849 Self::default()
2850 }
2851
2852 unsafe fn decode(
2853 &mut self,
2854 decoder: &mut fidl::encoding::Decoder<'_, D>,
2855 offset: usize,
2856 mut depth: fidl::encoding::Depth,
2857 ) -> fidl::Result<()> {
2858 decoder.debug_check_bounds::<Self>(offset);
2859 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
2860 None => return Err(fidl::Error::NotNullable),
2861 Some(len) => len,
2862 };
2863 if len == 0 {
2865 return Ok(());
2866 };
2867 depth.increment()?;
2868 let envelope_size = 8;
2869 let bytes_len = len * envelope_size;
2870 let offset = decoder.out_of_line_offset(bytes_len)?;
2871 let mut _next_ordinal_to_read = 0;
2873 let mut next_offset = offset;
2874 let end_offset = offset + bytes_len;
2875 _next_ordinal_to_read += 1;
2876 if next_offset >= end_offset {
2877 return Ok(());
2878 }
2879
2880 while _next_ordinal_to_read < 1 {
2882 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2883 _next_ordinal_to_read += 1;
2884 next_offset += envelope_size;
2885 }
2886
2887 let next_out_of_line = decoder.next_out_of_line();
2888 let handles_before = decoder.remaining_handles();
2889 if let Some((inlined, num_bytes, num_handles)) =
2890 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2891 {
2892 let member_inline_size =
2893 <ChannelMode as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2894 if inlined != (member_inline_size <= 4) {
2895 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2896 }
2897 let inner_offset;
2898 let mut inner_depth = depth.clone();
2899 if inlined {
2900 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2901 inner_offset = next_offset;
2902 } else {
2903 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2904 inner_depth.increment()?;
2905 }
2906 let val_ref =
2907 self.channel_mode.get_or_insert_with(|| fidl::new_empty!(ChannelMode, D));
2908 fidl::decode!(ChannelMode, D, val_ref, decoder, inner_offset, inner_depth)?;
2909 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2910 {
2911 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2912 }
2913 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2914 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2915 }
2916 }
2917
2918 next_offset += envelope_size;
2919 _next_ordinal_to_read += 1;
2920 if next_offset >= end_offset {
2921 return Ok(());
2922 }
2923
2924 while _next_ordinal_to_read < 2 {
2926 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2927 _next_ordinal_to_read += 1;
2928 next_offset += envelope_size;
2929 }
2930
2931 let next_out_of_line = decoder.next_out_of_line();
2932 let handles_before = decoder.remaining_handles();
2933 if let Some((inlined, num_bytes, num_handles)) =
2934 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2935 {
2936 let member_inline_size =
2937 <u16 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2938 if inlined != (member_inline_size <= 4) {
2939 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2940 }
2941 let inner_offset;
2942 let mut inner_depth = depth.clone();
2943 if inlined {
2944 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2945 inner_offset = next_offset;
2946 } else {
2947 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2948 inner_depth.increment()?;
2949 }
2950 let val_ref =
2951 self.max_rx_packet_size.get_or_insert_with(|| fidl::new_empty!(u16, D));
2952 fidl::decode!(u16, D, val_ref, decoder, inner_offset, inner_depth)?;
2953 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2954 {
2955 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2956 }
2957 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2958 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2959 }
2960 }
2961
2962 next_offset += envelope_size;
2963 _next_ordinal_to_read += 1;
2964 if next_offset >= end_offset {
2965 return Ok(());
2966 }
2967
2968 while _next_ordinal_to_read < 3 {
2970 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2971 _next_ordinal_to_read += 1;
2972 next_offset += envelope_size;
2973 }
2974
2975 let next_out_of_line = decoder.next_out_of_line();
2976 let handles_before = decoder.remaining_handles();
2977 if let Some((inlined, num_bytes, num_handles)) =
2978 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2979 {
2980 let member_inline_size =
2981 <SecurityRequirements as fidl::encoding::TypeMarker>::inline_size(
2982 decoder.context,
2983 );
2984 if inlined != (member_inline_size <= 4) {
2985 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2986 }
2987 let inner_offset;
2988 let mut inner_depth = depth.clone();
2989 if inlined {
2990 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2991 inner_offset = next_offset;
2992 } else {
2993 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2994 inner_depth.increment()?;
2995 }
2996 let val_ref = self
2997 .security_requirements
2998 .get_or_insert_with(|| fidl::new_empty!(SecurityRequirements, D));
2999 fidl::decode!(
3000 SecurityRequirements,
3001 D,
3002 val_ref,
3003 decoder,
3004 inner_offset,
3005 inner_depth
3006 )?;
3007 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3008 {
3009 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3010 }
3011 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3012 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3013 }
3014 }
3015
3016 next_offset += envelope_size;
3017 _next_ordinal_to_read += 1;
3018 if next_offset >= end_offset {
3019 return Ok(());
3020 }
3021
3022 while _next_ordinal_to_read < 4 {
3024 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3025 _next_ordinal_to_read += 1;
3026 next_offset += envelope_size;
3027 }
3028
3029 let next_out_of_line = decoder.next_out_of_line();
3030 let handles_before = decoder.remaining_handles();
3031 if let Some((inlined, num_bytes, num_handles)) =
3032 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3033 {
3034 let member_inline_size =
3035 <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3036 if inlined != (member_inline_size <= 4) {
3037 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3038 }
3039 let inner_offset;
3040 let mut inner_depth = depth.clone();
3041 if inlined {
3042 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3043 inner_offset = next_offset;
3044 } else {
3045 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3046 inner_depth.increment()?;
3047 }
3048 let val_ref = self.flush_timeout.get_or_insert_with(|| fidl::new_empty!(i64, D));
3049 fidl::decode!(i64, D, val_ref, decoder, inner_offset, inner_depth)?;
3050 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3051 {
3052 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3053 }
3054 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3055 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3056 }
3057 }
3058
3059 next_offset += envelope_size;
3060
3061 while next_offset < end_offset {
3063 _next_ordinal_to_read += 1;
3064 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3065 next_offset += envelope_size;
3066 }
3067
3068 Ok(())
3069 }
3070 }
3071
3072 impl CodecAttributes {
3073 #[inline(always)]
3074 fn max_ordinal_present(&self) -> u64 {
3075 if let Some(_) = self.codec_configuration {
3076 return 2;
3077 }
3078 if let Some(_) = self.codec_id {
3079 return 1;
3080 }
3081 0
3082 }
3083 }
3084
3085 impl fidl::encoding::ValueTypeMarker for CodecAttributes {
3086 type Borrowed<'a> = &'a Self;
3087 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3088 value
3089 }
3090 }
3091
3092 unsafe impl fidl::encoding::TypeMarker for CodecAttributes {
3093 type Owned = Self;
3094
3095 #[inline(always)]
3096 fn inline_align(_context: fidl::encoding::Context) -> usize {
3097 8
3098 }
3099
3100 #[inline(always)]
3101 fn inline_size(_context: fidl::encoding::Context) -> usize {
3102 16
3103 }
3104 }
3105
3106 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<CodecAttributes, D>
3107 for &CodecAttributes
3108 {
3109 unsafe fn encode(
3110 self,
3111 encoder: &mut fidl::encoding::Encoder<'_, D>,
3112 offset: usize,
3113 mut depth: fidl::encoding::Depth,
3114 ) -> fidl::Result<()> {
3115 encoder.debug_check_bounds::<CodecAttributes>(offset);
3116 let max_ordinal: u64 = self.max_ordinal_present();
3118 encoder.write_num(max_ordinal, offset);
3119 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
3120 if max_ordinal == 0 {
3122 return Ok(());
3123 }
3124 depth.increment()?;
3125 let envelope_size = 8;
3126 let bytes_len = max_ordinal as usize * envelope_size;
3127 #[allow(unused_variables)]
3128 let offset = encoder.out_of_line_offset(bytes_len);
3129 let mut _prev_end_offset: usize = 0;
3130 if 1 > max_ordinal {
3131 return Ok(());
3132 }
3133
3134 let cur_offset: usize = (1 - 1) * envelope_size;
3137
3138 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3140
3141 fidl::encoding::encode_in_envelope_optional::<CodecId, D>(
3146 self.codec_id.as_ref().map(<CodecId as fidl::encoding::ValueTypeMarker>::borrow),
3147 encoder,
3148 offset + cur_offset,
3149 depth,
3150 )?;
3151
3152 _prev_end_offset = cur_offset + envelope_size;
3153 if 2 > max_ordinal {
3154 return Ok(());
3155 }
3156
3157 let cur_offset: usize = (2 - 1) * envelope_size;
3160
3161 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3163
3164 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedVector<u8>, D>(
3169 self.codec_configuration.as_ref().map(<fidl::encoding::UnboundedVector<u8> as fidl::encoding::ValueTypeMarker>::borrow),
3170 encoder, offset + cur_offset, depth
3171 )?;
3172
3173 _prev_end_offset = cur_offset + envelope_size;
3174
3175 Ok(())
3176 }
3177 }
3178
3179 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for CodecAttributes {
3180 #[inline(always)]
3181 fn new_empty() -> Self {
3182 Self::default()
3183 }
3184
3185 unsafe fn decode(
3186 &mut self,
3187 decoder: &mut fidl::encoding::Decoder<'_, D>,
3188 offset: usize,
3189 mut depth: fidl::encoding::Depth,
3190 ) -> fidl::Result<()> {
3191 decoder.debug_check_bounds::<Self>(offset);
3192 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
3193 None => return Err(fidl::Error::NotNullable),
3194 Some(len) => len,
3195 };
3196 if len == 0 {
3198 return Ok(());
3199 };
3200 depth.increment()?;
3201 let envelope_size = 8;
3202 let bytes_len = len * envelope_size;
3203 let offset = decoder.out_of_line_offset(bytes_len)?;
3204 let mut _next_ordinal_to_read = 0;
3206 let mut next_offset = offset;
3207 let end_offset = offset + bytes_len;
3208 _next_ordinal_to_read += 1;
3209 if next_offset >= end_offset {
3210 return Ok(());
3211 }
3212
3213 while _next_ordinal_to_read < 1 {
3215 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3216 _next_ordinal_to_read += 1;
3217 next_offset += envelope_size;
3218 }
3219
3220 let next_out_of_line = decoder.next_out_of_line();
3221 let handles_before = decoder.remaining_handles();
3222 if let Some((inlined, num_bytes, num_handles)) =
3223 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3224 {
3225 let member_inline_size =
3226 <CodecId as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3227 if inlined != (member_inline_size <= 4) {
3228 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3229 }
3230 let inner_offset;
3231 let mut inner_depth = depth.clone();
3232 if inlined {
3233 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3234 inner_offset = next_offset;
3235 } else {
3236 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3237 inner_depth.increment()?;
3238 }
3239 let val_ref = self.codec_id.get_or_insert_with(|| fidl::new_empty!(CodecId, D));
3240 fidl::decode!(CodecId, D, val_ref, decoder, inner_offset, inner_depth)?;
3241 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3242 {
3243 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3244 }
3245 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3246 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3247 }
3248 }
3249
3250 next_offset += envelope_size;
3251 _next_ordinal_to_read += 1;
3252 if next_offset >= end_offset {
3253 return Ok(());
3254 }
3255
3256 while _next_ordinal_to_read < 2 {
3258 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3259 _next_ordinal_to_read += 1;
3260 next_offset += envelope_size;
3261 }
3262
3263 let next_out_of_line = decoder.next_out_of_line();
3264 let handles_before = decoder.remaining_handles();
3265 if let Some((inlined, num_bytes, num_handles)) =
3266 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3267 {
3268 let member_inline_size = <fidl::encoding::UnboundedVector<u8> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3269 if inlined != (member_inline_size <= 4) {
3270 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3271 }
3272 let inner_offset;
3273 let mut inner_depth = depth.clone();
3274 if inlined {
3275 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3276 inner_offset = next_offset;
3277 } else {
3278 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3279 inner_depth.increment()?;
3280 }
3281 let val_ref = self.codec_configuration.get_or_insert_with(|| {
3282 fidl::new_empty!(fidl::encoding::UnboundedVector<u8>, D)
3283 });
3284 fidl::decode!(
3285 fidl::encoding::UnboundedVector<u8>,
3286 D,
3287 val_ref,
3288 decoder,
3289 inner_offset,
3290 inner_depth
3291 )?;
3292 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3293 {
3294 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3295 }
3296 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3297 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3298 }
3299 }
3300
3301 next_offset += envelope_size;
3302
3303 while next_offset < end_offset {
3305 _next_ordinal_to_read += 1;
3306 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3307 next_offset += envelope_size;
3308 }
3309
3310 Ok(())
3311 }
3312 }
3313
3314 impl SecurityRequirements {
3315 #[inline(always)]
3316 fn max_ordinal_present(&self) -> u64 {
3317 if let Some(_) = self.secure_connections_required {
3318 return 2;
3319 }
3320 if let Some(_) = self.authentication_required {
3321 return 1;
3322 }
3323 0
3324 }
3325 }
3326
3327 impl fidl::encoding::ValueTypeMarker for SecurityRequirements {
3328 type Borrowed<'a> = &'a Self;
3329 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3330 value
3331 }
3332 }
3333
3334 unsafe impl fidl::encoding::TypeMarker for SecurityRequirements {
3335 type Owned = Self;
3336
3337 #[inline(always)]
3338 fn inline_align(_context: fidl::encoding::Context) -> usize {
3339 8
3340 }
3341
3342 #[inline(always)]
3343 fn inline_size(_context: fidl::encoding::Context) -> usize {
3344 16
3345 }
3346 }
3347
3348 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<SecurityRequirements, D>
3349 for &SecurityRequirements
3350 {
3351 unsafe fn encode(
3352 self,
3353 encoder: &mut fidl::encoding::Encoder<'_, D>,
3354 offset: usize,
3355 mut depth: fidl::encoding::Depth,
3356 ) -> fidl::Result<()> {
3357 encoder.debug_check_bounds::<SecurityRequirements>(offset);
3358 let max_ordinal: u64 = self.max_ordinal_present();
3360 encoder.write_num(max_ordinal, offset);
3361 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
3362 if max_ordinal == 0 {
3364 return Ok(());
3365 }
3366 depth.increment()?;
3367 let envelope_size = 8;
3368 let bytes_len = max_ordinal as usize * envelope_size;
3369 #[allow(unused_variables)]
3370 let offset = encoder.out_of_line_offset(bytes_len);
3371 let mut _prev_end_offset: usize = 0;
3372 if 1 > max_ordinal {
3373 return Ok(());
3374 }
3375
3376 let cur_offset: usize = (1 - 1) * envelope_size;
3379
3380 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3382
3383 fidl::encoding::encode_in_envelope_optional::<bool, D>(
3388 self.authentication_required
3389 .as_ref()
3390 .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
3391 encoder,
3392 offset + cur_offset,
3393 depth,
3394 )?;
3395
3396 _prev_end_offset = cur_offset + envelope_size;
3397 if 2 > max_ordinal {
3398 return Ok(());
3399 }
3400
3401 let cur_offset: usize = (2 - 1) * envelope_size;
3404
3405 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3407
3408 fidl::encoding::encode_in_envelope_optional::<bool, D>(
3413 self.secure_connections_required
3414 .as_ref()
3415 .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
3416 encoder,
3417 offset + cur_offset,
3418 depth,
3419 )?;
3420
3421 _prev_end_offset = cur_offset + envelope_size;
3422
3423 Ok(())
3424 }
3425 }
3426
3427 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SecurityRequirements {
3428 #[inline(always)]
3429 fn new_empty() -> Self {
3430 Self::default()
3431 }
3432
3433 unsafe fn decode(
3434 &mut self,
3435 decoder: &mut fidl::encoding::Decoder<'_, D>,
3436 offset: usize,
3437 mut depth: fidl::encoding::Depth,
3438 ) -> fidl::Result<()> {
3439 decoder.debug_check_bounds::<Self>(offset);
3440 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
3441 None => return Err(fidl::Error::NotNullable),
3442 Some(len) => len,
3443 };
3444 if len == 0 {
3446 return Ok(());
3447 };
3448 depth.increment()?;
3449 let envelope_size = 8;
3450 let bytes_len = len * envelope_size;
3451 let offset = decoder.out_of_line_offset(bytes_len)?;
3452 let mut _next_ordinal_to_read = 0;
3454 let mut next_offset = offset;
3455 let end_offset = offset + bytes_len;
3456 _next_ordinal_to_read += 1;
3457 if next_offset >= end_offset {
3458 return Ok(());
3459 }
3460
3461 while _next_ordinal_to_read < 1 {
3463 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3464 _next_ordinal_to_read += 1;
3465 next_offset += envelope_size;
3466 }
3467
3468 let next_out_of_line = decoder.next_out_of_line();
3469 let handles_before = decoder.remaining_handles();
3470 if let Some((inlined, num_bytes, num_handles)) =
3471 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3472 {
3473 let member_inline_size =
3474 <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3475 if inlined != (member_inline_size <= 4) {
3476 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3477 }
3478 let inner_offset;
3479 let mut inner_depth = depth.clone();
3480 if inlined {
3481 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3482 inner_offset = next_offset;
3483 } else {
3484 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3485 inner_depth.increment()?;
3486 }
3487 let val_ref =
3488 self.authentication_required.get_or_insert_with(|| fidl::new_empty!(bool, D));
3489 fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
3490 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3491 {
3492 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3493 }
3494 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3495 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3496 }
3497 }
3498
3499 next_offset += envelope_size;
3500 _next_ordinal_to_read += 1;
3501 if next_offset >= end_offset {
3502 return Ok(());
3503 }
3504
3505 while _next_ordinal_to_read < 2 {
3507 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3508 _next_ordinal_to_read += 1;
3509 next_offset += envelope_size;
3510 }
3511
3512 let next_out_of_line = decoder.next_out_of_line();
3513 let handles_before = decoder.remaining_handles();
3514 if let Some((inlined, num_bytes, num_handles)) =
3515 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3516 {
3517 let member_inline_size =
3518 <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3519 if inlined != (member_inline_size <= 4) {
3520 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3521 }
3522 let inner_offset;
3523 let mut inner_depth = depth.clone();
3524 if inlined {
3525 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3526 inner_offset = next_offset;
3527 } else {
3528 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3529 inner_depth.increment()?;
3530 }
3531 let val_ref = self
3532 .secure_connections_required
3533 .get_or_insert_with(|| fidl::new_empty!(bool, D));
3534 fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
3535 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3536 {
3537 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3538 }
3539 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3540 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3541 }
3542 }
3543
3544 next_offset += envelope_size;
3545
3546 while next_offset < end_offset {
3548 _next_ordinal_to_read += 1;
3549 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3550 next_offset += envelope_size;
3551 }
3552
3553 Ok(())
3554 }
3555 }
3556
3557 impl VendorCodingFormat {
3558 #[inline(always)]
3559 fn max_ordinal_present(&self) -> u64 {
3560 if let Some(_) = self.vendor_id {
3561 return 2;
3562 }
3563 if let Some(_) = self.company_id {
3564 return 1;
3565 }
3566 0
3567 }
3568 }
3569
3570 impl fidl::encoding::ValueTypeMarker for VendorCodingFormat {
3571 type Borrowed<'a> = &'a Self;
3572 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3573 value
3574 }
3575 }
3576
3577 unsafe impl fidl::encoding::TypeMarker for VendorCodingFormat {
3578 type Owned = Self;
3579
3580 #[inline(always)]
3581 fn inline_align(_context: fidl::encoding::Context) -> usize {
3582 8
3583 }
3584
3585 #[inline(always)]
3586 fn inline_size(_context: fidl::encoding::Context) -> usize {
3587 16
3588 }
3589 }
3590
3591 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<VendorCodingFormat, D>
3592 for &VendorCodingFormat
3593 {
3594 unsafe fn encode(
3595 self,
3596 encoder: &mut fidl::encoding::Encoder<'_, D>,
3597 offset: usize,
3598 mut depth: fidl::encoding::Depth,
3599 ) -> fidl::Result<()> {
3600 encoder.debug_check_bounds::<VendorCodingFormat>(offset);
3601 let max_ordinal: u64 = self.max_ordinal_present();
3603 encoder.write_num(max_ordinal, offset);
3604 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
3605 if max_ordinal == 0 {
3607 return Ok(());
3608 }
3609 depth.increment()?;
3610 let envelope_size = 8;
3611 let bytes_len = max_ordinal as usize * envelope_size;
3612 #[allow(unused_variables)]
3613 let offset = encoder.out_of_line_offset(bytes_len);
3614 let mut _prev_end_offset: usize = 0;
3615 if 1 > max_ordinal {
3616 return Ok(());
3617 }
3618
3619 let cur_offset: usize = (1 - 1) * envelope_size;
3622
3623 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3625
3626 fidl::encoding::encode_in_envelope_optional::<u16, D>(
3631 self.company_id.as_ref().map(<u16 as fidl::encoding::ValueTypeMarker>::borrow),
3632 encoder,
3633 offset + cur_offset,
3634 depth,
3635 )?;
3636
3637 _prev_end_offset = cur_offset + envelope_size;
3638 if 2 > max_ordinal {
3639 return Ok(());
3640 }
3641
3642 let cur_offset: usize = (2 - 1) * envelope_size;
3645
3646 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3648
3649 fidl::encoding::encode_in_envelope_optional::<u16, D>(
3654 self.vendor_id.as_ref().map(<u16 as fidl::encoding::ValueTypeMarker>::borrow),
3655 encoder,
3656 offset + cur_offset,
3657 depth,
3658 )?;
3659
3660 _prev_end_offset = cur_offset + envelope_size;
3661
3662 Ok(())
3663 }
3664 }
3665
3666 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for VendorCodingFormat {
3667 #[inline(always)]
3668 fn new_empty() -> Self {
3669 Self::default()
3670 }
3671
3672 unsafe fn decode(
3673 &mut self,
3674 decoder: &mut fidl::encoding::Decoder<'_, D>,
3675 offset: usize,
3676 mut depth: fidl::encoding::Depth,
3677 ) -> fidl::Result<()> {
3678 decoder.debug_check_bounds::<Self>(offset);
3679 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
3680 None => return Err(fidl::Error::NotNullable),
3681 Some(len) => len,
3682 };
3683 if len == 0 {
3685 return Ok(());
3686 };
3687 depth.increment()?;
3688 let envelope_size = 8;
3689 let bytes_len = len * envelope_size;
3690 let offset = decoder.out_of_line_offset(bytes_len)?;
3691 let mut _next_ordinal_to_read = 0;
3693 let mut next_offset = offset;
3694 let end_offset = offset + bytes_len;
3695 _next_ordinal_to_read += 1;
3696 if next_offset >= end_offset {
3697 return Ok(());
3698 }
3699
3700 while _next_ordinal_to_read < 1 {
3702 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3703 _next_ordinal_to_read += 1;
3704 next_offset += envelope_size;
3705 }
3706
3707 let next_out_of_line = decoder.next_out_of_line();
3708 let handles_before = decoder.remaining_handles();
3709 if let Some((inlined, num_bytes, num_handles)) =
3710 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3711 {
3712 let member_inline_size =
3713 <u16 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3714 if inlined != (member_inline_size <= 4) {
3715 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3716 }
3717 let inner_offset;
3718 let mut inner_depth = depth.clone();
3719 if inlined {
3720 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3721 inner_offset = next_offset;
3722 } else {
3723 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3724 inner_depth.increment()?;
3725 }
3726 let val_ref = self.company_id.get_or_insert_with(|| fidl::new_empty!(u16, D));
3727 fidl::decode!(u16, D, val_ref, decoder, inner_offset, inner_depth)?;
3728 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3729 {
3730 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3731 }
3732 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3733 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3734 }
3735 }
3736
3737 next_offset += envelope_size;
3738 _next_ordinal_to_read += 1;
3739 if next_offset >= end_offset {
3740 return Ok(());
3741 }
3742
3743 while _next_ordinal_to_read < 2 {
3745 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3746 _next_ordinal_to_read += 1;
3747 next_offset += envelope_size;
3748 }
3749
3750 let next_out_of_line = decoder.next_out_of_line();
3751 let handles_before = decoder.remaining_handles();
3752 if let Some((inlined, num_bytes, num_handles)) =
3753 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3754 {
3755 let member_inline_size =
3756 <u16 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3757 if inlined != (member_inline_size <= 4) {
3758 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3759 }
3760 let inner_offset;
3761 let mut inner_depth = depth.clone();
3762 if inlined {
3763 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3764 inner_offset = next_offset;
3765 } else {
3766 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3767 inner_depth.increment()?;
3768 }
3769 let val_ref = self.vendor_id.get_or_insert_with(|| fidl::new_empty!(u16, D));
3770 fidl::decode!(u16, D, val_ref, decoder, inner_offset, inner_depth)?;
3771 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3772 {
3773 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3774 }
3775 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3776 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3777 }
3778 }
3779
3780 next_offset += envelope_size;
3781
3782 while next_offset < end_offset {
3784 _next_ordinal_to_read += 1;
3785 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3786 next_offset += envelope_size;
3787 }
3788
3789 Ok(())
3790 }
3791 }
3792
3793 impl fidl::encoding::ValueTypeMarker for CodecId {
3794 type Borrowed<'a> = &'a Self;
3795 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3796 value
3797 }
3798 }
3799
3800 unsafe impl fidl::encoding::TypeMarker for CodecId {
3801 type Owned = Self;
3802
3803 #[inline(always)]
3804 fn inline_align(_context: fidl::encoding::Context) -> usize {
3805 8
3806 }
3807
3808 #[inline(always)]
3809 fn inline_size(_context: fidl::encoding::Context) -> usize {
3810 16
3811 }
3812 }
3813
3814 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<CodecId, D> for &CodecId {
3815 #[inline]
3816 unsafe fn encode(
3817 self,
3818 encoder: &mut fidl::encoding::Encoder<'_, D>,
3819 offset: usize,
3820 _depth: fidl::encoding::Depth,
3821 ) -> fidl::Result<()> {
3822 encoder.debug_check_bounds::<CodecId>(offset);
3823 encoder.write_num::<u64>(self.ordinal(), offset);
3824 match self {
3825 CodecId::AssignedFormat(ref val) => {
3826 fidl::encoding::encode_in_envelope::<AssignedCodingFormat, D>(
3827 <AssignedCodingFormat as fidl::encoding::ValueTypeMarker>::borrow(val),
3828 encoder,
3829 offset + 8,
3830 _depth,
3831 )
3832 }
3833 CodecId::VendorFormat(ref val) => {
3834 fidl::encoding::encode_in_envelope::<VendorCodingFormat, D>(
3835 <VendorCodingFormat as fidl::encoding::ValueTypeMarker>::borrow(val),
3836 encoder,
3837 offset + 8,
3838 _depth,
3839 )
3840 }
3841 CodecId::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
3842 }
3843 }
3844 }
3845
3846 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for CodecId {
3847 #[inline(always)]
3848 fn new_empty() -> Self {
3849 Self::__SourceBreaking { unknown_ordinal: 0 }
3850 }
3851
3852 #[inline]
3853 unsafe fn decode(
3854 &mut self,
3855 decoder: &mut fidl::encoding::Decoder<'_, D>,
3856 offset: usize,
3857 mut depth: fidl::encoding::Depth,
3858 ) -> fidl::Result<()> {
3859 decoder.debug_check_bounds::<Self>(offset);
3860 #[allow(unused_variables)]
3861 let next_out_of_line = decoder.next_out_of_line();
3862 let handles_before = decoder.remaining_handles();
3863 let (ordinal, inlined, num_bytes, num_handles) =
3864 fidl::encoding::decode_union_inline_portion(decoder, offset)?;
3865
3866 let member_inline_size = match ordinal {
3867 1 => <AssignedCodingFormat as fidl::encoding::TypeMarker>::inline_size(
3868 decoder.context,
3869 ),
3870 2 => {
3871 <VendorCodingFormat as fidl::encoding::TypeMarker>::inline_size(decoder.context)
3872 }
3873 0 => return Err(fidl::Error::UnknownUnionTag),
3874 _ => num_bytes as usize,
3875 };
3876
3877 if inlined != (member_inline_size <= 4) {
3878 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3879 }
3880 let _inner_offset;
3881 if inlined {
3882 decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
3883 _inner_offset = offset + 8;
3884 } else {
3885 depth.increment()?;
3886 _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3887 }
3888 match ordinal {
3889 1 => {
3890 #[allow(irrefutable_let_patterns)]
3891 if let CodecId::AssignedFormat(_) = self {
3892 } else {
3894 *self = CodecId::AssignedFormat(fidl::new_empty!(AssignedCodingFormat, D));
3896 }
3897 #[allow(irrefutable_let_patterns)]
3898 if let CodecId::AssignedFormat(ref mut val) = self {
3899 fidl::decode!(AssignedCodingFormat, D, val, decoder, _inner_offset, depth)?;
3900 } else {
3901 unreachable!()
3902 }
3903 }
3904 2 => {
3905 #[allow(irrefutable_let_patterns)]
3906 if let CodecId::VendorFormat(_) = self {
3907 } else {
3909 *self = CodecId::VendorFormat(fidl::new_empty!(VendorCodingFormat, D));
3911 }
3912 #[allow(irrefutable_let_patterns)]
3913 if let CodecId::VendorFormat(ref mut val) = self {
3914 fidl::decode!(VendorCodingFormat, D, val, decoder, _inner_offset, depth)?;
3915 } else {
3916 unreachable!()
3917 }
3918 }
3919 #[allow(deprecated)]
3920 ordinal => {
3921 for _ in 0..num_handles {
3922 decoder.drop_next_handle()?;
3923 }
3924 *self = CodecId::__SourceBreaking { unknown_ordinal: ordinal };
3925 }
3926 }
3927 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
3928 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3929 }
3930 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3931 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3932 }
3933 Ok(())
3934 }
3935 }
3936}