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 const CONTROL_NODE_NAME: &str = "sys/platform/virtual-audio/virtual-audio";
12
13pub const LEGACY_CONTROL_NODE_NAME: &str = "sys/platform/virtual-audio-legacy/virtual-audio-legacy";
14
15pub const MAX_COUNT_DAI_INTERCONNECTS: u32 =
16 fidl_fuchsia_hardware_audio_signalprocessing::MAX_COUNT_PROCESSING_ELEMENTS as u32;
17
18pub const MAX_COUNT_RING_BUFFERS: u32 =
19 fidl_fuchsia_hardware_audio_signalprocessing::MAX_COUNT_PROCESSING_ELEMENTS as u32;
20
21pub const MAX_FORMAT_RANGES: u32 = 64;
22
23pub const MAX_UI_STRING_SIZE: u32 = 256;
24
25#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
26pub enum DeviceType {
27 StreamConfig,
29 Dai,
31 Codec,
33 Composite,
35 #[doc(hidden)]
36 __SourceBreaking { unknown_ordinal: u32 },
37}
38
39#[macro_export]
41macro_rules! DeviceTypeUnknown {
42 () => {
43 _
44 };
45}
46
47impl DeviceType {
48 #[inline]
49 pub fn from_primitive(prim: u32) -> Option<Self> {
50 match prim {
51 1 => Some(Self::StreamConfig),
52 2 => Some(Self::Dai),
53 3 => Some(Self::Codec),
54 4 => Some(Self::Composite),
55 _ => None,
56 }
57 }
58
59 #[inline]
60 pub fn from_primitive_allow_unknown(prim: u32) -> Self {
61 match prim {
62 1 => Self::StreamConfig,
63 2 => Self::Dai,
64 3 => Self::Codec,
65 4 => Self::Composite,
66 unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
67 }
68 }
69
70 #[inline]
71 pub fn unknown() -> Self {
72 Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
73 }
74
75 #[inline]
76 pub const fn into_primitive(self) -> u32 {
77 match self {
78 Self::StreamConfig => 1,
79 Self::Dai => 2,
80 Self::Codec => 3,
81 Self::Composite => 4,
82 Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
83 }
84 }
85
86 #[inline]
87 pub fn is_unknown(&self) -> bool {
88 match self {
89 Self::__SourceBreaking { unknown_ordinal: _ } => true,
90 _ => false,
91 }
92 }
93}
94
95#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
96pub enum Error {
97 Internal,
99 NoRingBuffer,
101 NotStarted,
103 NotSupported,
105 InvalidArgs,
107 #[doc(hidden)]
108 __SourceBreaking { unknown_ordinal: u32 },
109}
110
111#[macro_export]
113macro_rules! ErrorUnknown {
114 () => {
115 _
116 };
117}
118
119impl Error {
120 #[inline]
121 pub fn from_primitive(prim: u32) -> Option<Self> {
122 match prim {
123 1 => Some(Self::Internal),
124 2 => Some(Self::NoRingBuffer),
125 3 => Some(Self::NotStarted),
126 4 => Some(Self::NotSupported),
127 5 => Some(Self::InvalidArgs),
128 _ => None,
129 }
130 }
131
132 #[inline]
133 pub fn from_primitive_allow_unknown(prim: u32) -> Self {
134 match prim {
135 1 => Self::Internal,
136 2 => Self::NoRingBuffer,
137 3 => Self::NotStarted,
138 4 => Self::NotSupported,
139 5 => Self::InvalidArgs,
140 unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
141 }
142 }
143
144 #[inline]
145 pub fn unknown() -> Self {
146 Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
147 }
148
149 #[inline]
150 pub const fn into_primitive(self) -> u32 {
151 match self {
152 Self::Internal => 1,
153 Self::NoRingBuffer => 2,
154 Self::NotStarted => 3,
155 Self::NotSupported => 4,
156 Self::InvalidArgs => 5,
157 Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
158 }
159 }
160
161 #[inline]
162 pub fn is_unknown(&self) -> bool {
163 match self {
164 Self::__SourceBreaking { unknown_ordinal: _ } => true,
165 _ => false,
166 }
167 }
168}
169
170#[derive(Clone, Debug, PartialEq)]
171pub struct ControlGetDefaultConfigurationRequest {
172 pub type_: DeviceType,
173 pub direction: Direction,
174}
175
176impl fidl::Persistable for ControlGetDefaultConfigurationRequest {}
177
178#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
179#[repr(C)]
180pub struct ControlGetNumDevicesResponse {
181 pub num_input_devices: u32,
182 pub num_output_devices: u32,
183 pub num_unspecified_direction_devices: u32,
184}
185
186impl fidl::Persistable for ControlGetNumDevicesResponse {}
187
188#[derive(Clone, Debug, PartialEq)]
189pub struct ControlGetDefaultConfigurationResponse {
190 pub config: Configuration,
191}
192
193impl fidl::Persistable for ControlGetDefaultConfigurationResponse {}
194
195#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
196#[repr(C)]
197pub struct DeviceAdjustClockRateRequest {
198 pub ppm_from_monotonic: i32,
199}
200
201impl fidl::Persistable for DeviceAdjustClockRateRequest {}
202
203#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
204pub struct DeviceChangePlugStateRequest {
205 pub plug_change_time: i64,
206 pub plugged: bool,
207}
208
209impl fidl::Persistable for DeviceChangePlugStateRequest {}
210
211#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
212#[repr(C)]
213pub struct DeviceOnPositionNotifyRequest {
214 pub monotonic_time: i64,
215 pub ring_position: u32,
216}
217
218impl fidl::Persistable for DeviceOnPositionNotifyRequest {}
219
220#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
221#[repr(C)]
222pub struct DeviceOnSetFormatRequest {
223 pub frames_per_second: u32,
224 pub sample_format: u32,
225 pub num_channels: u32,
226 pub external_delay: i64,
227}
228
229impl fidl::Persistable for DeviceOnSetFormatRequest {}
230
231#[derive(Clone, Copy, Debug, PartialEq, PartialOrd)]
232pub struct DeviceOnSetGainRequest {
233 pub current_mute: bool,
234 pub current_agc: bool,
235 pub current_gain_db: f32,
236}
237
238impl fidl::Persistable for DeviceOnSetGainRequest {}
239
240#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
241#[repr(C)]
242pub struct DeviceOnStartRequest {
243 pub start_time: i64,
244}
245
246impl fidl::Persistable for DeviceOnStartRequest {}
247
248#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
249#[repr(C)]
250pub struct DeviceOnStopRequest {
251 pub stop_time: i64,
252 pub ring_position: u32,
253}
254
255impl fidl::Persistable for DeviceOnStopRequest {}
256
257#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
258#[repr(C)]
259pub struct DeviceSetNotificationFrequencyRequest {
260 pub notifications_per_ring: u32,
261}
262
263impl fidl::Persistable for DeviceSetNotificationFrequencyRequest {}
264
265#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
266#[repr(C)]
267pub struct DeviceGetFormatResponse {
268 pub frames_per_second: u32,
269 pub sample_format: u32,
270 pub num_channels: u32,
271 pub external_delay: i64,
272}
273
274impl fidl::Persistable for DeviceGetFormatResponse {}
275
276#[derive(Clone, Copy, Debug, PartialEq, PartialOrd)]
277pub struct DeviceGetGainResponse {
278 pub current_mute: bool,
279 pub current_agc: bool,
280 pub current_gain_db: f32,
281}
282
283impl fidl::Persistable for DeviceGetGainResponse {}
284
285#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
286#[repr(C)]
287pub struct DeviceGetPositionResponse {
288 pub monotonic_time: i64,
289 pub ring_position: u32,
290}
291
292impl fidl::Persistable for DeviceGetPositionResponse {}
293
294#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
295#[repr(C)]
296pub struct FormatRange {
297 pub sample_format_flags: u32,
299 pub min_frame_rate: u32,
300 pub max_frame_rate: u32,
301 pub min_channels: u8,
302 pub max_channels: u8,
303 pub rate_family_flags: u16,
305}
306
307impl fidl::Persistable for FormatRange {}
308
309#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
315#[repr(C)]
316pub struct RingBufferConstraints {
317 pub min_frames: u32,
320 pub max_frames: u32,
323 pub modulo_frames: u32,
326}
327
328impl fidl::Persistable for RingBufferConstraints {}
329
330#[derive(Clone, Debug, Default, PartialEq)]
331pub struct ClockProperties {
332 pub domain: Option<i32>,
340 pub rate_adjustment_ppm: Option<i32>,
344 #[doc(hidden)]
345 pub __source_breaking: fidl::marker::SourceBreaking,
346}
347
348impl fidl::Persistable for ClockProperties {}
349
350#[derive(Clone, Debug, Default, PartialEq)]
352pub struct Codec {
353 pub is_input: Option<bool>,
358 pub dai_interconnect: Option<DaiInterconnect>,
362 pub plug_properties: Option<PlugProperties>,
366 #[doc(hidden)]
367 pub __source_breaking: fidl::marker::SourceBreaking,
368}
369
370impl fidl::Persistable for Codec {}
371
372#[derive(Clone, Debug, Default, PartialEq)]
374pub struct Composite {
375 pub ring_buffers: Option<Vec<CompositeRingBuffer>>,
379 pub dai_interconnects: Option<Vec<CompositeDaiInterconnect>>,
383 pub clock_properties: Option<ClockProperties>,
387 pub topologies: Option<Vec<fidl_fuchsia_hardware_audio_signalprocessing::Topology>>,
391 #[doc(hidden)]
392 pub __source_breaking: fidl::marker::SourceBreaking,
393}
394
395impl fidl::Persistable for Composite {}
396
397#[derive(Clone, Debug, Default, PartialEq)]
399pub struct CompositeDaiInterconnect {
400 pub id: Option<u64>,
404 pub dai_interconnect: Option<DaiInterconnect>,
408 #[doc(hidden)]
409 pub __source_breaking: fidl::marker::SourceBreaking,
410}
411
412impl fidl::Persistable for CompositeDaiInterconnect {}
413
414#[derive(Clone, Debug, Default, PartialEq)]
416pub struct CompositeRingBuffer {
417 pub id: Option<u64>,
421 pub ring_buffer: Option<RingBuffer>,
425 #[doc(hidden)]
426 pub __source_breaking: fidl::marker::SourceBreaking,
427}
428
429impl fidl::Persistable for CompositeRingBuffer {}
430
431#[derive(Clone, Debug, Default, PartialEq)]
433pub struct Configuration {
434 pub device_name: Option<String>,
438 pub manufacturer_name: Option<String>,
442 pub product_name: Option<String>,
446 pub unique_id: Option<[u8; 16]>,
453 pub device_specific: Option<DeviceSpecific>,
459 #[doc(hidden)]
460 pub __source_breaking: fidl::marker::SourceBreaking,
461}
462
463impl fidl::Persistable for Configuration {}
464
465#[derive(Clone, Debug, Default, PartialEq)]
467pub struct Dai {
468 pub is_input: Option<bool>,
472 pub ring_buffer: Option<RingBuffer>,
476 pub dai_interconnect: Option<DaiInterconnect>,
480 pub clock_properties: Option<ClockProperties>,
484 #[doc(hidden)]
485 pub __source_breaking: fidl::marker::SourceBreaking,
486}
487
488impl fidl::Persistable for Dai {}
489
490#[derive(Clone, Debug, Default, PartialEq)]
492pub struct DaiInterconnect {
493 pub dai_supported_formats: Option<Vec<fidl_fuchsia_hardware_audio::DaiSupportedFormats>>,
497 #[doc(hidden)]
498 pub __source_breaking: fidl::marker::SourceBreaking,
499}
500
501impl fidl::Persistable for DaiInterconnect {}
502
503#[derive(Clone, Debug, Default, PartialEq)]
504pub struct Direction {
505 pub is_input: Option<bool>,
515 #[doc(hidden)]
516 pub __source_breaking: fidl::marker::SourceBreaking,
517}
518
519impl fidl::Persistable for Direction {}
520
521#[derive(Clone, Debug, Default, PartialEq)]
522pub struct GainProperties {
523 pub gain_state: Option<fidl_fuchsia_hardware_audio::GainState>,
527 pub min_gain_db: Option<f32>,
531 pub max_gain_db: Option<f32>,
535 pub gain_step_db: Option<f32>,
539 pub can_mute: Option<bool>,
544 pub can_agc: Option<bool>,
548 #[doc(hidden)]
549 pub __source_breaking: fidl::marker::SourceBreaking,
550}
551
552impl fidl::Persistable for GainProperties {}
553
554#[derive(Clone, Debug, Default, PartialEq)]
555pub struct PlugProperties {
556 pub plug_state: Option<fidl_fuchsia_hardware_audio::PlugState>,
560 pub plug_detect_capabilities: Option<fidl_fuchsia_hardware_audio::PlugDetectCapabilities>,
564 #[doc(hidden)]
565 pub __source_breaking: fidl::marker::SourceBreaking,
566}
567
568impl fidl::Persistable for PlugProperties {}
569
570#[derive(Clone, Debug, Default, PartialEq)]
572pub struct RingBuffer {
573 pub driver_transfer_bytes: Option<u32>,
577 pub internal_delay: Option<i64>,
581 pub external_delay: Option<i64>,
585 pub supported_formats: Option<Vec<FormatRange>>,
589 pub ring_buffer_constraints: Option<RingBufferConstraints>,
594 pub notifications_per_ring: Option<u32>,
601 #[doc(hidden)]
602 pub __source_breaking: fidl::marker::SourceBreaking,
603}
604
605impl fidl::Persistable for RingBuffer {}
606
607#[derive(Clone, Debug, Default, PartialEq)]
609pub struct StreamConfig {
610 pub is_input: Option<bool>,
618 pub ring_buffer: Option<RingBuffer>,
622 pub clock_properties: Option<ClockProperties>,
626 pub gain_properties: Option<GainProperties>,
630 pub plug_properties: Option<PlugProperties>,
634 #[doc(hidden)]
635 pub __source_breaking: fidl::marker::SourceBreaking,
636}
637
638impl fidl::Persistable for StreamConfig {}
639
640#[derive(Clone, Debug)]
642pub enum DeviceSpecific {
643 StreamConfig(StreamConfig),
645 Dai(Dai),
647 Codec(Codec),
649 Composite(Composite),
651 #[doc(hidden)]
652 __SourceBreaking { unknown_ordinal: u64 },
653}
654
655#[macro_export]
657macro_rules! DeviceSpecificUnknown {
658 () => {
659 _
660 };
661}
662
663impl PartialEq for DeviceSpecific {
665 fn eq(&self, other: &Self) -> bool {
666 match (self, other) {
667 (Self::StreamConfig(x), Self::StreamConfig(y)) => *x == *y,
668 (Self::Dai(x), Self::Dai(y)) => *x == *y,
669 (Self::Codec(x), Self::Codec(y)) => *x == *y,
670 (Self::Composite(x), Self::Composite(y)) => *x == *y,
671 _ => false,
672 }
673 }
674}
675
676impl DeviceSpecific {
677 #[inline]
678 pub fn ordinal(&self) -> u64 {
679 match *self {
680 Self::StreamConfig(_) => 1,
681 Self::Dai(_) => 2,
682 Self::Codec(_) => 3,
683 Self::Composite(_) => 4,
684 Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
685 }
686 }
687
688 #[inline]
689 pub fn unknown_variant_for_testing() -> Self {
690 Self::__SourceBreaking { unknown_ordinal: 0 }
691 }
692
693 #[inline]
694 pub fn is_unknown(&self) -> bool {
695 match self {
696 Self::__SourceBreaking { .. } => true,
697 _ => false,
698 }
699 }
700}
701
702impl fidl::Persistable for DeviceSpecific {}
703
704mod internal {
705 use super::*;
706 unsafe impl fidl::encoding::TypeMarker for DeviceType {
707 type Owned = Self;
708
709 #[inline(always)]
710 fn inline_align(_context: fidl::encoding::Context) -> usize {
711 std::mem::align_of::<u32>()
712 }
713
714 #[inline(always)]
715 fn inline_size(_context: fidl::encoding::Context) -> usize {
716 std::mem::size_of::<u32>()
717 }
718
719 #[inline(always)]
720 fn encode_is_copy() -> bool {
721 false
722 }
723
724 #[inline(always)]
725 fn decode_is_copy() -> bool {
726 false
727 }
728 }
729
730 impl fidl::encoding::ValueTypeMarker for DeviceType {
731 type Borrowed<'a> = Self;
732 #[inline(always)]
733 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
734 *value
735 }
736 }
737
738 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for DeviceType {
739 #[inline]
740 unsafe fn encode(
741 self,
742 encoder: &mut fidl::encoding::Encoder<'_, D>,
743 offset: usize,
744 _depth: fidl::encoding::Depth,
745 ) -> fidl::Result<()> {
746 encoder.debug_check_bounds::<Self>(offset);
747 encoder.write_num(self.into_primitive(), offset);
748 Ok(())
749 }
750 }
751
752 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for DeviceType {
753 #[inline(always)]
754 fn new_empty() -> Self {
755 Self::unknown()
756 }
757
758 #[inline]
759 unsafe fn decode(
760 &mut self,
761 decoder: &mut fidl::encoding::Decoder<'_, D>,
762 offset: usize,
763 _depth: fidl::encoding::Depth,
764 ) -> fidl::Result<()> {
765 decoder.debug_check_bounds::<Self>(offset);
766 let prim = decoder.read_num::<u32>(offset);
767
768 *self = Self::from_primitive_allow_unknown(prim);
769 Ok(())
770 }
771 }
772 unsafe impl fidl::encoding::TypeMarker for Error {
773 type Owned = Self;
774
775 #[inline(always)]
776 fn inline_align(_context: fidl::encoding::Context) -> usize {
777 std::mem::align_of::<u32>()
778 }
779
780 #[inline(always)]
781 fn inline_size(_context: fidl::encoding::Context) -> usize {
782 std::mem::size_of::<u32>()
783 }
784
785 #[inline(always)]
786 fn encode_is_copy() -> bool {
787 false
788 }
789
790 #[inline(always)]
791 fn decode_is_copy() -> bool {
792 false
793 }
794 }
795
796 impl fidl::encoding::ValueTypeMarker for Error {
797 type Borrowed<'a> = Self;
798 #[inline(always)]
799 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
800 *value
801 }
802 }
803
804 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for Error {
805 #[inline]
806 unsafe fn encode(
807 self,
808 encoder: &mut fidl::encoding::Encoder<'_, D>,
809 offset: usize,
810 _depth: fidl::encoding::Depth,
811 ) -> fidl::Result<()> {
812 encoder.debug_check_bounds::<Self>(offset);
813 encoder.write_num(self.into_primitive(), offset);
814 Ok(())
815 }
816 }
817
818 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Error {
819 #[inline(always)]
820 fn new_empty() -> Self {
821 Self::unknown()
822 }
823
824 #[inline]
825 unsafe fn decode(
826 &mut self,
827 decoder: &mut fidl::encoding::Decoder<'_, D>,
828 offset: usize,
829 _depth: fidl::encoding::Depth,
830 ) -> fidl::Result<()> {
831 decoder.debug_check_bounds::<Self>(offset);
832 let prim = decoder.read_num::<u32>(offset);
833
834 *self = Self::from_primitive_allow_unknown(prim);
835 Ok(())
836 }
837 }
838
839 impl fidl::encoding::ValueTypeMarker for ControlGetDefaultConfigurationRequest {
840 type Borrowed<'a> = &'a Self;
841 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
842 value
843 }
844 }
845
846 unsafe impl fidl::encoding::TypeMarker for ControlGetDefaultConfigurationRequest {
847 type Owned = Self;
848
849 #[inline(always)]
850 fn inline_align(_context: fidl::encoding::Context) -> usize {
851 8
852 }
853
854 #[inline(always)]
855 fn inline_size(_context: fidl::encoding::Context) -> usize {
856 24
857 }
858 }
859
860 unsafe impl<D: fidl::encoding::ResourceDialect>
861 fidl::encoding::Encode<ControlGetDefaultConfigurationRequest, D>
862 for &ControlGetDefaultConfigurationRequest
863 {
864 #[inline]
865 unsafe fn encode(
866 self,
867 encoder: &mut fidl::encoding::Encoder<'_, D>,
868 offset: usize,
869 _depth: fidl::encoding::Depth,
870 ) -> fidl::Result<()> {
871 encoder.debug_check_bounds::<ControlGetDefaultConfigurationRequest>(offset);
872 fidl::encoding::Encode::<ControlGetDefaultConfigurationRequest, D>::encode(
874 (
875 <DeviceType as fidl::encoding::ValueTypeMarker>::borrow(&self.type_),
876 <Direction as fidl::encoding::ValueTypeMarker>::borrow(&self.direction),
877 ),
878 encoder,
879 offset,
880 _depth,
881 )
882 }
883 }
884 unsafe impl<
885 D: fidl::encoding::ResourceDialect,
886 T0: fidl::encoding::Encode<DeviceType, D>,
887 T1: fidl::encoding::Encode<Direction, D>,
888 > fidl::encoding::Encode<ControlGetDefaultConfigurationRequest, D> for (T0, T1)
889 {
890 #[inline]
891 unsafe fn encode(
892 self,
893 encoder: &mut fidl::encoding::Encoder<'_, D>,
894 offset: usize,
895 depth: fidl::encoding::Depth,
896 ) -> fidl::Result<()> {
897 encoder.debug_check_bounds::<ControlGetDefaultConfigurationRequest>(offset);
898 unsafe {
901 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
902 (ptr as *mut u64).write_unaligned(0);
903 }
904 self.0.encode(encoder, offset + 0, depth)?;
906 self.1.encode(encoder, offset + 8, depth)?;
907 Ok(())
908 }
909 }
910
911 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
912 for ControlGetDefaultConfigurationRequest
913 {
914 #[inline(always)]
915 fn new_empty() -> Self {
916 Self {
917 type_: fidl::new_empty!(DeviceType, D),
918 direction: fidl::new_empty!(Direction, D),
919 }
920 }
921
922 #[inline]
923 unsafe fn decode(
924 &mut self,
925 decoder: &mut fidl::encoding::Decoder<'_, D>,
926 offset: usize,
927 _depth: fidl::encoding::Depth,
928 ) -> fidl::Result<()> {
929 decoder.debug_check_bounds::<Self>(offset);
930 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
932 let padval = unsafe { (ptr as *const u64).read_unaligned() };
933 let mask = 0xffffffff00000000u64;
934 let maskedval = padval & mask;
935 if maskedval != 0 {
936 return Err(fidl::Error::NonZeroPadding {
937 padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
938 });
939 }
940 fidl::decode!(DeviceType, D, &mut self.type_, decoder, offset + 0, _depth)?;
941 fidl::decode!(Direction, D, &mut self.direction, decoder, offset + 8, _depth)?;
942 Ok(())
943 }
944 }
945
946 impl fidl::encoding::ValueTypeMarker for ControlGetNumDevicesResponse {
947 type Borrowed<'a> = &'a Self;
948 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
949 value
950 }
951 }
952
953 unsafe impl fidl::encoding::TypeMarker for ControlGetNumDevicesResponse {
954 type Owned = Self;
955
956 #[inline(always)]
957 fn inline_align(_context: fidl::encoding::Context) -> usize {
958 4
959 }
960
961 #[inline(always)]
962 fn inline_size(_context: fidl::encoding::Context) -> usize {
963 12
964 }
965 #[inline(always)]
966 fn encode_is_copy() -> bool {
967 true
968 }
969
970 #[inline(always)]
971 fn decode_is_copy() -> bool {
972 true
973 }
974 }
975
976 unsafe impl<D: fidl::encoding::ResourceDialect>
977 fidl::encoding::Encode<ControlGetNumDevicesResponse, D> for &ControlGetNumDevicesResponse
978 {
979 #[inline]
980 unsafe fn encode(
981 self,
982 encoder: &mut fidl::encoding::Encoder<'_, D>,
983 offset: usize,
984 _depth: fidl::encoding::Depth,
985 ) -> fidl::Result<()> {
986 encoder.debug_check_bounds::<ControlGetNumDevicesResponse>(offset);
987 unsafe {
988 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
990 (buf_ptr as *mut ControlGetNumDevicesResponse)
991 .write_unaligned((self as *const ControlGetNumDevicesResponse).read());
992 }
995 Ok(())
996 }
997 }
998 unsafe impl<
999 D: fidl::encoding::ResourceDialect,
1000 T0: fidl::encoding::Encode<u32, D>,
1001 T1: fidl::encoding::Encode<u32, D>,
1002 T2: fidl::encoding::Encode<u32, D>,
1003 > fidl::encoding::Encode<ControlGetNumDevicesResponse, D> for (T0, T1, T2)
1004 {
1005 #[inline]
1006 unsafe fn encode(
1007 self,
1008 encoder: &mut fidl::encoding::Encoder<'_, D>,
1009 offset: usize,
1010 depth: fidl::encoding::Depth,
1011 ) -> fidl::Result<()> {
1012 encoder.debug_check_bounds::<ControlGetNumDevicesResponse>(offset);
1013 self.0.encode(encoder, offset + 0, depth)?;
1017 self.1.encode(encoder, offset + 4, depth)?;
1018 self.2.encode(encoder, offset + 8, depth)?;
1019 Ok(())
1020 }
1021 }
1022
1023 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1024 for ControlGetNumDevicesResponse
1025 {
1026 #[inline(always)]
1027 fn new_empty() -> Self {
1028 Self {
1029 num_input_devices: fidl::new_empty!(u32, D),
1030 num_output_devices: fidl::new_empty!(u32, D),
1031 num_unspecified_direction_devices: fidl::new_empty!(u32, D),
1032 }
1033 }
1034
1035 #[inline]
1036 unsafe fn decode(
1037 &mut self,
1038 decoder: &mut fidl::encoding::Decoder<'_, D>,
1039 offset: usize,
1040 _depth: fidl::encoding::Depth,
1041 ) -> fidl::Result<()> {
1042 decoder.debug_check_bounds::<Self>(offset);
1043 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
1044 unsafe {
1047 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 12);
1048 }
1049 Ok(())
1050 }
1051 }
1052
1053 impl fidl::encoding::ValueTypeMarker for ControlGetDefaultConfigurationResponse {
1054 type Borrowed<'a> = &'a Self;
1055 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1056 value
1057 }
1058 }
1059
1060 unsafe impl fidl::encoding::TypeMarker for ControlGetDefaultConfigurationResponse {
1061 type Owned = Self;
1062
1063 #[inline(always)]
1064 fn inline_align(_context: fidl::encoding::Context) -> usize {
1065 8
1066 }
1067
1068 #[inline(always)]
1069 fn inline_size(_context: fidl::encoding::Context) -> usize {
1070 16
1071 }
1072 }
1073
1074 unsafe impl<D: fidl::encoding::ResourceDialect>
1075 fidl::encoding::Encode<ControlGetDefaultConfigurationResponse, D>
1076 for &ControlGetDefaultConfigurationResponse
1077 {
1078 #[inline]
1079 unsafe fn encode(
1080 self,
1081 encoder: &mut fidl::encoding::Encoder<'_, D>,
1082 offset: usize,
1083 _depth: fidl::encoding::Depth,
1084 ) -> fidl::Result<()> {
1085 encoder.debug_check_bounds::<ControlGetDefaultConfigurationResponse>(offset);
1086 fidl::encoding::Encode::<ControlGetDefaultConfigurationResponse, D>::encode(
1088 (<Configuration as fidl::encoding::ValueTypeMarker>::borrow(&self.config),),
1089 encoder,
1090 offset,
1091 _depth,
1092 )
1093 }
1094 }
1095 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<Configuration, D>>
1096 fidl::encoding::Encode<ControlGetDefaultConfigurationResponse, D> for (T0,)
1097 {
1098 #[inline]
1099 unsafe fn encode(
1100 self,
1101 encoder: &mut fidl::encoding::Encoder<'_, D>,
1102 offset: usize,
1103 depth: fidl::encoding::Depth,
1104 ) -> fidl::Result<()> {
1105 encoder.debug_check_bounds::<ControlGetDefaultConfigurationResponse>(offset);
1106 self.0.encode(encoder, offset + 0, depth)?;
1110 Ok(())
1111 }
1112 }
1113
1114 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1115 for ControlGetDefaultConfigurationResponse
1116 {
1117 #[inline(always)]
1118 fn new_empty() -> Self {
1119 Self { config: fidl::new_empty!(Configuration, D) }
1120 }
1121
1122 #[inline]
1123 unsafe fn decode(
1124 &mut self,
1125 decoder: &mut fidl::encoding::Decoder<'_, D>,
1126 offset: usize,
1127 _depth: fidl::encoding::Depth,
1128 ) -> fidl::Result<()> {
1129 decoder.debug_check_bounds::<Self>(offset);
1130 fidl::decode!(Configuration, D, &mut self.config, decoder, offset + 0, _depth)?;
1132 Ok(())
1133 }
1134 }
1135
1136 impl fidl::encoding::ValueTypeMarker for DeviceAdjustClockRateRequest {
1137 type Borrowed<'a> = &'a Self;
1138 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1139 value
1140 }
1141 }
1142
1143 unsafe impl fidl::encoding::TypeMarker for DeviceAdjustClockRateRequest {
1144 type Owned = Self;
1145
1146 #[inline(always)]
1147 fn inline_align(_context: fidl::encoding::Context) -> usize {
1148 4
1149 }
1150
1151 #[inline(always)]
1152 fn inline_size(_context: fidl::encoding::Context) -> usize {
1153 4
1154 }
1155 #[inline(always)]
1156 fn encode_is_copy() -> bool {
1157 true
1158 }
1159
1160 #[inline(always)]
1161 fn decode_is_copy() -> bool {
1162 true
1163 }
1164 }
1165
1166 unsafe impl<D: fidl::encoding::ResourceDialect>
1167 fidl::encoding::Encode<DeviceAdjustClockRateRequest, D> for &DeviceAdjustClockRateRequest
1168 {
1169 #[inline]
1170 unsafe fn encode(
1171 self,
1172 encoder: &mut fidl::encoding::Encoder<'_, D>,
1173 offset: usize,
1174 _depth: fidl::encoding::Depth,
1175 ) -> fidl::Result<()> {
1176 encoder.debug_check_bounds::<DeviceAdjustClockRateRequest>(offset);
1177 unsafe {
1178 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
1180 (buf_ptr as *mut DeviceAdjustClockRateRequest)
1181 .write_unaligned((self as *const DeviceAdjustClockRateRequest).read());
1182 }
1185 Ok(())
1186 }
1187 }
1188 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<i32, D>>
1189 fidl::encoding::Encode<DeviceAdjustClockRateRequest, D> for (T0,)
1190 {
1191 #[inline]
1192 unsafe fn encode(
1193 self,
1194 encoder: &mut fidl::encoding::Encoder<'_, D>,
1195 offset: usize,
1196 depth: fidl::encoding::Depth,
1197 ) -> fidl::Result<()> {
1198 encoder.debug_check_bounds::<DeviceAdjustClockRateRequest>(offset);
1199 self.0.encode(encoder, offset + 0, depth)?;
1203 Ok(())
1204 }
1205 }
1206
1207 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1208 for DeviceAdjustClockRateRequest
1209 {
1210 #[inline(always)]
1211 fn new_empty() -> Self {
1212 Self { ppm_from_monotonic: fidl::new_empty!(i32, D) }
1213 }
1214
1215 #[inline]
1216 unsafe fn decode(
1217 &mut self,
1218 decoder: &mut fidl::encoding::Decoder<'_, D>,
1219 offset: usize,
1220 _depth: fidl::encoding::Depth,
1221 ) -> fidl::Result<()> {
1222 decoder.debug_check_bounds::<Self>(offset);
1223 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
1224 unsafe {
1227 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
1228 }
1229 Ok(())
1230 }
1231 }
1232
1233 impl fidl::encoding::ValueTypeMarker for DeviceChangePlugStateRequest {
1234 type Borrowed<'a> = &'a Self;
1235 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1236 value
1237 }
1238 }
1239
1240 unsafe impl fidl::encoding::TypeMarker for DeviceChangePlugStateRequest {
1241 type Owned = Self;
1242
1243 #[inline(always)]
1244 fn inline_align(_context: fidl::encoding::Context) -> usize {
1245 8
1246 }
1247
1248 #[inline(always)]
1249 fn inline_size(_context: fidl::encoding::Context) -> usize {
1250 16
1251 }
1252 }
1253
1254 unsafe impl<D: fidl::encoding::ResourceDialect>
1255 fidl::encoding::Encode<DeviceChangePlugStateRequest, D> for &DeviceChangePlugStateRequest
1256 {
1257 #[inline]
1258 unsafe fn encode(
1259 self,
1260 encoder: &mut fidl::encoding::Encoder<'_, D>,
1261 offset: usize,
1262 _depth: fidl::encoding::Depth,
1263 ) -> fidl::Result<()> {
1264 encoder.debug_check_bounds::<DeviceChangePlugStateRequest>(offset);
1265 fidl::encoding::Encode::<DeviceChangePlugStateRequest, D>::encode(
1267 (
1268 <i64 as fidl::encoding::ValueTypeMarker>::borrow(&self.plug_change_time),
1269 <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.plugged),
1270 ),
1271 encoder,
1272 offset,
1273 _depth,
1274 )
1275 }
1276 }
1277 unsafe impl<
1278 D: fidl::encoding::ResourceDialect,
1279 T0: fidl::encoding::Encode<i64, D>,
1280 T1: fidl::encoding::Encode<bool, D>,
1281 > fidl::encoding::Encode<DeviceChangePlugStateRequest, D> for (T0, T1)
1282 {
1283 #[inline]
1284 unsafe fn encode(
1285 self,
1286 encoder: &mut fidl::encoding::Encoder<'_, D>,
1287 offset: usize,
1288 depth: fidl::encoding::Depth,
1289 ) -> fidl::Result<()> {
1290 encoder.debug_check_bounds::<DeviceChangePlugStateRequest>(offset);
1291 unsafe {
1294 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
1295 (ptr as *mut u64).write_unaligned(0);
1296 }
1297 self.0.encode(encoder, offset + 0, depth)?;
1299 self.1.encode(encoder, offset + 8, depth)?;
1300 Ok(())
1301 }
1302 }
1303
1304 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1305 for DeviceChangePlugStateRequest
1306 {
1307 #[inline(always)]
1308 fn new_empty() -> Self {
1309 Self { plug_change_time: fidl::new_empty!(i64, D), plugged: fidl::new_empty!(bool, D) }
1310 }
1311
1312 #[inline]
1313 unsafe fn decode(
1314 &mut self,
1315 decoder: &mut fidl::encoding::Decoder<'_, D>,
1316 offset: usize,
1317 _depth: fidl::encoding::Depth,
1318 ) -> fidl::Result<()> {
1319 decoder.debug_check_bounds::<Self>(offset);
1320 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(8) };
1322 let padval = unsafe { (ptr as *const u64).read_unaligned() };
1323 let mask = 0xffffffffffffff00u64;
1324 let maskedval = padval & mask;
1325 if maskedval != 0 {
1326 return Err(fidl::Error::NonZeroPadding {
1327 padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
1328 });
1329 }
1330 fidl::decode!(i64, D, &mut self.plug_change_time, decoder, offset + 0, _depth)?;
1331 fidl::decode!(bool, D, &mut self.plugged, decoder, offset + 8, _depth)?;
1332 Ok(())
1333 }
1334 }
1335
1336 impl fidl::encoding::ValueTypeMarker for DeviceOnPositionNotifyRequest {
1337 type Borrowed<'a> = &'a Self;
1338 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1339 value
1340 }
1341 }
1342
1343 unsafe impl fidl::encoding::TypeMarker for DeviceOnPositionNotifyRequest {
1344 type Owned = Self;
1345
1346 #[inline(always)]
1347 fn inline_align(_context: fidl::encoding::Context) -> usize {
1348 8
1349 }
1350
1351 #[inline(always)]
1352 fn inline_size(_context: fidl::encoding::Context) -> usize {
1353 16
1354 }
1355 }
1356
1357 unsafe impl<D: fidl::encoding::ResourceDialect>
1358 fidl::encoding::Encode<DeviceOnPositionNotifyRequest, D>
1359 for &DeviceOnPositionNotifyRequest
1360 {
1361 #[inline]
1362 unsafe fn encode(
1363 self,
1364 encoder: &mut fidl::encoding::Encoder<'_, D>,
1365 offset: usize,
1366 _depth: fidl::encoding::Depth,
1367 ) -> fidl::Result<()> {
1368 encoder.debug_check_bounds::<DeviceOnPositionNotifyRequest>(offset);
1369 unsafe {
1370 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
1372 (buf_ptr as *mut DeviceOnPositionNotifyRequest)
1373 .write_unaligned((self as *const DeviceOnPositionNotifyRequest).read());
1374 let padding_ptr = buf_ptr.offset(8) as *mut u64;
1377 let padding_mask = 0xffffffff00000000u64;
1378 padding_ptr.write_unaligned(padding_ptr.read_unaligned() & !padding_mask);
1379 }
1380 Ok(())
1381 }
1382 }
1383 unsafe impl<
1384 D: fidl::encoding::ResourceDialect,
1385 T0: fidl::encoding::Encode<i64, D>,
1386 T1: fidl::encoding::Encode<u32, D>,
1387 > fidl::encoding::Encode<DeviceOnPositionNotifyRequest, D> for (T0, T1)
1388 {
1389 #[inline]
1390 unsafe fn encode(
1391 self,
1392 encoder: &mut fidl::encoding::Encoder<'_, D>,
1393 offset: usize,
1394 depth: fidl::encoding::Depth,
1395 ) -> fidl::Result<()> {
1396 encoder.debug_check_bounds::<DeviceOnPositionNotifyRequest>(offset);
1397 unsafe {
1400 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
1401 (ptr as *mut u64).write_unaligned(0);
1402 }
1403 self.0.encode(encoder, offset + 0, depth)?;
1405 self.1.encode(encoder, offset + 8, depth)?;
1406 Ok(())
1407 }
1408 }
1409
1410 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1411 for DeviceOnPositionNotifyRequest
1412 {
1413 #[inline(always)]
1414 fn new_empty() -> Self {
1415 Self {
1416 monotonic_time: fidl::new_empty!(i64, D),
1417 ring_position: fidl::new_empty!(u32, D),
1418 }
1419 }
1420
1421 #[inline]
1422 unsafe fn decode(
1423 &mut self,
1424 decoder: &mut fidl::encoding::Decoder<'_, D>,
1425 offset: usize,
1426 _depth: fidl::encoding::Depth,
1427 ) -> fidl::Result<()> {
1428 decoder.debug_check_bounds::<Self>(offset);
1429 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
1430 let ptr = unsafe { buf_ptr.offset(8) };
1432 let padval = unsafe { (ptr as *const u64).read_unaligned() };
1433 let mask = 0xffffffff00000000u64;
1434 let maskedval = padval & mask;
1435 if maskedval != 0 {
1436 return Err(fidl::Error::NonZeroPadding {
1437 padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
1438 });
1439 }
1440 unsafe {
1442 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 16);
1443 }
1444 Ok(())
1445 }
1446 }
1447
1448 impl fidl::encoding::ValueTypeMarker for DeviceOnSetFormatRequest {
1449 type Borrowed<'a> = &'a Self;
1450 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1451 value
1452 }
1453 }
1454
1455 unsafe impl fidl::encoding::TypeMarker for DeviceOnSetFormatRequest {
1456 type Owned = Self;
1457
1458 #[inline(always)]
1459 fn inline_align(_context: fidl::encoding::Context) -> usize {
1460 8
1461 }
1462
1463 #[inline(always)]
1464 fn inline_size(_context: fidl::encoding::Context) -> usize {
1465 24
1466 }
1467 }
1468
1469 unsafe impl<D: fidl::encoding::ResourceDialect>
1470 fidl::encoding::Encode<DeviceOnSetFormatRequest, D> for &DeviceOnSetFormatRequest
1471 {
1472 #[inline]
1473 unsafe fn encode(
1474 self,
1475 encoder: &mut fidl::encoding::Encoder<'_, D>,
1476 offset: usize,
1477 _depth: fidl::encoding::Depth,
1478 ) -> fidl::Result<()> {
1479 encoder.debug_check_bounds::<DeviceOnSetFormatRequest>(offset);
1480 unsafe {
1481 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
1483 (buf_ptr as *mut DeviceOnSetFormatRequest)
1484 .write_unaligned((self as *const DeviceOnSetFormatRequest).read());
1485 let padding_ptr = buf_ptr.offset(8) as *mut u64;
1488 let padding_mask = 0xffffffff00000000u64;
1489 padding_ptr.write_unaligned(padding_ptr.read_unaligned() & !padding_mask);
1490 }
1491 Ok(())
1492 }
1493 }
1494 unsafe impl<
1495 D: fidl::encoding::ResourceDialect,
1496 T0: fidl::encoding::Encode<u32, D>,
1497 T1: fidl::encoding::Encode<u32, D>,
1498 T2: fidl::encoding::Encode<u32, D>,
1499 T3: fidl::encoding::Encode<i64, D>,
1500 > fidl::encoding::Encode<DeviceOnSetFormatRequest, D> for (T0, T1, T2, T3)
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::<DeviceOnSetFormatRequest>(offset);
1510 unsafe {
1513 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
1514 (ptr as *mut u64).write_unaligned(0);
1515 }
1516 self.0.encode(encoder, offset + 0, depth)?;
1518 self.1.encode(encoder, offset + 4, depth)?;
1519 self.2.encode(encoder, offset + 8, depth)?;
1520 self.3.encode(encoder, offset + 16, depth)?;
1521 Ok(())
1522 }
1523 }
1524
1525 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1526 for DeviceOnSetFormatRequest
1527 {
1528 #[inline(always)]
1529 fn new_empty() -> Self {
1530 Self {
1531 frames_per_second: fidl::new_empty!(u32, D),
1532 sample_format: fidl::new_empty!(u32, D),
1533 num_channels: fidl::new_empty!(u32, D),
1534 external_delay: fidl::new_empty!(i64, D),
1535 }
1536 }
1537
1538 #[inline]
1539 unsafe fn decode(
1540 &mut self,
1541 decoder: &mut fidl::encoding::Decoder<'_, D>,
1542 offset: usize,
1543 _depth: fidl::encoding::Depth,
1544 ) -> fidl::Result<()> {
1545 decoder.debug_check_bounds::<Self>(offset);
1546 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
1547 let ptr = unsafe { buf_ptr.offset(8) };
1549 let padval = unsafe { (ptr as *const u64).read_unaligned() };
1550 let mask = 0xffffffff00000000u64;
1551 let maskedval = padval & mask;
1552 if maskedval != 0 {
1553 return Err(fidl::Error::NonZeroPadding {
1554 padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
1555 });
1556 }
1557 unsafe {
1559 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 24);
1560 }
1561 Ok(())
1562 }
1563 }
1564
1565 impl fidl::encoding::ValueTypeMarker for DeviceOnSetGainRequest {
1566 type Borrowed<'a> = &'a Self;
1567 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1568 value
1569 }
1570 }
1571
1572 unsafe impl fidl::encoding::TypeMarker for DeviceOnSetGainRequest {
1573 type Owned = Self;
1574
1575 #[inline(always)]
1576 fn inline_align(_context: fidl::encoding::Context) -> usize {
1577 4
1578 }
1579
1580 #[inline(always)]
1581 fn inline_size(_context: fidl::encoding::Context) -> usize {
1582 8
1583 }
1584 }
1585
1586 unsafe impl<D: fidl::encoding::ResourceDialect>
1587 fidl::encoding::Encode<DeviceOnSetGainRequest, D> for &DeviceOnSetGainRequest
1588 {
1589 #[inline]
1590 unsafe fn encode(
1591 self,
1592 encoder: &mut fidl::encoding::Encoder<'_, D>,
1593 offset: usize,
1594 _depth: fidl::encoding::Depth,
1595 ) -> fidl::Result<()> {
1596 encoder.debug_check_bounds::<DeviceOnSetGainRequest>(offset);
1597 fidl::encoding::Encode::<DeviceOnSetGainRequest, D>::encode(
1599 (
1600 <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.current_mute),
1601 <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.current_agc),
1602 <f32 as fidl::encoding::ValueTypeMarker>::borrow(&self.current_gain_db),
1603 ),
1604 encoder,
1605 offset,
1606 _depth,
1607 )
1608 }
1609 }
1610 unsafe impl<
1611 D: fidl::encoding::ResourceDialect,
1612 T0: fidl::encoding::Encode<bool, D>,
1613 T1: fidl::encoding::Encode<bool, D>,
1614 T2: fidl::encoding::Encode<f32, D>,
1615 > fidl::encoding::Encode<DeviceOnSetGainRequest, D> for (T0, T1, T2)
1616 {
1617 #[inline]
1618 unsafe fn encode(
1619 self,
1620 encoder: &mut fidl::encoding::Encoder<'_, D>,
1621 offset: usize,
1622 depth: fidl::encoding::Depth,
1623 ) -> fidl::Result<()> {
1624 encoder.debug_check_bounds::<DeviceOnSetGainRequest>(offset);
1625 unsafe {
1628 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
1629 (ptr as *mut u32).write_unaligned(0);
1630 }
1631 self.0.encode(encoder, offset + 0, depth)?;
1633 self.1.encode(encoder, offset + 1, depth)?;
1634 self.2.encode(encoder, offset + 4, depth)?;
1635 Ok(())
1636 }
1637 }
1638
1639 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1640 for DeviceOnSetGainRequest
1641 {
1642 #[inline(always)]
1643 fn new_empty() -> Self {
1644 Self {
1645 current_mute: fidl::new_empty!(bool, D),
1646 current_agc: fidl::new_empty!(bool, D),
1647 current_gain_db: fidl::new_empty!(f32, D),
1648 }
1649 }
1650
1651 #[inline]
1652 unsafe fn decode(
1653 &mut self,
1654 decoder: &mut fidl::encoding::Decoder<'_, D>,
1655 offset: usize,
1656 _depth: fidl::encoding::Depth,
1657 ) -> fidl::Result<()> {
1658 decoder.debug_check_bounds::<Self>(offset);
1659 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
1661 let padval = unsafe { (ptr as *const u32).read_unaligned() };
1662 let mask = 0xffff0000u32;
1663 let maskedval = padval & mask;
1664 if maskedval != 0 {
1665 return Err(fidl::Error::NonZeroPadding {
1666 padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
1667 });
1668 }
1669 fidl::decode!(bool, D, &mut self.current_mute, decoder, offset + 0, _depth)?;
1670 fidl::decode!(bool, D, &mut self.current_agc, decoder, offset + 1, _depth)?;
1671 fidl::decode!(f32, D, &mut self.current_gain_db, decoder, offset + 4, _depth)?;
1672 Ok(())
1673 }
1674 }
1675
1676 impl fidl::encoding::ValueTypeMarker for DeviceOnStartRequest {
1677 type Borrowed<'a> = &'a Self;
1678 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1679 value
1680 }
1681 }
1682
1683 unsafe impl fidl::encoding::TypeMarker for DeviceOnStartRequest {
1684 type Owned = Self;
1685
1686 #[inline(always)]
1687 fn inline_align(_context: fidl::encoding::Context) -> usize {
1688 8
1689 }
1690
1691 #[inline(always)]
1692 fn inline_size(_context: fidl::encoding::Context) -> usize {
1693 8
1694 }
1695 #[inline(always)]
1696 fn encode_is_copy() -> bool {
1697 true
1698 }
1699
1700 #[inline(always)]
1701 fn decode_is_copy() -> bool {
1702 true
1703 }
1704 }
1705
1706 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<DeviceOnStartRequest, D>
1707 for &DeviceOnStartRequest
1708 {
1709 #[inline]
1710 unsafe fn encode(
1711 self,
1712 encoder: &mut fidl::encoding::Encoder<'_, D>,
1713 offset: usize,
1714 _depth: fidl::encoding::Depth,
1715 ) -> fidl::Result<()> {
1716 encoder.debug_check_bounds::<DeviceOnStartRequest>(offset);
1717 unsafe {
1718 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
1720 (buf_ptr as *mut DeviceOnStartRequest)
1721 .write_unaligned((self as *const DeviceOnStartRequest).read());
1722 }
1725 Ok(())
1726 }
1727 }
1728 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<i64, D>>
1729 fidl::encoding::Encode<DeviceOnStartRequest, D> for (T0,)
1730 {
1731 #[inline]
1732 unsafe fn encode(
1733 self,
1734 encoder: &mut fidl::encoding::Encoder<'_, D>,
1735 offset: usize,
1736 depth: fidl::encoding::Depth,
1737 ) -> fidl::Result<()> {
1738 encoder.debug_check_bounds::<DeviceOnStartRequest>(offset);
1739 self.0.encode(encoder, offset + 0, depth)?;
1743 Ok(())
1744 }
1745 }
1746
1747 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for DeviceOnStartRequest {
1748 #[inline(always)]
1749 fn new_empty() -> Self {
1750 Self { start_time: fidl::new_empty!(i64, D) }
1751 }
1752
1753 #[inline]
1754 unsafe fn decode(
1755 &mut self,
1756 decoder: &mut fidl::encoding::Decoder<'_, D>,
1757 offset: usize,
1758 _depth: fidl::encoding::Depth,
1759 ) -> fidl::Result<()> {
1760 decoder.debug_check_bounds::<Self>(offset);
1761 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
1762 unsafe {
1765 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 8);
1766 }
1767 Ok(())
1768 }
1769 }
1770
1771 impl fidl::encoding::ValueTypeMarker for DeviceOnStopRequest {
1772 type Borrowed<'a> = &'a Self;
1773 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1774 value
1775 }
1776 }
1777
1778 unsafe impl fidl::encoding::TypeMarker for DeviceOnStopRequest {
1779 type Owned = Self;
1780
1781 #[inline(always)]
1782 fn inline_align(_context: fidl::encoding::Context) -> usize {
1783 8
1784 }
1785
1786 #[inline(always)]
1787 fn inline_size(_context: fidl::encoding::Context) -> usize {
1788 16
1789 }
1790 }
1791
1792 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<DeviceOnStopRequest, D>
1793 for &DeviceOnStopRequest
1794 {
1795 #[inline]
1796 unsafe fn encode(
1797 self,
1798 encoder: &mut fidl::encoding::Encoder<'_, D>,
1799 offset: usize,
1800 _depth: fidl::encoding::Depth,
1801 ) -> fidl::Result<()> {
1802 encoder.debug_check_bounds::<DeviceOnStopRequest>(offset);
1803 unsafe {
1804 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
1806 (buf_ptr as *mut DeviceOnStopRequest)
1807 .write_unaligned((self as *const DeviceOnStopRequest).read());
1808 let padding_ptr = buf_ptr.offset(8) as *mut u64;
1811 let padding_mask = 0xffffffff00000000u64;
1812 padding_ptr.write_unaligned(padding_ptr.read_unaligned() & !padding_mask);
1813 }
1814 Ok(())
1815 }
1816 }
1817 unsafe impl<
1818 D: fidl::encoding::ResourceDialect,
1819 T0: fidl::encoding::Encode<i64, D>,
1820 T1: fidl::encoding::Encode<u32, D>,
1821 > fidl::encoding::Encode<DeviceOnStopRequest, D> for (T0, T1)
1822 {
1823 #[inline]
1824 unsafe fn encode(
1825 self,
1826 encoder: &mut fidl::encoding::Encoder<'_, D>,
1827 offset: usize,
1828 depth: fidl::encoding::Depth,
1829 ) -> fidl::Result<()> {
1830 encoder.debug_check_bounds::<DeviceOnStopRequest>(offset);
1831 unsafe {
1834 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
1835 (ptr as *mut u64).write_unaligned(0);
1836 }
1837 self.0.encode(encoder, offset + 0, depth)?;
1839 self.1.encode(encoder, offset + 8, depth)?;
1840 Ok(())
1841 }
1842 }
1843
1844 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for DeviceOnStopRequest {
1845 #[inline(always)]
1846 fn new_empty() -> Self {
1847 Self { stop_time: fidl::new_empty!(i64, D), ring_position: fidl::new_empty!(u32, D) }
1848 }
1849
1850 #[inline]
1851 unsafe fn decode(
1852 &mut self,
1853 decoder: &mut fidl::encoding::Decoder<'_, D>,
1854 offset: usize,
1855 _depth: fidl::encoding::Depth,
1856 ) -> fidl::Result<()> {
1857 decoder.debug_check_bounds::<Self>(offset);
1858 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
1859 let ptr = unsafe { buf_ptr.offset(8) };
1861 let padval = unsafe { (ptr as *const u64).read_unaligned() };
1862 let mask = 0xffffffff00000000u64;
1863 let maskedval = padval & mask;
1864 if maskedval != 0 {
1865 return Err(fidl::Error::NonZeroPadding {
1866 padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
1867 });
1868 }
1869 unsafe {
1871 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 16);
1872 }
1873 Ok(())
1874 }
1875 }
1876
1877 impl fidl::encoding::ValueTypeMarker for DeviceSetNotificationFrequencyRequest {
1878 type Borrowed<'a> = &'a Self;
1879 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1880 value
1881 }
1882 }
1883
1884 unsafe impl fidl::encoding::TypeMarker for DeviceSetNotificationFrequencyRequest {
1885 type Owned = Self;
1886
1887 #[inline(always)]
1888 fn inline_align(_context: fidl::encoding::Context) -> usize {
1889 4
1890 }
1891
1892 #[inline(always)]
1893 fn inline_size(_context: fidl::encoding::Context) -> usize {
1894 4
1895 }
1896 #[inline(always)]
1897 fn encode_is_copy() -> bool {
1898 true
1899 }
1900
1901 #[inline(always)]
1902 fn decode_is_copy() -> bool {
1903 true
1904 }
1905 }
1906
1907 unsafe impl<D: fidl::encoding::ResourceDialect>
1908 fidl::encoding::Encode<DeviceSetNotificationFrequencyRequest, D>
1909 for &DeviceSetNotificationFrequencyRequest
1910 {
1911 #[inline]
1912 unsafe fn encode(
1913 self,
1914 encoder: &mut fidl::encoding::Encoder<'_, D>,
1915 offset: usize,
1916 _depth: fidl::encoding::Depth,
1917 ) -> fidl::Result<()> {
1918 encoder.debug_check_bounds::<DeviceSetNotificationFrequencyRequest>(offset);
1919 unsafe {
1920 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
1922 (buf_ptr as *mut DeviceSetNotificationFrequencyRequest)
1923 .write_unaligned((self as *const DeviceSetNotificationFrequencyRequest).read());
1924 }
1927 Ok(())
1928 }
1929 }
1930 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u32, D>>
1931 fidl::encoding::Encode<DeviceSetNotificationFrequencyRequest, D> for (T0,)
1932 {
1933 #[inline]
1934 unsafe fn encode(
1935 self,
1936 encoder: &mut fidl::encoding::Encoder<'_, D>,
1937 offset: usize,
1938 depth: fidl::encoding::Depth,
1939 ) -> fidl::Result<()> {
1940 encoder.debug_check_bounds::<DeviceSetNotificationFrequencyRequest>(offset);
1941 self.0.encode(encoder, offset + 0, depth)?;
1945 Ok(())
1946 }
1947 }
1948
1949 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1950 for DeviceSetNotificationFrequencyRequest
1951 {
1952 #[inline(always)]
1953 fn new_empty() -> Self {
1954 Self { notifications_per_ring: fidl::new_empty!(u32, D) }
1955 }
1956
1957 #[inline]
1958 unsafe fn decode(
1959 &mut self,
1960 decoder: &mut fidl::encoding::Decoder<'_, D>,
1961 offset: usize,
1962 _depth: fidl::encoding::Depth,
1963 ) -> fidl::Result<()> {
1964 decoder.debug_check_bounds::<Self>(offset);
1965 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
1966 unsafe {
1969 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
1970 }
1971 Ok(())
1972 }
1973 }
1974
1975 impl fidl::encoding::ValueTypeMarker for DeviceGetFormatResponse {
1976 type Borrowed<'a> = &'a Self;
1977 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1978 value
1979 }
1980 }
1981
1982 unsafe impl fidl::encoding::TypeMarker for DeviceGetFormatResponse {
1983 type Owned = Self;
1984
1985 #[inline(always)]
1986 fn inline_align(_context: fidl::encoding::Context) -> usize {
1987 8
1988 }
1989
1990 #[inline(always)]
1991 fn inline_size(_context: fidl::encoding::Context) -> usize {
1992 24
1993 }
1994 }
1995
1996 unsafe impl<D: fidl::encoding::ResourceDialect>
1997 fidl::encoding::Encode<DeviceGetFormatResponse, D> for &DeviceGetFormatResponse
1998 {
1999 #[inline]
2000 unsafe fn encode(
2001 self,
2002 encoder: &mut fidl::encoding::Encoder<'_, D>,
2003 offset: usize,
2004 _depth: fidl::encoding::Depth,
2005 ) -> fidl::Result<()> {
2006 encoder.debug_check_bounds::<DeviceGetFormatResponse>(offset);
2007 unsafe {
2008 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
2010 (buf_ptr as *mut DeviceGetFormatResponse)
2011 .write_unaligned((self as *const DeviceGetFormatResponse).read());
2012 let padding_ptr = buf_ptr.offset(8) as *mut u64;
2015 let padding_mask = 0xffffffff00000000u64;
2016 padding_ptr.write_unaligned(padding_ptr.read_unaligned() & !padding_mask);
2017 }
2018 Ok(())
2019 }
2020 }
2021 unsafe impl<
2022 D: fidl::encoding::ResourceDialect,
2023 T0: fidl::encoding::Encode<u32, D>,
2024 T1: fidl::encoding::Encode<u32, D>,
2025 T2: fidl::encoding::Encode<u32, D>,
2026 T3: fidl::encoding::Encode<i64, D>,
2027 > fidl::encoding::Encode<DeviceGetFormatResponse, D> for (T0, T1, T2, T3)
2028 {
2029 #[inline]
2030 unsafe fn encode(
2031 self,
2032 encoder: &mut fidl::encoding::Encoder<'_, D>,
2033 offset: usize,
2034 depth: fidl::encoding::Depth,
2035 ) -> fidl::Result<()> {
2036 encoder.debug_check_bounds::<DeviceGetFormatResponse>(offset);
2037 unsafe {
2040 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
2041 (ptr as *mut u64).write_unaligned(0);
2042 }
2043 self.0.encode(encoder, offset + 0, depth)?;
2045 self.1.encode(encoder, offset + 4, depth)?;
2046 self.2.encode(encoder, offset + 8, depth)?;
2047 self.3.encode(encoder, offset + 16, depth)?;
2048 Ok(())
2049 }
2050 }
2051
2052 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2053 for DeviceGetFormatResponse
2054 {
2055 #[inline(always)]
2056 fn new_empty() -> Self {
2057 Self {
2058 frames_per_second: fidl::new_empty!(u32, D),
2059 sample_format: fidl::new_empty!(u32, D),
2060 num_channels: fidl::new_empty!(u32, D),
2061 external_delay: fidl::new_empty!(i64, D),
2062 }
2063 }
2064
2065 #[inline]
2066 unsafe fn decode(
2067 &mut self,
2068 decoder: &mut fidl::encoding::Decoder<'_, D>,
2069 offset: usize,
2070 _depth: fidl::encoding::Depth,
2071 ) -> fidl::Result<()> {
2072 decoder.debug_check_bounds::<Self>(offset);
2073 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
2074 let ptr = unsafe { buf_ptr.offset(8) };
2076 let padval = unsafe { (ptr as *const u64).read_unaligned() };
2077 let mask = 0xffffffff00000000u64;
2078 let maskedval = padval & mask;
2079 if maskedval != 0 {
2080 return Err(fidl::Error::NonZeroPadding {
2081 padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
2082 });
2083 }
2084 unsafe {
2086 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 24);
2087 }
2088 Ok(())
2089 }
2090 }
2091
2092 impl fidl::encoding::ValueTypeMarker for DeviceGetGainResponse {
2093 type Borrowed<'a> = &'a Self;
2094 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2095 value
2096 }
2097 }
2098
2099 unsafe impl fidl::encoding::TypeMarker for DeviceGetGainResponse {
2100 type Owned = Self;
2101
2102 #[inline(always)]
2103 fn inline_align(_context: fidl::encoding::Context) -> usize {
2104 4
2105 }
2106
2107 #[inline(always)]
2108 fn inline_size(_context: fidl::encoding::Context) -> usize {
2109 8
2110 }
2111 }
2112
2113 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<DeviceGetGainResponse, D>
2114 for &DeviceGetGainResponse
2115 {
2116 #[inline]
2117 unsafe fn encode(
2118 self,
2119 encoder: &mut fidl::encoding::Encoder<'_, D>,
2120 offset: usize,
2121 _depth: fidl::encoding::Depth,
2122 ) -> fidl::Result<()> {
2123 encoder.debug_check_bounds::<DeviceGetGainResponse>(offset);
2124 fidl::encoding::Encode::<DeviceGetGainResponse, D>::encode(
2126 (
2127 <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.current_mute),
2128 <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.current_agc),
2129 <f32 as fidl::encoding::ValueTypeMarker>::borrow(&self.current_gain_db),
2130 ),
2131 encoder,
2132 offset,
2133 _depth,
2134 )
2135 }
2136 }
2137 unsafe impl<
2138 D: fidl::encoding::ResourceDialect,
2139 T0: fidl::encoding::Encode<bool, D>,
2140 T1: fidl::encoding::Encode<bool, D>,
2141 T2: fidl::encoding::Encode<f32, D>,
2142 > fidl::encoding::Encode<DeviceGetGainResponse, D> for (T0, T1, T2)
2143 {
2144 #[inline]
2145 unsafe fn encode(
2146 self,
2147 encoder: &mut fidl::encoding::Encoder<'_, D>,
2148 offset: usize,
2149 depth: fidl::encoding::Depth,
2150 ) -> fidl::Result<()> {
2151 encoder.debug_check_bounds::<DeviceGetGainResponse>(offset);
2152 unsafe {
2155 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
2156 (ptr as *mut u32).write_unaligned(0);
2157 }
2158 self.0.encode(encoder, offset + 0, depth)?;
2160 self.1.encode(encoder, offset + 1, depth)?;
2161 self.2.encode(encoder, offset + 4, depth)?;
2162 Ok(())
2163 }
2164 }
2165
2166 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for DeviceGetGainResponse {
2167 #[inline(always)]
2168 fn new_empty() -> Self {
2169 Self {
2170 current_mute: fidl::new_empty!(bool, D),
2171 current_agc: fidl::new_empty!(bool, D),
2172 current_gain_db: fidl::new_empty!(f32, D),
2173 }
2174 }
2175
2176 #[inline]
2177 unsafe fn decode(
2178 &mut self,
2179 decoder: &mut fidl::encoding::Decoder<'_, D>,
2180 offset: usize,
2181 _depth: fidl::encoding::Depth,
2182 ) -> fidl::Result<()> {
2183 decoder.debug_check_bounds::<Self>(offset);
2184 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
2186 let padval = unsafe { (ptr as *const u32).read_unaligned() };
2187 let mask = 0xffff0000u32;
2188 let maskedval = padval & mask;
2189 if maskedval != 0 {
2190 return Err(fidl::Error::NonZeroPadding {
2191 padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
2192 });
2193 }
2194 fidl::decode!(bool, D, &mut self.current_mute, decoder, offset + 0, _depth)?;
2195 fidl::decode!(bool, D, &mut self.current_agc, decoder, offset + 1, _depth)?;
2196 fidl::decode!(f32, D, &mut self.current_gain_db, decoder, offset + 4, _depth)?;
2197 Ok(())
2198 }
2199 }
2200
2201 impl fidl::encoding::ValueTypeMarker for DeviceGetPositionResponse {
2202 type Borrowed<'a> = &'a Self;
2203 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2204 value
2205 }
2206 }
2207
2208 unsafe impl fidl::encoding::TypeMarker for DeviceGetPositionResponse {
2209 type Owned = Self;
2210
2211 #[inline(always)]
2212 fn inline_align(_context: fidl::encoding::Context) -> usize {
2213 8
2214 }
2215
2216 #[inline(always)]
2217 fn inline_size(_context: fidl::encoding::Context) -> usize {
2218 16
2219 }
2220 }
2221
2222 unsafe impl<D: fidl::encoding::ResourceDialect>
2223 fidl::encoding::Encode<DeviceGetPositionResponse, D> for &DeviceGetPositionResponse
2224 {
2225 #[inline]
2226 unsafe fn encode(
2227 self,
2228 encoder: &mut fidl::encoding::Encoder<'_, D>,
2229 offset: usize,
2230 _depth: fidl::encoding::Depth,
2231 ) -> fidl::Result<()> {
2232 encoder.debug_check_bounds::<DeviceGetPositionResponse>(offset);
2233 unsafe {
2234 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
2236 (buf_ptr as *mut DeviceGetPositionResponse)
2237 .write_unaligned((self as *const DeviceGetPositionResponse).read());
2238 let padding_ptr = buf_ptr.offset(8) as *mut u64;
2241 let padding_mask = 0xffffffff00000000u64;
2242 padding_ptr.write_unaligned(padding_ptr.read_unaligned() & !padding_mask);
2243 }
2244 Ok(())
2245 }
2246 }
2247 unsafe impl<
2248 D: fidl::encoding::ResourceDialect,
2249 T0: fidl::encoding::Encode<i64, D>,
2250 T1: fidl::encoding::Encode<u32, D>,
2251 > fidl::encoding::Encode<DeviceGetPositionResponse, D> for (T0, T1)
2252 {
2253 #[inline]
2254 unsafe fn encode(
2255 self,
2256 encoder: &mut fidl::encoding::Encoder<'_, D>,
2257 offset: usize,
2258 depth: fidl::encoding::Depth,
2259 ) -> fidl::Result<()> {
2260 encoder.debug_check_bounds::<DeviceGetPositionResponse>(offset);
2261 unsafe {
2264 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
2265 (ptr as *mut u64).write_unaligned(0);
2266 }
2267 self.0.encode(encoder, offset + 0, depth)?;
2269 self.1.encode(encoder, offset + 8, depth)?;
2270 Ok(())
2271 }
2272 }
2273
2274 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2275 for DeviceGetPositionResponse
2276 {
2277 #[inline(always)]
2278 fn new_empty() -> Self {
2279 Self {
2280 monotonic_time: fidl::new_empty!(i64, D),
2281 ring_position: fidl::new_empty!(u32, D),
2282 }
2283 }
2284
2285 #[inline]
2286 unsafe fn decode(
2287 &mut self,
2288 decoder: &mut fidl::encoding::Decoder<'_, D>,
2289 offset: usize,
2290 _depth: fidl::encoding::Depth,
2291 ) -> fidl::Result<()> {
2292 decoder.debug_check_bounds::<Self>(offset);
2293 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
2294 let ptr = unsafe { buf_ptr.offset(8) };
2296 let padval = unsafe { (ptr as *const u64).read_unaligned() };
2297 let mask = 0xffffffff00000000u64;
2298 let maskedval = padval & mask;
2299 if maskedval != 0 {
2300 return Err(fidl::Error::NonZeroPadding {
2301 padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
2302 });
2303 }
2304 unsafe {
2306 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 16);
2307 }
2308 Ok(())
2309 }
2310 }
2311
2312 impl fidl::encoding::ValueTypeMarker for FormatRange {
2313 type Borrowed<'a> = &'a Self;
2314 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2315 value
2316 }
2317 }
2318
2319 unsafe impl fidl::encoding::TypeMarker for FormatRange {
2320 type Owned = Self;
2321
2322 #[inline(always)]
2323 fn inline_align(_context: fidl::encoding::Context) -> usize {
2324 4
2325 }
2326
2327 #[inline(always)]
2328 fn inline_size(_context: fidl::encoding::Context) -> usize {
2329 16
2330 }
2331 #[inline(always)]
2332 fn encode_is_copy() -> bool {
2333 true
2334 }
2335
2336 #[inline(always)]
2337 fn decode_is_copy() -> bool {
2338 true
2339 }
2340 }
2341
2342 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<FormatRange, D>
2343 for &FormatRange
2344 {
2345 #[inline]
2346 unsafe fn encode(
2347 self,
2348 encoder: &mut fidl::encoding::Encoder<'_, D>,
2349 offset: usize,
2350 _depth: fidl::encoding::Depth,
2351 ) -> fidl::Result<()> {
2352 encoder.debug_check_bounds::<FormatRange>(offset);
2353 unsafe {
2354 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
2356 (buf_ptr as *mut FormatRange).write_unaligned((self as *const FormatRange).read());
2357 }
2360 Ok(())
2361 }
2362 }
2363 unsafe impl<
2364 D: fidl::encoding::ResourceDialect,
2365 T0: fidl::encoding::Encode<u32, D>,
2366 T1: fidl::encoding::Encode<u32, D>,
2367 T2: fidl::encoding::Encode<u32, D>,
2368 T3: fidl::encoding::Encode<u8, D>,
2369 T4: fidl::encoding::Encode<u8, D>,
2370 T5: fidl::encoding::Encode<u16, D>,
2371 > fidl::encoding::Encode<FormatRange, D> for (T0, T1, T2, T3, T4, T5)
2372 {
2373 #[inline]
2374 unsafe fn encode(
2375 self,
2376 encoder: &mut fidl::encoding::Encoder<'_, D>,
2377 offset: usize,
2378 depth: fidl::encoding::Depth,
2379 ) -> fidl::Result<()> {
2380 encoder.debug_check_bounds::<FormatRange>(offset);
2381 self.0.encode(encoder, offset + 0, depth)?;
2385 self.1.encode(encoder, offset + 4, depth)?;
2386 self.2.encode(encoder, offset + 8, depth)?;
2387 self.3.encode(encoder, offset + 12, depth)?;
2388 self.4.encode(encoder, offset + 13, depth)?;
2389 self.5.encode(encoder, offset + 14, depth)?;
2390 Ok(())
2391 }
2392 }
2393
2394 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for FormatRange {
2395 #[inline(always)]
2396 fn new_empty() -> Self {
2397 Self {
2398 sample_format_flags: fidl::new_empty!(u32, D),
2399 min_frame_rate: fidl::new_empty!(u32, D),
2400 max_frame_rate: fidl::new_empty!(u32, D),
2401 min_channels: fidl::new_empty!(u8, D),
2402 max_channels: fidl::new_empty!(u8, D),
2403 rate_family_flags: fidl::new_empty!(u16, D),
2404 }
2405 }
2406
2407 #[inline]
2408 unsafe fn decode(
2409 &mut self,
2410 decoder: &mut fidl::encoding::Decoder<'_, D>,
2411 offset: usize,
2412 _depth: fidl::encoding::Depth,
2413 ) -> fidl::Result<()> {
2414 decoder.debug_check_bounds::<Self>(offset);
2415 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
2416 unsafe {
2419 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 16);
2420 }
2421 Ok(())
2422 }
2423 }
2424
2425 impl fidl::encoding::ValueTypeMarker for RingBufferConstraints {
2426 type Borrowed<'a> = &'a Self;
2427 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2428 value
2429 }
2430 }
2431
2432 unsafe impl fidl::encoding::TypeMarker for RingBufferConstraints {
2433 type Owned = Self;
2434
2435 #[inline(always)]
2436 fn inline_align(_context: fidl::encoding::Context) -> usize {
2437 4
2438 }
2439
2440 #[inline(always)]
2441 fn inline_size(_context: fidl::encoding::Context) -> usize {
2442 12
2443 }
2444 #[inline(always)]
2445 fn encode_is_copy() -> bool {
2446 true
2447 }
2448
2449 #[inline(always)]
2450 fn decode_is_copy() -> bool {
2451 true
2452 }
2453 }
2454
2455 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<RingBufferConstraints, D>
2456 for &RingBufferConstraints
2457 {
2458 #[inline]
2459 unsafe fn encode(
2460 self,
2461 encoder: &mut fidl::encoding::Encoder<'_, D>,
2462 offset: usize,
2463 _depth: fidl::encoding::Depth,
2464 ) -> fidl::Result<()> {
2465 encoder.debug_check_bounds::<RingBufferConstraints>(offset);
2466 unsafe {
2467 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
2469 (buf_ptr as *mut RingBufferConstraints)
2470 .write_unaligned((self as *const RingBufferConstraints).read());
2471 }
2474 Ok(())
2475 }
2476 }
2477 unsafe impl<
2478 D: fidl::encoding::ResourceDialect,
2479 T0: fidl::encoding::Encode<u32, D>,
2480 T1: fidl::encoding::Encode<u32, D>,
2481 T2: fidl::encoding::Encode<u32, D>,
2482 > fidl::encoding::Encode<RingBufferConstraints, D> for (T0, T1, T2)
2483 {
2484 #[inline]
2485 unsafe fn encode(
2486 self,
2487 encoder: &mut fidl::encoding::Encoder<'_, D>,
2488 offset: usize,
2489 depth: fidl::encoding::Depth,
2490 ) -> fidl::Result<()> {
2491 encoder.debug_check_bounds::<RingBufferConstraints>(offset);
2492 self.0.encode(encoder, offset + 0, depth)?;
2496 self.1.encode(encoder, offset + 4, depth)?;
2497 self.2.encode(encoder, offset + 8, depth)?;
2498 Ok(())
2499 }
2500 }
2501
2502 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for RingBufferConstraints {
2503 #[inline(always)]
2504 fn new_empty() -> Self {
2505 Self {
2506 min_frames: fidl::new_empty!(u32, D),
2507 max_frames: fidl::new_empty!(u32, D),
2508 modulo_frames: fidl::new_empty!(u32, D),
2509 }
2510 }
2511
2512 #[inline]
2513 unsafe fn decode(
2514 &mut self,
2515 decoder: &mut fidl::encoding::Decoder<'_, D>,
2516 offset: usize,
2517 _depth: fidl::encoding::Depth,
2518 ) -> fidl::Result<()> {
2519 decoder.debug_check_bounds::<Self>(offset);
2520 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
2521 unsafe {
2524 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 12);
2525 }
2526 Ok(())
2527 }
2528 }
2529
2530 impl ClockProperties {
2531 #[inline(always)]
2532 fn max_ordinal_present(&self) -> u64 {
2533 if let Some(_) = self.rate_adjustment_ppm {
2534 return 2;
2535 }
2536 if let Some(_) = self.domain {
2537 return 1;
2538 }
2539 0
2540 }
2541 }
2542
2543 impl fidl::encoding::ValueTypeMarker for ClockProperties {
2544 type Borrowed<'a> = &'a Self;
2545 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2546 value
2547 }
2548 }
2549
2550 unsafe impl fidl::encoding::TypeMarker for ClockProperties {
2551 type Owned = Self;
2552
2553 #[inline(always)]
2554 fn inline_align(_context: fidl::encoding::Context) -> usize {
2555 8
2556 }
2557
2558 #[inline(always)]
2559 fn inline_size(_context: fidl::encoding::Context) -> usize {
2560 16
2561 }
2562 }
2563
2564 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<ClockProperties, D>
2565 for &ClockProperties
2566 {
2567 unsafe fn encode(
2568 self,
2569 encoder: &mut fidl::encoding::Encoder<'_, D>,
2570 offset: usize,
2571 mut depth: fidl::encoding::Depth,
2572 ) -> fidl::Result<()> {
2573 encoder.debug_check_bounds::<ClockProperties>(offset);
2574 let max_ordinal: u64 = self.max_ordinal_present();
2576 encoder.write_num(max_ordinal, offset);
2577 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
2578 if max_ordinal == 0 {
2580 return Ok(());
2581 }
2582 depth.increment()?;
2583 let envelope_size = 8;
2584 let bytes_len = max_ordinal as usize * envelope_size;
2585 #[allow(unused_variables)]
2586 let offset = encoder.out_of_line_offset(bytes_len);
2587 let mut _prev_end_offset: usize = 0;
2588 if 1 > max_ordinal {
2589 return Ok(());
2590 }
2591
2592 let cur_offset: usize = (1 - 1) * envelope_size;
2595
2596 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2598
2599 fidl::encoding::encode_in_envelope_optional::<i32, D>(
2604 self.domain.as_ref().map(<i32 as fidl::encoding::ValueTypeMarker>::borrow),
2605 encoder,
2606 offset + cur_offset,
2607 depth,
2608 )?;
2609
2610 _prev_end_offset = cur_offset + envelope_size;
2611 if 2 > max_ordinal {
2612 return Ok(());
2613 }
2614
2615 let cur_offset: usize = (2 - 1) * envelope_size;
2618
2619 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2621
2622 fidl::encoding::encode_in_envelope_optional::<i32, D>(
2627 self.rate_adjustment_ppm
2628 .as_ref()
2629 .map(<i32 as fidl::encoding::ValueTypeMarker>::borrow),
2630 encoder,
2631 offset + cur_offset,
2632 depth,
2633 )?;
2634
2635 _prev_end_offset = cur_offset + envelope_size;
2636
2637 Ok(())
2638 }
2639 }
2640
2641 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ClockProperties {
2642 #[inline(always)]
2643 fn new_empty() -> Self {
2644 Self::default()
2645 }
2646
2647 unsafe fn decode(
2648 &mut self,
2649 decoder: &mut fidl::encoding::Decoder<'_, D>,
2650 offset: usize,
2651 mut depth: fidl::encoding::Depth,
2652 ) -> fidl::Result<()> {
2653 decoder.debug_check_bounds::<Self>(offset);
2654 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
2655 None => return Err(fidl::Error::NotNullable),
2656 Some(len) => len,
2657 };
2658 if len == 0 {
2660 return Ok(());
2661 };
2662 depth.increment()?;
2663 let envelope_size = 8;
2664 let bytes_len = len * envelope_size;
2665 let offset = decoder.out_of_line_offset(bytes_len)?;
2666 let mut _next_ordinal_to_read = 0;
2668 let mut next_offset = offset;
2669 let end_offset = offset + bytes_len;
2670 _next_ordinal_to_read += 1;
2671 if next_offset >= end_offset {
2672 return Ok(());
2673 }
2674
2675 while _next_ordinal_to_read < 1 {
2677 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2678 _next_ordinal_to_read += 1;
2679 next_offset += envelope_size;
2680 }
2681
2682 let next_out_of_line = decoder.next_out_of_line();
2683 let handles_before = decoder.remaining_handles();
2684 if let Some((inlined, num_bytes, num_handles)) =
2685 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2686 {
2687 let member_inline_size =
2688 <i32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2689 if inlined != (member_inline_size <= 4) {
2690 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2691 }
2692 let inner_offset;
2693 let mut inner_depth = depth.clone();
2694 if inlined {
2695 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2696 inner_offset = next_offset;
2697 } else {
2698 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2699 inner_depth.increment()?;
2700 }
2701 let val_ref = self.domain.get_or_insert_with(|| fidl::new_empty!(i32, D));
2702 fidl::decode!(i32, D, val_ref, decoder, inner_offset, inner_depth)?;
2703 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2704 {
2705 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2706 }
2707 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2708 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2709 }
2710 }
2711
2712 next_offset += envelope_size;
2713 _next_ordinal_to_read += 1;
2714 if next_offset >= end_offset {
2715 return Ok(());
2716 }
2717
2718 while _next_ordinal_to_read < 2 {
2720 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2721 _next_ordinal_to_read += 1;
2722 next_offset += envelope_size;
2723 }
2724
2725 let next_out_of_line = decoder.next_out_of_line();
2726 let handles_before = decoder.remaining_handles();
2727 if let Some((inlined, num_bytes, num_handles)) =
2728 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2729 {
2730 let member_inline_size =
2731 <i32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2732 if inlined != (member_inline_size <= 4) {
2733 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2734 }
2735 let inner_offset;
2736 let mut inner_depth = depth.clone();
2737 if inlined {
2738 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2739 inner_offset = next_offset;
2740 } else {
2741 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2742 inner_depth.increment()?;
2743 }
2744 let val_ref =
2745 self.rate_adjustment_ppm.get_or_insert_with(|| fidl::new_empty!(i32, D));
2746 fidl::decode!(i32, D, val_ref, decoder, inner_offset, inner_depth)?;
2747 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2748 {
2749 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2750 }
2751 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2752 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2753 }
2754 }
2755
2756 next_offset += envelope_size;
2757
2758 while next_offset < end_offset {
2760 _next_ordinal_to_read += 1;
2761 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2762 next_offset += envelope_size;
2763 }
2764
2765 Ok(())
2766 }
2767 }
2768
2769 impl Codec {
2770 #[inline(always)]
2771 fn max_ordinal_present(&self) -> u64 {
2772 if let Some(_) = self.plug_properties {
2773 return 3;
2774 }
2775 if let Some(_) = self.dai_interconnect {
2776 return 2;
2777 }
2778 if let Some(_) = self.is_input {
2779 return 1;
2780 }
2781 0
2782 }
2783 }
2784
2785 impl fidl::encoding::ValueTypeMarker for Codec {
2786 type Borrowed<'a> = &'a Self;
2787 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2788 value
2789 }
2790 }
2791
2792 unsafe impl fidl::encoding::TypeMarker for Codec {
2793 type Owned = Self;
2794
2795 #[inline(always)]
2796 fn inline_align(_context: fidl::encoding::Context) -> usize {
2797 8
2798 }
2799
2800 #[inline(always)]
2801 fn inline_size(_context: fidl::encoding::Context) -> usize {
2802 16
2803 }
2804 }
2805
2806 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Codec, D> for &Codec {
2807 unsafe fn encode(
2808 self,
2809 encoder: &mut fidl::encoding::Encoder<'_, D>,
2810 offset: usize,
2811 mut depth: fidl::encoding::Depth,
2812 ) -> fidl::Result<()> {
2813 encoder.debug_check_bounds::<Codec>(offset);
2814 let max_ordinal: u64 = self.max_ordinal_present();
2816 encoder.write_num(max_ordinal, offset);
2817 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
2818 if max_ordinal == 0 {
2820 return Ok(());
2821 }
2822 depth.increment()?;
2823 let envelope_size = 8;
2824 let bytes_len = max_ordinal as usize * envelope_size;
2825 #[allow(unused_variables)]
2826 let offset = encoder.out_of_line_offset(bytes_len);
2827 let mut _prev_end_offset: usize = 0;
2828 if 1 > max_ordinal {
2829 return Ok(());
2830 }
2831
2832 let cur_offset: usize = (1 - 1) * envelope_size;
2835
2836 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2838
2839 fidl::encoding::encode_in_envelope_optional::<bool, D>(
2844 self.is_input.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
2845 encoder,
2846 offset + cur_offset,
2847 depth,
2848 )?;
2849
2850 _prev_end_offset = cur_offset + envelope_size;
2851 if 2 > max_ordinal {
2852 return Ok(());
2853 }
2854
2855 let cur_offset: usize = (2 - 1) * envelope_size;
2858
2859 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2861
2862 fidl::encoding::encode_in_envelope_optional::<DaiInterconnect, D>(
2867 self.dai_interconnect
2868 .as_ref()
2869 .map(<DaiInterconnect as fidl::encoding::ValueTypeMarker>::borrow),
2870 encoder,
2871 offset + cur_offset,
2872 depth,
2873 )?;
2874
2875 _prev_end_offset = cur_offset + envelope_size;
2876 if 3 > max_ordinal {
2877 return Ok(());
2878 }
2879
2880 let cur_offset: usize = (3 - 1) * envelope_size;
2883
2884 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2886
2887 fidl::encoding::encode_in_envelope_optional::<PlugProperties, D>(
2892 self.plug_properties
2893 .as_ref()
2894 .map(<PlugProperties as fidl::encoding::ValueTypeMarker>::borrow),
2895 encoder,
2896 offset + cur_offset,
2897 depth,
2898 )?;
2899
2900 _prev_end_offset = cur_offset + envelope_size;
2901
2902 Ok(())
2903 }
2904 }
2905
2906 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Codec {
2907 #[inline(always)]
2908 fn new_empty() -> Self {
2909 Self::default()
2910 }
2911
2912 unsafe fn decode(
2913 &mut self,
2914 decoder: &mut fidl::encoding::Decoder<'_, D>,
2915 offset: usize,
2916 mut depth: fidl::encoding::Depth,
2917 ) -> fidl::Result<()> {
2918 decoder.debug_check_bounds::<Self>(offset);
2919 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
2920 None => return Err(fidl::Error::NotNullable),
2921 Some(len) => len,
2922 };
2923 if len == 0 {
2925 return Ok(());
2926 };
2927 depth.increment()?;
2928 let envelope_size = 8;
2929 let bytes_len = len * envelope_size;
2930 let offset = decoder.out_of_line_offset(bytes_len)?;
2931 let mut _next_ordinal_to_read = 0;
2933 let mut next_offset = offset;
2934 let end_offset = offset + bytes_len;
2935 _next_ordinal_to_read += 1;
2936 if next_offset >= end_offset {
2937 return Ok(());
2938 }
2939
2940 while _next_ordinal_to_read < 1 {
2942 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2943 _next_ordinal_to_read += 1;
2944 next_offset += envelope_size;
2945 }
2946
2947 let next_out_of_line = decoder.next_out_of_line();
2948 let handles_before = decoder.remaining_handles();
2949 if let Some((inlined, num_bytes, num_handles)) =
2950 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2951 {
2952 let member_inline_size =
2953 <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2954 if inlined != (member_inline_size <= 4) {
2955 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2956 }
2957 let inner_offset;
2958 let mut inner_depth = depth.clone();
2959 if inlined {
2960 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2961 inner_offset = next_offset;
2962 } else {
2963 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2964 inner_depth.increment()?;
2965 }
2966 let val_ref = self.is_input.get_or_insert_with(|| fidl::new_empty!(bool, D));
2967 fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
2968 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2969 {
2970 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2971 }
2972 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2973 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2974 }
2975 }
2976
2977 next_offset += envelope_size;
2978 _next_ordinal_to_read += 1;
2979 if next_offset >= end_offset {
2980 return Ok(());
2981 }
2982
2983 while _next_ordinal_to_read < 2 {
2985 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2986 _next_ordinal_to_read += 1;
2987 next_offset += envelope_size;
2988 }
2989
2990 let next_out_of_line = decoder.next_out_of_line();
2991 let handles_before = decoder.remaining_handles();
2992 if let Some((inlined, num_bytes, num_handles)) =
2993 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2994 {
2995 let member_inline_size =
2996 <DaiInterconnect as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2997 if inlined != (member_inline_size <= 4) {
2998 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2999 }
3000 let inner_offset;
3001 let mut inner_depth = depth.clone();
3002 if inlined {
3003 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3004 inner_offset = next_offset;
3005 } else {
3006 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3007 inner_depth.increment()?;
3008 }
3009 let val_ref = self
3010 .dai_interconnect
3011 .get_or_insert_with(|| fidl::new_empty!(DaiInterconnect, D));
3012 fidl::decode!(DaiInterconnect, D, val_ref, decoder, inner_offset, inner_depth)?;
3013 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3014 {
3015 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3016 }
3017 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3018 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3019 }
3020 }
3021
3022 next_offset += envelope_size;
3023 _next_ordinal_to_read += 1;
3024 if next_offset >= end_offset {
3025 return Ok(());
3026 }
3027
3028 while _next_ordinal_to_read < 3 {
3030 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3031 _next_ordinal_to_read += 1;
3032 next_offset += envelope_size;
3033 }
3034
3035 let next_out_of_line = decoder.next_out_of_line();
3036 let handles_before = decoder.remaining_handles();
3037 if let Some((inlined, num_bytes, num_handles)) =
3038 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3039 {
3040 let member_inline_size =
3041 <PlugProperties as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3042 if inlined != (member_inline_size <= 4) {
3043 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3044 }
3045 let inner_offset;
3046 let mut inner_depth = depth.clone();
3047 if inlined {
3048 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3049 inner_offset = next_offset;
3050 } else {
3051 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3052 inner_depth.increment()?;
3053 }
3054 let val_ref =
3055 self.plug_properties.get_or_insert_with(|| fidl::new_empty!(PlugProperties, D));
3056 fidl::decode!(PlugProperties, D, val_ref, decoder, inner_offset, inner_depth)?;
3057 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3058 {
3059 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3060 }
3061 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3062 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3063 }
3064 }
3065
3066 next_offset += envelope_size;
3067
3068 while next_offset < end_offset {
3070 _next_ordinal_to_read += 1;
3071 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3072 next_offset += envelope_size;
3073 }
3074
3075 Ok(())
3076 }
3077 }
3078
3079 impl Composite {
3080 #[inline(always)]
3081 fn max_ordinal_present(&self) -> u64 {
3082 if let Some(_) = self.topologies {
3083 return 4;
3084 }
3085 if let Some(_) = self.clock_properties {
3086 return 3;
3087 }
3088 if let Some(_) = self.dai_interconnects {
3089 return 2;
3090 }
3091 if let Some(_) = self.ring_buffers {
3092 return 1;
3093 }
3094 0
3095 }
3096 }
3097
3098 impl fidl::encoding::ValueTypeMarker for Composite {
3099 type Borrowed<'a> = &'a Self;
3100 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3101 value
3102 }
3103 }
3104
3105 unsafe impl fidl::encoding::TypeMarker for Composite {
3106 type Owned = Self;
3107
3108 #[inline(always)]
3109 fn inline_align(_context: fidl::encoding::Context) -> usize {
3110 8
3111 }
3112
3113 #[inline(always)]
3114 fn inline_size(_context: fidl::encoding::Context) -> usize {
3115 16
3116 }
3117 }
3118
3119 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Composite, D>
3120 for &Composite
3121 {
3122 unsafe fn encode(
3123 self,
3124 encoder: &mut fidl::encoding::Encoder<'_, D>,
3125 offset: usize,
3126 mut depth: fidl::encoding::Depth,
3127 ) -> fidl::Result<()> {
3128 encoder.debug_check_bounds::<Composite>(offset);
3129 let max_ordinal: u64 = self.max_ordinal_present();
3131 encoder.write_num(max_ordinal, offset);
3132 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
3133 if max_ordinal == 0 {
3135 return Ok(());
3136 }
3137 depth.increment()?;
3138 let envelope_size = 8;
3139 let bytes_len = max_ordinal as usize * envelope_size;
3140 #[allow(unused_variables)]
3141 let offset = encoder.out_of_line_offset(bytes_len);
3142 let mut _prev_end_offset: usize = 0;
3143 if 1 > max_ordinal {
3144 return Ok(());
3145 }
3146
3147 let cur_offset: usize = (1 - 1) * envelope_size;
3150
3151 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3153
3154 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<CompositeRingBuffer, 64>, D>(
3159 self.ring_buffers.as_ref().map(<fidl::encoding::Vector<CompositeRingBuffer, 64> as fidl::encoding::ValueTypeMarker>::borrow),
3160 encoder, offset + cur_offset, depth
3161 )?;
3162
3163 _prev_end_offset = cur_offset + envelope_size;
3164 if 2 > max_ordinal {
3165 return Ok(());
3166 }
3167
3168 let cur_offset: usize = (2 - 1) * envelope_size;
3171
3172 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3174
3175 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<CompositeDaiInterconnect, 64>, D>(
3180 self.dai_interconnects.as_ref().map(<fidl::encoding::Vector<CompositeDaiInterconnect, 64> as fidl::encoding::ValueTypeMarker>::borrow),
3181 encoder, offset + cur_offset, depth
3182 )?;
3183
3184 _prev_end_offset = cur_offset + envelope_size;
3185 if 3 > max_ordinal {
3186 return Ok(());
3187 }
3188
3189 let cur_offset: usize = (3 - 1) * envelope_size;
3192
3193 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3195
3196 fidl::encoding::encode_in_envelope_optional::<ClockProperties, D>(
3201 self.clock_properties
3202 .as_ref()
3203 .map(<ClockProperties as fidl::encoding::ValueTypeMarker>::borrow),
3204 encoder,
3205 offset + cur_offset,
3206 depth,
3207 )?;
3208
3209 _prev_end_offset = cur_offset + envelope_size;
3210 if 4 > max_ordinal {
3211 return Ok(());
3212 }
3213
3214 let cur_offset: usize = (4 - 1) * envelope_size;
3217
3218 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3220
3221 fidl::encoding::encode_in_envelope_optional::<
3226 fidl::encoding::Vector<fidl_fuchsia_hardware_audio_signalprocessing::Topology, 64>,
3227 D,
3228 >(
3229 self.topologies.as_ref().map(
3230 <fidl::encoding::Vector<
3231 fidl_fuchsia_hardware_audio_signalprocessing::Topology,
3232 64,
3233 > as fidl::encoding::ValueTypeMarker>::borrow,
3234 ),
3235 encoder,
3236 offset + cur_offset,
3237 depth,
3238 )?;
3239
3240 _prev_end_offset = cur_offset + envelope_size;
3241
3242 Ok(())
3243 }
3244 }
3245
3246 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Composite {
3247 #[inline(always)]
3248 fn new_empty() -> Self {
3249 Self::default()
3250 }
3251
3252 unsafe fn decode(
3253 &mut self,
3254 decoder: &mut fidl::encoding::Decoder<'_, D>,
3255 offset: usize,
3256 mut depth: fidl::encoding::Depth,
3257 ) -> fidl::Result<()> {
3258 decoder.debug_check_bounds::<Self>(offset);
3259 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
3260 None => return Err(fidl::Error::NotNullable),
3261 Some(len) => len,
3262 };
3263 if len == 0 {
3265 return Ok(());
3266 };
3267 depth.increment()?;
3268 let envelope_size = 8;
3269 let bytes_len = len * envelope_size;
3270 let offset = decoder.out_of_line_offset(bytes_len)?;
3271 let mut _next_ordinal_to_read = 0;
3273 let mut next_offset = offset;
3274 let end_offset = offset + bytes_len;
3275 _next_ordinal_to_read += 1;
3276 if next_offset >= end_offset {
3277 return Ok(());
3278 }
3279
3280 while _next_ordinal_to_read < 1 {
3282 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3283 _next_ordinal_to_read += 1;
3284 next_offset += envelope_size;
3285 }
3286
3287 let next_out_of_line = decoder.next_out_of_line();
3288 let handles_before = decoder.remaining_handles();
3289 if let Some((inlined, num_bytes, num_handles)) =
3290 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3291 {
3292 let member_inline_size = <fidl::encoding::Vector<CompositeRingBuffer, 64> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3293 if inlined != (member_inline_size <= 4) {
3294 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3295 }
3296 let inner_offset;
3297 let mut inner_depth = depth.clone();
3298 if inlined {
3299 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3300 inner_offset = next_offset;
3301 } else {
3302 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3303 inner_depth.increment()?;
3304 }
3305 let val_ref = self.ring_buffers.get_or_insert_with(
3306 || fidl::new_empty!(fidl::encoding::Vector<CompositeRingBuffer, 64>, D),
3307 );
3308 fidl::decode!(fidl::encoding::Vector<CompositeRingBuffer, 64>, D, val_ref, decoder, inner_offset, inner_depth)?;
3309 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3310 {
3311 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3312 }
3313 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3314 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3315 }
3316 }
3317
3318 next_offset += envelope_size;
3319 _next_ordinal_to_read += 1;
3320 if next_offset >= end_offset {
3321 return Ok(());
3322 }
3323
3324 while _next_ordinal_to_read < 2 {
3326 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3327 _next_ordinal_to_read += 1;
3328 next_offset += envelope_size;
3329 }
3330
3331 let next_out_of_line = decoder.next_out_of_line();
3332 let handles_before = decoder.remaining_handles();
3333 if let Some((inlined, num_bytes, num_handles)) =
3334 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3335 {
3336 let member_inline_size = <fidl::encoding::Vector<CompositeDaiInterconnect, 64> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3337 if inlined != (member_inline_size <= 4) {
3338 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3339 }
3340 let inner_offset;
3341 let mut inner_depth = depth.clone();
3342 if inlined {
3343 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3344 inner_offset = next_offset;
3345 } else {
3346 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3347 inner_depth.increment()?;
3348 }
3349 let val_ref = self.dai_interconnects.get_or_insert_with(
3350 || fidl::new_empty!(fidl::encoding::Vector<CompositeDaiInterconnect, 64>, D),
3351 );
3352 fidl::decode!(fidl::encoding::Vector<CompositeDaiInterconnect, 64>, D, val_ref, decoder, inner_offset, inner_depth)?;
3353 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3354 {
3355 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3356 }
3357 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3358 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3359 }
3360 }
3361
3362 next_offset += envelope_size;
3363 _next_ordinal_to_read += 1;
3364 if next_offset >= end_offset {
3365 return Ok(());
3366 }
3367
3368 while _next_ordinal_to_read < 3 {
3370 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3371 _next_ordinal_to_read += 1;
3372 next_offset += envelope_size;
3373 }
3374
3375 let next_out_of_line = decoder.next_out_of_line();
3376 let handles_before = decoder.remaining_handles();
3377 if let Some((inlined, num_bytes, num_handles)) =
3378 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3379 {
3380 let member_inline_size =
3381 <ClockProperties as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3382 if inlined != (member_inline_size <= 4) {
3383 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3384 }
3385 let inner_offset;
3386 let mut inner_depth = depth.clone();
3387 if inlined {
3388 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3389 inner_offset = next_offset;
3390 } else {
3391 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3392 inner_depth.increment()?;
3393 }
3394 let val_ref = self
3395 .clock_properties
3396 .get_or_insert_with(|| fidl::new_empty!(ClockProperties, D));
3397 fidl::decode!(ClockProperties, D, val_ref, decoder, inner_offset, inner_depth)?;
3398 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3399 {
3400 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3401 }
3402 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3403 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3404 }
3405 }
3406
3407 next_offset += envelope_size;
3408 _next_ordinal_to_read += 1;
3409 if next_offset >= end_offset {
3410 return Ok(());
3411 }
3412
3413 while _next_ordinal_to_read < 4 {
3415 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3416 _next_ordinal_to_read += 1;
3417 next_offset += envelope_size;
3418 }
3419
3420 let next_out_of_line = decoder.next_out_of_line();
3421 let handles_before = decoder.remaining_handles();
3422 if let Some((inlined, num_bytes, num_handles)) =
3423 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3424 {
3425 let member_inline_size = <fidl::encoding::Vector<
3426 fidl_fuchsia_hardware_audio_signalprocessing::Topology,
3427 64,
3428 > as fidl::encoding::TypeMarker>::inline_size(
3429 decoder.context
3430 );
3431 if inlined != (member_inline_size <= 4) {
3432 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3433 }
3434 let inner_offset;
3435 let mut inner_depth = depth.clone();
3436 if inlined {
3437 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3438 inner_offset = next_offset;
3439 } else {
3440 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3441 inner_depth.increment()?;
3442 }
3443 let val_ref =
3444 self.topologies.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<fidl_fuchsia_hardware_audio_signalprocessing::Topology, 64>, D));
3445 fidl::decode!(fidl::encoding::Vector<fidl_fuchsia_hardware_audio_signalprocessing::Topology, 64>, D, val_ref, decoder, inner_offset, inner_depth)?;
3446 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3447 {
3448 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3449 }
3450 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3451 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3452 }
3453 }
3454
3455 next_offset += envelope_size;
3456
3457 while next_offset < end_offset {
3459 _next_ordinal_to_read += 1;
3460 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3461 next_offset += envelope_size;
3462 }
3463
3464 Ok(())
3465 }
3466 }
3467
3468 impl CompositeDaiInterconnect {
3469 #[inline(always)]
3470 fn max_ordinal_present(&self) -> u64 {
3471 if let Some(_) = self.dai_interconnect {
3472 return 2;
3473 }
3474 if let Some(_) = self.id {
3475 return 1;
3476 }
3477 0
3478 }
3479 }
3480
3481 impl fidl::encoding::ValueTypeMarker for CompositeDaiInterconnect {
3482 type Borrowed<'a> = &'a Self;
3483 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3484 value
3485 }
3486 }
3487
3488 unsafe impl fidl::encoding::TypeMarker for CompositeDaiInterconnect {
3489 type Owned = Self;
3490
3491 #[inline(always)]
3492 fn inline_align(_context: fidl::encoding::Context) -> usize {
3493 8
3494 }
3495
3496 #[inline(always)]
3497 fn inline_size(_context: fidl::encoding::Context) -> usize {
3498 16
3499 }
3500 }
3501
3502 unsafe impl<D: fidl::encoding::ResourceDialect>
3503 fidl::encoding::Encode<CompositeDaiInterconnect, D> for &CompositeDaiInterconnect
3504 {
3505 unsafe fn encode(
3506 self,
3507 encoder: &mut fidl::encoding::Encoder<'_, D>,
3508 offset: usize,
3509 mut depth: fidl::encoding::Depth,
3510 ) -> fidl::Result<()> {
3511 encoder.debug_check_bounds::<CompositeDaiInterconnect>(offset);
3512 let max_ordinal: u64 = self.max_ordinal_present();
3514 encoder.write_num(max_ordinal, offset);
3515 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
3516 if max_ordinal == 0 {
3518 return Ok(());
3519 }
3520 depth.increment()?;
3521 let envelope_size = 8;
3522 let bytes_len = max_ordinal as usize * envelope_size;
3523 #[allow(unused_variables)]
3524 let offset = encoder.out_of_line_offset(bytes_len);
3525 let mut _prev_end_offset: usize = 0;
3526 if 1 > max_ordinal {
3527 return Ok(());
3528 }
3529
3530 let cur_offset: usize = (1 - 1) * envelope_size;
3533
3534 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3536
3537 fidl::encoding::encode_in_envelope_optional::<u64, D>(
3542 self.id.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
3543 encoder,
3544 offset + cur_offset,
3545 depth,
3546 )?;
3547
3548 _prev_end_offset = cur_offset + envelope_size;
3549 if 2 > max_ordinal {
3550 return Ok(());
3551 }
3552
3553 let cur_offset: usize = (2 - 1) * envelope_size;
3556
3557 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3559
3560 fidl::encoding::encode_in_envelope_optional::<DaiInterconnect, D>(
3565 self.dai_interconnect
3566 .as_ref()
3567 .map(<DaiInterconnect as fidl::encoding::ValueTypeMarker>::borrow),
3568 encoder,
3569 offset + cur_offset,
3570 depth,
3571 )?;
3572
3573 _prev_end_offset = cur_offset + envelope_size;
3574
3575 Ok(())
3576 }
3577 }
3578
3579 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3580 for CompositeDaiInterconnect
3581 {
3582 #[inline(always)]
3583 fn new_empty() -> Self {
3584 Self::default()
3585 }
3586
3587 unsafe fn decode(
3588 &mut self,
3589 decoder: &mut fidl::encoding::Decoder<'_, D>,
3590 offset: usize,
3591 mut depth: fidl::encoding::Depth,
3592 ) -> fidl::Result<()> {
3593 decoder.debug_check_bounds::<Self>(offset);
3594 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
3595 None => return Err(fidl::Error::NotNullable),
3596 Some(len) => len,
3597 };
3598 if len == 0 {
3600 return Ok(());
3601 };
3602 depth.increment()?;
3603 let envelope_size = 8;
3604 let bytes_len = len * envelope_size;
3605 let offset = decoder.out_of_line_offset(bytes_len)?;
3606 let mut _next_ordinal_to_read = 0;
3608 let mut next_offset = offset;
3609 let end_offset = offset + bytes_len;
3610 _next_ordinal_to_read += 1;
3611 if next_offset >= end_offset {
3612 return Ok(());
3613 }
3614
3615 while _next_ordinal_to_read < 1 {
3617 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3618 _next_ordinal_to_read += 1;
3619 next_offset += envelope_size;
3620 }
3621
3622 let next_out_of_line = decoder.next_out_of_line();
3623 let handles_before = decoder.remaining_handles();
3624 if let Some((inlined, num_bytes, num_handles)) =
3625 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3626 {
3627 let member_inline_size =
3628 <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3629 if inlined != (member_inline_size <= 4) {
3630 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3631 }
3632 let inner_offset;
3633 let mut inner_depth = depth.clone();
3634 if inlined {
3635 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3636 inner_offset = next_offset;
3637 } else {
3638 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3639 inner_depth.increment()?;
3640 }
3641 let val_ref = self.id.get_or_insert_with(|| fidl::new_empty!(u64, D));
3642 fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
3643 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3644 {
3645 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3646 }
3647 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3648 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3649 }
3650 }
3651
3652 next_offset += envelope_size;
3653 _next_ordinal_to_read += 1;
3654 if next_offset >= end_offset {
3655 return Ok(());
3656 }
3657
3658 while _next_ordinal_to_read < 2 {
3660 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3661 _next_ordinal_to_read += 1;
3662 next_offset += envelope_size;
3663 }
3664
3665 let next_out_of_line = decoder.next_out_of_line();
3666 let handles_before = decoder.remaining_handles();
3667 if let Some((inlined, num_bytes, num_handles)) =
3668 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3669 {
3670 let member_inline_size =
3671 <DaiInterconnect as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3672 if inlined != (member_inline_size <= 4) {
3673 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3674 }
3675 let inner_offset;
3676 let mut inner_depth = depth.clone();
3677 if inlined {
3678 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3679 inner_offset = next_offset;
3680 } else {
3681 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3682 inner_depth.increment()?;
3683 }
3684 let val_ref = self
3685 .dai_interconnect
3686 .get_or_insert_with(|| fidl::new_empty!(DaiInterconnect, D));
3687 fidl::decode!(DaiInterconnect, D, val_ref, decoder, inner_offset, inner_depth)?;
3688 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3689 {
3690 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3691 }
3692 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3693 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3694 }
3695 }
3696
3697 next_offset += envelope_size;
3698
3699 while next_offset < end_offset {
3701 _next_ordinal_to_read += 1;
3702 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3703 next_offset += envelope_size;
3704 }
3705
3706 Ok(())
3707 }
3708 }
3709
3710 impl CompositeRingBuffer {
3711 #[inline(always)]
3712 fn max_ordinal_present(&self) -> u64 {
3713 if let Some(_) = self.ring_buffer {
3714 return 2;
3715 }
3716 if let Some(_) = self.id {
3717 return 1;
3718 }
3719 0
3720 }
3721 }
3722
3723 impl fidl::encoding::ValueTypeMarker for CompositeRingBuffer {
3724 type Borrowed<'a> = &'a Self;
3725 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3726 value
3727 }
3728 }
3729
3730 unsafe impl fidl::encoding::TypeMarker for CompositeRingBuffer {
3731 type Owned = Self;
3732
3733 #[inline(always)]
3734 fn inline_align(_context: fidl::encoding::Context) -> usize {
3735 8
3736 }
3737
3738 #[inline(always)]
3739 fn inline_size(_context: fidl::encoding::Context) -> usize {
3740 16
3741 }
3742 }
3743
3744 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<CompositeRingBuffer, D>
3745 for &CompositeRingBuffer
3746 {
3747 unsafe fn encode(
3748 self,
3749 encoder: &mut fidl::encoding::Encoder<'_, D>,
3750 offset: usize,
3751 mut depth: fidl::encoding::Depth,
3752 ) -> fidl::Result<()> {
3753 encoder.debug_check_bounds::<CompositeRingBuffer>(offset);
3754 let max_ordinal: u64 = self.max_ordinal_present();
3756 encoder.write_num(max_ordinal, offset);
3757 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
3758 if max_ordinal == 0 {
3760 return Ok(());
3761 }
3762 depth.increment()?;
3763 let envelope_size = 8;
3764 let bytes_len = max_ordinal as usize * envelope_size;
3765 #[allow(unused_variables)]
3766 let offset = encoder.out_of_line_offset(bytes_len);
3767 let mut _prev_end_offset: usize = 0;
3768 if 1 > max_ordinal {
3769 return Ok(());
3770 }
3771
3772 let cur_offset: usize = (1 - 1) * envelope_size;
3775
3776 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3778
3779 fidl::encoding::encode_in_envelope_optional::<u64, D>(
3784 self.id.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
3785 encoder,
3786 offset + cur_offset,
3787 depth,
3788 )?;
3789
3790 _prev_end_offset = cur_offset + envelope_size;
3791 if 2 > max_ordinal {
3792 return Ok(());
3793 }
3794
3795 let cur_offset: usize = (2 - 1) * envelope_size;
3798
3799 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3801
3802 fidl::encoding::encode_in_envelope_optional::<RingBuffer, D>(
3807 self.ring_buffer
3808 .as_ref()
3809 .map(<RingBuffer as fidl::encoding::ValueTypeMarker>::borrow),
3810 encoder,
3811 offset + cur_offset,
3812 depth,
3813 )?;
3814
3815 _prev_end_offset = cur_offset + envelope_size;
3816
3817 Ok(())
3818 }
3819 }
3820
3821 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for CompositeRingBuffer {
3822 #[inline(always)]
3823 fn new_empty() -> Self {
3824 Self::default()
3825 }
3826
3827 unsafe fn decode(
3828 &mut self,
3829 decoder: &mut fidl::encoding::Decoder<'_, D>,
3830 offset: usize,
3831 mut depth: fidl::encoding::Depth,
3832 ) -> fidl::Result<()> {
3833 decoder.debug_check_bounds::<Self>(offset);
3834 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
3835 None => return Err(fidl::Error::NotNullable),
3836 Some(len) => len,
3837 };
3838 if len == 0 {
3840 return Ok(());
3841 };
3842 depth.increment()?;
3843 let envelope_size = 8;
3844 let bytes_len = len * envelope_size;
3845 let offset = decoder.out_of_line_offset(bytes_len)?;
3846 let mut _next_ordinal_to_read = 0;
3848 let mut next_offset = offset;
3849 let end_offset = offset + bytes_len;
3850 _next_ordinal_to_read += 1;
3851 if next_offset >= end_offset {
3852 return Ok(());
3853 }
3854
3855 while _next_ordinal_to_read < 1 {
3857 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3858 _next_ordinal_to_read += 1;
3859 next_offset += envelope_size;
3860 }
3861
3862 let next_out_of_line = decoder.next_out_of_line();
3863 let handles_before = decoder.remaining_handles();
3864 if let Some((inlined, num_bytes, num_handles)) =
3865 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3866 {
3867 let member_inline_size =
3868 <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3869 if inlined != (member_inline_size <= 4) {
3870 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3871 }
3872 let inner_offset;
3873 let mut inner_depth = depth.clone();
3874 if inlined {
3875 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3876 inner_offset = next_offset;
3877 } else {
3878 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3879 inner_depth.increment()?;
3880 }
3881 let val_ref = self.id.get_or_insert_with(|| fidl::new_empty!(u64, D));
3882 fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
3883 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3884 {
3885 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3886 }
3887 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3888 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3889 }
3890 }
3891
3892 next_offset += envelope_size;
3893 _next_ordinal_to_read += 1;
3894 if next_offset >= end_offset {
3895 return Ok(());
3896 }
3897
3898 while _next_ordinal_to_read < 2 {
3900 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3901 _next_ordinal_to_read += 1;
3902 next_offset += envelope_size;
3903 }
3904
3905 let next_out_of_line = decoder.next_out_of_line();
3906 let handles_before = decoder.remaining_handles();
3907 if let Some((inlined, num_bytes, num_handles)) =
3908 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3909 {
3910 let member_inline_size =
3911 <RingBuffer as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3912 if inlined != (member_inline_size <= 4) {
3913 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3914 }
3915 let inner_offset;
3916 let mut inner_depth = depth.clone();
3917 if inlined {
3918 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3919 inner_offset = next_offset;
3920 } else {
3921 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3922 inner_depth.increment()?;
3923 }
3924 let val_ref =
3925 self.ring_buffer.get_or_insert_with(|| fidl::new_empty!(RingBuffer, D));
3926 fidl::decode!(RingBuffer, D, val_ref, decoder, inner_offset, inner_depth)?;
3927 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3928 {
3929 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3930 }
3931 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3932 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3933 }
3934 }
3935
3936 next_offset += envelope_size;
3937
3938 while next_offset < end_offset {
3940 _next_ordinal_to_read += 1;
3941 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3942 next_offset += envelope_size;
3943 }
3944
3945 Ok(())
3946 }
3947 }
3948
3949 impl Configuration {
3950 #[inline(always)]
3951 fn max_ordinal_present(&self) -> u64 {
3952 if let Some(_) = self.device_specific {
3953 return 5;
3954 }
3955 if let Some(_) = self.unique_id {
3956 return 4;
3957 }
3958 if let Some(_) = self.product_name {
3959 return 3;
3960 }
3961 if let Some(_) = self.manufacturer_name {
3962 return 2;
3963 }
3964 if let Some(_) = self.device_name {
3965 return 1;
3966 }
3967 0
3968 }
3969 }
3970
3971 impl fidl::encoding::ValueTypeMarker for Configuration {
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 Configuration {
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<Configuration, D>
3993 for &Configuration
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::<Configuration>(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<256>, D>(
4032 self.device_name.as_ref().map(
4033 <fidl::encoding::BoundedString<256> 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<256>, D>(
4057 self.manufacturer_name.as_ref().map(
4058 <fidl::encoding::BoundedString<256> as fidl::encoding::ValueTypeMarker>::borrow,
4059 ),
4060 encoder,
4061 offset + cur_offset,
4062 depth,
4063 )?;
4064
4065 _prev_end_offset = cur_offset + envelope_size;
4066 if 3 > max_ordinal {
4067 return Ok(());
4068 }
4069
4070 let cur_offset: usize = (3 - 1) * envelope_size;
4073
4074 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4076
4077 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<256>, D>(
4082 self.product_name.as_ref().map(
4083 <fidl::encoding::BoundedString<256> as fidl::encoding::ValueTypeMarker>::borrow,
4084 ),
4085 encoder,
4086 offset + cur_offset,
4087 depth,
4088 )?;
4089
4090 _prev_end_offset = cur_offset + envelope_size;
4091 if 4 > max_ordinal {
4092 return Ok(());
4093 }
4094
4095 let cur_offset: usize = (4 - 1) * envelope_size;
4098
4099 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4101
4102 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Array<u8, 16>, D>(
4107 self.unique_id.as_ref().map(
4108 <fidl::encoding::Array<u8, 16> as fidl::encoding::ValueTypeMarker>::borrow,
4109 ),
4110 encoder,
4111 offset + cur_offset,
4112 depth,
4113 )?;
4114
4115 _prev_end_offset = cur_offset + envelope_size;
4116 if 5 > max_ordinal {
4117 return Ok(());
4118 }
4119
4120 let cur_offset: usize = (5 - 1) * envelope_size;
4123
4124 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4126
4127 fidl::encoding::encode_in_envelope_optional::<DeviceSpecific, D>(
4132 self.device_specific
4133 .as_ref()
4134 .map(<DeviceSpecific as fidl::encoding::ValueTypeMarker>::borrow),
4135 encoder,
4136 offset + cur_offset,
4137 depth,
4138 )?;
4139
4140 _prev_end_offset = cur_offset + envelope_size;
4141
4142 Ok(())
4143 }
4144 }
4145
4146 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Configuration {
4147 #[inline(always)]
4148 fn new_empty() -> Self {
4149 Self::default()
4150 }
4151
4152 unsafe fn decode(
4153 &mut self,
4154 decoder: &mut fidl::encoding::Decoder<'_, D>,
4155 offset: usize,
4156 mut depth: fidl::encoding::Depth,
4157 ) -> fidl::Result<()> {
4158 decoder.debug_check_bounds::<Self>(offset);
4159 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
4160 None => return Err(fidl::Error::NotNullable),
4161 Some(len) => len,
4162 };
4163 if len == 0 {
4165 return Ok(());
4166 };
4167 depth.increment()?;
4168 let envelope_size = 8;
4169 let bytes_len = len * envelope_size;
4170 let offset = decoder.out_of_line_offset(bytes_len)?;
4171 let mut _next_ordinal_to_read = 0;
4173 let mut next_offset = offset;
4174 let end_offset = offset + bytes_len;
4175 _next_ordinal_to_read += 1;
4176 if next_offset >= end_offset {
4177 return Ok(());
4178 }
4179
4180 while _next_ordinal_to_read < 1 {
4182 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4183 _next_ordinal_to_read += 1;
4184 next_offset += envelope_size;
4185 }
4186
4187 let next_out_of_line = decoder.next_out_of_line();
4188 let handles_before = decoder.remaining_handles();
4189 if let Some((inlined, num_bytes, num_handles)) =
4190 fidl::encoding::decode_envelope_header(decoder, next_offset)?
4191 {
4192 let member_inline_size =
4193 <fidl::encoding::BoundedString<256> as fidl::encoding::TypeMarker>::inline_size(
4194 decoder.context,
4195 );
4196 if inlined != (member_inline_size <= 4) {
4197 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4198 }
4199 let inner_offset;
4200 let mut inner_depth = depth.clone();
4201 if inlined {
4202 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4203 inner_offset = next_offset;
4204 } else {
4205 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4206 inner_depth.increment()?;
4207 }
4208 let val_ref = self
4209 .device_name
4210 .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::BoundedString<256>, D));
4211 fidl::decode!(
4212 fidl::encoding::BoundedString<256>,
4213 D,
4214 val_ref,
4215 decoder,
4216 inner_offset,
4217 inner_depth
4218 )?;
4219 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4220 {
4221 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4222 }
4223 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4224 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4225 }
4226 }
4227
4228 next_offset += envelope_size;
4229 _next_ordinal_to_read += 1;
4230 if next_offset >= end_offset {
4231 return Ok(());
4232 }
4233
4234 while _next_ordinal_to_read < 2 {
4236 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4237 _next_ordinal_to_read += 1;
4238 next_offset += envelope_size;
4239 }
4240
4241 let next_out_of_line = decoder.next_out_of_line();
4242 let handles_before = decoder.remaining_handles();
4243 if let Some((inlined, num_bytes, num_handles)) =
4244 fidl::encoding::decode_envelope_header(decoder, next_offset)?
4245 {
4246 let member_inline_size =
4247 <fidl::encoding::BoundedString<256> as fidl::encoding::TypeMarker>::inline_size(
4248 decoder.context,
4249 );
4250 if inlined != (member_inline_size <= 4) {
4251 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4252 }
4253 let inner_offset;
4254 let mut inner_depth = depth.clone();
4255 if inlined {
4256 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4257 inner_offset = next_offset;
4258 } else {
4259 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4260 inner_depth.increment()?;
4261 }
4262 let val_ref = self
4263 .manufacturer_name
4264 .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::BoundedString<256>, D));
4265 fidl::decode!(
4266 fidl::encoding::BoundedString<256>,
4267 D,
4268 val_ref,
4269 decoder,
4270 inner_offset,
4271 inner_depth
4272 )?;
4273 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4274 {
4275 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4276 }
4277 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4278 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4279 }
4280 }
4281
4282 next_offset += envelope_size;
4283 _next_ordinal_to_read += 1;
4284 if next_offset >= end_offset {
4285 return Ok(());
4286 }
4287
4288 while _next_ordinal_to_read < 3 {
4290 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4291 _next_ordinal_to_read += 1;
4292 next_offset += envelope_size;
4293 }
4294
4295 let next_out_of_line = decoder.next_out_of_line();
4296 let handles_before = decoder.remaining_handles();
4297 if let Some((inlined, num_bytes, num_handles)) =
4298 fidl::encoding::decode_envelope_header(decoder, next_offset)?
4299 {
4300 let member_inline_size =
4301 <fidl::encoding::BoundedString<256> as fidl::encoding::TypeMarker>::inline_size(
4302 decoder.context,
4303 );
4304 if inlined != (member_inline_size <= 4) {
4305 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4306 }
4307 let inner_offset;
4308 let mut inner_depth = depth.clone();
4309 if inlined {
4310 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4311 inner_offset = next_offset;
4312 } else {
4313 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4314 inner_depth.increment()?;
4315 }
4316 let val_ref = self
4317 .product_name
4318 .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::BoundedString<256>, D));
4319 fidl::decode!(
4320 fidl::encoding::BoundedString<256>,
4321 D,
4322 val_ref,
4323 decoder,
4324 inner_offset,
4325 inner_depth
4326 )?;
4327 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4328 {
4329 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4330 }
4331 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4332 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4333 }
4334 }
4335
4336 next_offset += envelope_size;
4337 _next_ordinal_to_read += 1;
4338 if next_offset >= end_offset {
4339 return Ok(());
4340 }
4341
4342 while _next_ordinal_to_read < 4 {
4344 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4345 _next_ordinal_to_read += 1;
4346 next_offset += envelope_size;
4347 }
4348
4349 let next_out_of_line = decoder.next_out_of_line();
4350 let handles_before = decoder.remaining_handles();
4351 if let Some((inlined, num_bytes, num_handles)) =
4352 fidl::encoding::decode_envelope_header(decoder, next_offset)?
4353 {
4354 let member_inline_size =
4355 <fidl::encoding::Array<u8, 16> as fidl::encoding::TypeMarker>::inline_size(
4356 decoder.context,
4357 );
4358 if inlined != (member_inline_size <= 4) {
4359 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4360 }
4361 let inner_offset;
4362 let mut inner_depth = depth.clone();
4363 if inlined {
4364 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4365 inner_offset = next_offset;
4366 } else {
4367 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4368 inner_depth.increment()?;
4369 }
4370 let val_ref = self
4371 .unique_id
4372 .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Array<u8, 16>, D));
4373 fidl::decode!(fidl::encoding::Array<u8, 16>, D, val_ref, decoder, inner_offset, inner_depth)?;
4374 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4375 {
4376 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4377 }
4378 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4379 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4380 }
4381 }
4382
4383 next_offset += envelope_size;
4384 _next_ordinal_to_read += 1;
4385 if next_offset >= end_offset {
4386 return Ok(());
4387 }
4388
4389 while _next_ordinal_to_read < 5 {
4391 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4392 _next_ordinal_to_read += 1;
4393 next_offset += envelope_size;
4394 }
4395
4396 let next_out_of_line = decoder.next_out_of_line();
4397 let handles_before = decoder.remaining_handles();
4398 if let Some((inlined, num_bytes, num_handles)) =
4399 fidl::encoding::decode_envelope_header(decoder, next_offset)?
4400 {
4401 let member_inline_size =
4402 <DeviceSpecific as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4403 if inlined != (member_inline_size <= 4) {
4404 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4405 }
4406 let inner_offset;
4407 let mut inner_depth = depth.clone();
4408 if inlined {
4409 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4410 inner_offset = next_offset;
4411 } else {
4412 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4413 inner_depth.increment()?;
4414 }
4415 let val_ref =
4416 self.device_specific.get_or_insert_with(|| fidl::new_empty!(DeviceSpecific, D));
4417 fidl::decode!(DeviceSpecific, D, val_ref, decoder, inner_offset, inner_depth)?;
4418 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4419 {
4420 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4421 }
4422 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4423 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4424 }
4425 }
4426
4427 next_offset += envelope_size;
4428
4429 while next_offset < end_offset {
4431 _next_ordinal_to_read += 1;
4432 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4433 next_offset += envelope_size;
4434 }
4435
4436 Ok(())
4437 }
4438 }
4439
4440 impl Dai {
4441 #[inline(always)]
4442 fn max_ordinal_present(&self) -> u64 {
4443 if let Some(_) = self.clock_properties {
4444 return 4;
4445 }
4446 if let Some(_) = self.dai_interconnect {
4447 return 3;
4448 }
4449 if let Some(_) = self.ring_buffer {
4450 return 2;
4451 }
4452 if let Some(_) = self.is_input {
4453 return 1;
4454 }
4455 0
4456 }
4457 }
4458
4459 impl fidl::encoding::ValueTypeMarker for Dai {
4460 type Borrowed<'a> = &'a Self;
4461 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4462 value
4463 }
4464 }
4465
4466 unsafe impl fidl::encoding::TypeMarker for Dai {
4467 type Owned = Self;
4468
4469 #[inline(always)]
4470 fn inline_align(_context: fidl::encoding::Context) -> usize {
4471 8
4472 }
4473
4474 #[inline(always)]
4475 fn inline_size(_context: fidl::encoding::Context) -> usize {
4476 16
4477 }
4478 }
4479
4480 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Dai, D> for &Dai {
4481 unsafe fn encode(
4482 self,
4483 encoder: &mut fidl::encoding::Encoder<'_, D>,
4484 offset: usize,
4485 mut depth: fidl::encoding::Depth,
4486 ) -> fidl::Result<()> {
4487 encoder.debug_check_bounds::<Dai>(offset);
4488 let max_ordinal: u64 = self.max_ordinal_present();
4490 encoder.write_num(max_ordinal, offset);
4491 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
4492 if max_ordinal == 0 {
4494 return Ok(());
4495 }
4496 depth.increment()?;
4497 let envelope_size = 8;
4498 let bytes_len = max_ordinal as usize * envelope_size;
4499 #[allow(unused_variables)]
4500 let offset = encoder.out_of_line_offset(bytes_len);
4501 let mut _prev_end_offset: usize = 0;
4502 if 1 > max_ordinal {
4503 return Ok(());
4504 }
4505
4506 let cur_offset: usize = (1 - 1) * envelope_size;
4509
4510 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4512
4513 fidl::encoding::encode_in_envelope_optional::<bool, D>(
4518 self.is_input.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
4519 encoder,
4520 offset + cur_offset,
4521 depth,
4522 )?;
4523
4524 _prev_end_offset = cur_offset + envelope_size;
4525 if 2 > max_ordinal {
4526 return Ok(());
4527 }
4528
4529 let cur_offset: usize = (2 - 1) * envelope_size;
4532
4533 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4535
4536 fidl::encoding::encode_in_envelope_optional::<RingBuffer, D>(
4541 self.ring_buffer
4542 .as_ref()
4543 .map(<RingBuffer as fidl::encoding::ValueTypeMarker>::borrow),
4544 encoder,
4545 offset + cur_offset,
4546 depth,
4547 )?;
4548
4549 _prev_end_offset = cur_offset + envelope_size;
4550 if 3 > max_ordinal {
4551 return Ok(());
4552 }
4553
4554 let cur_offset: usize = (3 - 1) * envelope_size;
4557
4558 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4560
4561 fidl::encoding::encode_in_envelope_optional::<DaiInterconnect, D>(
4566 self.dai_interconnect
4567 .as_ref()
4568 .map(<DaiInterconnect as fidl::encoding::ValueTypeMarker>::borrow),
4569 encoder,
4570 offset + cur_offset,
4571 depth,
4572 )?;
4573
4574 _prev_end_offset = cur_offset + envelope_size;
4575 if 4 > max_ordinal {
4576 return Ok(());
4577 }
4578
4579 let cur_offset: usize = (4 - 1) * envelope_size;
4582
4583 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4585
4586 fidl::encoding::encode_in_envelope_optional::<ClockProperties, D>(
4591 self.clock_properties
4592 .as_ref()
4593 .map(<ClockProperties as fidl::encoding::ValueTypeMarker>::borrow),
4594 encoder,
4595 offset + cur_offset,
4596 depth,
4597 )?;
4598
4599 _prev_end_offset = cur_offset + envelope_size;
4600
4601 Ok(())
4602 }
4603 }
4604
4605 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Dai {
4606 #[inline(always)]
4607 fn new_empty() -> Self {
4608 Self::default()
4609 }
4610
4611 unsafe fn decode(
4612 &mut self,
4613 decoder: &mut fidl::encoding::Decoder<'_, D>,
4614 offset: usize,
4615 mut depth: fidl::encoding::Depth,
4616 ) -> fidl::Result<()> {
4617 decoder.debug_check_bounds::<Self>(offset);
4618 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
4619 None => return Err(fidl::Error::NotNullable),
4620 Some(len) => len,
4621 };
4622 if len == 0 {
4624 return Ok(());
4625 };
4626 depth.increment()?;
4627 let envelope_size = 8;
4628 let bytes_len = len * envelope_size;
4629 let offset = decoder.out_of_line_offset(bytes_len)?;
4630 let mut _next_ordinal_to_read = 0;
4632 let mut next_offset = offset;
4633 let end_offset = offset + bytes_len;
4634 _next_ordinal_to_read += 1;
4635 if next_offset >= end_offset {
4636 return Ok(());
4637 }
4638
4639 while _next_ordinal_to_read < 1 {
4641 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4642 _next_ordinal_to_read += 1;
4643 next_offset += envelope_size;
4644 }
4645
4646 let next_out_of_line = decoder.next_out_of_line();
4647 let handles_before = decoder.remaining_handles();
4648 if let Some((inlined, num_bytes, num_handles)) =
4649 fidl::encoding::decode_envelope_header(decoder, next_offset)?
4650 {
4651 let member_inline_size =
4652 <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4653 if inlined != (member_inline_size <= 4) {
4654 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4655 }
4656 let inner_offset;
4657 let mut inner_depth = depth.clone();
4658 if inlined {
4659 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4660 inner_offset = next_offset;
4661 } else {
4662 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4663 inner_depth.increment()?;
4664 }
4665 let val_ref = self.is_input.get_or_insert_with(|| fidl::new_empty!(bool, D));
4666 fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
4667 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4668 {
4669 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4670 }
4671 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4672 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4673 }
4674 }
4675
4676 next_offset += envelope_size;
4677 _next_ordinal_to_read += 1;
4678 if next_offset >= end_offset {
4679 return Ok(());
4680 }
4681
4682 while _next_ordinal_to_read < 2 {
4684 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4685 _next_ordinal_to_read += 1;
4686 next_offset += envelope_size;
4687 }
4688
4689 let next_out_of_line = decoder.next_out_of_line();
4690 let handles_before = decoder.remaining_handles();
4691 if let Some((inlined, num_bytes, num_handles)) =
4692 fidl::encoding::decode_envelope_header(decoder, next_offset)?
4693 {
4694 let member_inline_size =
4695 <RingBuffer as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4696 if inlined != (member_inline_size <= 4) {
4697 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4698 }
4699 let inner_offset;
4700 let mut inner_depth = depth.clone();
4701 if inlined {
4702 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4703 inner_offset = next_offset;
4704 } else {
4705 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4706 inner_depth.increment()?;
4707 }
4708 let val_ref =
4709 self.ring_buffer.get_or_insert_with(|| fidl::new_empty!(RingBuffer, D));
4710 fidl::decode!(RingBuffer, D, val_ref, decoder, inner_offset, inner_depth)?;
4711 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4712 {
4713 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4714 }
4715 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4716 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4717 }
4718 }
4719
4720 next_offset += envelope_size;
4721 _next_ordinal_to_read += 1;
4722 if next_offset >= end_offset {
4723 return Ok(());
4724 }
4725
4726 while _next_ordinal_to_read < 3 {
4728 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4729 _next_ordinal_to_read += 1;
4730 next_offset += envelope_size;
4731 }
4732
4733 let next_out_of_line = decoder.next_out_of_line();
4734 let handles_before = decoder.remaining_handles();
4735 if let Some((inlined, num_bytes, num_handles)) =
4736 fidl::encoding::decode_envelope_header(decoder, next_offset)?
4737 {
4738 let member_inline_size =
4739 <DaiInterconnect as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4740 if inlined != (member_inline_size <= 4) {
4741 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4742 }
4743 let inner_offset;
4744 let mut inner_depth = depth.clone();
4745 if inlined {
4746 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4747 inner_offset = next_offset;
4748 } else {
4749 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4750 inner_depth.increment()?;
4751 }
4752 let val_ref = self
4753 .dai_interconnect
4754 .get_or_insert_with(|| fidl::new_empty!(DaiInterconnect, D));
4755 fidl::decode!(DaiInterconnect, D, val_ref, decoder, inner_offset, inner_depth)?;
4756 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4757 {
4758 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4759 }
4760 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4761 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4762 }
4763 }
4764
4765 next_offset += envelope_size;
4766 _next_ordinal_to_read += 1;
4767 if next_offset >= end_offset {
4768 return Ok(());
4769 }
4770
4771 while _next_ordinal_to_read < 4 {
4773 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4774 _next_ordinal_to_read += 1;
4775 next_offset += envelope_size;
4776 }
4777
4778 let next_out_of_line = decoder.next_out_of_line();
4779 let handles_before = decoder.remaining_handles();
4780 if let Some((inlined, num_bytes, num_handles)) =
4781 fidl::encoding::decode_envelope_header(decoder, next_offset)?
4782 {
4783 let member_inline_size =
4784 <ClockProperties as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4785 if inlined != (member_inline_size <= 4) {
4786 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4787 }
4788 let inner_offset;
4789 let mut inner_depth = depth.clone();
4790 if inlined {
4791 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4792 inner_offset = next_offset;
4793 } else {
4794 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4795 inner_depth.increment()?;
4796 }
4797 let val_ref = self
4798 .clock_properties
4799 .get_or_insert_with(|| fidl::new_empty!(ClockProperties, D));
4800 fidl::decode!(ClockProperties, D, val_ref, decoder, inner_offset, inner_depth)?;
4801 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4802 {
4803 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4804 }
4805 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4806 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4807 }
4808 }
4809
4810 next_offset += envelope_size;
4811
4812 while next_offset < end_offset {
4814 _next_ordinal_to_read += 1;
4815 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4816 next_offset += envelope_size;
4817 }
4818
4819 Ok(())
4820 }
4821 }
4822
4823 impl DaiInterconnect {
4824 #[inline(always)]
4825 fn max_ordinal_present(&self) -> u64 {
4826 if let Some(_) = self.dai_supported_formats {
4827 return 1;
4828 }
4829 0
4830 }
4831 }
4832
4833 impl fidl::encoding::ValueTypeMarker for DaiInterconnect {
4834 type Borrowed<'a> = &'a Self;
4835 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4836 value
4837 }
4838 }
4839
4840 unsafe impl fidl::encoding::TypeMarker for DaiInterconnect {
4841 type Owned = Self;
4842
4843 #[inline(always)]
4844 fn inline_align(_context: fidl::encoding::Context) -> usize {
4845 8
4846 }
4847
4848 #[inline(always)]
4849 fn inline_size(_context: fidl::encoding::Context) -> usize {
4850 16
4851 }
4852 }
4853
4854 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<DaiInterconnect, D>
4855 for &DaiInterconnect
4856 {
4857 unsafe fn encode(
4858 self,
4859 encoder: &mut fidl::encoding::Encoder<'_, D>,
4860 offset: usize,
4861 mut depth: fidl::encoding::Depth,
4862 ) -> fidl::Result<()> {
4863 encoder.debug_check_bounds::<DaiInterconnect>(offset);
4864 let max_ordinal: u64 = self.max_ordinal_present();
4866 encoder.write_num(max_ordinal, offset);
4867 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
4868 if max_ordinal == 0 {
4870 return Ok(());
4871 }
4872 depth.increment()?;
4873 let envelope_size = 8;
4874 let bytes_len = max_ordinal as usize * envelope_size;
4875 #[allow(unused_variables)]
4876 let offset = encoder.out_of_line_offset(bytes_len);
4877 let mut _prev_end_offset: usize = 0;
4878 if 1 > max_ordinal {
4879 return Ok(());
4880 }
4881
4882 let cur_offset: usize = (1 - 1) * envelope_size;
4885
4886 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4888
4889 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<fidl_fuchsia_hardware_audio::DaiSupportedFormats, 64>, D>(
4894 self.dai_supported_formats.as_ref().map(<fidl::encoding::Vector<fidl_fuchsia_hardware_audio::DaiSupportedFormats, 64> as fidl::encoding::ValueTypeMarker>::borrow),
4895 encoder, offset + cur_offset, depth
4896 )?;
4897
4898 _prev_end_offset = cur_offset + envelope_size;
4899
4900 Ok(())
4901 }
4902 }
4903
4904 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for DaiInterconnect {
4905 #[inline(always)]
4906 fn new_empty() -> Self {
4907 Self::default()
4908 }
4909
4910 unsafe fn decode(
4911 &mut self,
4912 decoder: &mut fidl::encoding::Decoder<'_, D>,
4913 offset: usize,
4914 mut depth: fidl::encoding::Depth,
4915 ) -> fidl::Result<()> {
4916 decoder.debug_check_bounds::<Self>(offset);
4917 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
4918 None => return Err(fidl::Error::NotNullable),
4919 Some(len) => len,
4920 };
4921 if len == 0 {
4923 return Ok(());
4924 };
4925 depth.increment()?;
4926 let envelope_size = 8;
4927 let bytes_len = len * envelope_size;
4928 let offset = decoder.out_of_line_offset(bytes_len)?;
4929 let mut _next_ordinal_to_read = 0;
4931 let mut next_offset = offset;
4932 let end_offset = offset + bytes_len;
4933 _next_ordinal_to_read += 1;
4934 if next_offset >= end_offset {
4935 return Ok(());
4936 }
4937
4938 while _next_ordinal_to_read < 1 {
4940 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4941 _next_ordinal_to_read += 1;
4942 next_offset += envelope_size;
4943 }
4944
4945 let next_out_of_line = decoder.next_out_of_line();
4946 let handles_before = decoder.remaining_handles();
4947 if let Some((inlined, num_bytes, num_handles)) =
4948 fidl::encoding::decode_envelope_header(decoder, next_offset)?
4949 {
4950 let member_inline_size = <fidl::encoding::Vector<
4951 fidl_fuchsia_hardware_audio::DaiSupportedFormats,
4952 64,
4953 > as fidl::encoding::TypeMarker>::inline_size(
4954 decoder.context
4955 );
4956 if inlined != (member_inline_size <= 4) {
4957 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4958 }
4959 let inner_offset;
4960 let mut inner_depth = depth.clone();
4961 if inlined {
4962 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4963 inner_offset = next_offset;
4964 } else {
4965 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4966 inner_depth.increment()?;
4967 }
4968 let val_ref =
4969 self.dai_supported_formats.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<fidl_fuchsia_hardware_audio::DaiSupportedFormats, 64>, D));
4970 fidl::decode!(fidl::encoding::Vector<fidl_fuchsia_hardware_audio::DaiSupportedFormats, 64>, D, val_ref, decoder, inner_offset, inner_depth)?;
4971 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4972 {
4973 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4974 }
4975 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4976 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4977 }
4978 }
4979
4980 next_offset += envelope_size;
4981
4982 while next_offset < end_offset {
4984 _next_ordinal_to_read += 1;
4985 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4986 next_offset += envelope_size;
4987 }
4988
4989 Ok(())
4990 }
4991 }
4992
4993 impl Direction {
4994 #[inline(always)]
4995 fn max_ordinal_present(&self) -> u64 {
4996 if let Some(_) = self.is_input {
4997 return 1;
4998 }
4999 0
5000 }
5001 }
5002
5003 impl fidl::encoding::ValueTypeMarker for Direction {
5004 type Borrowed<'a> = &'a Self;
5005 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
5006 value
5007 }
5008 }
5009
5010 unsafe impl fidl::encoding::TypeMarker for Direction {
5011 type Owned = Self;
5012
5013 #[inline(always)]
5014 fn inline_align(_context: fidl::encoding::Context) -> usize {
5015 8
5016 }
5017
5018 #[inline(always)]
5019 fn inline_size(_context: fidl::encoding::Context) -> usize {
5020 16
5021 }
5022 }
5023
5024 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Direction, D>
5025 for &Direction
5026 {
5027 unsafe fn encode(
5028 self,
5029 encoder: &mut fidl::encoding::Encoder<'_, D>,
5030 offset: usize,
5031 mut depth: fidl::encoding::Depth,
5032 ) -> fidl::Result<()> {
5033 encoder.debug_check_bounds::<Direction>(offset);
5034 let max_ordinal: u64 = self.max_ordinal_present();
5036 encoder.write_num(max_ordinal, offset);
5037 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
5038 if max_ordinal == 0 {
5040 return Ok(());
5041 }
5042 depth.increment()?;
5043 let envelope_size = 8;
5044 let bytes_len = max_ordinal as usize * envelope_size;
5045 #[allow(unused_variables)]
5046 let offset = encoder.out_of_line_offset(bytes_len);
5047 let mut _prev_end_offset: usize = 0;
5048 if 1 > max_ordinal {
5049 return Ok(());
5050 }
5051
5052 let cur_offset: usize = (1 - 1) * envelope_size;
5055
5056 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5058
5059 fidl::encoding::encode_in_envelope_optional::<bool, D>(
5064 self.is_input.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
5065 encoder,
5066 offset + cur_offset,
5067 depth,
5068 )?;
5069
5070 _prev_end_offset = cur_offset + envelope_size;
5071
5072 Ok(())
5073 }
5074 }
5075
5076 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Direction {
5077 #[inline(always)]
5078 fn new_empty() -> Self {
5079 Self::default()
5080 }
5081
5082 unsafe fn decode(
5083 &mut self,
5084 decoder: &mut fidl::encoding::Decoder<'_, D>,
5085 offset: usize,
5086 mut depth: fidl::encoding::Depth,
5087 ) -> fidl::Result<()> {
5088 decoder.debug_check_bounds::<Self>(offset);
5089 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
5090 None => return Err(fidl::Error::NotNullable),
5091 Some(len) => len,
5092 };
5093 if len == 0 {
5095 return Ok(());
5096 };
5097 depth.increment()?;
5098 let envelope_size = 8;
5099 let bytes_len = len * envelope_size;
5100 let offset = decoder.out_of_line_offset(bytes_len)?;
5101 let mut _next_ordinal_to_read = 0;
5103 let mut next_offset = offset;
5104 let end_offset = offset + bytes_len;
5105 _next_ordinal_to_read += 1;
5106 if next_offset >= end_offset {
5107 return Ok(());
5108 }
5109
5110 while _next_ordinal_to_read < 1 {
5112 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5113 _next_ordinal_to_read += 1;
5114 next_offset += envelope_size;
5115 }
5116
5117 let next_out_of_line = decoder.next_out_of_line();
5118 let handles_before = decoder.remaining_handles();
5119 if let Some((inlined, num_bytes, num_handles)) =
5120 fidl::encoding::decode_envelope_header(decoder, next_offset)?
5121 {
5122 let member_inline_size =
5123 <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5124 if inlined != (member_inline_size <= 4) {
5125 return Err(fidl::Error::InvalidInlineBitInEnvelope);
5126 }
5127 let inner_offset;
5128 let mut inner_depth = depth.clone();
5129 if inlined {
5130 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5131 inner_offset = next_offset;
5132 } else {
5133 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5134 inner_depth.increment()?;
5135 }
5136 let val_ref = self.is_input.get_or_insert_with(|| fidl::new_empty!(bool, D));
5137 fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
5138 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5139 {
5140 return Err(fidl::Error::InvalidNumBytesInEnvelope);
5141 }
5142 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5143 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5144 }
5145 }
5146
5147 next_offset += envelope_size;
5148
5149 while next_offset < end_offset {
5151 _next_ordinal_to_read += 1;
5152 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5153 next_offset += envelope_size;
5154 }
5155
5156 Ok(())
5157 }
5158 }
5159
5160 impl GainProperties {
5161 #[inline(always)]
5162 fn max_ordinal_present(&self) -> u64 {
5163 if let Some(_) = self.can_agc {
5164 return 6;
5165 }
5166 if let Some(_) = self.can_mute {
5167 return 5;
5168 }
5169 if let Some(_) = self.gain_step_db {
5170 return 4;
5171 }
5172 if let Some(_) = self.max_gain_db {
5173 return 3;
5174 }
5175 if let Some(_) = self.min_gain_db {
5176 return 2;
5177 }
5178 if let Some(_) = self.gain_state {
5179 return 1;
5180 }
5181 0
5182 }
5183 }
5184
5185 impl fidl::encoding::ValueTypeMarker for GainProperties {
5186 type Borrowed<'a> = &'a Self;
5187 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
5188 value
5189 }
5190 }
5191
5192 unsafe impl fidl::encoding::TypeMarker for GainProperties {
5193 type Owned = Self;
5194
5195 #[inline(always)]
5196 fn inline_align(_context: fidl::encoding::Context) -> usize {
5197 8
5198 }
5199
5200 #[inline(always)]
5201 fn inline_size(_context: fidl::encoding::Context) -> usize {
5202 16
5203 }
5204 }
5205
5206 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<GainProperties, D>
5207 for &GainProperties
5208 {
5209 unsafe fn encode(
5210 self,
5211 encoder: &mut fidl::encoding::Encoder<'_, D>,
5212 offset: usize,
5213 mut depth: fidl::encoding::Depth,
5214 ) -> fidl::Result<()> {
5215 encoder.debug_check_bounds::<GainProperties>(offset);
5216 let max_ordinal: u64 = self.max_ordinal_present();
5218 encoder.write_num(max_ordinal, offset);
5219 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
5220 if max_ordinal == 0 {
5222 return Ok(());
5223 }
5224 depth.increment()?;
5225 let envelope_size = 8;
5226 let bytes_len = max_ordinal as usize * envelope_size;
5227 #[allow(unused_variables)]
5228 let offset = encoder.out_of_line_offset(bytes_len);
5229 let mut _prev_end_offset: usize = 0;
5230 if 1 > max_ordinal {
5231 return Ok(());
5232 }
5233
5234 let cur_offset: usize = (1 - 1) * envelope_size;
5237
5238 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5240
5241 fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_hardware_audio::GainState, D>(
5246 self.gain_state.as_ref().map(<fidl_fuchsia_hardware_audio::GainState as fidl::encoding::ValueTypeMarker>::borrow),
5247 encoder, offset + cur_offset, depth
5248 )?;
5249
5250 _prev_end_offset = cur_offset + envelope_size;
5251 if 2 > max_ordinal {
5252 return Ok(());
5253 }
5254
5255 let cur_offset: usize = (2 - 1) * envelope_size;
5258
5259 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5261
5262 fidl::encoding::encode_in_envelope_optional::<f32, D>(
5267 self.min_gain_db.as_ref().map(<f32 as fidl::encoding::ValueTypeMarker>::borrow),
5268 encoder,
5269 offset + cur_offset,
5270 depth,
5271 )?;
5272
5273 _prev_end_offset = cur_offset + envelope_size;
5274 if 3 > max_ordinal {
5275 return Ok(());
5276 }
5277
5278 let cur_offset: usize = (3 - 1) * envelope_size;
5281
5282 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5284
5285 fidl::encoding::encode_in_envelope_optional::<f32, D>(
5290 self.max_gain_db.as_ref().map(<f32 as fidl::encoding::ValueTypeMarker>::borrow),
5291 encoder,
5292 offset + cur_offset,
5293 depth,
5294 )?;
5295
5296 _prev_end_offset = cur_offset + envelope_size;
5297 if 4 > max_ordinal {
5298 return Ok(());
5299 }
5300
5301 let cur_offset: usize = (4 - 1) * envelope_size;
5304
5305 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5307
5308 fidl::encoding::encode_in_envelope_optional::<f32, D>(
5313 self.gain_step_db.as_ref().map(<f32 as fidl::encoding::ValueTypeMarker>::borrow),
5314 encoder,
5315 offset + cur_offset,
5316 depth,
5317 )?;
5318
5319 _prev_end_offset = cur_offset + envelope_size;
5320 if 5 > max_ordinal {
5321 return Ok(());
5322 }
5323
5324 let cur_offset: usize = (5 - 1) * envelope_size;
5327
5328 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5330
5331 fidl::encoding::encode_in_envelope_optional::<bool, D>(
5336 self.can_mute.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
5337 encoder,
5338 offset + cur_offset,
5339 depth,
5340 )?;
5341
5342 _prev_end_offset = cur_offset + envelope_size;
5343 if 6 > max_ordinal {
5344 return Ok(());
5345 }
5346
5347 let cur_offset: usize = (6 - 1) * envelope_size;
5350
5351 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5353
5354 fidl::encoding::encode_in_envelope_optional::<bool, D>(
5359 self.can_agc.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
5360 encoder,
5361 offset + cur_offset,
5362 depth,
5363 )?;
5364
5365 _prev_end_offset = cur_offset + envelope_size;
5366
5367 Ok(())
5368 }
5369 }
5370
5371 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for GainProperties {
5372 #[inline(always)]
5373 fn new_empty() -> Self {
5374 Self::default()
5375 }
5376
5377 unsafe fn decode(
5378 &mut self,
5379 decoder: &mut fidl::encoding::Decoder<'_, D>,
5380 offset: usize,
5381 mut depth: fidl::encoding::Depth,
5382 ) -> fidl::Result<()> {
5383 decoder.debug_check_bounds::<Self>(offset);
5384 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
5385 None => return Err(fidl::Error::NotNullable),
5386 Some(len) => len,
5387 };
5388 if len == 0 {
5390 return Ok(());
5391 };
5392 depth.increment()?;
5393 let envelope_size = 8;
5394 let bytes_len = len * envelope_size;
5395 let offset = decoder.out_of_line_offset(bytes_len)?;
5396 let mut _next_ordinal_to_read = 0;
5398 let mut next_offset = offset;
5399 let end_offset = offset + bytes_len;
5400 _next_ordinal_to_read += 1;
5401 if next_offset >= end_offset {
5402 return Ok(());
5403 }
5404
5405 while _next_ordinal_to_read < 1 {
5407 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5408 _next_ordinal_to_read += 1;
5409 next_offset += envelope_size;
5410 }
5411
5412 let next_out_of_line = decoder.next_out_of_line();
5413 let handles_before = decoder.remaining_handles();
5414 if let Some((inlined, num_bytes, num_handles)) =
5415 fidl::encoding::decode_envelope_header(decoder, next_offset)?
5416 {
5417 let member_inline_size = <fidl_fuchsia_hardware_audio::GainState as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5418 if inlined != (member_inline_size <= 4) {
5419 return Err(fidl::Error::InvalidInlineBitInEnvelope);
5420 }
5421 let inner_offset;
5422 let mut inner_depth = depth.clone();
5423 if inlined {
5424 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5425 inner_offset = next_offset;
5426 } else {
5427 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5428 inner_depth.increment()?;
5429 }
5430 let val_ref = self.gain_state.get_or_insert_with(|| {
5431 fidl::new_empty!(fidl_fuchsia_hardware_audio::GainState, D)
5432 });
5433 fidl::decode!(
5434 fidl_fuchsia_hardware_audio::GainState,
5435 D,
5436 val_ref,
5437 decoder,
5438 inner_offset,
5439 inner_depth
5440 )?;
5441 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5442 {
5443 return Err(fidl::Error::InvalidNumBytesInEnvelope);
5444 }
5445 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5446 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5447 }
5448 }
5449
5450 next_offset += envelope_size;
5451 _next_ordinal_to_read += 1;
5452 if next_offset >= end_offset {
5453 return Ok(());
5454 }
5455
5456 while _next_ordinal_to_read < 2 {
5458 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5459 _next_ordinal_to_read += 1;
5460 next_offset += envelope_size;
5461 }
5462
5463 let next_out_of_line = decoder.next_out_of_line();
5464 let handles_before = decoder.remaining_handles();
5465 if let Some((inlined, num_bytes, num_handles)) =
5466 fidl::encoding::decode_envelope_header(decoder, next_offset)?
5467 {
5468 let member_inline_size =
5469 <f32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5470 if inlined != (member_inline_size <= 4) {
5471 return Err(fidl::Error::InvalidInlineBitInEnvelope);
5472 }
5473 let inner_offset;
5474 let mut inner_depth = depth.clone();
5475 if inlined {
5476 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5477 inner_offset = next_offset;
5478 } else {
5479 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5480 inner_depth.increment()?;
5481 }
5482 let val_ref = self.min_gain_db.get_or_insert_with(|| fidl::new_empty!(f32, D));
5483 fidl::decode!(f32, D, val_ref, decoder, inner_offset, inner_depth)?;
5484 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5485 {
5486 return Err(fidl::Error::InvalidNumBytesInEnvelope);
5487 }
5488 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5489 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5490 }
5491 }
5492
5493 next_offset += envelope_size;
5494 _next_ordinal_to_read += 1;
5495 if next_offset >= end_offset {
5496 return Ok(());
5497 }
5498
5499 while _next_ordinal_to_read < 3 {
5501 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5502 _next_ordinal_to_read += 1;
5503 next_offset += envelope_size;
5504 }
5505
5506 let next_out_of_line = decoder.next_out_of_line();
5507 let handles_before = decoder.remaining_handles();
5508 if let Some((inlined, num_bytes, num_handles)) =
5509 fidl::encoding::decode_envelope_header(decoder, next_offset)?
5510 {
5511 let member_inline_size =
5512 <f32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5513 if inlined != (member_inline_size <= 4) {
5514 return Err(fidl::Error::InvalidInlineBitInEnvelope);
5515 }
5516 let inner_offset;
5517 let mut inner_depth = depth.clone();
5518 if inlined {
5519 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5520 inner_offset = next_offset;
5521 } else {
5522 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5523 inner_depth.increment()?;
5524 }
5525 let val_ref = self.max_gain_db.get_or_insert_with(|| fidl::new_empty!(f32, D));
5526 fidl::decode!(f32, D, val_ref, decoder, inner_offset, inner_depth)?;
5527 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5528 {
5529 return Err(fidl::Error::InvalidNumBytesInEnvelope);
5530 }
5531 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5532 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5533 }
5534 }
5535
5536 next_offset += envelope_size;
5537 _next_ordinal_to_read += 1;
5538 if next_offset >= end_offset {
5539 return Ok(());
5540 }
5541
5542 while _next_ordinal_to_read < 4 {
5544 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5545 _next_ordinal_to_read += 1;
5546 next_offset += envelope_size;
5547 }
5548
5549 let next_out_of_line = decoder.next_out_of_line();
5550 let handles_before = decoder.remaining_handles();
5551 if let Some((inlined, num_bytes, num_handles)) =
5552 fidl::encoding::decode_envelope_header(decoder, next_offset)?
5553 {
5554 let member_inline_size =
5555 <f32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5556 if inlined != (member_inline_size <= 4) {
5557 return Err(fidl::Error::InvalidInlineBitInEnvelope);
5558 }
5559 let inner_offset;
5560 let mut inner_depth = depth.clone();
5561 if inlined {
5562 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5563 inner_offset = next_offset;
5564 } else {
5565 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5566 inner_depth.increment()?;
5567 }
5568 let val_ref = self.gain_step_db.get_or_insert_with(|| fidl::new_empty!(f32, D));
5569 fidl::decode!(f32, D, val_ref, decoder, inner_offset, inner_depth)?;
5570 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5571 {
5572 return Err(fidl::Error::InvalidNumBytesInEnvelope);
5573 }
5574 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5575 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5576 }
5577 }
5578
5579 next_offset += envelope_size;
5580 _next_ordinal_to_read += 1;
5581 if next_offset >= end_offset {
5582 return Ok(());
5583 }
5584
5585 while _next_ordinal_to_read < 5 {
5587 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5588 _next_ordinal_to_read += 1;
5589 next_offset += envelope_size;
5590 }
5591
5592 let next_out_of_line = decoder.next_out_of_line();
5593 let handles_before = decoder.remaining_handles();
5594 if let Some((inlined, num_bytes, num_handles)) =
5595 fidl::encoding::decode_envelope_header(decoder, next_offset)?
5596 {
5597 let member_inline_size =
5598 <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5599 if inlined != (member_inline_size <= 4) {
5600 return Err(fidl::Error::InvalidInlineBitInEnvelope);
5601 }
5602 let inner_offset;
5603 let mut inner_depth = depth.clone();
5604 if inlined {
5605 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5606 inner_offset = next_offset;
5607 } else {
5608 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5609 inner_depth.increment()?;
5610 }
5611 let val_ref = self.can_mute.get_or_insert_with(|| fidl::new_empty!(bool, D));
5612 fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
5613 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5614 {
5615 return Err(fidl::Error::InvalidNumBytesInEnvelope);
5616 }
5617 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5618 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5619 }
5620 }
5621
5622 next_offset += envelope_size;
5623 _next_ordinal_to_read += 1;
5624 if next_offset >= end_offset {
5625 return Ok(());
5626 }
5627
5628 while _next_ordinal_to_read < 6 {
5630 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5631 _next_ordinal_to_read += 1;
5632 next_offset += envelope_size;
5633 }
5634
5635 let next_out_of_line = decoder.next_out_of_line();
5636 let handles_before = decoder.remaining_handles();
5637 if let Some((inlined, num_bytes, num_handles)) =
5638 fidl::encoding::decode_envelope_header(decoder, next_offset)?
5639 {
5640 let member_inline_size =
5641 <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5642 if inlined != (member_inline_size <= 4) {
5643 return Err(fidl::Error::InvalidInlineBitInEnvelope);
5644 }
5645 let inner_offset;
5646 let mut inner_depth = depth.clone();
5647 if inlined {
5648 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5649 inner_offset = next_offset;
5650 } else {
5651 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5652 inner_depth.increment()?;
5653 }
5654 let val_ref = self.can_agc.get_or_insert_with(|| fidl::new_empty!(bool, D));
5655 fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
5656 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5657 {
5658 return Err(fidl::Error::InvalidNumBytesInEnvelope);
5659 }
5660 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5661 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5662 }
5663 }
5664
5665 next_offset += envelope_size;
5666
5667 while next_offset < end_offset {
5669 _next_ordinal_to_read += 1;
5670 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5671 next_offset += envelope_size;
5672 }
5673
5674 Ok(())
5675 }
5676 }
5677
5678 impl PlugProperties {
5679 #[inline(always)]
5680 fn max_ordinal_present(&self) -> u64 {
5681 if let Some(_) = self.plug_detect_capabilities {
5682 return 2;
5683 }
5684 if let Some(_) = self.plug_state {
5685 return 1;
5686 }
5687 0
5688 }
5689 }
5690
5691 impl fidl::encoding::ValueTypeMarker for PlugProperties {
5692 type Borrowed<'a> = &'a Self;
5693 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
5694 value
5695 }
5696 }
5697
5698 unsafe impl fidl::encoding::TypeMarker for PlugProperties {
5699 type Owned = Self;
5700
5701 #[inline(always)]
5702 fn inline_align(_context: fidl::encoding::Context) -> usize {
5703 8
5704 }
5705
5706 #[inline(always)]
5707 fn inline_size(_context: fidl::encoding::Context) -> usize {
5708 16
5709 }
5710 }
5711
5712 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<PlugProperties, D>
5713 for &PlugProperties
5714 {
5715 unsafe fn encode(
5716 self,
5717 encoder: &mut fidl::encoding::Encoder<'_, D>,
5718 offset: usize,
5719 mut depth: fidl::encoding::Depth,
5720 ) -> fidl::Result<()> {
5721 encoder.debug_check_bounds::<PlugProperties>(offset);
5722 let max_ordinal: u64 = self.max_ordinal_present();
5724 encoder.write_num(max_ordinal, offset);
5725 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
5726 if max_ordinal == 0 {
5728 return Ok(());
5729 }
5730 depth.increment()?;
5731 let envelope_size = 8;
5732 let bytes_len = max_ordinal as usize * envelope_size;
5733 #[allow(unused_variables)]
5734 let offset = encoder.out_of_line_offset(bytes_len);
5735 let mut _prev_end_offset: usize = 0;
5736 if 1 > max_ordinal {
5737 return Ok(());
5738 }
5739
5740 let cur_offset: usize = (1 - 1) * envelope_size;
5743
5744 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5746
5747 fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_hardware_audio::PlugState, D>(
5752 self.plug_state.as_ref().map(<fidl_fuchsia_hardware_audio::PlugState as fidl::encoding::ValueTypeMarker>::borrow),
5753 encoder, offset + cur_offset, depth
5754 )?;
5755
5756 _prev_end_offset = cur_offset + envelope_size;
5757 if 2 > max_ordinal {
5758 return Ok(());
5759 }
5760
5761 let cur_offset: usize = (2 - 1) * envelope_size;
5764
5765 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5767
5768 fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_hardware_audio::PlugDetectCapabilities, D>(
5773 self.plug_detect_capabilities.as_ref().map(<fidl_fuchsia_hardware_audio::PlugDetectCapabilities as fidl::encoding::ValueTypeMarker>::borrow),
5774 encoder, offset + cur_offset, depth
5775 )?;
5776
5777 _prev_end_offset = cur_offset + envelope_size;
5778
5779 Ok(())
5780 }
5781 }
5782
5783 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for PlugProperties {
5784 #[inline(always)]
5785 fn new_empty() -> Self {
5786 Self::default()
5787 }
5788
5789 unsafe fn decode(
5790 &mut self,
5791 decoder: &mut fidl::encoding::Decoder<'_, D>,
5792 offset: usize,
5793 mut depth: fidl::encoding::Depth,
5794 ) -> fidl::Result<()> {
5795 decoder.debug_check_bounds::<Self>(offset);
5796 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
5797 None => return Err(fidl::Error::NotNullable),
5798 Some(len) => len,
5799 };
5800 if len == 0 {
5802 return Ok(());
5803 };
5804 depth.increment()?;
5805 let envelope_size = 8;
5806 let bytes_len = len * envelope_size;
5807 let offset = decoder.out_of_line_offset(bytes_len)?;
5808 let mut _next_ordinal_to_read = 0;
5810 let mut next_offset = offset;
5811 let end_offset = offset + bytes_len;
5812 _next_ordinal_to_read += 1;
5813 if next_offset >= end_offset {
5814 return Ok(());
5815 }
5816
5817 while _next_ordinal_to_read < 1 {
5819 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5820 _next_ordinal_to_read += 1;
5821 next_offset += envelope_size;
5822 }
5823
5824 let next_out_of_line = decoder.next_out_of_line();
5825 let handles_before = decoder.remaining_handles();
5826 if let Some((inlined, num_bytes, num_handles)) =
5827 fidl::encoding::decode_envelope_header(decoder, next_offset)?
5828 {
5829 let member_inline_size = <fidl_fuchsia_hardware_audio::PlugState as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5830 if inlined != (member_inline_size <= 4) {
5831 return Err(fidl::Error::InvalidInlineBitInEnvelope);
5832 }
5833 let inner_offset;
5834 let mut inner_depth = depth.clone();
5835 if inlined {
5836 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5837 inner_offset = next_offset;
5838 } else {
5839 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5840 inner_depth.increment()?;
5841 }
5842 let val_ref = self.plug_state.get_or_insert_with(|| {
5843 fidl::new_empty!(fidl_fuchsia_hardware_audio::PlugState, D)
5844 });
5845 fidl::decode!(
5846 fidl_fuchsia_hardware_audio::PlugState,
5847 D,
5848 val_ref,
5849 decoder,
5850 inner_offset,
5851 inner_depth
5852 )?;
5853 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5854 {
5855 return Err(fidl::Error::InvalidNumBytesInEnvelope);
5856 }
5857 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5858 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5859 }
5860 }
5861
5862 next_offset += envelope_size;
5863 _next_ordinal_to_read += 1;
5864 if next_offset >= end_offset {
5865 return Ok(());
5866 }
5867
5868 while _next_ordinal_to_read < 2 {
5870 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5871 _next_ordinal_to_read += 1;
5872 next_offset += envelope_size;
5873 }
5874
5875 let next_out_of_line = decoder.next_out_of_line();
5876 let handles_before = decoder.remaining_handles();
5877 if let Some((inlined, num_bytes, num_handles)) =
5878 fidl::encoding::decode_envelope_header(decoder, next_offset)?
5879 {
5880 let member_inline_size = <fidl_fuchsia_hardware_audio::PlugDetectCapabilities as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5881 if inlined != (member_inline_size <= 4) {
5882 return Err(fidl::Error::InvalidInlineBitInEnvelope);
5883 }
5884 let inner_offset;
5885 let mut inner_depth = depth.clone();
5886 if inlined {
5887 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5888 inner_offset = next_offset;
5889 } else {
5890 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5891 inner_depth.increment()?;
5892 }
5893 let val_ref = self.plug_detect_capabilities.get_or_insert_with(|| {
5894 fidl::new_empty!(fidl_fuchsia_hardware_audio::PlugDetectCapabilities, D)
5895 });
5896 fidl::decode!(
5897 fidl_fuchsia_hardware_audio::PlugDetectCapabilities,
5898 D,
5899 val_ref,
5900 decoder,
5901 inner_offset,
5902 inner_depth
5903 )?;
5904 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5905 {
5906 return Err(fidl::Error::InvalidNumBytesInEnvelope);
5907 }
5908 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5909 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5910 }
5911 }
5912
5913 next_offset += envelope_size;
5914
5915 while next_offset < end_offset {
5917 _next_ordinal_to_read += 1;
5918 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5919 next_offset += envelope_size;
5920 }
5921
5922 Ok(())
5923 }
5924 }
5925
5926 impl RingBuffer {
5927 #[inline(always)]
5928 fn max_ordinal_present(&self) -> u64 {
5929 if let Some(_) = self.notifications_per_ring {
5930 return 6;
5931 }
5932 if let Some(_) = self.ring_buffer_constraints {
5933 return 5;
5934 }
5935 if let Some(_) = self.supported_formats {
5936 return 4;
5937 }
5938 if let Some(_) = self.external_delay {
5939 return 3;
5940 }
5941 if let Some(_) = self.internal_delay {
5942 return 2;
5943 }
5944 if let Some(_) = self.driver_transfer_bytes {
5945 return 1;
5946 }
5947 0
5948 }
5949 }
5950
5951 impl fidl::encoding::ValueTypeMarker for RingBuffer {
5952 type Borrowed<'a> = &'a Self;
5953 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
5954 value
5955 }
5956 }
5957
5958 unsafe impl fidl::encoding::TypeMarker for RingBuffer {
5959 type Owned = Self;
5960
5961 #[inline(always)]
5962 fn inline_align(_context: fidl::encoding::Context) -> usize {
5963 8
5964 }
5965
5966 #[inline(always)]
5967 fn inline_size(_context: fidl::encoding::Context) -> usize {
5968 16
5969 }
5970 }
5971
5972 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<RingBuffer, D>
5973 for &RingBuffer
5974 {
5975 unsafe fn encode(
5976 self,
5977 encoder: &mut fidl::encoding::Encoder<'_, D>,
5978 offset: usize,
5979 mut depth: fidl::encoding::Depth,
5980 ) -> fidl::Result<()> {
5981 encoder.debug_check_bounds::<RingBuffer>(offset);
5982 let max_ordinal: u64 = self.max_ordinal_present();
5984 encoder.write_num(max_ordinal, offset);
5985 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
5986 if max_ordinal == 0 {
5988 return Ok(());
5989 }
5990 depth.increment()?;
5991 let envelope_size = 8;
5992 let bytes_len = max_ordinal as usize * envelope_size;
5993 #[allow(unused_variables)]
5994 let offset = encoder.out_of_line_offset(bytes_len);
5995 let mut _prev_end_offset: usize = 0;
5996 if 1 > max_ordinal {
5997 return Ok(());
5998 }
5999
6000 let cur_offset: usize = (1 - 1) * envelope_size;
6003
6004 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6006
6007 fidl::encoding::encode_in_envelope_optional::<u32, D>(
6012 self.driver_transfer_bytes
6013 .as_ref()
6014 .map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
6015 encoder,
6016 offset + cur_offset,
6017 depth,
6018 )?;
6019
6020 _prev_end_offset = cur_offset + envelope_size;
6021 if 2 > max_ordinal {
6022 return Ok(());
6023 }
6024
6025 let cur_offset: usize = (2 - 1) * envelope_size;
6028
6029 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6031
6032 fidl::encoding::encode_in_envelope_optional::<i64, D>(
6037 self.internal_delay.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
6038 encoder,
6039 offset + cur_offset,
6040 depth,
6041 )?;
6042
6043 _prev_end_offset = cur_offset + envelope_size;
6044 if 3 > max_ordinal {
6045 return Ok(());
6046 }
6047
6048 let cur_offset: usize = (3 - 1) * envelope_size;
6051
6052 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6054
6055 fidl::encoding::encode_in_envelope_optional::<i64, D>(
6060 self.external_delay.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
6061 encoder,
6062 offset + cur_offset,
6063 depth,
6064 )?;
6065
6066 _prev_end_offset = cur_offset + envelope_size;
6067 if 4 > max_ordinal {
6068 return Ok(());
6069 }
6070
6071 let cur_offset: usize = (4 - 1) * envelope_size;
6074
6075 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6077
6078 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<FormatRange, 64>, D>(
6083 self.supported_formats.as_ref().map(<fidl::encoding::Vector<FormatRange, 64> as fidl::encoding::ValueTypeMarker>::borrow),
6084 encoder, offset + cur_offset, depth
6085 )?;
6086
6087 _prev_end_offset = cur_offset + envelope_size;
6088 if 5 > max_ordinal {
6089 return Ok(());
6090 }
6091
6092 let cur_offset: usize = (5 - 1) * envelope_size;
6095
6096 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6098
6099 fidl::encoding::encode_in_envelope_optional::<RingBufferConstraints, D>(
6104 self.ring_buffer_constraints
6105 .as_ref()
6106 .map(<RingBufferConstraints as fidl::encoding::ValueTypeMarker>::borrow),
6107 encoder,
6108 offset + cur_offset,
6109 depth,
6110 )?;
6111
6112 _prev_end_offset = cur_offset + envelope_size;
6113 if 6 > max_ordinal {
6114 return Ok(());
6115 }
6116
6117 let cur_offset: usize = (6 - 1) * envelope_size;
6120
6121 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6123
6124 fidl::encoding::encode_in_envelope_optional::<u32, D>(
6129 self.notifications_per_ring
6130 .as_ref()
6131 .map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
6132 encoder,
6133 offset + cur_offset,
6134 depth,
6135 )?;
6136
6137 _prev_end_offset = cur_offset + envelope_size;
6138
6139 Ok(())
6140 }
6141 }
6142
6143 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for RingBuffer {
6144 #[inline(always)]
6145 fn new_empty() -> Self {
6146 Self::default()
6147 }
6148
6149 unsafe fn decode(
6150 &mut self,
6151 decoder: &mut fidl::encoding::Decoder<'_, D>,
6152 offset: usize,
6153 mut depth: fidl::encoding::Depth,
6154 ) -> fidl::Result<()> {
6155 decoder.debug_check_bounds::<Self>(offset);
6156 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
6157 None => return Err(fidl::Error::NotNullable),
6158 Some(len) => len,
6159 };
6160 if len == 0 {
6162 return Ok(());
6163 };
6164 depth.increment()?;
6165 let envelope_size = 8;
6166 let bytes_len = len * envelope_size;
6167 let offset = decoder.out_of_line_offset(bytes_len)?;
6168 let mut _next_ordinal_to_read = 0;
6170 let mut next_offset = offset;
6171 let end_offset = offset + bytes_len;
6172 _next_ordinal_to_read += 1;
6173 if next_offset >= end_offset {
6174 return Ok(());
6175 }
6176
6177 while _next_ordinal_to_read < 1 {
6179 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6180 _next_ordinal_to_read += 1;
6181 next_offset += envelope_size;
6182 }
6183
6184 let next_out_of_line = decoder.next_out_of_line();
6185 let handles_before = decoder.remaining_handles();
6186 if let Some((inlined, num_bytes, num_handles)) =
6187 fidl::encoding::decode_envelope_header(decoder, next_offset)?
6188 {
6189 let member_inline_size =
6190 <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
6191 if inlined != (member_inline_size <= 4) {
6192 return Err(fidl::Error::InvalidInlineBitInEnvelope);
6193 }
6194 let inner_offset;
6195 let mut inner_depth = depth.clone();
6196 if inlined {
6197 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6198 inner_offset = next_offset;
6199 } else {
6200 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6201 inner_depth.increment()?;
6202 }
6203 let val_ref =
6204 self.driver_transfer_bytes.get_or_insert_with(|| fidl::new_empty!(u32, D));
6205 fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
6206 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6207 {
6208 return Err(fidl::Error::InvalidNumBytesInEnvelope);
6209 }
6210 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6211 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6212 }
6213 }
6214
6215 next_offset += envelope_size;
6216 _next_ordinal_to_read += 1;
6217 if next_offset >= end_offset {
6218 return Ok(());
6219 }
6220
6221 while _next_ordinal_to_read < 2 {
6223 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6224 _next_ordinal_to_read += 1;
6225 next_offset += envelope_size;
6226 }
6227
6228 let next_out_of_line = decoder.next_out_of_line();
6229 let handles_before = decoder.remaining_handles();
6230 if let Some((inlined, num_bytes, num_handles)) =
6231 fidl::encoding::decode_envelope_header(decoder, next_offset)?
6232 {
6233 let member_inline_size =
6234 <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
6235 if inlined != (member_inline_size <= 4) {
6236 return Err(fidl::Error::InvalidInlineBitInEnvelope);
6237 }
6238 let inner_offset;
6239 let mut inner_depth = depth.clone();
6240 if inlined {
6241 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6242 inner_offset = next_offset;
6243 } else {
6244 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6245 inner_depth.increment()?;
6246 }
6247 let val_ref = self.internal_delay.get_or_insert_with(|| fidl::new_empty!(i64, D));
6248 fidl::decode!(i64, D, val_ref, decoder, inner_offset, inner_depth)?;
6249 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6250 {
6251 return Err(fidl::Error::InvalidNumBytesInEnvelope);
6252 }
6253 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6254 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6255 }
6256 }
6257
6258 next_offset += envelope_size;
6259 _next_ordinal_to_read += 1;
6260 if next_offset >= end_offset {
6261 return Ok(());
6262 }
6263
6264 while _next_ordinal_to_read < 3 {
6266 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6267 _next_ordinal_to_read += 1;
6268 next_offset += envelope_size;
6269 }
6270
6271 let next_out_of_line = decoder.next_out_of_line();
6272 let handles_before = decoder.remaining_handles();
6273 if let Some((inlined, num_bytes, num_handles)) =
6274 fidl::encoding::decode_envelope_header(decoder, next_offset)?
6275 {
6276 let member_inline_size =
6277 <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
6278 if inlined != (member_inline_size <= 4) {
6279 return Err(fidl::Error::InvalidInlineBitInEnvelope);
6280 }
6281 let inner_offset;
6282 let mut inner_depth = depth.clone();
6283 if inlined {
6284 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6285 inner_offset = next_offset;
6286 } else {
6287 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6288 inner_depth.increment()?;
6289 }
6290 let val_ref = self.external_delay.get_or_insert_with(|| fidl::new_empty!(i64, D));
6291 fidl::decode!(i64, D, val_ref, decoder, inner_offset, inner_depth)?;
6292 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6293 {
6294 return Err(fidl::Error::InvalidNumBytesInEnvelope);
6295 }
6296 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6297 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6298 }
6299 }
6300
6301 next_offset += envelope_size;
6302 _next_ordinal_to_read += 1;
6303 if next_offset >= end_offset {
6304 return Ok(());
6305 }
6306
6307 while _next_ordinal_to_read < 4 {
6309 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6310 _next_ordinal_to_read += 1;
6311 next_offset += envelope_size;
6312 }
6313
6314 let next_out_of_line = decoder.next_out_of_line();
6315 let handles_before = decoder.remaining_handles();
6316 if let Some((inlined, num_bytes, num_handles)) =
6317 fidl::encoding::decode_envelope_header(decoder, next_offset)?
6318 {
6319 let member_inline_size = <fidl::encoding::Vector<FormatRange, 64> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
6320 if inlined != (member_inline_size <= 4) {
6321 return Err(fidl::Error::InvalidInlineBitInEnvelope);
6322 }
6323 let inner_offset;
6324 let mut inner_depth = depth.clone();
6325 if inlined {
6326 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6327 inner_offset = next_offset;
6328 } else {
6329 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6330 inner_depth.increment()?;
6331 }
6332 let val_ref = self.supported_formats.get_or_insert_with(
6333 || fidl::new_empty!(fidl::encoding::Vector<FormatRange, 64>, D),
6334 );
6335 fidl::decode!(fidl::encoding::Vector<FormatRange, 64>, D, val_ref, decoder, inner_offset, inner_depth)?;
6336 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6337 {
6338 return Err(fidl::Error::InvalidNumBytesInEnvelope);
6339 }
6340 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6341 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6342 }
6343 }
6344
6345 next_offset += envelope_size;
6346 _next_ordinal_to_read += 1;
6347 if next_offset >= end_offset {
6348 return Ok(());
6349 }
6350
6351 while _next_ordinal_to_read < 5 {
6353 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6354 _next_ordinal_to_read += 1;
6355 next_offset += envelope_size;
6356 }
6357
6358 let next_out_of_line = decoder.next_out_of_line();
6359 let handles_before = decoder.remaining_handles();
6360 if let Some((inlined, num_bytes, num_handles)) =
6361 fidl::encoding::decode_envelope_header(decoder, next_offset)?
6362 {
6363 let member_inline_size =
6364 <RingBufferConstraints as fidl::encoding::TypeMarker>::inline_size(
6365 decoder.context,
6366 );
6367 if inlined != (member_inline_size <= 4) {
6368 return Err(fidl::Error::InvalidInlineBitInEnvelope);
6369 }
6370 let inner_offset;
6371 let mut inner_depth = depth.clone();
6372 if inlined {
6373 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6374 inner_offset = next_offset;
6375 } else {
6376 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6377 inner_depth.increment()?;
6378 }
6379 let val_ref = self
6380 .ring_buffer_constraints
6381 .get_or_insert_with(|| fidl::new_empty!(RingBufferConstraints, D));
6382 fidl::decode!(
6383 RingBufferConstraints,
6384 D,
6385 val_ref,
6386 decoder,
6387 inner_offset,
6388 inner_depth
6389 )?;
6390 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6391 {
6392 return Err(fidl::Error::InvalidNumBytesInEnvelope);
6393 }
6394 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6395 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6396 }
6397 }
6398
6399 next_offset += envelope_size;
6400 _next_ordinal_to_read += 1;
6401 if next_offset >= end_offset {
6402 return Ok(());
6403 }
6404
6405 while _next_ordinal_to_read < 6 {
6407 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6408 _next_ordinal_to_read += 1;
6409 next_offset += envelope_size;
6410 }
6411
6412 let next_out_of_line = decoder.next_out_of_line();
6413 let handles_before = decoder.remaining_handles();
6414 if let Some((inlined, num_bytes, num_handles)) =
6415 fidl::encoding::decode_envelope_header(decoder, next_offset)?
6416 {
6417 let member_inline_size =
6418 <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
6419 if inlined != (member_inline_size <= 4) {
6420 return Err(fidl::Error::InvalidInlineBitInEnvelope);
6421 }
6422 let inner_offset;
6423 let mut inner_depth = depth.clone();
6424 if inlined {
6425 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6426 inner_offset = next_offset;
6427 } else {
6428 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6429 inner_depth.increment()?;
6430 }
6431 let val_ref =
6432 self.notifications_per_ring.get_or_insert_with(|| fidl::new_empty!(u32, D));
6433 fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
6434 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6435 {
6436 return Err(fidl::Error::InvalidNumBytesInEnvelope);
6437 }
6438 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6439 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6440 }
6441 }
6442
6443 next_offset += envelope_size;
6444
6445 while next_offset < end_offset {
6447 _next_ordinal_to_read += 1;
6448 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6449 next_offset += envelope_size;
6450 }
6451
6452 Ok(())
6453 }
6454 }
6455
6456 impl StreamConfig {
6457 #[inline(always)]
6458 fn max_ordinal_present(&self) -> u64 {
6459 if let Some(_) = self.plug_properties {
6460 return 5;
6461 }
6462 if let Some(_) = self.gain_properties {
6463 return 4;
6464 }
6465 if let Some(_) = self.clock_properties {
6466 return 3;
6467 }
6468 if let Some(_) = self.ring_buffer {
6469 return 2;
6470 }
6471 if let Some(_) = self.is_input {
6472 return 1;
6473 }
6474 0
6475 }
6476 }
6477
6478 impl fidl::encoding::ValueTypeMarker for StreamConfig {
6479 type Borrowed<'a> = &'a Self;
6480 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
6481 value
6482 }
6483 }
6484
6485 unsafe impl fidl::encoding::TypeMarker for StreamConfig {
6486 type Owned = Self;
6487
6488 #[inline(always)]
6489 fn inline_align(_context: fidl::encoding::Context) -> usize {
6490 8
6491 }
6492
6493 #[inline(always)]
6494 fn inline_size(_context: fidl::encoding::Context) -> usize {
6495 16
6496 }
6497 }
6498
6499 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<StreamConfig, D>
6500 for &StreamConfig
6501 {
6502 unsafe fn encode(
6503 self,
6504 encoder: &mut fidl::encoding::Encoder<'_, D>,
6505 offset: usize,
6506 mut depth: fidl::encoding::Depth,
6507 ) -> fidl::Result<()> {
6508 encoder.debug_check_bounds::<StreamConfig>(offset);
6509 let max_ordinal: u64 = self.max_ordinal_present();
6511 encoder.write_num(max_ordinal, offset);
6512 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
6513 if max_ordinal == 0 {
6515 return Ok(());
6516 }
6517 depth.increment()?;
6518 let envelope_size = 8;
6519 let bytes_len = max_ordinal as usize * envelope_size;
6520 #[allow(unused_variables)]
6521 let offset = encoder.out_of_line_offset(bytes_len);
6522 let mut _prev_end_offset: usize = 0;
6523 if 1 > max_ordinal {
6524 return Ok(());
6525 }
6526
6527 let cur_offset: usize = (1 - 1) * envelope_size;
6530
6531 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6533
6534 fidl::encoding::encode_in_envelope_optional::<bool, D>(
6539 self.is_input.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
6540 encoder,
6541 offset + cur_offset,
6542 depth,
6543 )?;
6544
6545 _prev_end_offset = cur_offset + envelope_size;
6546 if 2 > max_ordinal {
6547 return Ok(());
6548 }
6549
6550 let cur_offset: usize = (2 - 1) * envelope_size;
6553
6554 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6556
6557 fidl::encoding::encode_in_envelope_optional::<RingBuffer, D>(
6562 self.ring_buffer
6563 .as_ref()
6564 .map(<RingBuffer as fidl::encoding::ValueTypeMarker>::borrow),
6565 encoder,
6566 offset + cur_offset,
6567 depth,
6568 )?;
6569
6570 _prev_end_offset = cur_offset + envelope_size;
6571 if 3 > max_ordinal {
6572 return Ok(());
6573 }
6574
6575 let cur_offset: usize = (3 - 1) * envelope_size;
6578
6579 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6581
6582 fidl::encoding::encode_in_envelope_optional::<ClockProperties, D>(
6587 self.clock_properties
6588 .as_ref()
6589 .map(<ClockProperties as fidl::encoding::ValueTypeMarker>::borrow),
6590 encoder,
6591 offset + cur_offset,
6592 depth,
6593 )?;
6594
6595 _prev_end_offset = cur_offset + envelope_size;
6596 if 4 > max_ordinal {
6597 return Ok(());
6598 }
6599
6600 let cur_offset: usize = (4 - 1) * envelope_size;
6603
6604 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6606
6607 fidl::encoding::encode_in_envelope_optional::<GainProperties, D>(
6612 self.gain_properties
6613 .as_ref()
6614 .map(<GainProperties as fidl::encoding::ValueTypeMarker>::borrow),
6615 encoder,
6616 offset + cur_offset,
6617 depth,
6618 )?;
6619
6620 _prev_end_offset = cur_offset + envelope_size;
6621 if 5 > max_ordinal {
6622 return Ok(());
6623 }
6624
6625 let cur_offset: usize = (5 - 1) * envelope_size;
6628
6629 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6631
6632 fidl::encoding::encode_in_envelope_optional::<PlugProperties, D>(
6637 self.plug_properties
6638 .as_ref()
6639 .map(<PlugProperties as fidl::encoding::ValueTypeMarker>::borrow),
6640 encoder,
6641 offset + cur_offset,
6642 depth,
6643 )?;
6644
6645 _prev_end_offset = cur_offset + envelope_size;
6646
6647 Ok(())
6648 }
6649 }
6650
6651 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for StreamConfig {
6652 #[inline(always)]
6653 fn new_empty() -> Self {
6654 Self::default()
6655 }
6656
6657 unsafe fn decode(
6658 &mut self,
6659 decoder: &mut fidl::encoding::Decoder<'_, D>,
6660 offset: usize,
6661 mut depth: fidl::encoding::Depth,
6662 ) -> fidl::Result<()> {
6663 decoder.debug_check_bounds::<Self>(offset);
6664 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
6665 None => return Err(fidl::Error::NotNullable),
6666 Some(len) => len,
6667 };
6668 if len == 0 {
6670 return Ok(());
6671 };
6672 depth.increment()?;
6673 let envelope_size = 8;
6674 let bytes_len = len * envelope_size;
6675 let offset = decoder.out_of_line_offset(bytes_len)?;
6676 let mut _next_ordinal_to_read = 0;
6678 let mut next_offset = offset;
6679 let end_offset = offset + bytes_len;
6680 _next_ordinal_to_read += 1;
6681 if next_offset >= end_offset {
6682 return Ok(());
6683 }
6684
6685 while _next_ordinal_to_read < 1 {
6687 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6688 _next_ordinal_to_read += 1;
6689 next_offset += envelope_size;
6690 }
6691
6692 let next_out_of_line = decoder.next_out_of_line();
6693 let handles_before = decoder.remaining_handles();
6694 if let Some((inlined, num_bytes, num_handles)) =
6695 fidl::encoding::decode_envelope_header(decoder, next_offset)?
6696 {
6697 let member_inline_size =
6698 <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
6699 if inlined != (member_inline_size <= 4) {
6700 return Err(fidl::Error::InvalidInlineBitInEnvelope);
6701 }
6702 let inner_offset;
6703 let mut inner_depth = depth.clone();
6704 if inlined {
6705 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6706 inner_offset = next_offset;
6707 } else {
6708 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6709 inner_depth.increment()?;
6710 }
6711 let val_ref = self.is_input.get_or_insert_with(|| fidl::new_empty!(bool, D));
6712 fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
6713 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6714 {
6715 return Err(fidl::Error::InvalidNumBytesInEnvelope);
6716 }
6717 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6718 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6719 }
6720 }
6721
6722 next_offset += envelope_size;
6723 _next_ordinal_to_read += 1;
6724 if next_offset >= end_offset {
6725 return Ok(());
6726 }
6727
6728 while _next_ordinal_to_read < 2 {
6730 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6731 _next_ordinal_to_read += 1;
6732 next_offset += envelope_size;
6733 }
6734
6735 let next_out_of_line = decoder.next_out_of_line();
6736 let handles_before = decoder.remaining_handles();
6737 if let Some((inlined, num_bytes, num_handles)) =
6738 fidl::encoding::decode_envelope_header(decoder, next_offset)?
6739 {
6740 let member_inline_size =
6741 <RingBuffer as fidl::encoding::TypeMarker>::inline_size(decoder.context);
6742 if inlined != (member_inline_size <= 4) {
6743 return Err(fidl::Error::InvalidInlineBitInEnvelope);
6744 }
6745 let inner_offset;
6746 let mut inner_depth = depth.clone();
6747 if inlined {
6748 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6749 inner_offset = next_offset;
6750 } else {
6751 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6752 inner_depth.increment()?;
6753 }
6754 let val_ref =
6755 self.ring_buffer.get_or_insert_with(|| fidl::new_empty!(RingBuffer, D));
6756 fidl::decode!(RingBuffer, D, val_ref, decoder, inner_offset, inner_depth)?;
6757 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6758 {
6759 return Err(fidl::Error::InvalidNumBytesInEnvelope);
6760 }
6761 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6762 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6763 }
6764 }
6765
6766 next_offset += envelope_size;
6767 _next_ordinal_to_read += 1;
6768 if next_offset >= end_offset {
6769 return Ok(());
6770 }
6771
6772 while _next_ordinal_to_read < 3 {
6774 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6775 _next_ordinal_to_read += 1;
6776 next_offset += envelope_size;
6777 }
6778
6779 let next_out_of_line = decoder.next_out_of_line();
6780 let handles_before = decoder.remaining_handles();
6781 if let Some((inlined, num_bytes, num_handles)) =
6782 fidl::encoding::decode_envelope_header(decoder, next_offset)?
6783 {
6784 let member_inline_size =
6785 <ClockProperties as fidl::encoding::TypeMarker>::inline_size(decoder.context);
6786 if inlined != (member_inline_size <= 4) {
6787 return Err(fidl::Error::InvalidInlineBitInEnvelope);
6788 }
6789 let inner_offset;
6790 let mut inner_depth = depth.clone();
6791 if inlined {
6792 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6793 inner_offset = next_offset;
6794 } else {
6795 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6796 inner_depth.increment()?;
6797 }
6798 let val_ref = self
6799 .clock_properties
6800 .get_or_insert_with(|| fidl::new_empty!(ClockProperties, D));
6801 fidl::decode!(ClockProperties, D, val_ref, decoder, inner_offset, inner_depth)?;
6802 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6803 {
6804 return Err(fidl::Error::InvalidNumBytesInEnvelope);
6805 }
6806 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6807 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6808 }
6809 }
6810
6811 next_offset += envelope_size;
6812 _next_ordinal_to_read += 1;
6813 if next_offset >= end_offset {
6814 return Ok(());
6815 }
6816
6817 while _next_ordinal_to_read < 4 {
6819 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6820 _next_ordinal_to_read += 1;
6821 next_offset += envelope_size;
6822 }
6823
6824 let next_out_of_line = decoder.next_out_of_line();
6825 let handles_before = decoder.remaining_handles();
6826 if let Some((inlined, num_bytes, num_handles)) =
6827 fidl::encoding::decode_envelope_header(decoder, next_offset)?
6828 {
6829 let member_inline_size =
6830 <GainProperties as fidl::encoding::TypeMarker>::inline_size(decoder.context);
6831 if inlined != (member_inline_size <= 4) {
6832 return Err(fidl::Error::InvalidInlineBitInEnvelope);
6833 }
6834 let inner_offset;
6835 let mut inner_depth = depth.clone();
6836 if inlined {
6837 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6838 inner_offset = next_offset;
6839 } else {
6840 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6841 inner_depth.increment()?;
6842 }
6843 let val_ref =
6844 self.gain_properties.get_or_insert_with(|| fidl::new_empty!(GainProperties, D));
6845 fidl::decode!(GainProperties, D, val_ref, decoder, inner_offset, inner_depth)?;
6846 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6847 {
6848 return Err(fidl::Error::InvalidNumBytesInEnvelope);
6849 }
6850 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6851 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6852 }
6853 }
6854
6855 next_offset += envelope_size;
6856 _next_ordinal_to_read += 1;
6857 if next_offset >= end_offset {
6858 return Ok(());
6859 }
6860
6861 while _next_ordinal_to_read < 5 {
6863 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6864 _next_ordinal_to_read += 1;
6865 next_offset += envelope_size;
6866 }
6867
6868 let next_out_of_line = decoder.next_out_of_line();
6869 let handles_before = decoder.remaining_handles();
6870 if let Some((inlined, num_bytes, num_handles)) =
6871 fidl::encoding::decode_envelope_header(decoder, next_offset)?
6872 {
6873 let member_inline_size =
6874 <PlugProperties as fidl::encoding::TypeMarker>::inline_size(decoder.context);
6875 if inlined != (member_inline_size <= 4) {
6876 return Err(fidl::Error::InvalidInlineBitInEnvelope);
6877 }
6878 let inner_offset;
6879 let mut inner_depth = depth.clone();
6880 if inlined {
6881 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6882 inner_offset = next_offset;
6883 } else {
6884 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6885 inner_depth.increment()?;
6886 }
6887 let val_ref =
6888 self.plug_properties.get_or_insert_with(|| fidl::new_empty!(PlugProperties, D));
6889 fidl::decode!(PlugProperties, D, val_ref, decoder, inner_offset, inner_depth)?;
6890 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6891 {
6892 return Err(fidl::Error::InvalidNumBytesInEnvelope);
6893 }
6894 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6895 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6896 }
6897 }
6898
6899 next_offset += envelope_size;
6900
6901 while next_offset < end_offset {
6903 _next_ordinal_to_read += 1;
6904 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6905 next_offset += envelope_size;
6906 }
6907
6908 Ok(())
6909 }
6910 }
6911
6912 impl fidl::encoding::ValueTypeMarker for DeviceSpecific {
6913 type Borrowed<'a> = &'a Self;
6914 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
6915 value
6916 }
6917 }
6918
6919 unsafe impl fidl::encoding::TypeMarker for DeviceSpecific {
6920 type Owned = Self;
6921
6922 #[inline(always)]
6923 fn inline_align(_context: fidl::encoding::Context) -> usize {
6924 8
6925 }
6926
6927 #[inline(always)]
6928 fn inline_size(_context: fidl::encoding::Context) -> usize {
6929 16
6930 }
6931 }
6932
6933 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<DeviceSpecific, D>
6934 for &DeviceSpecific
6935 {
6936 #[inline]
6937 unsafe fn encode(
6938 self,
6939 encoder: &mut fidl::encoding::Encoder<'_, D>,
6940 offset: usize,
6941 _depth: fidl::encoding::Depth,
6942 ) -> fidl::Result<()> {
6943 encoder.debug_check_bounds::<DeviceSpecific>(offset);
6944 encoder.write_num::<u64>(self.ordinal(), offset);
6945 match self {
6946 DeviceSpecific::StreamConfig(ref val) => {
6947 fidl::encoding::encode_in_envelope::<StreamConfig, D>(
6948 <StreamConfig as fidl::encoding::ValueTypeMarker>::borrow(val),
6949 encoder,
6950 offset + 8,
6951 _depth,
6952 )
6953 }
6954 DeviceSpecific::Dai(ref val) => fidl::encoding::encode_in_envelope::<Dai, D>(
6955 <Dai as fidl::encoding::ValueTypeMarker>::borrow(val),
6956 encoder,
6957 offset + 8,
6958 _depth,
6959 ),
6960 DeviceSpecific::Codec(ref val) => fidl::encoding::encode_in_envelope::<Codec, D>(
6961 <Codec as fidl::encoding::ValueTypeMarker>::borrow(val),
6962 encoder,
6963 offset + 8,
6964 _depth,
6965 ),
6966 DeviceSpecific::Composite(ref val) => {
6967 fidl::encoding::encode_in_envelope::<Composite, D>(
6968 <Composite as fidl::encoding::ValueTypeMarker>::borrow(val),
6969 encoder,
6970 offset + 8,
6971 _depth,
6972 )
6973 }
6974 DeviceSpecific::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
6975 }
6976 }
6977 }
6978
6979 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for DeviceSpecific {
6980 #[inline(always)]
6981 fn new_empty() -> Self {
6982 Self::__SourceBreaking { unknown_ordinal: 0 }
6983 }
6984
6985 #[inline]
6986 unsafe fn decode(
6987 &mut self,
6988 decoder: &mut fidl::encoding::Decoder<'_, D>,
6989 offset: usize,
6990 mut depth: fidl::encoding::Depth,
6991 ) -> fidl::Result<()> {
6992 decoder.debug_check_bounds::<Self>(offset);
6993 #[allow(unused_variables)]
6994 let next_out_of_line = decoder.next_out_of_line();
6995 let handles_before = decoder.remaining_handles();
6996 let (ordinal, inlined, num_bytes, num_handles) =
6997 fidl::encoding::decode_union_inline_portion(decoder, offset)?;
6998
6999 let member_inline_size = match ordinal {
7000 1 => <StreamConfig as fidl::encoding::TypeMarker>::inline_size(decoder.context),
7001 2 => <Dai as fidl::encoding::TypeMarker>::inline_size(decoder.context),
7002 3 => <Codec as fidl::encoding::TypeMarker>::inline_size(decoder.context),
7003 4 => <Composite as fidl::encoding::TypeMarker>::inline_size(decoder.context),
7004 0 => return Err(fidl::Error::UnknownUnionTag),
7005 _ => num_bytes as usize,
7006 };
7007
7008 if inlined != (member_inline_size <= 4) {
7009 return Err(fidl::Error::InvalidInlineBitInEnvelope);
7010 }
7011 let _inner_offset;
7012 if inlined {
7013 decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
7014 _inner_offset = offset + 8;
7015 } else {
7016 depth.increment()?;
7017 _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7018 }
7019 match ordinal {
7020 1 => {
7021 #[allow(irrefutable_let_patterns)]
7022 if let DeviceSpecific::StreamConfig(_) = self {
7023 } else {
7025 *self = DeviceSpecific::StreamConfig(fidl::new_empty!(StreamConfig, D));
7027 }
7028 #[allow(irrefutable_let_patterns)]
7029 if let DeviceSpecific::StreamConfig(ref mut val) = self {
7030 fidl::decode!(StreamConfig, D, val, decoder, _inner_offset, depth)?;
7031 } else {
7032 unreachable!()
7033 }
7034 }
7035 2 => {
7036 #[allow(irrefutable_let_patterns)]
7037 if let DeviceSpecific::Dai(_) = self {
7038 } else {
7040 *self = DeviceSpecific::Dai(fidl::new_empty!(Dai, D));
7042 }
7043 #[allow(irrefutable_let_patterns)]
7044 if let DeviceSpecific::Dai(ref mut val) = self {
7045 fidl::decode!(Dai, D, val, decoder, _inner_offset, depth)?;
7046 } else {
7047 unreachable!()
7048 }
7049 }
7050 3 => {
7051 #[allow(irrefutable_let_patterns)]
7052 if let DeviceSpecific::Codec(_) = self {
7053 } else {
7055 *self = DeviceSpecific::Codec(fidl::new_empty!(Codec, D));
7057 }
7058 #[allow(irrefutable_let_patterns)]
7059 if let DeviceSpecific::Codec(ref mut val) = self {
7060 fidl::decode!(Codec, D, val, decoder, _inner_offset, depth)?;
7061 } else {
7062 unreachable!()
7063 }
7064 }
7065 4 => {
7066 #[allow(irrefutable_let_patterns)]
7067 if let DeviceSpecific::Composite(_) = self {
7068 } else {
7070 *self = DeviceSpecific::Composite(fidl::new_empty!(Composite, D));
7072 }
7073 #[allow(irrefutable_let_patterns)]
7074 if let DeviceSpecific::Composite(ref mut val) = self {
7075 fidl::decode!(Composite, D, val, decoder, _inner_offset, depth)?;
7076 } else {
7077 unreachable!()
7078 }
7079 }
7080 #[allow(deprecated)]
7081 ordinal => {
7082 for _ in 0..num_handles {
7083 decoder.drop_next_handle()?;
7084 }
7085 *self = DeviceSpecific::__SourceBreaking { unknown_ordinal: ordinal };
7086 }
7087 }
7088 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
7089 return Err(fidl::Error::InvalidNumBytesInEnvelope);
7090 }
7091 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7092 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7093 }
7094 Ok(())
7095 }
7096 }
7097}