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