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