fidl_fuchsia_hardware_audio__common/
fidl_fuchsia_hardware_audio__common.rs

1// WARNING: This file is machine generated by fidlgen.
2
3#![warn(clippy::all)]
4#![allow(unused_parens, unused_mut, unused_imports, nonstandard_style)]
5
6use bitflags::bitflags;
7use fidl::encoding::{MessageBufFor, ProxyChannelBox, ResourceDialect};
8use futures::future::{self, MaybeDone, TryFutureExt};
9use zx_status;
10
11pub type ClockDomain = u32;
12
13pub type ElementId = u64;
14
15pub type TopologyId = u64;
16
17pub const CLOCK_DOMAIN_EXTERNAL: u32 = 4294967295;
18
19pub const CLOCK_DOMAIN_MONOTONIC: u32 = 0;
20
21pub const MAX_COUNT_CHANNELS_IN_RING_BUFFER: u32 = 64;
22
23pub const MAX_COUNT_CHANNEL_SETS: u32 = 64;
24
25pub const MAX_COUNT_DAI_FORMATS: u32 = MAX_COUNT_FORMATS as u32;
26
27pub const MAX_COUNT_DAI_SUPPORTED_BITS_PER_SAMPLE: u32 = 8;
28
29pub const MAX_COUNT_DAI_SUPPORTED_BITS_PER_SLOT: u32 = 8;
30
31pub const MAX_COUNT_DAI_SUPPORTED_FRAME_FORMATS: u32 = 64;
32
33pub const MAX_COUNT_DAI_SUPPORTED_NUMBER_OF_CHANNELS: u32 = 64;
34
35pub const MAX_COUNT_DAI_SUPPORTED_RATES: u32 = 64;
36
37pub const MAX_COUNT_DAI_SUPPORTED_SAMPLE_FORMATS: u32 = 4;
38
39pub const MAX_COUNT_FORMATS: u32 = 64;
40
41pub const MAX_COUNT_SUPPORTED_BYTES_PER_SAMPLE: u32 = 8;
42
43pub const MAX_COUNT_SUPPORTED_NUMBER_OF_CHANNELS: u32 = 64;
44
45pub const MAX_COUNT_SUPPORTED_RATES: u32 = 64;
46
47pub const MAX_COUNT_SUPPORTED_SAMPLE_FORMATS: u32 = 3;
48
49pub const MAX_COUNT_SUPPORTED_VALID_BITS_PER_SAMPLE: u32 = 8;
50
51pub const MAX_DAI_UI_STRING_SIZE: u32 = 256;
52
53pub const MAX_UI_STRING_SIZE: u32 = 256;
54
55pub const UNIQUE_ID_SIZE: u32 = 16;
56
57/// Standard Frame format.
58#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
59#[repr(u8)]
60pub enum DaiFrameFormatStandard {
61    /// No frame format as in samples without a frame sync like PDM.
62    None = 1,
63    /// Format as specified in the I2S specification (left justified, 2 channels, 32 bits per
64    /// sample, frame sync stays low for the left channel and high for the right channel, data
65    /// starts one clock cycle after frame sync changes clocked out at the falling edge of sclk).
66    I2S = 2,
67    /// Left justified, 2 channels. Data starts at frame sync changes from low to high clocked out
68    /// at the falling edge of sclk. The frame sync must stay high for `bits_per_sample` bits for
69    /// the first channel and low for `bits_per_sample` bits for the second channel.
70    StereoLeft = 3,
71    /// Right justified, 2 channels. The frame sync must stay high for `bits_per_sample` bits for
72    /// the first channel and low for `bits_per_sample` bits for the second channel.
73    StereoRight = 4,
74    /// Left justified, variable number of channels, data starts at frame sync changes from low to
75    /// high clocked out at the rising edge of sclk. The frame sync must stay high for exactly 1
76    /// clock cycle.
77    Tdm1 = 5,
78    /// Left justified, variable number of channels, data starts one clock cycle after the frame
79    /// sync changes from low to high clocked out at the rising edge of sclk. The frame sync must
80    /// stay high for exactly 1 clock cycle.
81    Tdm2 = 6,
82    /// Left justified, variable number of channels, data starts two clock cycles after the frame
83    /// sync changes from low to high clocked out at the rising edge of sclk. The frame sync must
84    /// stay high for exactly 1 clock cycle.
85    Tdm3 = 7,
86}
87
88impl DaiFrameFormatStandard {
89    #[inline]
90    pub fn from_primitive(prim: u8) -> Option<Self> {
91        match prim {
92            1 => Some(Self::None),
93            2 => Some(Self::I2S),
94            3 => Some(Self::StereoLeft),
95            4 => Some(Self::StereoRight),
96            5 => Some(Self::Tdm1),
97            6 => Some(Self::Tdm2),
98            7 => Some(Self::Tdm3),
99            _ => None,
100        }
101    }
102
103    #[inline]
104    pub const fn into_primitive(self) -> u8 {
105        self as u8
106    }
107}
108
109#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
110#[repr(u8)]
111pub enum DaiSampleFormat {
112    /// Pulse Density Modulation samples.
113    Pdm = 1,
114    /// Signed integer Linear Pulse Code Modulation samples, at the host endianness.
115    PcmSigned = 2,
116    /// Unsigned integer Linear Pulse Code Modulation samples, at the host endianness.
117    PcmUnsigned = 3,
118    /// Floating point samples, encoded per the IEEE-754 standard.
119    PcmFloat = 4,
120}
121
122impl DaiSampleFormat {
123    #[inline]
124    pub fn from_primitive(prim: u8) -> Option<Self> {
125        match prim {
126            1 => Some(Self::Pdm),
127            2 => Some(Self::PcmSigned),
128            3 => Some(Self::PcmUnsigned),
129            4 => Some(Self::PcmFloat),
130            _ => None,
131        }
132    }
133
134    #[inline]
135    pub const fn into_primitive(self) -> u8 {
136        self as u8
137    }
138}
139
140#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
141pub enum DeviceType {
142    /// Device supports the fuchsia.hardware.audio/StreamConfig protocol.
143    StreamConfig,
144    /// Device supports the fuchsia.hardware.audio/Dai protocol.
145    Dai,
146    /// Device supports the fuchsia.hardware.audio/Codec protocol.
147    Codec,
148    /// Device supports the fuchsia.hardware.audio/Composite protocol.
149    Composite,
150    #[doc(hidden)]
151    __SourceBreaking { unknown_ordinal: u32 },
152}
153
154/// Pattern that matches an unknown `DeviceType` member.
155#[macro_export]
156macro_rules! DeviceTypeUnknown {
157    () => {
158        _
159    };
160}
161
162impl DeviceType {
163    #[inline]
164    pub fn from_primitive(prim: u32) -> Option<Self> {
165        match prim {
166            1 => Some(Self::StreamConfig),
167            2 => Some(Self::Dai),
168            3 => Some(Self::Codec),
169            4 => Some(Self::Composite),
170            _ => None,
171        }
172    }
173
174    #[inline]
175    pub fn from_primitive_allow_unknown(prim: u32) -> Self {
176        match prim {
177            1 => Self::StreamConfig,
178            2 => Self::Dai,
179            3 => Self::Codec,
180            4 => Self::Composite,
181            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
182        }
183    }
184
185    #[inline]
186    pub fn unknown() -> Self {
187        Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
188    }
189
190    #[inline]
191    pub const fn into_primitive(self) -> u32 {
192        match self {
193            Self::StreamConfig => 1,
194            Self::Dai => 2,
195            Self::Codec => 3,
196            Self::Composite => 4,
197            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
198        }
199    }
200
201    #[inline]
202    pub fn is_unknown(&self) -> bool {
203        match self {
204            Self::__SourceBreaking { unknown_ordinal: _ } => true,
205            _ => false,
206        }
207    }
208}
209
210#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
211pub enum DriverError {
212    /// The driver encountered an otherwise unspecified error while performing the operation.
213    InternalError,
214    /// The operation is not implemented, supported, or enabled.
215    NotSupported,
216    /// An argument is invalid.
217    InvalidArgs,
218    /// The subject of the operation is the wrong type to perform the operation.
219    WrongType,
220    /// The operation cannot be performed currently but potentially could succeed if
221    /// the caller waits for a prerequisite to be satisfied.
222    ShouldWait,
223    #[doc(hidden)]
224    __SourceBreaking { unknown_ordinal: u32 },
225}
226
227/// Pattern that matches an unknown `DriverError` member.
228#[macro_export]
229macro_rules! DriverErrorUnknown {
230    () => {
231        _
232    };
233}
234
235impl DriverError {
236    #[inline]
237    pub fn from_primitive(prim: u32) -> Option<Self> {
238        match prim {
239            1 => Some(Self::InternalError),
240            2 => Some(Self::NotSupported),
241            3 => Some(Self::InvalidArgs),
242            4 => Some(Self::WrongType),
243            5 => Some(Self::ShouldWait),
244            _ => None,
245        }
246    }
247
248    #[inline]
249    pub fn from_primitive_allow_unknown(prim: u32) -> Self {
250        match prim {
251            1 => Self::InternalError,
252            2 => Self::NotSupported,
253            3 => Self::InvalidArgs,
254            4 => Self::WrongType,
255            5 => Self::ShouldWait,
256            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
257        }
258    }
259
260    #[inline]
261    pub fn unknown() -> Self {
262        Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
263    }
264
265    #[inline]
266    pub const fn into_primitive(self) -> u32 {
267        match self {
268            Self::InternalError => 1,
269            Self::NotSupported => 2,
270            Self::InvalidArgs => 3,
271            Self::WrongType => 4,
272            Self::ShouldWait => 5,
273            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
274        }
275    }
276
277    #[inline]
278    pub fn is_unknown(&self) -> bool {
279        match self {
280            Self::__SourceBreaking { unknown_ordinal: _ } => true,
281            _ => false,
282        }
283    }
284}
285
286#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
287#[repr(u32)]
288pub enum GetVmoError {
289    /// The ring buffer setup failed due to an invalid argument, e.g. min_frames is too big.
290    InvalidArgs = 1,
291    /// The ring buffer setup failed due to an internal error.
292    InternalError = 2,
293}
294
295impl GetVmoError {
296    #[inline]
297    pub fn from_primitive(prim: u32) -> Option<Self> {
298        match prim {
299            1 => Some(Self::InvalidArgs),
300            2 => Some(Self::InternalError),
301            _ => None,
302        }
303    }
304
305    #[inline]
306    pub const fn into_primitive(self) -> u32 {
307        self as u32
308    }
309}
310
311#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
312#[repr(u32)]
313pub enum PlugDetectCapabilities {
314    /// Driver is hardwired (will always be plugged in).
315    Hardwired = 0,
316    /// Driver is able to asynchronously notify of plug state changes.
317    CanAsyncNotify = 1,
318}
319
320impl PlugDetectCapabilities {
321    #[inline]
322    pub fn from_primitive(prim: u32) -> Option<Self> {
323        match prim {
324            0 => Some(Self::Hardwired),
325            1 => Some(Self::CanAsyncNotify),
326            _ => None,
327        }
328    }
329
330    #[inline]
331    pub const fn into_primitive(self) -> u32 {
332        self as u32
333    }
334}
335
336#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
337#[repr(u8)]
338pub enum SampleFormat {
339    /// Signed integer Linear Pulse Code Modulation samples, at the host endianness.
340    PcmSigned = 1,
341    /// Unsigned integer Linear Pulse Code Modulation samples, at the host endianness.
342    PcmUnsigned = 2,
343    /// Floating point samples, encoded per the IEEE-754 standard.
344    PcmFloat = 3,
345}
346
347impl SampleFormat {
348    #[inline]
349    pub fn from_primitive(prim: u8) -> Option<Self> {
350        match prim {
351            1 => Some(Self::PcmSigned),
352            2 => Some(Self::PcmUnsigned),
353            3 => Some(Self::PcmFloat),
354            _ => None,
355        }
356    }
357
358    #[inline]
359    pub const fn into_primitive(self) -> u8 {
360        self as u8
361    }
362}
363
364#[derive(Clone, Debug, PartialEq)]
365pub struct CodecGetPropertiesResponse {
366    pub properties: CodecProperties,
367}
368
369impl fidl::Persistable for CodecGetPropertiesResponse {}
370
371#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
372pub struct CodecIsBridgeableResponse {
373    pub supports_bridged_mode: bool,
374}
375
376impl fidl::Persistable for CodecIsBridgeableResponse {}
377
378#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
379pub struct CodecSetBridgedModeRequest {
380    pub enable_bridged_mode: bool,
381}
382
383impl fidl::Persistable for CodecSetBridgedModeRequest {}
384
385#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
386pub struct CodecSetDaiFormatRequest {
387    pub format: DaiFormat,
388}
389
390impl fidl::Persistable for CodecSetDaiFormatRequest {}
391
392#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
393#[repr(C)]
394pub struct CodecStartResponse {
395    pub start_time: i64,
396}
397
398impl fidl::Persistable for CodecStartResponse {}
399
400#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
401#[repr(C)]
402pub struct CodecStopResponse {
403    pub stop_time: i64,
404}
405
406impl fidl::Persistable for CodecStopResponse {}
407
408#[derive(Clone, Debug, PartialEq)]
409pub struct CodecWatchPlugStateResponse {
410    pub plug_state: PlugState,
411}
412
413impl fidl::Persistable for CodecWatchPlugStateResponse {}
414
415#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
416pub struct CodecGetDaiFormatsResponse {
417    pub formats: Vec<DaiSupportedFormats>,
418}
419
420impl fidl::Persistable for CodecGetDaiFormatsResponse {}
421
422#[derive(Clone, Debug, PartialEq)]
423pub struct CodecSetDaiFormatResponse {
424    pub state: CodecFormatInfo,
425}
426
427impl fidl::Persistable for CodecSetDaiFormatResponse {}
428
429#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
430#[repr(C)]
431pub struct CompositeGetDaiFormatsRequest {
432    pub processing_element_id: u64,
433}
434
435impl fidl::Persistable for CompositeGetDaiFormatsRequest {}
436
437#[derive(Clone, Debug, PartialEq)]
438pub struct CompositeGetPropertiesResponse {
439    pub properties: CompositeProperties,
440}
441
442impl fidl::Persistable for CompositeGetPropertiesResponse {}
443
444#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
445#[repr(C)]
446pub struct CompositeGetRingBufferFormatsRequest {
447    pub processing_element_id: u64,
448}
449
450impl fidl::Persistable for CompositeGetRingBufferFormatsRequest {}
451
452#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
453pub struct CompositeSetDaiFormatRequest {
454    pub processing_element_id: u64,
455    pub format: DaiFormat,
456}
457
458impl fidl::Persistable for CompositeSetDaiFormatRequest {}
459
460#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
461pub struct CompositeGetDaiFormatsResponse {
462    pub dai_formats: Vec<DaiSupportedFormats>,
463}
464
465impl fidl::Persistable for CompositeGetDaiFormatsResponse {}
466
467#[derive(Clone, Debug, PartialEq)]
468pub struct CompositeGetRingBufferFormatsResponse {
469    pub ring_buffer_formats: Vec<SupportedFormats>,
470}
471
472impl fidl::Persistable for CompositeGetRingBufferFormatsResponse {}
473
474/// DAI format. Frames are made up of `number_of_channels` samples which have `bits_per_sample` bits
475/// of data within `bits_per_slot` arranged in `frame_format`. For more detailed information see
476/// [Digital Audio Interface](https://fuchsia.dev/fuchsia-src/concepts/drivers/driver_architectures/audio_drivers/audio_dai).
477#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
478pub struct DaiFormat {
479    /// Number of channels.
480    /// Must be 2, if `frame_format` is DaiFrameFormatStandard::I2S, STEREO_LEFT or STEREO_RIGHT.
481    pub number_of_channels: u32,
482    /// Sets which channels are active via a bitmask.
483    /// The least significant bit corresponds to channel index 0.
484    /// Must not set bits beyond the least-significant `number_of_channels` bits.
485    pub channels_to_use_bitmask: u64,
486    /// The sample format of all samples.
487    pub sample_format: DaiSampleFormat,
488    /// The frame format of all samples.
489    pub frame_format: DaiFrameFormat,
490    /// The frame rate for all samples.
491    pub frame_rate: u32,
492    /// The bits per slot for all channels.
493    pub bits_per_slot: u8,
494    /// The bits per sample for each channel.
495    /// Must be smaller than `bits_per_slot` for all samples to fit.
496    pub bits_per_sample: u8,
497}
498
499impl fidl::Persistable for DaiFormat {}
500
501/// Custom Frame format.
502#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
503pub struct DaiFrameFormatCustom {
504    /// Justification of the samples within a slot.
505    pub left_justified: bool,
506    /// Clocking of data samples and frame sync output on either raising or falling sclk.
507    /// If true then the sclk raises on the raising edge of the data and frame sync, i.e.
508    /// the data will be sampled on the falling edge of sclk (the middle of the sclk cycle).
509    /// Hence, if false then data will be sampled on the raising edge of sclk.
510    pub sclk_on_raising: bool,
511    /// Number of sclks between the beginning of a frame sync change and audio samples.
512    /// For example, for I2S set to 1 and for stereo left justified set to 0.
513    pub frame_sync_sclks_offset: i8,
514    /// Number of sclks the frame sync is high within a frame.
515    /// For example, for I2S with 32 bits slots set to 32, for TDM usually set to 1.
516    pub frame_sync_size: u8,
517}
518
519impl fidl::Persistable for DaiFrameFormatCustom {}
520
521#[derive(Clone, Debug, PartialEq)]
522pub struct DaiGetPropertiesResponse {
523    pub properties: DaiProperties,
524}
525
526impl fidl::Persistable for DaiGetPropertiesResponse {}
527
528/// Formats supported by the DAI. Frames are made up of `number_of_channels` samples which have
529/// `bits_per_sample` bits of data within `bits_per_slot` bits arranged in `frame_formats`.
530/// All values listed in each vector are supported. When not all combinations supported by the driver
531/// can be described with one `DaiSupportedFormats`, `GetDaiSupportedFormats` returns more than one
532/// `DaiSupportedFormats` in the returned vector.
533/// For more detailed information see
534/// [Digital Audio Interface](https://fuchsia.dev/fuchsia-src/concepts/drivers/driver_architectures/audio_drivers/audio_dai).
535#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
536pub struct DaiSupportedFormats {
537    /// Possible number of channels supported.
538    pub number_of_channels: Vec<u32>,
539    /// Sample formats supported.
540    pub sample_formats: Vec<DaiSampleFormat>,
541    /// Frame formats supported.
542    pub frame_formats: Vec<DaiFrameFormat>,
543    /// Rates supported. Values must be listed in ascending order.
544    pub frame_rates: Vec<u32>,
545    /// The bits per slot supported. Values must be listed in ascending order.
546    pub bits_per_slot: Vec<u8>,
547    /// Bits per sample supported. Values must be listed in ascending order.
548    pub bits_per_sample: Vec<u8>,
549}
550
551impl fidl::Persistable for DaiSupportedFormats {}
552
553#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
554pub struct DaiGetDaiFormatsResponse {
555    pub dai_formats: Vec<DaiSupportedFormats>,
556}
557
558impl fidl::Persistable for DaiGetDaiFormatsResponse {}
559
560#[derive(Clone, Debug, PartialEq)]
561pub struct DaiGetRingBufferFormatsResponse {
562    pub ring_buffer_formats: Vec<SupportedFormats>,
563}
564
565impl fidl::Persistable for DaiGetRingBufferFormatsResponse {}
566
567#[derive(Clone, Debug, PartialEq)]
568pub struct HealthGetHealthStateResponse {
569    pub state: HealthState,
570}
571
572impl fidl::Persistable for HealthGetHealthStateResponse {}
573
574/// Format supporting non-compressed PCM audio. Frames are made up of `number_of_channels` samples
575/// which have `valid_bits_per_sample` bits of most-significant (left-justified) data within
576/// `bytes_per_sample`. bytes. For more detailed information see
577/// [Audio Driver Streaming Interface](https://fuchsia.dev/fuchsia-src/concepts/drivers/driver_architectures/audio_drivers/audio_streaming).
578#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
579pub struct PcmFormat {
580    /// Number of channels.
581    pub number_of_channels: u8,
582    /// The format of all samples.
583    pub sample_format: SampleFormat,
584    /// Bytes allocated to hold a sample, equal or bigger than the valid sample size in
585    /// `valid_bits_per_sample`.
586    pub bytes_per_sample: u8,
587    /// Number of valid bits in a sample, must be equal or smaller than bits in `bytes_per_sample`.
588    /// If smaller, bits are left justified, and any additional bits must be ignored by the
589    /// receiver.
590    pub valid_bits_per_sample: u8,
591    /// The frame rate for all samples.
592    pub frame_rate: u32,
593}
594
595impl fidl::Persistable for PcmFormat {}
596
597#[derive(Clone, Debug, PartialEq)]
598pub struct RingBufferGetPropertiesResponse {
599    pub properties: RingBufferProperties,
600}
601
602impl fidl::Persistable for RingBufferGetPropertiesResponse {}
603
604#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
605#[repr(C)]
606pub struct RingBufferGetVmoRequest {
607    pub min_frames: u32,
608    pub clock_recovery_notifications_per_ring: u32,
609}
610
611impl fidl::Persistable for RingBufferGetVmoRequest {}
612
613#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
614#[repr(C)]
615pub struct RingBufferPositionInfo {
616    /// The driver's best estimate of the time (in the CLOCK_MONOTONIC timeline) at which the
617    /// playback/capture pointer reached the position indicated by `position`.
618    /// `turn_on_delay` impact should not be incorporated into 'timestamp'.
619    /// No delays indicated in `DelayInfo` should be incorporated.
620    pub timestamp: i64,
621    /// The playback/capture pointer position (in bytes) in the ring buffer at time
622    /// `timestamp` as estimated by the driver.
623    pub position: u32,
624}
625
626impl fidl::Persistable for RingBufferPositionInfo {}
627
628#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
629#[repr(C)]
630pub struct RingBufferSetActiveChannelsRequest {
631    pub active_channels_bitmask: u64,
632}
633
634impl fidl::Persistable for RingBufferSetActiveChannelsRequest {}
635
636#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
637#[repr(C)]
638pub struct RingBufferStartResponse {
639    pub start_time: i64,
640}
641
642impl fidl::Persistable for RingBufferStartResponse {}
643
644#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
645#[repr(C)]
646pub struct RingBufferWatchClockRecoveryPositionInfoResponse {
647    pub position_info: RingBufferPositionInfo,
648}
649
650impl fidl::Persistable for RingBufferWatchClockRecoveryPositionInfoResponse {}
651
652#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
653#[repr(C)]
654pub struct RingBufferSetActiveChannelsResponse {
655    pub set_time: i64,
656}
657
658impl fidl::Persistable for RingBufferSetActiveChannelsResponse {}
659
660#[derive(Clone, Debug, PartialEq)]
661pub struct RingBufferWatchDelayInfoResponse {
662    pub delay_info: DelayInfo,
663}
664
665impl fidl::Persistable for RingBufferWatchDelayInfoResponse {}
666
667#[derive(Clone, Debug, PartialEq)]
668pub struct StreamConfigGetPropertiesResponse {
669    pub properties: StreamProperties,
670}
671
672impl fidl::Persistable for StreamConfigGetPropertiesResponse {}
673
674#[derive(Clone, Debug, PartialEq)]
675pub struct StreamConfigGetSupportedFormatsResponse {
676    pub supported_formats: Vec<SupportedFormats>,
677}
678
679impl fidl::Persistable for StreamConfigGetSupportedFormatsResponse {}
680
681#[derive(Clone, Debug, PartialEq)]
682pub struct StreamConfigSetGainRequest {
683    pub target_state: GainState,
684}
685
686impl fidl::Persistable for StreamConfigSetGainRequest {}
687
688#[derive(Clone, Debug, PartialEq)]
689pub struct StreamConfigWatchGainStateResponse {
690    pub gain_state: GainState,
691}
692
693impl fidl::Persistable for StreamConfigWatchGainStateResponse {}
694
695#[derive(Clone, Debug, PartialEq)]
696pub struct StreamConfigWatchPlugStateResponse {
697    pub plug_state: PlugState,
698}
699
700impl fidl::Persistable for StreamConfigWatchPlugStateResponse {}
701
702/// The specification of a single channel, within the overall channel configuration.
703#[derive(Clone, Debug, Default, PartialEq)]
704pub struct ChannelAttributes {
705    /// Minimum frequency guaranteed to be emitted by (or captured in) this channel, in Hz.
706    /// If `min_frequency` is not included, then this channel is assumed to cover the entire
707    /// low-frequency range of this device.
708    ///
709    /// Optional.
710    pub min_frequency: Option<u32>,
711    /// Maximum frequency guaranteed to be emitted by (or captured in) this channel, in Hz.
712    /// If `max_frequency` is not included, then this channel is assumed to cover the entire
713    /// high-frequency range of this device.
714    ///
715    /// Optional.
716    pub max_frequency: Option<u32>,
717    #[doc(hidden)]
718    pub __source_breaking: fidl::marker::SourceBreaking,
719}
720
721impl fidl::Persistable for ChannelAttributes {}
722
723/// The specification of a channel configuration.
724#[derive(Clone, Debug, Default, PartialEq)]
725pub struct ChannelSet {
726    /// Describes attributes for this channel set.
727    /// The size of this vector defines the number of channels supported by this `ChannelSet`.
728    /// Each element of the `attributes` vector defines attributes of a single channel.
729    ///
730    /// Required.
731    pub attributes: Option<Vec<ChannelAttributes>>,
732    #[doc(hidden)]
733    pub __source_breaking: fidl::marker::SourceBreaking,
734}
735
736impl fidl::Persistable for ChannelSet {}
737
738/// Codec format information.
739#[derive(Clone, Debug, Default, PartialEq)]
740pub struct CodecFormatInfo {
741    /// The driver's best estimate of the external delay (in nanoseconds) present in the pipeline
742    /// for the chosen format. When precisely synchronizing presentation across multiple entities
743    /// (e.g. devices), the external delay should be taken into account.
744    /// If not included `external_delay` is unknown.
745    ///
746    /// Optional.
747    pub external_delay: Option<i64>,
748    /// The driver's best estimate of the amount of time (in nanoseconds) it takes the hardware to
749    /// actually start playback/capture after a `Start` command is issued.
750    /// It may take some time for the hardware to get into fully operational mode, for example due
751    /// a power state change. This delay must be taken into account if not getting the initial audio
752    /// samples played or captured is not acceptable.
753    /// If not included `turn_on_delay` is unknown.
754    ///
755    /// Optional.
756    pub turn_on_delay: Option<i64>,
757    /// The driver's best estimate of the amount of time (in nanoseconds) it takes the hardware to
758    /// actually stop playback/capture after a `Stop` command is issued.
759    /// It may take some time for the hardware to get into fully stopped mode, for example due
760    /// a power state change. This delay must be taken into account if playback/capture of samples
761    /// after a 'Stop' command is not acceptable.
762    /// If not included, the turn off delay is unknown.
763    ///
764    /// Optional.
765    pub turn_off_delay: Option<i64>,
766    #[doc(hidden)]
767    pub __source_breaking: fidl::marker::SourceBreaking,
768}
769
770impl fidl::Persistable for CodecFormatInfo {}
771
772#[derive(Clone, Debug, Default, PartialEq)]
773pub struct CodecProperties {
774    /// Driver type is input (true) or output (false)
775    /// If not included, then the driver may be used for both input and output.
776    ///
777    /// Optional.
778    pub is_input: Option<bool>,
779    /// UI string for the manufacturer name. If not included, the manufacturer is unspecified.
780    /// If included, this string must be non-empty.
781    ///
782    /// Optional.
783    pub manufacturer: Option<String>,
784    /// UI string for the product name. If not included, the product name is unspecified.
785    /// If included, this string must be non-empty.
786    ///
787    /// Optional.
788    pub product: Option<String>,
789    /// Unique identifier for the codec.
790    /// If not included, there is no unique id for the Codec.
791    ///
792    /// Optional.
793    pub unique_id: Option<[u8; 16]>,
794    /// Plug Detect Capabilities.
795    ///
796    /// Required.
797    pub plug_detect_capabilities: Option<PlugDetectCapabilities>,
798    #[doc(hidden)]
799    pub __source_breaking: fidl::marker::SourceBreaking,
800}
801
802impl fidl::Persistable for CodecProperties {}
803
804#[derive(Clone, Debug, Default, PartialEq)]
805pub struct CompositeProperties {
806    /// UI string for the manufacturer name. If not set, the manufacturer is unknown.
807    /// If included, this string must be non-empty.
808    ///
809    /// Optional.
810    pub manufacturer: Option<String>,
811    /// UI string for the product name. If not set, the product name is unknown.
812    /// If included, this string must be non-empty.
813    ///
814    /// Optional.
815    pub product: Option<String>,
816    /// A unique identifier. If not included, there is no unique id for the Device.
817    /// `unique_id` arrays starting with 0x42, 0x54, ... (or `BT` in ASCII) are
818    /// reserved for drivers implementing Bluetooth technologies.
819    /// `unique_id` arrays starting with 0x55, 0x53, 0x42, ... (or `USB` in ASCII) are
820    /// reserved for drivers implementing USB technologies.
821    /// Note that even though the above values map to readable ASCII characters, array
822    /// values can span the entire uint8 range (0-255).
823    ///
824    /// Optional.
825    pub unique_id: Option<[u8; 16]>,
826    /// An identifier for the clock domain in which this hardware operates. If
827    /// two hardware devices have the same clock domain, their clock rates are
828    /// identical and perfectly synchronized. Although these two clocks have the
829    /// same rate, the clock positions may be offset from each other by an
830    /// arbitrary (but fixed) amount. The clock_domain typically comes from a
831    /// system wide entity, such as a platform bus or global clock tree.
832    ///
833    /// There are two special values:
834    ///
835    /// *  `CLOCK_DOMAIN_MONOTONIC` means the hardware is operating at the same
836    ///    rate as the system montonic clock.
837    ///
838    /// *  `CLOCK_DOMAIN_EXTERNAL` means the hardware is operating at an unknown
839    ///    rate and is not synchronized with any known clock, not even with
840    ///    other clocks in domain `CLOCK_DOMAIN_EXTERNAL`.
841    ///
842    /// If the domain is not `CLOCK_DOMAIN_MONOTONIC`, client must use position
843    /// notification updates to recover the hardware's clock.
844    ///
845    /// Required.
846    pub clock_domain: Option<u32>,
847    #[doc(hidden)]
848    pub __source_breaking: fidl::marker::SourceBreaking,
849}
850
851impl fidl::Persistable for CompositeProperties {}
852
853#[derive(Clone, Debug, Default, PartialEq)]
854pub struct DaiProperties {
855    /// Driver type is input (true) or output (false)
856    ///
857    /// Required.
858    pub is_input: Option<bool>,
859    /// UI string for the manufacturer name. If not included, the manufacturer is unspecified.
860    /// If included, this string must be non-empty.
861    ///
862    /// Optional.
863    pub manufacturer: Option<String>,
864    /// UI string for the product name. If not included, the product name is unspecified.
865    /// If included, this string must be non-empty.
866    ///
867    /// Optional.
868    pub product_name: Option<String>,
869    /// A unique identifier for the driver.
870    /// If not included, there is no unique id for the driver.
871    ///
872    /// Optional.
873    pub unique_id: Option<[u8; 16]>,
874    /// An identifier for the clock domain in which this hardware operates. If
875    /// two hardware devices have the same clock domain, their clock rates are
876    /// identical and perfectly synchronized. Although these two clocks have the
877    /// same rate, the clock positions may be offset from each other by an
878    /// arbitrary (but fixed) amount. The clock_domain typically comes from a
879    /// system wide entity, such as a platform bus or global clock tree.
880    ///
881    /// There are two special values:
882    ///
883    /// *  `CLOCK_DOMAIN_MONOTONIC` means the hardware is operating at the same
884    ///    rate as the system montonic clock.
885    ///
886    /// *  `CLOCK_DOMAIN_EXTERNAL` means the hardware is operating at an unknown
887    ///    rate and is not synchronized with any known clock, not even with
888    ///    other clocks in domain `CLOCK_DOMAIN_EXTERNAL`.
889    ///
890    /// If the domain is not `CLOCK_DOMAIN_MONOTONIC`, client must use position
891    /// notification updates to recover the hardware's clock.
892    ///
893    /// Required.
894    pub clock_domain: Option<u32>,
895    #[doc(hidden)]
896    pub __source_breaking: fidl::marker::SourceBreaking,
897}
898
899impl fidl::Persistable for DaiProperties {}
900
901/// Delay information as returned by the driver.
902#[derive(Clone, Debug, Default, PartialEq)]
903pub struct DelayInfo {
904    /// The driver's best estimate (for the chosen format) of the delay internal to the hardware it
905    /// abstracts.
906    ///
907    /// "Internal" refers to the hardware between the hardware interconnect (DAI) and the ring
908    /// buffer (e.g. an SoC audio subsystem), whereas "external" refers to hardware on the far side
909    /// of any hardware interconnect (DAI) (e.g. hardware codecs).
910    ///
911    /// For a given frame during playback, this is any delay after the driver/HW copies it
912    /// out of the ring-buffer, before it exits any hardware interconnect.
913    /// For a given frame during recording, this is any delay after it enters the hardware
914    /// interconnect, before the driver/HW copies it into the ring-buffer.
915    ///
916    /// `internal_delay` must be taken into account by the client when determining the requirements
917    /// for minimum lead time (during playback) and minimum capture delay (during capture).
918    ///
919    /// This delay must not include the inherent delay added by the temporary buffering needed
920    /// to copy data in and out of the ring buffer, which is contained in `RingBufferProperties`
921    /// field `driver_transfer_bytes`.
922    ///
923    /// Required.
924    pub internal_delay: Option<i64>,
925    /// The driver's best estimate (for the chosen format) of the delay external to the hardware it
926    /// abstracts.
927    ///
928    /// "External" refers to hardware on the far side of any hardware interconnect (DAI) (e.g.
929    /// hardware codecs), whereas "internal" refers to hardware between the hardware interconnect
930    /// (DAI) and the ring buffer (e.g. an SoC audio subsystem).
931    ///
932    /// `external_delay` must be taken into account by the client when determining the requirements
933    /// for minimum lead time (during playback) and minimum capture delay (during capture).
934    ///
935    /// If not included, `external_delay` is unknown. If unknown, a client may treat it however it
936    /// chooses (consider it zero or some large number, autodetect it, etc).
937    ///
938    /// Like `internal_delay`, this delay must not include the inherent delay added by the temporary
939    /// buffering needed to copy data in and out of the ring buffer, which is contained in
940    /// `RingBufferProperties` field `driver_transfer_bytes`.
941    ///
942    /// Optional.
943    pub external_delay: Option<i64>,
944    #[doc(hidden)]
945    pub __source_breaking: fidl::marker::SourceBreaking,
946}
947
948impl fidl::Persistable for DelayInfo {}
949
950#[derive(Clone, Debug, Default, PartialEq)]
951pub struct Format {
952    /// Format supporting non-compressed PCM samples.
953    ///
954    /// Required.
955    pub pcm_format: Option<PcmFormat>,
956    #[doc(hidden)]
957    pub __source_breaking: fidl::marker::SourceBreaking,
958}
959
960impl fidl::Persistable for Format {}
961
962/// Gain state requested by the client or returned by the driver.
963#[derive(Clone, Debug, Default, PartialEq)]
964pub struct GainState {
965    /// Current mute state. If not included, the state is unmuted.
966    ///
967    /// Optional.
968    pub muted: Option<bool>,
969    /// Current Automatic Gain Control (AGC) state. If not included, AGC is disabled.
970    ///
971    /// Optional.
972    pub agc_enabled: Option<bool>,
973    /// Current gain in decibels.
974    ///
975    /// Required.
976    pub gain_db: Option<f32>,
977    #[doc(hidden)]
978    pub __source_breaking: fidl::marker::SourceBreaking,
979}
980
981impl fidl::Persistable for GainState {}
982
983#[derive(Clone, Debug, Default, PartialEq)]
984pub struct HealthState {
985    /// Driver is currently healthy.
986    /// No health information is provided if this field is not included.
987    /// This allows drivers to signal their health state in scenarios where they have not enough
988    /// capabilities or resources to recover on their own, for instance not able to power down the
989    /// hardware via a GPIO or control over the power subsystem.
990    ///
991    /// Optional.
992    pub healthy: Option<bool>,
993    #[doc(hidden)]
994    pub __source_breaking: fidl::marker::SourceBreaking,
995}
996
997impl fidl::Persistable for HealthState {}
998
999/// Format supporting non-compressed PCM audio. Each frame consists of one or more
1000/// (number_of_channels) samples, stored contiguously. Within the `bytes_per_sample` allocated for
1001/// each sample, `valid_bits_per_sample` bits of data are stored in the most-significant
1002/// (left-justified) portion.
1003/// All values listed in each vector are supported. When not all combinations supported by
1004/// the driver can be described with one `SupportedFormats` or `PcmSupportedFormats`,
1005/// `GetSupportedFormats` returns more than one `SupportedFormats` in the returned vector.
1006/// For more detailed information see [Audio Driver Streaming Interface](https://fuchsia.dev/fuchsia-src/concepts/drivers/driver_architectures/audio_drivers/audio_streaming).
1007#[derive(Clone, Debug, Default, PartialEq)]
1008pub struct PcmSupportedFormats {
1009    /// Vector of possible `ChannelSets` supported.
1010    /// A `ChannelSet` specifies a channel configuration (including a channel-count), plus a number
1011    /// of optional attributes.
1012    /// Only one `ChannelSet` is allowed for each unique channel-count. As a result, no two entries
1013    /// in `channel_sets` can contain `attributes` vectors with the same length.
1014    ///
1015    /// Required.
1016    pub channel_sets: Option<Vec<ChannelSet>>,
1017    /// Vector of possible `SampleFormat`s supported.
1018    ///
1019    /// Required.
1020    pub sample_formats: Option<Vec<SampleFormat>>,
1021    /// Vector of possible bytes allocated for each sample. Values must be listed in ascending
1022    /// order. All values listed in `valid_bits_per_sample` must fit into at least the largest
1023    /// `bytes_per_sample` value.
1024    ///
1025    /// Required.
1026    pub bytes_per_sample: Option<Vec<u8>>,
1027    /// Vector of possible number of bits containing valid data, within the sample container defined
1028    /// by `bytes_per_sample`. Values must be listed in ascending order. All values listed must fit
1029    /// into the largest `bytes_per_sample` value. The valid data bits must be most-significant
1030    /// (left-justified) within the sample container, and any additional bits will be ignored.
1031    ///
1032    /// Required.
1033    pub valid_bits_per_sample: Option<Vec<u8>>,
1034    /// Vector of possible frame rates supported. Values must be listed in ascending order.
1035    ///
1036    /// Required.
1037    pub frame_rates: Option<Vec<u32>>,
1038    #[doc(hidden)]
1039    pub __source_breaking: fidl::marker::SourceBreaking,
1040}
1041
1042impl fidl::Persistable for PcmSupportedFormats {}
1043
1044/// Plug state as returned by the driver.
1045/// If the driver reports a `plug_detect_capabilities` equal to HARDWIRED, then the driver should
1046/// respond to `WatchPlugState` only the first time it is called, with `plugged` set to true and
1047/// `plug_state_time` set to time '0'.
1048#[derive(Clone, Debug, Default, PartialEq)]
1049pub struct PlugState {
1050    /// Driver is currently plugged in. Required
1051    pub plugged: Option<bool>,
1052    /// Timestamps the information provided in the rest of the fields of this struct. Required.
1053    pub plug_state_time: Option<i64>,
1054    #[doc(hidden)]
1055    pub __source_breaking: fidl::marker::SourceBreaking,
1056}
1057
1058impl fidl::Persistable for PlugState {}
1059
1060/// Properties of the ring buffer. These values don't change once the ring buffer is created.
1061#[derive(Clone, Debug, Default, PartialEq)]
1062pub struct RingBufferProperties {
1063    /// The driver's best estimate (for the chosen format) of the delay external to the hardware it
1064    /// abstracts. External delay must be taken into account when precisely synchronizing
1065    /// presentation across multiple entities (e.g. devices).
1066    /// If not included `external_delay` is unknown.
1067    ///
1068    /// # Deprecation
1069    ///
1070    /// Not needed anymore since the functionality is available via `WatchDelayInfo` below.
1071    pub external_delay: Option<i64>,
1072    /// Size (in bytes) of the temporary buffer used by the driver when consuming or generating ring
1073    /// buffer contents. Required.
1074    /// The ring buffer contents must be produced and consumed at the rate specified with the
1075    /// `CreateRingBuffer` command, however some amount of buffering is required when the data is
1076    /// written into and read from the ring buffer. For playback the data is consumed by the driver
1077    /// by reading ahead up to `fifo_depth` bytes. For capture the data is produced by the driver
1078    /// holding up to `fifo_depth` bytes at the time before committing it to main system
1079    /// memory. Hence `fifo_depth` must be taken into account by the client when determining either
1080    /// the minimum lead time requirement (for playback) or the maximum capture delay (for capture).
1081    ///
1082    /// To convert `fifo_depth` to the corresponding number of audio frames, use the frame size
1083    /// returned by `CreateRingBuffer` in the `StreamConfig` protocol, note that the `fifo_depth`
1084    /// is not necessarily a multiple size of an audio frame.
1085    ///
1086    /// The ring buffer data may be directly consumed/generated by hardware, in this case
1087    /// `fifo_depth` maps directly to the size of a hardware FIFO block, since the hardware FIFO
1088    /// block determines the amount of data read ahead or held back.
1089    ///
1090    /// The ring buffer data may instead be consumed/generated by audio driver software that is
1091    /// conceptually situated between the ring buffer and the audio hardware. In this case, for
1092    /// playback the `fifo_depth` read ahead amount is set large enough such that the driver
1093    /// guarantees no undetected underruns, this assuming the client is generating the data as
1094    /// determined by the `CreateRingBuffer` and `Start` commands. For capture, the
1095    /// `fifo_depth` held back amount is set large enough such that the driver guarantees no
1096    /// undetected underruns when generating the data as determined by the `CreateRingBuffer` and
1097    /// `Start` commands. The driver must set `fifo_depth` big enough such that the potential
1098    /// delays added by any software interfacing with the audio hardware do not occur under most
1099    /// scenarios, and must detect and report underruns. How an underrun is reported is not defined
1100    /// in this API.
1101    ///
1102    /// # Deprecation
1103    ///
1104    /// Not needed anymore since the functionality is available via `driver_transfer_bytes` below.
1105    pub fifo_depth: Option<u32>,
1106    /// When set to true, indicates that the ring buffer runs in a different cache coherency domain,
1107    /// and thus clients must ensure that their data writes are flushed all the way to main memory
1108    /// (during playback), or that their view of the ring buffer must be invalidated before any
1109    /// reads (during capture). This is because there may be hardware external to the CPUs that
1110    /// reads/writes main memory, bypassing the CPUs.
1111    ///
1112    /// When set to false, indicates that the ring buffer runs in the same cache coherency domain as
1113    /// the CPUs, hence the driver is not required to flush/invalidate the ring buffer.
1114    /// Note that in this case, the driver and client still must synchronize their data access, for
1115    /// instance by inserting the appropriate acquire fences before reading and releasing fences
1116    /// after writing.
1117    ///
1118    /// Required.
1119    pub needs_cache_flush_or_invalidate: Option<bool>,
1120    /// The driver's best estimate of the time needed for the hardware to emit (during playback) or
1121    /// accept (during capture) frames, after a channel is activated by `SetActiveChannels`.
1122    /// The driver estimates that after `SetActiveChannels(channel)->(set_time)` enables a channel,
1123    /// its data will resume flowing at approximately `set_time` + `turn_on_delay`.
1124    /// Hardware can take time to become fully operational (e.g. due to a power state change, or
1125    /// communication delays between a Bluetooth driver's multiple hardware entities). The client
1126    /// must take this delay into account, if it is unacceptable to drop the actual audio frames
1127    /// and instead play/capture silence during this interval.
1128    /// If not included, `turn_on_delay` is unknown.
1129    ///
1130    /// Optional.
1131    pub turn_on_delay: Option<i64>,
1132    /// Size (in bytes) of the temporary buffer used by the driver/HW when consuming or generating
1133    /// the ring buffer contents.
1134    ///
1135    /// The ring buffer contents must be produced and consumed at the rate specified with the
1136    /// `CreateRingBuffer` command, using data transfers between a temporary buffer and the ring
1137    /// buffer. For playback, audio frames are consumed by the driver in transfers as large as
1138    /// `driver_transfer_bytes`. For capture, audio frames are produced by the driver in transfers
1139    /// as large as `driver_transfer_bytes`. In both cases, this many frames must accumulate before
1140    /// they are read from or committed to the ring buffer.
1141    ///
1142    /// These data transfers mean that there is always a section of the ring buffer that is unsafe
1143    /// for the client to be writing/reading. This unsafe buffer region is defined on one side by
1144    /// the current position 'P', and on the other side by the 'safe pointer' location 'S'. Once the
1145    /// ring buffer starts, these two pointers begin moving. 'P' begins moving from position 0 at
1146    /// the `start_time` from `Start`. The region between these pointers must not be read or
1147    /// written by the client at that time. The diagrams below note these pointers as 'P' and 'S'.
1148    ///
1149    /// During playback, client must write data BEFORE hardware transfers occur. During capture,
1150    /// client can read captured data only AFTER hardware transfers occur. For this reason, during
1151    /// playback 'S' is always ahead of 'P', whereas during capture 'S' is always behind 'P'.
1152    ///
1153    ///
1154    /// ## Playback
1155    ///
1156    /// Before they start the ring buffer, clients may safely write any ring buffer location. It is
1157    /// recommended that they write at least `driver_transfer_bytes` of initial audio, since they
1158    /// must always stay at least that far ahead of where the driver/HW is reading, and upon `Start`
1159    /// the hardware might immediately consume that much data from the ring buffer. Otherwise, the
1160    /// client relies on the zeroed-out contents of the VMO to be the initial audio read by the
1161    /// driver/HW.
1162    ///
1163    /// ```
1164    ///                                       Ring Buffer
1165    ///  +-------------------------+-------------------------------------------------------------+
1166    ///  |<---                                 safe to write                                 --->|
1167    ///  |             (to pre-populate the ring buffer before starting the hardware)            |
1168    ///  +-------------------------+-------------------------------------------------------------+
1169    ///  0=P                       S                                                             0
1170    /// ```
1171    ///
1172    /// Once the ring buffer is started, it is not safe for the client to write data to the ring
1173    /// buffer between 'P' and 'S', because this represents data already in use (potentially already
1174    /// consumed). The client may safely write the rest of the ring buffer (between 'S' and '0/P').
1175    ///
1176    /// ```
1177    ///                                       Ring Buffer
1178    ///  +-------------------------+-------------------------------------------------------------+
1179    ///  |<--- unsafe to write --->|<---                    safe to write                    --->|
1180    ///  |< driver_transfer_bytes >|           (empty unless prewritten by the client)           |
1181    ///  +-------------------------+-------------------------------------------------------------+
1182    ///  0=P                       S                                                             0
1183    /// ```
1184    ///
1185    /// As time passes, the driver/HW reads the data in chunks of `driver_transfer_bytes` or less,
1186    /// at the rate specified in `CreateRingBuffer`. The Position/Safe pointers move to the right at
1187    /// the same rate, but do so smoothly. As a result, the "unsafe for client writes" area moves
1188    /// gradually through the ring buffer, while maintaining a constant size equal to
1189    /// `driver_transfer_bytes`. Thus, after some period we now have:
1190    ///
1191    /// ```
1192    ///                                       Ring Buffer
1193    ///  +------------+-------------------------+------------------------------------------------+
1194    ///  |<-- safe -->|<--- unsafe to write --->|<--               safe to write              -->|
1195    ///  |  to write  |< driver_transfer_bytes >|       (not yet consumed by the hardware)       |
1196    ///  +------------+-------------------------+------------------------------------------------+
1197    ///  0            P                         S                                                0
1198    /// ```
1199    ///
1200    /// Later, 'S' wraps around the ring buffer before 'P' does. Note that the region from 0 to 'S',
1201    /// plus the region from 'P' to the end of the ring buffer, adds up to `driver_transfer_bytes`:
1202    ///
1203    /// ```
1204    ///                                       Ring Buffer
1205    ///  +---------------+------------------------------------------------------------+----------+
1206    ///  |<--- unsafe -->|<---                   safe to write                    --->|<-unsafe->|
1207    ///  |< driver_transf|                                                            |er_bytes >|
1208    ///  +---------------+------------------------------------------------------------+----------+
1209    ///  0               S                                                            P          0
1210    /// ```
1211    ///
1212    /// In steady state, any area outside of the pointers 'P' and 'S' is safe to write:
1213    ///
1214    /// ```
1215    ///                                       Ring Buffer
1216    ///  +--------------------------------+-------------------------+----------------------------+
1217    ///  [<--       safe to write      -->|<--- unsafe to write --->|<--     safe to write    -->|
1218    ///  |  (prior data already consumed) |< driver_transfer_bytes >|                            |
1219    ///  +--------------------------------+-------------------------+----------------------------+
1220    ///  0                                P                         S                            0
1221    /// ```
1222    ///
1223    ///
1224    /// ## Recording
1225    ///
1226    /// While recording, it is only safe for the client to read that part of the ring buffer that is
1227    /// not simultaneously being written by the driver/HW. Before capture begins, it may read the
1228    /// entire ring buffer, but the driver has not yet written anything for the client to read. This
1229    /// is the ring buffer at the moment that the client starts the ring buffer:
1230    ///
1231    /// ```
1232    ///                                       Ring Buffer
1233    ///  +---------------------------------------------------------------------------------------+
1234    ///  [<---                     empty (not yet written by the hardware)                    -->|
1235    ///  +---------------------------------------------------------------------------------------+
1236    /// 0=S=P                                                                                    0
1237    /// ```
1238    ///
1239    /// Once capture begins, the driver/HW acquires frames, eventually making its first data
1240    /// transfer to the ring buffer starting at '0'. These transfers are of unknown size but may be
1241    /// as large as `driver_transfer_bytes`; they occur at the rate specified in `CreateRingBuffer`.
1242    /// Before the driver/HW has written at least `driver_transfer_bytes` into the ring buffer, the
1243    /// client cannot yet safely read any of the newly captured frames:
1244    ///
1245    /// ```
1246    ///                                       Ring Buffer
1247    ///  +--------------+------------------------------------------------------------------------+
1248    ///  [<-- unsafe -->|<--                           safe to read                           -->|
1249    ///  |< driver_transfer_bytes >|     (but empty, not yet written by the hardware)            |
1250    ///  +--------------+------------------------------------------------------------------------+
1251    /// 0=S             P                                                                        0
1252    /// ```
1253    ///
1254    /// Once the driver/HW has written at least `driver_transfer_bytes` of data into the ring
1255    /// buffer, 'S' begins to smoothly move forward at the same rate as 'P' (as determined by the
1256    /// ring buffer's rate and sample format). The client can safely read frames in the region
1257    /// between '0' and 'S'. It is unsafe for the client to read data between 'S' and 'P', because
1258    /// this is where the driver/HW is simultaneously writing. This region gradually  progresses
1259    /// across the ring buffer, maintaining a constant size of `driver_transfer_bytes`.
1260    /// After some time we have:
1261    ///
1262    /// ```
1263    ///                                       Ring Buffer
1264    ///  +----------------+-------------------------+--------------------------------------------+
1265    ///  [< safe to read >|<---  unsafe to read --->|<--             safe to read             -->|
1266    ///  | captured audio |< driver_transfer_bytes >|      (not yet written by the hardware)     |
1267    ///  +----------------+-------------------------+--------------------------------------------+
1268    ///  0                S                         P                                            0
1269    /// ```
1270    ///
1271    /// Later, 'P' wraps around the ring buffer before 'S' does. Note that the region from 0 to 'P',
1272    /// plus the region from 'S' to the end of the ring buffer, adds up to `driver_transfer_bytes`:
1273    ///
1274    /// ```
1275    ///                                       Ring Buffer
1276    ///  +-----------+------------------------------------------------------------+--------------+
1277    ///  |<--unsafe->|<---                    safe to read                    --->|<---unsafe--->|
1278    ///  |< driver_tr|                      (captured audio)                      |ansfer_bytes >|
1279    ///  +-----------+------------------------------------------------------------+--------------+
1280    ///  0           P                                                            S              0
1281    /// ```
1282    ///
1283    /// In steady state, i.e. once the process has wrapped around the ring buffer, any area outside
1284    /// of pointers 'S' and 'P' is safe to read:
1285    ///
1286    /// ```
1287    ///                                       Ring Buffer
1288    ///  +--------------------------------+-------------------------+----------------------------+
1289    ///  [<--       safe to read       -->|<---      unsafe     --->|<--     safe to read     -->|
1290    ///  |                                |< driver_transfer_bytes >|                            |
1291    ///  +--------------------------------+-------------------------+----------------------------+
1292    ///  0                                S                         P                            0
1293    /// ```
1294    ///
1295    ///
1296    /// ## Hardware versus software
1297    ///
1298    /// The ring buffer data may be directly consumed/generated by hardware, i.e.
1299    /// `driver_transfer_bytes` can be mapped directly to the size of a hardware FIFO block, since a
1300    /// hardware FIFO block determines the upper limit amount of data read ahead or held back.
1301    /// Note that if the FIFO buffer is not used in the traditional "high water" way (such as a
1302    /// "ping pong" design where only half the FIFO size is used at any time -- even during the very
1303    /// first transfers at `Start` time), then `driver_transfer_bytes` may be set to a smaller value
1304    /// but must be at least equal to the largest amount of data ever stored in the FIFO buffer.
1305    /// Even if the transfer size never exceeds half the size of the FIFO, if the full size of the
1306    /// FIFO is used (for instance, upon `Start` when filling an initially empty hardware FIFO),
1307    /// then `driver_transfer_bytes` must be set to the entire size of the FIFO buffer.
1308    ///
1309    /// The ring buffer data may instead be consumed/generated by audio driver software that is
1310    /// conceptually situated between the ring buffer and the audio hardware. In this case, for
1311    /// playback, the `driver_transfer_bytes` read ahead amount must be large enough such that the
1312    /// driver guarantees no undetected underruns, based on the client requirement to generate data
1313    /// based on the `CreateRingBuffer` rate and the `start_time` from `Start`. For capture,
1314    /// `driver_transfer_bytes` must be large enough for the driver to guarantee no underruns when
1315    /// generating the data as determined by the `CreateRingBuffer` and `Start` commands.
1316    ///
1317    ///
1318    /// `driver_transfer_bytes` must not include the impact of delays caused by hardware or software
1319    /// processing abstracted by the driver. Those delays are communicated by `internal_delay` and
1320    /// `external_delay` fields in `DelayInfo`; they are orthogonal to this value.
1321    ///
1322    /// Required.
1323    pub driver_transfer_bytes: Option<u32>,
1324    #[doc(hidden)]
1325    pub __source_breaking: fidl::marker::SourceBreaking,
1326}
1327
1328impl fidl::Persistable for RingBufferProperties {}
1329
1330#[derive(Clone, Debug, Default, PartialEq)]
1331pub struct StreamProperties {
1332    /// A unique identifier. If not included, there is no unique id for the StreamConfig.
1333    /// `unique_id` arrays starting with 0x42, 0x54, ... (or `BT` in ASCII) are
1334    /// reserved for drivers implementing Bluetooth technologies.
1335    /// `unique_id` arrays starting with 0x55, 0x53, 0x42, ... (or `USB` in ASCII) are
1336    /// reserved for drivers implementing USB technologies.
1337    /// Note that even though the above values map to readable ASCII characters, array
1338    /// values can span the entire uint8 range (0-255).
1339    ///
1340    /// Optional.
1341    pub unique_id: Option<[u8; 16]>,
1342    /// Driver type is input (true) or output (false)
1343    ///
1344    /// Required.
1345    pub is_input: Option<bool>,
1346    /// Gain mute capability. If not included, the StreamConfig can't mute.
1347    ///
1348    /// Optional.
1349    pub can_mute: Option<bool>,
1350    /// Automatic Gain Control (AGC) capability. If not included, the StreamConfig can't AGC.
1351    ///
1352    /// Optional.
1353    pub can_agc: Option<bool>,
1354    /// Minimum gain in decibels.
1355    ///
1356    /// Required.
1357    pub min_gain_db: Option<f32>,
1358    /// Maximum gain in decibels.
1359    ///
1360    /// Required.
1361    pub max_gain_db: Option<f32>,
1362    /// Gain step in decibels, this value must not be negative, but may be zero to convey an
1363    /// effectively continuous range of values. Must not exceed `max_gain_db` - `min_gain_db`.
1364    ///
1365    /// Required.
1366    pub gain_step_db: Option<f32>,
1367    /// Plug Detect Capabilities.
1368    ///
1369    /// Required.
1370    pub plug_detect_capabilities: Option<PlugDetectCapabilities>,
1371    /// UI string for the manufacturer name. If not included, the manufacturer is unspecified.
1372    /// If included, this string must be non-empty.
1373    ///
1374    /// Optional.
1375    pub manufacturer: Option<String>,
1376    /// UI string for the product name. If not included, the product name is unspecified.
1377    /// If included, this string must be non-empty.
1378    ///
1379    /// Optional.
1380    pub product: Option<String>,
1381    /// An identifier for the clock domain in which this hardware operates. If
1382    /// two hardware devices have the same clock domain, their clock rates are
1383    /// identical and perfectly synchronized. Although these two clocks have the
1384    /// same rate, the clock positions may be offset from each other by an
1385    /// arbitrary (but fixed) amount. The clock_domain typically comes from a
1386    /// system wide entity, such as a platform bus or global clock tree.
1387    ///
1388    /// There are two special values:
1389    ///
1390    /// *  `CLOCK_DOMAIN_MONOTONIC` means the hardware is operating at the same
1391    ///    rate as the system montonic clock.
1392    ///
1393    /// *  `CLOCK_DOMAIN_EXTERNAL` means the hardware is operating at an unknown
1394    ///    rate and is not synchronized with any known clock, not even with
1395    ///    other clocks in domain `CLOCK_DOMAIN_EXTERNAL`.
1396    ///
1397    /// If the domain is not `CLOCK_DOMAIN_MONOTONIC`, client must use position
1398    /// notification updates to recover the hardware's clock.
1399    ///
1400    /// Required.
1401    pub clock_domain: Option<u32>,
1402    #[doc(hidden)]
1403    pub __source_breaking: fidl::marker::SourceBreaking,
1404}
1405
1406impl fidl::Persistable for StreamProperties {}
1407
1408/// All the possible formats supported by this device.
1409#[derive(Clone, Debug, Default, PartialEq)]
1410pub struct SupportedFormats {
1411    /// Supported formats for non-compressed PCM samples, with attributes.
1412    ///
1413    /// Required.
1414    pub pcm_supported_formats: Option<PcmSupportedFormats>,
1415    #[doc(hidden)]
1416    pub __source_breaking: fidl::marker::SourceBreaking,
1417}
1418
1419impl fidl::Persistable for SupportedFormats {}
1420
1421/// Either a standard or custom frame format.
1422#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
1423pub enum DaiFrameFormat {
1424    /// The format type of all samples in the DAI, listed in `DaiFrameFormatStandard`.
1425    FrameFormatStandard(DaiFrameFormatStandard),
1426    /// The format type of all samples in the DAI, specified in `DaiFrameFormatCustom`.
1427    FrameFormatCustom(DaiFrameFormatCustom),
1428}
1429
1430impl DaiFrameFormat {
1431    #[inline]
1432    pub fn ordinal(&self) -> u64 {
1433        match *self {
1434            Self::FrameFormatStandard(_) => 1,
1435            Self::FrameFormatCustom(_) => 2,
1436        }
1437    }
1438}
1439
1440impl fidl::Persistable for DaiFrameFormat {}
1441
1442pub mod codec_ordinals {
1443    pub const GET_HEALTH_STATE: u64 = 0x4e146d6bca733a84;
1444    pub const SIGNAL_PROCESSING_CONNECT: u64 = 0xa81907ce6066295;
1445    pub const RESET: u64 = 0x50757ae579a7bd6b;
1446    pub const GET_PROPERTIES: u64 = 0x7a0d138a6a1d9d90;
1447    pub const STOP: u64 = 0x5c2e380df1332dbd;
1448    pub const START: u64 = 0x329cdacb286ab00;
1449    pub const IS_BRIDGEABLE: u64 = 0x26b0684f603f88ec;
1450    pub const SET_BRIDGED_MODE: u64 = 0x2bd8f7bfd0b0aa36;
1451    pub const GET_DAI_FORMATS: u64 = 0xf8bbc46b4ba6a52;
1452    pub const SET_DAI_FORMAT: u64 = 0x2f829df9e5a7a1ea;
1453    pub const WATCH_PLUG_STATE: u64 = 0x182b87f935ca7326;
1454}
1455
1456pub mod codec_connector_ordinals {
1457    pub const CONNECT: u64 = 0x1413f551544026c9;
1458}
1459
1460pub mod composite_ordinals {
1461    pub const GET_HEALTH_STATE: u64 = 0x4e146d6bca733a84;
1462    pub const SIGNAL_PROCESSING_CONNECT: u64 = 0xa81907ce6066295;
1463    pub const RESET: u64 = 0xac355fb98341996;
1464    pub const GET_PROPERTIES: u64 = 0x31846fa0a459942b;
1465    pub const GET_RING_BUFFER_FORMATS: u64 = 0x1d89b701b6816ac4;
1466    pub const CREATE_RING_BUFFER: u64 = 0x28c5685f85262033;
1467    pub const GET_DAI_FORMATS: u64 = 0x3cbeaed59c8f69b;
1468    pub const SET_DAI_FORMAT: u64 = 0x155acf5cc0dc8a84;
1469}
1470
1471pub mod composite_connector_ordinals {
1472    pub const CONNECT: u64 = 0x7ee557529079e466;
1473}
1474
1475pub mod dai_ordinals {
1476    pub const GET_HEALTH_STATE: u64 = 0x4e146d6bca733a84;
1477    pub const SIGNAL_PROCESSING_CONNECT: u64 = 0xa81907ce6066295;
1478    pub const RESET: u64 = 0x69e5fa9fa2f78c14;
1479    pub const GET_PROPERTIES: u64 = 0x2c25a1a66149510b;
1480    pub const GET_DAI_FORMATS: u64 = 0x1eb37b0cddf79d69;
1481    pub const GET_RING_BUFFER_FORMATS: u64 = 0x760371081d8c92e4;
1482    pub const CREATE_RING_BUFFER: u64 = 0x5af9760589a75257;
1483}
1484
1485pub mod dai_connector_ordinals {
1486    pub const CONNECT: u64 = 0x4e4db05c2eca1450;
1487}
1488
1489pub mod health_ordinals {
1490    pub const GET_HEALTH_STATE: u64 = 0x4e146d6bca733a84;
1491}
1492
1493pub mod ring_buffer_ordinals {
1494    pub const GET_PROPERTIES: u64 = 0x12947f061a8fe1;
1495    pub const WATCH_CLOCK_RECOVERY_POSITION_INFO: u64 = 0x694d5b898a4167e5;
1496    pub const GET_VMO: u64 = 0x44c8f4f5680e853a;
1497    pub const START: u64 = 0x5dd780a769a8892d;
1498    pub const STOP: u64 = 0x49a73d9cf1d4e110;
1499    pub const SET_ACTIVE_CHANNELS: u64 = 0x605464c1d384f309;
1500    pub const WATCH_DELAY_INFO: u64 = 0x6c1248db213fcf9f;
1501}
1502
1503pub mod stream_config_ordinals {
1504    pub const GET_HEALTH_STATE: u64 = 0x4e146d6bca733a84;
1505    pub const SIGNAL_PROCESSING_CONNECT: u64 = 0xa81907ce6066295;
1506    pub const GET_PROPERTIES: u64 = 0x7d89c02f3e2d3c01;
1507    pub const GET_SUPPORTED_FORMATS: u64 = 0x448efa7850cafe7e;
1508    pub const CREATE_RING_BUFFER: u64 = 0x2afb19dd13faa1ba;
1509    pub const WATCH_GAIN_STATE: u64 = 0x4772506136ab65c1;
1510    pub const SET_GAIN: u64 = 0x3943b41498c6a384;
1511    pub const WATCH_PLUG_STATE: u64 = 0x497345a6f048b2a6;
1512}
1513
1514pub mod stream_config_connector_ordinals {
1515    pub const CONNECT: u64 = 0x22051ff3021eafec;
1516}
1517
1518mod internal {
1519    use super::*;
1520    unsafe impl fidl::encoding::TypeMarker for DaiFrameFormatStandard {
1521        type Owned = Self;
1522
1523        #[inline(always)]
1524        fn inline_align(_context: fidl::encoding::Context) -> usize {
1525            std::mem::align_of::<u8>()
1526        }
1527
1528        #[inline(always)]
1529        fn inline_size(_context: fidl::encoding::Context) -> usize {
1530            std::mem::size_of::<u8>()
1531        }
1532
1533        #[inline(always)]
1534        fn encode_is_copy() -> bool {
1535            true
1536        }
1537
1538        #[inline(always)]
1539        fn decode_is_copy() -> bool {
1540            false
1541        }
1542    }
1543
1544    impl fidl::encoding::ValueTypeMarker for DaiFrameFormatStandard {
1545        type Borrowed<'a> = Self;
1546        #[inline(always)]
1547        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1548            *value
1549        }
1550    }
1551
1552    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
1553        for DaiFrameFormatStandard
1554    {
1555        #[inline]
1556        unsafe fn encode(
1557            self,
1558            encoder: &mut fidl::encoding::Encoder<'_, D>,
1559            offset: usize,
1560            _depth: fidl::encoding::Depth,
1561        ) -> fidl::Result<()> {
1562            encoder.debug_check_bounds::<Self>(offset);
1563            encoder.write_num(self.into_primitive(), offset);
1564            Ok(())
1565        }
1566    }
1567
1568    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1569        for DaiFrameFormatStandard
1570    {
1571        #[inline(always)]
1572        fn new_empty() -> Self {
1573            Self::None
1574        }
1575
1576        #[inline]
1577        unsafe fn decode(
1578            &mut self,
1579            decoder: &mut fidl::encoding::Decoder<'_, D>,
1580            offset: usize,
1581            _depth: fidl::encoding::Depth,
1582        ) -> fidl::Result<()> {
1583            decoder.debug_check_bounds::<Self>(offset);
1584            let prim = decoder.read_num::<u8>(offset);
1585
1586            *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
1587            Ok(())
1588        }
1589    }
1590    unsafe impl fidl::encoding::TypeMarker for DaiSampleFormat {
1591        type Owned = Self;
1592
1593        #[inline(always)]
1594        fn inline_align(_context: fidl::encoding::Context) -> usize {
1595            std::mem::align_of::<u8>()
1596        }
1597
1598        #[inline(always)]
1599        fn inline_size(_context: fidl::encoding::Context) -> usize {
1600            std::mem::size_of::<u8>()
1601        }
1602
1603        #[inline(always)]
1604        fn encode_is_copy() -> bool {
1605            true
1606        }
1607
1608        #[inline(always)]
1609        fn decode_is_copy() -> bool {
1610            false
1611        }
1612    }
1613
1614    impl fidl::encoding::ValueTypeMarker for DaiSampleFormat {
1615        type Borrowed<'a> = Self;
1616        #[inline(always)]
1617        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1618            *value
1619        }
1620    }
1621
1622    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
1623        for DaiSampleFormat
1624    {
1625        #[inline]
1626        unsafe fn encode(
1627            self,
1628            encoder: &mut fidl::encoding::Encoder<'_, D>,
1629            offset: usize,
1630            _depth: fidl::encoding::Depth,
1631        ) -> fidl::Result<()> {
1632            encoder.debug_check_bounds::<Self>(offset);
1633            encoder.write_num(self.into_primitive(), offset);
1634            Ok(())
1635        }
1636    }
1637
1638    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for DaiSampleFormat {
1639        #[inline(always)]
1640        fn new_empty() -> Self {
1641            Self::Pdm
1642        }
1643
1644        #[inline]
1645        unsafe fn decode(
1646            &mut self,
1647            decoder: &mut fidl::encoding::Decoder<'_, D>,
1648            offset: usize,
1649            _depth: fidl::encoding::Depth,
1650        ) -> fidl::Result<()> {
1651            decoder.debug_check_bounds::<Self>(offset);
1652            let prim = decoder.read_num::<u8>(offset);
1653
1654            *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
1655            Ok(())
1656        }
1657    }
1658    unsafe impl fidl::encoding::TypeMarker for DeviceType {
1659        type Owned = Self;
1660
1661        #[inline(always)]
1662        fn inline_align(_context: fidl::encoding::Context) -> usize {
1663            std::mem::align_of::<u32>()
1664        }
1665
1666        #[inline(always)]
1667        fn inline_size(_context: fidl::encoding::Context) -> usize {
1668            std::mem::size_of::<u32>()
1669        }
1670
1671        #[inline(always)]
1672        fn encode_is_copy() -> bool {
1673            false
1674        }
1675
1676        #[inline(always)]
1677        fn decode_is_copy() -> bool {
1678            false
1679        }
1680    }
1681
1682    impl fidl::encoding::ValueTypeMarker for DeviceType {
1683        type Borrowed<'a> = Self;
1684        #[inline(always)]
1685        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1686            *value
1687        }
1688    }
1689
1690    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for DeviceType {
1691        #[inline]
1692        unsafe fn encode(
1693            self,
1694            encoder: &mut fidl::encoding::Encoder<'_, D>,
1695            offset: usize,
1696            _depth: fidl::encoding::Depth,
1697        ) -> fidl::Result<()> {
1698            encoder.debug_check_bounds::<Self>(offset);
1699            encoder.write_num(self.into_primitive(), offset);
1700            Ok(())
1701        }
1702    }
1703
1704    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for DeviceType {
1705        #[inline(always)]
1706        fn new_empty() -> Self {
1707            Self::unknown()
1708        }
1709
1710        #[inline]
1711        unsafe fn decode(
1712            &mut self,
1713            decoder: &mut fidl::encoding::Decoder<'_, D>,
1714            offset: usize,
1715            _depth: fidl::encoding::Depth,
1716        ) -> fidl::Result<()> {
1717            decoder.debug_check_bounds::<Self>(offset);
1718            let prim = decoder.read_num::<u32>(offset);
1719
1720            *self = Self::from_primitive_allow_unknown(prim);
1721            Ok(())
1722        }
1723    }
1724    unsafe impl fidl::encoding::TypeMarker for DriverError {
1725        type Owned = Self;
1726
1727        #[inline(always)]
1728        fn inline_align(_context: fidl::encoding::Context) -> usize {
1729            std::mem::align_of::<u32>()
1730        }
1731
1732        #[inline(always)]
1733        fn inline_size(_context: fidl::encoding::Context) -> usize {
1734            std::mem::size_of::<u32>()
1735        }
1736
1737        #[inline(always)]
1738        fn encode_is_copy() -> bool {
1739            false
1740        }
1741
1742        #[inline(always)]
1743        fn decode_is_copy() -> bool {
1744            false
1745        }
1746    }
1747
1748    impl fidl::encoding::ValueTypeMarker for DriverError {
1749        type Borrowed<'a> = Self;
1750        #[inline(always)]
1751        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1752            *value
1753        }
1754    }
1755
1756    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for DriverError {
1757        #[inline]
1758        unsafe fn encode(
1759            self,
1760            encoder: &mut fidl::encoding::Encoder<'_, D>,
1761            offset: usize,
1762            _depth: fidl::encoding::Depth,
1763        ) -> fidl::Result<()> {
1764            encoder.debug_check_bounds::<Self>(offset);
1765            encoder.write_num(self.into_primitive(), offset);
1766            Ok(())
1767        }
1768    }
1769
1770    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for DriverError {
1771        #[inline(always)]
1772        fn new_empty() -> Self {
1773            Self::unknown()
1774        }
1775
1776        #[inline]
1777        unsafe fn decode(
1778            &mut self,
1779            decoder: &mut fidl::encoding::Decoder<'_, D>,
1780            offset: usize,
1781            _depth: fidl::encoding::Depth,
1782        ) -> fidl::Result<()> {
1783            decoder.debug_check_bounds::<Self>(offset);
1784            let prim = decoder.read_num::<u32>(offset);
1785
1786            *self = Self::from_primitive_allow_unknown(prim);
1787            Ok(())
1788        }
1789    }
1790    unsafe impl fidl::encoding::TypeMarker for GetVmoError {
1791        type Owned = Self;
1792
1793        #[inline(always)]
1794        fn inline_align(_context: fidl::encoding::Context) -> usize {
1795            std::mem::align_of::<u32>()
1796        }
1797
1798        #[inline(always)]
1799        fn inline_size(_context: fidl::encoding::Context) -> usize {
1800            std::mem::size_of::<u32>()
1801        }
1802
1803        #[inline(always)]
1804        fn encode_is_copy() -> bool {
1805            true
1806        }
1807
1808        #[inline(always)]
1809        fn decode_is_copy() -> bool {
1810            false
1811        }
1812    }
1813
1814    impl fidl::encoding::ValueTypeMarker for GetVmoError {
1815        type Borrowed<'a> = Self;
1816        #[inline(always)]
1817        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1818            *value
1819        }
1820    }
1821
1822    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for GetVmoError {
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::<Self>(offset);
1831            encoder.write_num(self.into_primitive(), offset);
1832            Ok(())
1833        }
1834    }
1835
1836    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for GetVmoError {
1837        #[inline(always)]
1838        fn new_empty() -> Self {
1839            Self::InvalidArgs
1840        }
1841
1842        #[inline]
1843        unsafe fn decode(
1844            &mut self,
1845            decoder: &mut fidl::encoding::Decoder<'_, D>,
1846            offset: usize,
1847            _depth: fidl::encoding::Depth,
1848        ) -> fidl::Result<()> {
1849            decoder.debug_check_bounds::<Self>(offset);
1850            let prim = decoder.read_num::<u32>(offset);
1851
1852            *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
1853            Ok(())
1854        }
1855    }
1856    unsafe impl fidl::encoding::TypeMarker for PlugDetectCapabilities {
1857        type Owned = Self;
1858
1859        #[inline(always)]
1860        fn inline_align(_context: fidl::encoding::Context) -> usize {
1861            std::mem::align_of::<u32>()
1862        }
1863
1864        #[inline(always)]
1865        fn inline_size(_context: fidl::encoding::Context) -> usize {
1866            std::mem::size_of::<u32>()
1867        }
1868
1869        #[inline(always)]
1870        fn encode_is_copy() -> bool {
1871            true
1872        }
1873
1874        #[inline(always)]
1875        fn decode_is_copy() -> bool {
1876            false
1877        }
1878    }
1879
1880    impl fidl::encoding::ValueTypeMarker for PlugDetectCapabilities {
1881        type Borrowed<'a> = Self;
1882        #[inline(always)]
1883        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1884            *value
1885        }
1886    }
1887
1888    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
1889        for PlugDetectCapabilities
1890    {
1891        #[inline]
1892        unsafe fn encode(
1893            self,
1894            encoder: &mut fidl::encoding::Encoder<'_, D>,
1895            offset: usize,
1896            _depth: fidl::encoding::Depth,
1897        ) -> fidl::Result<()> {
1898            encoder.debug_check_bounds::<Self>(offset);
1899            encoder.write_num(self.into_primitive(), offset);
1900            Ok(())
1901        }
1902    }
1903
1904    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1905        for PlugDetectCapabilities
1906    {
1907        #[inline(always)]
1908        fn new_empty() -> Self {
1909            Self::Hardwired
1910        }
1911
1912        #[inline]
1913        unsafe fn decode(
1914            &mut self,
1915            decoder: &mut fidl::encoding::Decoder<'_, D>,
1916            offset: usize,
1917            _depth: fidl::encoding::Depth,
1918        ) -> fidl::Result<()> {
1919            decoder.debug_check_bounds::<Self>(offset);
1920            let prim = decoder.read_num::<u32>(offset);
1921
1922            *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
1923            Ok(())
1924        }
1925    }
1926    unsafe impl fidl::encoding::TypeMarker for SampleFormat {
1927        type Owned = Self;
1928
1929        #[inline(always)]
1930        fn inline_align(_context: fidl::encoding::Context) -> usize {
1931            std::mem::align_of::<u8>()
1932        }
1933
1934        #[inline(always)]
1935        fn inline_size(_context: fidl::encoding::Context) -> usize {
1936            std::mem::size_of::<u8>()
1937        }
1938
1939        #[inline(always)]
1940        fn encode_is_copy() -> bool {
1941            true
1942        }
1943
1944        #[inline(always)]
1945        fn decode_is_copy() -> bool {
1946            false
1947        }
1948    }
1949
1950    impl fidl::encoding::ValueTypeMarker for SampleFormat {
1951        type Borrowed<'a> = Self;
1952        #[inline(always)]
1953        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1954            *value
1955        }
1956    }
1957
1958    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for SampleFormat {
1959        #[inline]
1960        unsafe fn encode(
1961            self,
1962            encoder: &mut fidl::encoding::Encoder<'_, D>,
1963            offset: usize,
1964            _depth: fidl::encoding::Depth,
1965        ) -> fidl::Result<()> {
1966            encoder.debug_check_bounds::<Self>(offset);
1967            encoder.write_num(self.into_primitive(), offset);
1968            Ok(())
1969        }
1970    }
1971
1972    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SampleFormat {
1973        #[inline(always)]
1974        fn new_empty() -> Self {
1975            Self::PcmSigned
1976        }
1977
1978        #[inline]
1979        unsafe fn decode(
1980            &mut self,
1981            decoder: &mut fidl::encoding::Decoder<'_, D>,
1982            offset: usize,
1983            _depth: fidl::encoding::Depth,
1984        ) -> fidl::Result<()> {
1985            decoder.debug_check_bounds::<Self>(offset);
1986            let prim = decoder.read_num::<u8>(offset);
1987
1988            *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
1989            Ok(())
1990        }
1991    }
1992
1993    impl fidl::encoding::ValueTypeMarker for CodecGetPropertiesResponse {
1994        type Borrowed<'a> = &'a Self;
1995        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1996            value
1997        }
1998    }
1999
2000    unsafe impl fidl::encoding::TypeMarker for CodecGetPropertiesResponse {
2001        type Owned = Self;
2002
2003        #[inline(always)]
2004        fn inline_align(_context: fidl::encoding::Context) -> usize {
2005            8
2006        }
2007
2008        #[inline(always)]
2009        fn inline_size(_context: fidl::encoding::Context) -> usize {
2010            16
2011        }
2012    }
2013
2014    unsafe impl<D: fidl::encoding::ResourceDialect>
2015        fidl::encoding::Encode<CodecGetPropertiesResponse, D> for &CodecGetPropertiesResponse
2016    {
2017        #[inline]
2018        unsafe fn encode(
2019            self,
2020            encoder: &mut fidl::encoding::Encoder<'_, D>,
2021            offset: usize,
2022            _depth: fidl::encoding::Depth,
2023        ) -> fidl::Result<()> {
2024            encoder.debug_check_bounds::<CodecGetPropertiesResponse>(offset);
2025            // Delegate to tuple encoding.
2026            fidl::encoding::Encode::<CodecGetPropertiesResponse, D>::encode(
2027                (<CodecProperties as fidl::encoding::ValueTypeMarker>::borrow(&self.properties),),
2028                encoder,
2029                offset,
2030                _depth,
2031            )
2032        }
2033    }
2034    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<CodecProperties, D>>
2035        fidl::encoding::Encode<CodecGetPropertiesResponse, D> for (T0,)
2036    {
2037        #[inline]
2038        unsafe fn encode(
2039            self,
2040            encoder: &mut fidl::encoding::Encoder<'_, D>,
2041            offset: usize,
2042            depth: fidl::encoding::Depth,
2043        ) -> fidl::Result<()> {
2044            encoder.debug_check_bounds::<CodecGetPropertiesResponse>(offset);
2045            // Zero out padding regions. There's no need to apply masks
2046            // because the unmasked parts will be overwritten by fields.
2047            // Write the fields.
2048            self.0.encode(encoder, offset + 0, depth)?;
2049            Ok(())
2050        }
2051    }
2052
2053    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2054        for CodecGetPropertiesResponse
2055    {
2056        #[inline(always)]
2057        fn new_empty() -> Self {
2058            Self { properties: fidl::new_empty!(CodecProperties, D) }
2059        }
2060
2061        #[inline]
2062        unsafe fn decode(
2063            &mut self,
2064            decoder: &mut fidl::encoding::Decoder<'_, D>,
2065            offset: usize,
2066            _depth: fidl::encoding::Depth,
2067        ) -> fidl::Result<()> {
2068            decoder.debug_check_bounds::<Self>(offset);
2069            // Verify that padding bytes are zero.
2070            fidl::decode!(CodecProperties, D, &mut self.properties, decoder, offset + 0, _depth)?;
2071            Ok(())
2072        }
2073    }
2074
2075    impl fidl::encoding::ValueTypeMarker for CodecIsBridgeableResponse {
2076        type Borrowed<'a> = &'a Self;
2077        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2078            value
2079        }
2080    }
2081
2082    unsafe impl fidl::encoding::TypeMarker for CodecIsBridgeableResponse {
2083        type Owned = Self;
2084
2085        #[inline(always)]
2086        fn inline_align(_context: fidl::encoding::Context) -> usize {
2087            1
2088        }
2089
2090        #[inline(always)]
2091        fn inline_size(_context: fidl::encoding::Context) -> usize {
2092            1
2093        }
2094    }
2095
2096    unsafe impl<D: fidl::encoding::ResourceDialect>
2097        fidl::encoding::Encode<CodecIsBridgeableResponse, D> for &CodecIsBridgeableResponse
2098    {
2099        #[inline]
2100        unsafe fn encode(
2101            self,
2102            encoder: &mut fidl::encoding::Encoder<'_, D>,
2103            offset: usize,
2104            _depth: fidl::encoding::Depth,
2105        ) -> fidl::Result<()> {
2106            encoder.debug_check_bounds::<CodecIsBridgeableResponse>(offset);
2107            // Delegate to tuple encoding.
2108            fidl::encoding::Encode::<CodecIsBridgeableResponse, D>::encode(
2109                (<bool as fidl::encoding::ValueTypeMarker>::borrow(&self.supports_bridged_mode),),
2110                encoder,
2111                offset,
2112                _depth,
2113            )
2114        }
2115    }
2116    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<bool, D>>
2117        fidl::encoding::Encode<CodecIsBridgeableResponse, D> for (T0,)
2118    {
2119        #[inline]
2120        unsafe fn encode(
2121            self,
2122            encoder: &mut fidl::encoding::Encoder<'_, D>,
2123            offset: usize,
2124            depth: fidl::encoding::Depth,
2125        ) -> fidl::Result<()> {
2126            encoder.debug_check_bounds::<CodecIsBridgeableResponse>(offset);
2127            // Zero out padding regions. There's no need to apply masks
2128            // because the unmasked parts will be overwritten by fields.
2129            // Write the fields.
2130            self.0.encode(encoder, offset + 0, depth)?;
2131            Ok(())
2132        }
2133    }
2134
2135    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2136        for CodecIsBridgeableResponse
2137    {
2138        #[inline(always)]
2139        fn new_empty() -> Self {
2140            Self { supports_bridged_mode: fidl::new_empty!(bool, D) }
2141        }
2142
2143        #[inline]
2144        unsafe fn decode(
2145            &mut self,
2146            decoder: &mut fidl::encoding::Decoder<'_, D>,
2147            offset: usize,
2148            _depth: fidl::encoding::Depth,
2149        ) -> fidl::Result<()> {
2150            decoder.debug_check_bounds::<Self>(offset);
2151            // Verify that padding bytes are zero.
2152            fidl::decode!(bool, D, &mut self.supports_bridged_mode, decoder, offset + 0, _depth)?;
2153            Ok(())
2154        }
2155    }
2156
2157    impl fidl::encoding::ValueTypeMarker for CodecSetBridgedModeRequest {
2158        type Borrowed<'a> = &'a Self;
2159        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2160            value
2161        }
2162    }
2163
2164    unsafe impl fidl::encoding::TypeMarker for CodecSetBridgedModeRequest {
2165        type Owned = Self;
2166
2167        #[inline(always)]
2168        fn inline_align(_context: fidl::encoding::Context) -> usize {
2169            1
2170        }
2171
2172        #[inline(always)]
2173        fn inline_size(_context: fidl::encoding::Context) -> usize {
2174            1
2175        }
2176    }
2177
2178    unsafe impl<D: fidl::encoding::ResourceDialect>
2179        fidl::encoding::Encode<CodecSetBridgedModeRequest, D> for &CodecSetBridgedModeRequest
2180    {
2181        #[inline]
2182        unsafe fn encode(
2183            self,
2184            encoder: &mut fidl::encoding::Encoder<'_, D>,
2185            offset: usize,
2186            _depth: fidl::encoding::Depth,
2187        ) -> fidl::Result<()> {
2188            encoder.debug_check_bounds::<CodecSetBridgedModeRequest>(offset);
2189            // Delegate to tuple encoding.
2190            fidl::encoding::Encode::<CodecSetBridgedModeRequest, D>::encode(
2191                (<bool as fidl::encoding::ValueTypeMarker>::borrow(&self.enable_bridged_mode),),
2192                encoder,
2193                offset,
2194                _depth,
2195            )
2196        }
2197    }
2198    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<bool, D>>
2199        fidl::encoding::Encode<CodecSetBridgedModeRequest, D> for (T0,)
2200    {
2201        #[inline]
2202        unsafe fn encode(
2203            self,
2204            encoder: &mut fidl::encoding::Encoder<'_, D>,
2205            offset: usize,
2206            depth: fidl::encoding::Depth,
2207        ) -> fidl::Result<()> {
2208            encoder.debug_check_bounds::<CodecSetBridgedModeRequest>(offset);
2209            // Zero out padding regions. There's no need to apply masks
2210            // because the unmasked parts will be overwritten by fields.
2211            // Write the fields.
2212            self.0.encode(encoder, offset + 0, depth)?;
2213            Ok(())
2214        }
2215    }
2216
2217    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2218        for CodecSetBridgedModeRequest
2219    {
2220        #[inline(always)]
2221        fn new_empty() -> Self {
2222            Self { enable_bridged_mode: fidl::new_empty!(bool, D) }
2223        }
2224
2225        #[inline]
2226        unsafe fn decode(
2227            &mut self,
2228            decoder: &mut fidl::encoding::Decoder<'_, D>,
2229            offset: usize,
2230            _depth: fidl::encoding::Depth,
2231        ) -> fidl::Result<()> {
2232            decoder.debug_check_bounds::<Self>(offset);
2233            // Verify that padding bytes are zero.
2234            fidl::decode!(bool, D, &mut self.enable_bridged_mode, decoder, offset + 0, _depth)?;
2235            Ok(())
2236        }
2237    }
2238
2239    impl fidl::encoding::ValueTypeMarker for CodecSetDaiFormatRequest {
2240        type Borrowed<'a> = &'a Self;
2241        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2242            value
2243        }
2244    }
2245
2246    unsafe impl fidl::encoding::TypeMarker for CodecSetDaiFormatRequest {
2247        type Owned = Self;
2248
2249        #[inline(always)]
2250        fn inline_align(_context: fidl::encoding::Context) -> usize {
2251            8
2252        }
2253
2254        #[inline(always)]
2255        fn inline_size(_context: fidl::encoding::Context) -> usize {
2256            48
2257        }
2258    }
2259
2260    unsafe impl<D: fidl::encoding::ResourceDialect>
2261        fidl::encoding::Encode<CodecSetDaiFormatRequest, D> for &CodecSetDaiFormatRequest
2262    {
2263        #[inline]
2264        unsafe fn encode(
2265            self,
2266            encoder: &mut fidl::encoding::Encoder<'_, D>,
2267            offset: usize,
2268            _depth: fidl::encoding::Depth,
2269        ) -> fidl::Result<()> {
2270            encoder.debug_check_bounds::<CodecSetDaiFormatRequest>(offset);
2271            // Delegate to tuple encoding.
2272            fidl::encoding::Encode::<CodecSetDaiFormatRequest, D>::encode(
2273                (<DaiFormat as fidl::encoding::ValueTypeMarker>::borrow(&self.format),),
2274                encoder,
2275                offset,
2276                _depth,
2277            )
2278        }
2279    }
2280    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<DaiFormat, D>>
2281        fidl::encoding::Encode<CodecSetDaiFormatRequest, D> for (T0,)
2282    {
2283        #[inline]
2284        unsafe fn encode(
2285            self,
2286            encoder: &mut fidl::encoding::Encoder<'_, D>,
2287            offset: usize,
2288            depth: fidl::encoding::Depth,
2289        ) -> fidl::Result<()> {
2290            encoder.debug_check_bounds::<CodecSetDaiFormatRequest>(offset);
2291            // Zero out padding regions. There's no need to apply masks
2292            // because the unmasked parts will be overwritten by fields.
2293            // Write the fields.
2294            self.0.encode(encoder, offset + 0, depth)?;
2295            Ok(())
2296        }
2297    }
2298
2299    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2300        for CodecSetDaiFormatRequest
2301    {
2302        #[inline(always)]
2303        fn new_empty() -> Self {
2304            Self { format: fidl::new_empty!(DaiFormat, D) }
2305        }
2306
2307        #[inline]
2308        unsafe fn decode(
2309            &mut self,
2310            decoder: &mut fidl::encoding::Decoder<'_, D>,
2311            offset: usize,
2312            _depth: fidl::encoding::Depth,
2313        ) -> fidl::Result<()> {
2314            decoder.debug_check_bounds::<Self>(offset);
2315            // Verify that padding bytes are zero.
2316            fidl::decode!(DaiFormat, D, &mut self.format, decoder, offset + 0, _depth)?;
2317            Ok(())
2318        }
2319    }
2320
2321    impl fidl::encoding::ValueTypeMarker for CodecStartResponse {
2322        type Borrowed<'a> = &'a Self;
2323        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2324            value
2325        }
2326    }
2327
2328    unsafe impl fidl::encoding::TypeMarker for CodecStartResponse {
2329        type Owned = Self;
2330
2331        #[inline(always)]
2332        fn inline_align(_context: fidl::encoding::Context) -> usize {
2333            8
2334        }
2335
2336        #[inline(always)]
2337        fn inline_size(_context: fidl::encoding::Context) -> usize {
2338            8
2339        }
2340        #[inline(always)]
2341        fn encode_is_copy() -> bool {
2342            true
2343        }
2344
2345        #[inline(always)]
2346        fn decode_is_copy() -> bool {
2347            true
2348        }
2349    }
2350
2351    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<CodecStartResponse, D>
2352        for &CodecStartResponse
2353    {
2354        #[inline]
2355        unsafe fn encode(
2356            self,
2357            encoder: &mut fidl::encoding::Encoder<'_, D>,
2358            offset: usize,
2359            _depth: fidl::encoding::Depth,
2360        ) -> fidl::Result<()> {
2361            encoder.debug_check_bounds::<CodecStartResponse>(offset);
2362            unsafe {
2363                // Copy the object into the buffer.
2364                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
2365                (buf_ptr as *mut CodecStartResponse)
2366                    .write_unaligned((self as *const CodecStartResponse).read());
2367                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
2368                // done second because the memcpy will write garbage to these bytes.
2369            }
2370            Ok(())
2371        }
2372    }
2373    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<i64, D>>
2374        fidl::encoding::Encode<CodecStartResponse, D> for (T0,)
2375    {
2376        #[inline]
2377        unsafe fn encode(
2378            self,
2379            encoder: &mut fidl::encoding::Encoder<'_, D>,
2380            offset: usize,
2381            depth: fidl::encoding::Depth,
2382        ) -> fidl::Result<()> {
2383            encoder.debug_check_bounds::<CodecStartResponse>(offset);
2384            // Zero out padding regions. There's no need to apply masks
2385            // because the unmasked parts will be overwritten by fields.
2386            // Write the fields.
2387            self.0.encode(encoder, offset + 0, depth)?;
2388            Ok(())
2389        }
2390    }
2391
2392    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for CodecStartResponse {
2393        #[inline(always)]
2394        fn new_empty() -> Self {
2395            Self { start_time: fidl::new_empty!(i64, D) }
2396        }
2397
2398        #[inline]
2399        unsafe fn decode(
2400            &mut self,
2401            decoder: &mut fidl::encoding::Decoder<'_, D>,
2402            offset: usize,
2403            _depth: fidl::encoding::Depth,
2404        ) -> fidl::Result<()> {
2405            decoder.debug_check_bounds::<Self>(offset);
2406            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
2407            // Verify that padding bytes are zero.
2408            // Copy from the buffer into the object.
2409            unsafe {
2410                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 8);
2411            }
2412            Ok(())
2413        }
2414    }
2415
2416    impl fidl::encoding::ValueTypeMarker for CodecStopResponse {
2417        type Borrowed<'a> = &'a Self;
2418        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2419            value
2420        }
2421    }
2422
2423    unsafe impl fidl::encoding::TypeMarker for CodecStopResponse {
2424        type Owned = Self;
2425
2426        #[inline(always)]
2427        fn inline_align(_context: fidl::encoding::Context) -> usize {
2428            8
2429        }
2430
2431        #[inline(always)]
2432        fn inline_size(_context: fidl::encoding::Context) -> usize {
2433            8
2434        }
2435        #[inline(always)]
2436        fn encode_is_copy() -> bool {
2437            true
2438        }
2439
2440        #[inline(always)]
2441        fn decode_is_copy() -> bool {
2442            true
2443        }
2444    }
2445
2446    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<CodecStopResponse, D>
2447        for &CodecStopResponse
2448    {
2449        #[inline]
2450        unsafe fn encode(
2451            self,
2452            encoder: &mut fidl::encoding::Encoder<'_, D>,
2453            offset: usize,
2454            _depth: fidl::encoding::Depth,
2455        ) -> fidl::Result<()> {
2456            encoder.debug_check_bounds::<CodecStopResponse>(offset);
2457            unsafe {
2458                // Copy the object into the buffer.
2459                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
2460                (buf_ptr as *mut CodecStopResponse)
2461                    .write_unaligned((self as *const CodecStopResponse).read());
2462                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
2463                // done second because the memcpy will write garbage to these bytes.
2464            }
2465            Ok(())
2466        }
2467    }
2468    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<i64, D>>
2469        fidl::encoding::Encode<CodecStopResponse, D> for (T0,)
2470    {
2471        #[inline]
2472        unsafe fn encode(
2473            self,
2474            encoder: &mut fidl::encoding::Encoder<'_, D>,
2475            offset: usize,
2476            depth: fidl::encoding::Depth,
2477        ) -> fidl::Result<()> {
2478            encoder.debug_check_bounds::<CodecStopResponse>(offset);
2479            // Zero out padding regions. There's no need to apply masks
2480            // because the unmasked parts will be overwritten by fields.
2481            // Write the fields.
2482            self.0.encode(encoder, offset + 0, depth)?;
2483            Ok(())
2484        }
2485    }
2486
2487    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for CodecStopResponse {
2488        #[inline(always)]
2489        fn new_empty() -> Self {
2490            Self { stop_time: fidl::new_empty!(i64, D) }
2491        }
2492
2493        #[inline]
2494        unsafe fn decode(
2495            &mut self,
2496            decoder: &mut fidl::encoding::Decoder<'_, D>,
2497            offset: usize,
2498            _depth: fidl::encoding::Depth,
2499        ) -> fidl::Result<()> {
2500            decoder.debug_check_bounds::<Self>(offset);
2501            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
2502            // Verify that padding bytes are zero.
2503            // Copy from the buffer into the object.
2504            unsafe {
2505                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 8);
2506            }
2507            Ok(())
2508        }
2509    }
2510
2511    impl fidl::encoding::ValueTypeMarker for CodecWatchPlugStateResponse {
2512        type Borrowed<'a> = &'a Self;
2513        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2514            value
2515        }
2516    }
2517
2518    unsafe impl fidl::encoding::TypeMarker for CodecWatchPlugStateResponse {
2519        type Owned = Self;
2520
2521        #[inline(always)]
2522        fn inline_align(_context: fidl::encoding::Context) -> usize {
2523            8
2524        }
2525
2526        #[inline(always)]
2527        fn inline_size(_context: fidl::encoding::Context) -> usize {
2528            16
2529        }
2530    }
2531
2532    unsafe impl<D: fidl::encoding::ResourceDialect>
2533        fidl::encoding::Encode<CodecWatchPlugStateResponse, D> for &CodecWatchPlugStateResponse
2534    {
2535        #[inline]
2536        unsafe fn encode(
2537            self,
2538            encoder: &mut fidl::encoding::Encoder<'_, D>,
2539            offset: usize,
2540            _depth: fidl::encoding::Depth,
2541        ) -> fidl::Result<()> {
2542            encoder.debug_check_bounds::<CodecWatchPlugStateResponse>(offset);
2543            // Delegate to tuple encoding.
2544            fidl::encoding::Encode::<CodecWatchPlugStateResponse, D>::encode(
2545                (<PlugState as fidl::encoding::ValueTypeMarker>::borrow(&self.plug_state),),
2546                encoder,
2547                offset,
2548                _depth,
2549            )
2550        }
2551    }
2552    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<PlugState, D>>
2553        fidl::encoding::Encode<CodecWatchPlugStateResponse, D> for (T0,)
2554    {
2555        #[inline]
2556        unsafe fn encode(
2557            self,
2558            encoder: &mut fidl::encoding::Encoder<'_, D>,
2559            offset: usize,
2560            depth: fidl::encoding::Depth,
2561        ) -> fidl::Result<()> {
2562            encoder.debug_check_bounds::<CodecWatchPlugStateResponse>(offset);
2563            // Zero out padding regions. There's no need to apply masks
2564            // because the unmasked parts will be overwritten by fields.
2565            // Write the fields.
2566            self.0.encode(encoder, offset + 0, depth)?;
2567            Ok(())
2568        }
2569    }
2570
2571    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2572        for CodecWatchPlugStateResponse
2573    {
2574        #[inline(always)]
2575        fn new_empty() -> Self {
2576            Self { plug_state: fidl::new_empty!(PlugState, D) }
2577        }
2578
2579        #[inline]
2580        unsafe fn decode(
2581            &mut self,
2582            decoder: &mut fidl::encoding::Decoder<'_, D>,
2583            offset: usize,
2584            _depth: fidl::encoding::Depth,
2585        ) -> fidl::Result<()> {
2586            decoder.debug_check_bounds::<Self>(offset);
2587            // Verify that padding bytes are zero.
2588            fidl::decode!(PlugState, D, &mut self.plug_state, decoder, offset + 0, _depth)?;
2589            Ok(())
2590        }
2591    }
2592
2593    impl fidl::encoding::ValueTypeMarker for CodecGetDaiFormatsResponse {
2594        type Borrowed<'a> = &'a Self;
2595        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2596            value
2597        }
2598    }
2599
2600    unsafe impl fidl::encoding::TypeMarker for CodecGetDaiFormatsResponse {
2601        type Owned = Self;
2602
2603        #[inline(always)]
2604        fn inline_align(_context: fidl::encoding::Context) -> usize {
2605            8
2606        }
2607
2608        #[inline(always)]
2609        fn inline_size(_context: fidl::encoding::Context) -> usize {
2610            16
2611        }
2612    }
2613
2614    unsafe impl<D: fidl::encoding::ResourceDialect>
2615        fidl::encoding::Encode<CodecGetDaiFormatsResponse, D> for &CodecGetDaiFormatsResponse
2616    {
2617        #[inline]
2618        unsafe fn encode(
2619            self,
2620            encoder: &mut fidl::encoding::Encoder<'_, D>,
2621            offset: usize,
2622            _depth: fidl::encoding::Depth,
2623        ) -> fidl::Result<()> {
2624            encoder.debug_check_bounds::<CodecGetDaiFormatsResponse>(offset);
2625            // Delegate to tuple encoding.
2626            fidl::encoding::Encode::<CodecGetDaiFormatsResponse, D>::encode(
2627                (
2628                    <fidl::encoding::Vector<DaiSupportedFormats, 64> as fidl::encoding::ValueTypeMarker>::borrow(&self.formats),
2629                ),
2630                encoder, offset, _depth
2631            )
2632        }
2633    }
2634    unsafe impl<
2635            D: fidl::encoding::ResourceDialect,
2636            T0: fidl::encoding::Encode<fidl::encoding::Vector<DaiSupportedFormats, 64>, D>,
2637        > fidl::encoding::Encode<CodecGetDaiFormatsResponse, D> for (T0,)
2638    {
2639        #[inline]
2640        unsafe fn encode(
2641            self,
2642            encoder: &mut fidl::encoding::Encoder<'_, D>,
2643            offset: usize,
2644            depth: fidl::encoding::Depth,
2645        ) -> fidl::Result<()> {
2646            encoder.debug_check_bounds::<CodecGetDaiFormatsResponse>(offset);
2647            // Zero out padding regions. There's no need to apply masks
2648            // because the unmasked parts will be overwritten by fields.
2649            // Write the fields.
2650            self.0.encode(encoder, offset + 0, depth)?;
2651            Ok(())
2652        }
2653    }
2654
2655    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2656        for CodecGetDaiFormatsResponse
2657    {
2658        #[inline(always)]
2659        fn new_empty() -> Self {
2660            Self { formats: fidl::new_empty!(fidl::encoding::Vector<DaiSupportedFormats, 64>, D) }
2661        }
2662
2663        #[inline]
2664        unsafe fn decode(
2665            &mut self,
2666            decoder: &mut fidl::encoding::Decoder<'_, D>,
2667            offset: usize,
2668            _depth: fidl::encoding::Depth,
2669        ) -> fidl::Result<()> {
2670            decoder.debug_check_bounds::<Self>(offset);
2671            // Verify that padding bytes are zero.
2672            fidl::decode!(fidl::encoding::Vector<DaiSupportedFormats, 64>, D, &mut self.formats, decoder, offset + 0, _depth)?;
2673            Ok(())
2674        }
2675    }
2676
2677    impl fidl::encoding::ValueTypeMarker for CodecSetDaiFormatResponse {
2678        type Borrowed<'a> = &'a Self;
2679        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2680            value
2681        }
2682    }
2683
2684    unsafe impl fidl::encoding::TypeMarker for CodecSetDaiFormatResponse {
2685        type Owned = Self;
2686
2687        #[inline(always)]
2688        fn inline_align(_context: fidl::encoding::Context) -> usize {
2689            8
2690        }
2691
2692        #[inline(always)]
2693        fn inline_size(_context: fidl::encoding::Context) -> usize {
2694            16
2695        }
2696    }
2697
2698    unsafe impl<D: fidl::encoding::ResourceDialect>
2699        fidl::encoding::Encode<CodecSetDaiFormatResponse, D> for &CodecSetDaiFormatResponse
2700    {
2701        #[inline]
2702        unsafe fn encode(
2703            self,
2704            encoder: &mut fidl::encoding::Encoder<'_, D>,
2705            offset: usize,
2706            _depth: fidl::encoding::Depth,
2707        ) -> fidl::Result<()> {
2708            encoder.debug_check_bounds::<CodecSetDaiFormatResponse>(offset);
2709            // Delegate to tuple encoding.
2710            fidl::encoding::Encode::<CodecSetDaiFormatResponse, D>::encode(
2711                (<CodecFormatInfo as fidl::encoding::ValueTypeMarker>::borrow(&self.state),),
2712                encoder,
2713                offset,
2714                _depth,
2715            )
2716        }
2717    }
2718    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<CodecFormatInfo, D>>
2719        fidl::encoding::Encode<CodecSetDaiFormatResponse, D> for (T0,)
2720    {
2721        #[inline]
2722        unsafe fn encode(
2723            self,
2724            encoder: &mut fidl::encoding::Encoder<'_, D>,
2725            offset: usize,
2726            depth: fidl::encoding::Depth,
2727        ) -> fidl::Result<()> {
2728            encoder.debug_check_bounds::<CodecSetDaiFormatResponse>(offset);
2729            // Zero out padding regions. There's no need to apply masks
2730            // because the unmasked parts will be overwritten by fields.
2731            // Write the fields.
2732            self.0.encode(encoder, offset + 0, depth)?;
2733            Ok(())
2734        }
2735    }
2736
2737    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2738        for CodecSetDaiFormatResponse
2739    {
2740        #[inline(always)]
2741        fn new_empty() -> Self {
2742            Self { state: fidl::new_empty!(CodecFormatInfo, D) }
2743        }
2744
2745        #[inline]
2746        unsafe fn decode(
2747            &mut self,
2748            decoder: &mut fidl::encoding::Decoder<'_, D>,
2749            offset: usize,
2750            _depth: fidl::encoding::Depth,
2751        ) -> fidl::Result<()> {
2752            decoder.debug_check_bounds::<Self>(offset);
2753            // Verify that padding bytes are zero.
2754            fidl::decode!(CodecFormatInfo, D, &mut self.state, decoder, offset + 0, _depth)?;
2755            Ok(())
2756        }
2757    }
2758
2759    impl fidl::encoding::ValueTypeMarker for CompositeGetDaiFormatsRequest {
2760        type Borrowed<'a> = &'a Self;
2761        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2762            value
2763        }
2764    }
2765
2766    unsafe impl fidl::encoding::TypeMarker for CompositeGetDaiFormatsRequest {
2767        type Owned = Self;
2768
2769        #[inline(always)]
2770        fn inline_align(_context: fidl::encoding::Context) -> usize {
2771            8
2772        }
2773
2774        #[inline(always)]
2775        fn inline_size(_context: fidl::encoding::Context) -> usize {
2776            8
2777        }
2778        #[inline(always)]
2779        fn encode_is_copy() -> bool {
2780            true
2781        }
2782
2783        #[inline(always)]
2784        fn decode_is_copy() -> bool {
2785            true
2786        }
2787    }
2788
2789    unsafe impl<D: fidl::encoding::ResourceDialect>
2790        fidl::encoding::Encode<CompositeGetDaiFormatsRequest, D>
2791        for &CompositeGetDaiFormatsRequest
2792    {
2793        #[inline]
2794        unsafe fn encode(
2795            self,
2796            encoder: &mut fidl::encoding::Encoder<'_, D>,
2797            offset: usize,
2798            _depth: fidl::encoding::Depth,
2799        ) -> fidl::Result<()> {
2800            encoder.debug_check_bounds::<CompositeGetDaiFormatsRequest>(offset);
2801            unsafe {
2802                // Copy the object into the buffer.
2803                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
2804                (buf_ptr as *mut CompositeGetDaiFormatsRequest)
2805                    .write_unaligned((self as *const CompositeGetDaiFormatsRequest).read());
2806                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
2807                // done second because the memcpy will write garbage to these bytes.
2808            }
2809            Ok(())
2810        }
2811    }
2812    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u64, D>>
2813        fidl::encoding::Encode<CompositeGetDaiFormatsRequest, D> for (T0,)
2814    {
2815        #[inline]
2816        unsafe fn encode(
2817            self,
2818            encoder: &mut fidl::encoding::Encoder<'_, D>,
2819            offset: usize,
2820            depth: fidl::encoding::Depth,
2821        ) -> fidl::Result<()> {
2822            encoder.debug_check_bounds::<CompositeGetDaiFormatsRequest>(offset);
2823            // Zero out padding regions. There's no need to apply masks
2824            // because the unmasked parts will be overwritten by fields.
2825            // Write the fields.
2826            self.0.encode(encoder, offset + 0, depth)?;
2827            Ok(())
2828        }
2829    }
2830
2831    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2832        for CompositeGetDaiFormatsRequest
2833    {
2834        #[inline(always)]
2835        fn new_empty() -> Self {
2836            Self { processing_element_id: fidl::new_empty!(u64, D) }
2837        }
2838
2839        #[inline]
2840        unsafe fn decode(
2841            &mut self,
2842            decoder: &mut fidl::encoding::Decoder<'_, D>,
2843            offset: usize,
2844            _depth: fidl::encoding::Depth,
2845        ) -> fidl::Result<()> {
2846            decoder.debug_check_bounds::<Self>(offset);
2847            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
2848            // Verify that padding bytes are zero.
2849            // Copy from the buffer into the object.
2850            unsafe {
2851                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 8);
2852            }
2853            Ok(())
2854        }
2855    }
2856
2857    impl fidl::encoding::ValueTypeMarker for CompositeGetPropertiesResponse {
2858        type Borrowed<'a> = &'a Self;
2859        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2860            value
2861        }
2862    }
2863
2864    unsafe impl fidl::encoding::TypeMarker for CompositeGetPropertiesResponse {
2865        type Owned = Self;
2866
2867        #[inline(always)]
2868        fn inline_align(_context: fidl::encoding::Context) -> usize {
2869            8
2870        }
2871
2872        #[inline(always)]
2873        fn inline_size(_context: fidl::encoding::Context) -> usize {
2874            16
2875        }
2876    }
2877
2878    unsafe impl<D: fidl::encoding::ResourceDialect>
2879        fidl::encoding::Encode<CompositeGetPropertiesResponse, D>
2880        for &CompositeGetPropertiesResponse
2881    {
2882        #[inline]
2883        unsafe fn encode(
2884            self,
2885            encoder: &mut fidl::encoding::Encoder<'_, D>,
2886            offset: usize,
2887            _depth: fidl::encoding::Depth,
2888        ) -> fidl::Result<()> {
2889            encoder.debug_check_bounds::<CompositeGetPropertiesResponse>(offset);
2890            // Delegate to tuple encoding.
2891            fidl::encoding::Encode::<CompositeGetPropertiesResponse, D>::encode(
2892                (<CompositeProperties as fidl::encoding::ValueTypeMarker>::borrow(
2893                    &self.properties,
2894                ),),
2895                encoder,
2896                offset,
2897                _depth,
2898            )
2899        }
2900    }
2901    unsafe impl<
2902            D: fidl::encoding::ResourceDialect,
2903            T0: fidl::encoding::Encode<CompositeProperties, D>,
2904        > fidl::encoding::Encode<CompositeGetPropertiesResponse, D> for (T0,)
2905    {
2906        #[inline]
2907        unsafe fn encode(
2908            self,
2909            encoder: &mut fidl::encoding::Encoder<'_, D>,
2910            offset: usize,
2911            depth: fidl::encoding::Depth,
2912        ) -> fidl::Result<()> {
2913            encoder.debug_check_bounds::<CompositeGetPropertiesResponse>(offset);
2914            // Zero out padding regions. There's no need to apply masks
2915            // because the unmasked parts will be overwritten by fields.
2916            // Write the fields.
2917            self.0.encode(encoder, offset + 0, depth)?;
2918            Ok(())
2919        }
2920    }
2921
2922    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2923        for CompositeGetPropertiesResponse
2924    {
2925        #[inline(always)]
2926        fn new_empty() -> Self {
2927            Self { properties: fidl::new_empty!(CompositeProperties, D) }
2928        }
2929
2930        #[inline]
2931        unsafe fn decode(
2932            &mut self,
2933            decoder: &mut fidl::encoding::Decoder<'_, D>,
2934            offset: usize,
2935            _depth: fidl::encoding::Depth,
2936        ) -> fidl::Result<()> {
2937            decoder.debug_check_bounds::<Self>(offset);
2938            // Verify that padding bytes are zero.
2939            fidl::decode!(
2940                CompositeProperties,
2941                D,
2942                &mut self.properties,
2943                decoder,
2944                offset + 0,
2945                _depth
2946            )?;
2947            Ok(())
2948        }
2949    }
2950
2951    impl fidl::encoding::ValueTypeMarker for CompositeGetRingBufferFormatsRequest {
2952        type Borrowed<'a> = &'a Self;
2953        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2954            value
2955        }
2956    }
2957
2958    unsafe impl fidl::encoding::TypeMarker for CompositeGetRingBufferFormatsRequest {
2959        type Owned = Self;
2960
2961        #[inline(always)]
2962        fn inline_align(_context: fidl::encoding::Context) -> usize {
2963            8
2964        }
2965
2966        #[inline(always)]
2967        fn inline_size(_context: fidl::encoding::Context) -> usize {
2968            8
2969        }
2970        #[inline(always)]
2971        fn encode_is_copy() -> bool {
2972            true
2973        }
2974
2975        #[inline(always)]
2976        fn decode_is_copy() -> bool {
2977            true
2978        }
2979    }
2980
2981    unsafe impl<D: fidl::encoding::ResourceDialect>
2982        fidl::encoding::Encode<CompositeGetRingBufferFormatsRequest, D>
2983        for &CompositeGetRingBufferFormatsRequest
2984    {
2985        #[inline]
2986        unsafe fn encode(
2987            self,
2988            encoder: &mut fidl::encoding::Encoder<'_, D>,
2989            offset: usize,
2990            _depth: fidl::encoding::Depth,
2991        ) -> fidl::Result<()> {
2992            encoder.debug_check_bounds::<CompositeGetRingBufferFormatsRequest>(offset);
2993            unsafe {
2994                // Copy the object into the buffer.
2995                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
2996                (buf_ptr as *mut CompositeGetRingBufferFormatsRequest)
2997                    .write_unaligned((self as *const CompositeGetRingBufferFormatsRequest).read());
2998                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
2999                // done second because the memcpy will write garbage to these bytes.
3000            }
3001            Ok(())
3002        }
3003    }
3004    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u64, D>>
3005        fidl::encoding::Encode<CompositeGetRingBufferFormatsRequest, D> for (T0,)
3006    {
3007        #[inline]
3008        unsafe fn encode(
3009            self,
3010            encoder: &mut fidl::encoding::Encoder<'_, D>,
3011            offset: usize,
3012            depth: fidl::encoding::Depth,
3013        ) -> fidl::Result<()> {
3014            encoder.debug_check_bounds::<CompositeGetRingBufferFormatsRequest>(offset);
3015            // Zero out padding regions. There's no need to apply masks
3016            // because the unmasked parts will be overwritten by fields.
3017            // Write the fields.
3018            self.0.encode(encoder, offset + 0, depth)?;
3019            Ok(())
3020        }
3021    }
3022
3023    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3024        for CompositeGetRingBufferFormatsRequest
3025    {
3026        #[inline(always)]
3027        fn new_empty() -> Self {
3028            Self { processing_element_id: fidl::new_empty!(u64, D) }
3029        }
3030
3031        #[inline]
3032        unsafe fn decode(
3033            &mut self,
3034            decoder: &mut fidl::encoding::Decoder<'_, D>,
3035            offset: usize,
3036            _depth: fidl::encoding::Depth,
3037        ) -> fidl::Result<()> {
3038            decoder.debug_check_bounds::<Self>(offset);
3039            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
3040            // Verify that padding bytes are zero.
3041            // Copy from the buffer into the object.
3042            unsafe {
3043                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 8);
3044            }
3045            Ok(())
3046        }
3047    }
3048
3049    impl fidl::encoding::ValueTypeMarker for CompositeSetDaiFormatRequest {
3050        type Borrowed<'a> = &'a Self;
3051        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3052            value
3053        }
3054    }
3055
3056    unsafe impl fidl::encoding::TypeMarker for CompositeSetDaiFormatRequest {
3057        type Owned = Self;
3058
3059        #[inline(always)]
3060        fn inline_align(_context: fidl::encoding::Context) -> usize {
3061            8
3062        }
3063
3064        #[inline(always)]
3065        fn inline_size(_context: fidl::encoding::Context) -> usize {
3066            56
3067        }
3068    }
3069
3070    unsafe impl<D: fidl::encoding::ResourceDialect>
3071        fidl::encoding::Encode<CompositeSetDaiFormatRequest, D> for &CompositeSetDaiFormatRequest
3072    {
3073        #[inline]
3074        unsafe fn encode(
3075            self,
3076            encoder: &mut fidl::encoding::Encoder<'_, D>,
3077            offset: usize,
3078            _depth: fidl::encoding::Depth,
3079        ) -> fidl::Result<()> {
3080            encoder.debug_check_bounds::<CompositeSetDaiFormatRequest>(offset);
3081            // Delegate to tuple encoding.
3082            fidl::encoding::Encode::<CompositeSetDaiFormatRequest, D>::encode(
3083                (
3084                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.processing_element_id),
3085                    <DaiFormat as fidl::encoding::ValueTypeMarker>::borrow(&self.format),
3086                ),
3087                encoder,
3088                offset,
3089                _depth,
3090            )
3091        }
3092    }
3093    unsafe impl<
3094            D: fidl::encoding::ResourceDialect,
3095            T0: fidl::encoding::Encode<u64, D>,
3096            T1: fidl::encoding::Encode<DaiFormat, D>,
3097        > fidl::encoding::Encode<CompositeSetDaiFormatRequest, D> for (T0, T1)
3098    {
3099        #[inline]
3100        unsafe fn encode(
3101            self,
3102            encoder: &mut fidl::encoding::Encoder<'_, D>,
3103            offset: usize,
3104            depth: fidl::encoding::Depth,
3105        ) -> fidl::Result<()> {
3106            encoder.debug_check_bounds::<CompositeSetDaiFormatRequest>(offset);
3107            // Zero out padding regions. There's no need to apply masks
3108            // because the unmasked parts will be overwritten by fields.
3109            // Write the fields.
3110            self.0.encode(encoder, offset + 0, depth)?;
3111            self.1.encode(encoder, offset + 8, depth)?;
3112            Ok(())
3113        }
3114    }
3115
3116    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3117        for CompositeSetDaiFormatRequest
3118    {
3119        #[inline(always)]
3120        fn new_empty() -> Self {
3121            Self {
3122                processing_element_id: fidl::new_empty!(u64, D),
3123                format: fidl::new_empty!(DaiFormat, D),
3124            }
3125        }
3126
3127        #[inline]
3128        unsafe fn decode(
3129            &mut self,
3130            decoder: &mut fidl::encoding::Decoder<'_, D>,
3131            offset: usize,
3132            _depth: fidl::encoding::Depth,
3133        ) -> fidl::Result<()> {
3134            decoder.debug_check_bounds::<Self>(offset);
3135            // Verify that padding bytes are zero.
3136            fidl::decode!(u64, D, &mut self.processing_element_id, decoder, offset + 0, _depth)?;
3137            fidl::decode!(DaiFormat, D, &mut self.format, decoder, offset + 8, _depth)?;
3138            Ok(())
3139        }
3140    }
3141
3142    impl fidl::encoding::ValueTypeMarker for CompositeGetDaiFormatsResponse {
3143        type Borrowed<'a> = &'a Self;
3144        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3145            value
3146        }
3147    }
3148
3149    unsafe impl fidl::encoding::TypeMarker for CompositeGetDaiFormatsResponse {
3150        type Owned = Self;
3151
3152        #[inline(always)]
3153        fn inline_align(_context: fidl::encoding::Context) -> usize {
3154            8
3155        }
3156
3157        #[inline(always)]
3158        fn inline_size(_context: fidl::encoding::Context) -> usize {
3159            16
3160        }
3161    }
3162
3163    unsafe impl<D: fidl::encoding::ResourceDialect>
3164        fidl::encoding::Encode<CompositeGetDaiFormatsResponse, D>
3165        for &CompositeGetDaiFormatsResponse
3166    {
3167        #[inline]
3168        unsafe fn encode(
3169            self,
3170            encoder: &mut fidl::encoding::Encoder<'_, D>,
3171            offset: usize,
3172            _depth: fidl::encoding::Depth,
3173        ) -> fidl::Result<()> {
3174            encoder.debug_check_bounds::<CompositeGetDaiFormatsResponse>(offset);
3175            // Delegate to tuple encoding.
3176            fidl::encoding::Encode::<CompositeGetDaiFormatsResponse, D>::encode(
3177                (
3178                    <fidl::encoding::Vector<DaiSupportedFormats, 64> as fidl::encoding::ValueTypeMarker>::borrow(&self.dai_formats),
3179                ),
3180                encoder, offset, _depth
3181            )
3182        }
3183    }
3184    unsafe impl<
3185            D: fidl::encoding::ResourceDialect,
3186            T0: fidl::encoding::Encode<fidl::encoding::Vector<DaiSupportedFormats, 64>, D>,
3187        > fidl::encoding::Encode<CompositeGetDaiFormatsResponse, D> for (T0,)
3188    {
3189        #[inline]
3190        unsafe fn encode(
3191            self,
3192            encoder: &mut fidl::encoding::Encoder<'_, D>,
3193            offset: usize,
3194            depth: fidl::encoding::Depth,
3195        ) -> fidl::Result<()> {
3196            encoder.debug_check_bounds::<CompositeGetDaiFormatsResponse>(offset);
3197            // Zero out padding regions. There's no need to apply masks
3198            // because the unmasked parts will be overwritten by fields.
3199            // Write the fields.
3200            self.0.encode(encoder, offset + 0, depth)?;
3201            Ok(())
3202        }
3203    }
3204
3205    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3206        for CompositeGetDaiFormatsResponse
3207    {
3208        #[inline(always)]
3209        fn new_empty() -> Self {
3210            Self {
3211                dai_formats: fidl::new_empty!(fidl::encoding::Vector<DaiSupportedFormats, 64>, D),
3212            }
3213        }
3214
3215        #[inline]
3216        unsafe fn decode(
3217            &mut self,
3218            decoder: &mut fidl::encoding::Decoder<'_, D>,
3219            offset: usize,
3220            _depth: fidl::encoding::Depth,
3221        ) -> fidl::Result<()> {
3222            decoder.debug_check_bounds::<Self>(offset);
3223            // Verify that padding bytes are zero.
3224            fidl::decode!(fidl::encoding::Vector<DaiSupportedFormats, 64>, D, &mut self.dai_formats, decoder, offset + 0, _depth)?;
3225            Ok(())
3226        }
3227    }
3228
3229    impl fidl::encoding::ValueTypeMarker for CompositeGetRingBufferFormatsResponse {
3230        type Borrowed<'a> = &'a Self;
3231        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3232            value
3233        }
3234    }
3235
3236    unsafe impl fidl::encoding::TypeMarker for CompositeGetRingBufferFormatsResponse {
3237        type Owned = Self;
3238
3239        #[inline(always)]
3240        fn inline_align(_context: fidl::encoding::Context) -> usize {
3241            8
3242        }
3243
3244        #[inline(always)]
3245        fn inline_size(_context: fidl::encoding::Context) -> usize {
3246            16
3247        }
3248    }
3249
3250    unsafe impl<D: fidl::encoding::ResourceDialect>
3251        fidl::encoding::Encode<CompositeGetRingBufferFormatsResponse, D>
3252        for &CompositeGetRingBufferFormatsResponse
3253    {
3254        #[inline]
3255        unsafe fn encode(
3256            self,
3257            encoder: &mut fidl::encoding::Encoder<'_, D>,
3258            offset: usize,
3259            _depth: fidl::encoding::Depth,
3260        ) -> fidl::Result<()> {
3261            encoder.debug_check_bounds::<CompositeGetRingBufferFormatsResponse>(offset);
3262            // Delegate to tuple encoding.
3263            fidl::encoding::Encode::<CompositeGetRingBufferFormatsResponse, D>::encode(
3264                (
3265                    <fidl::encoding::Vector<SupportedFormats, 64> as fidl::encoding::ValueTypeMarker>::borrow(&self.ring_buffer_formats),
3266                ),
3267                encoder, offset, _depth
3268            )
3269        }
3270    }
3271    unsafe impl<
3272            D: fidl::encoding::ResourceDialect,
3273            T0: fidl::encoding::Encode<fidl::encoding::Vector<SupportedFormats, 64>, D>,
3274        > fidl::encoding::Encode<CompositeGetRingBufferFormatsResponse, D> for (T0,)
3275    {
3276        #[inline]
3277        unsafe fn encode(
3278            self,
3279            encoder: &mut fidl::encoding::Encoder<'_, D>,
3280            offset: usize,
3281            depth: fidl::encoding::Depth,
3282        ) -> fidl::Result<()> {
3283            encoder.debug_check_bounds::<CompositeGetRingBufferFormatsResponse>(offset);
3284            // Zero out padding regions. There's no need to apply masks
3285            // because the unmasked parts will be overwritten by fields.
3286            // Write the fields.
3287            self.0.encode(encoder, offset + 0, depth)?;
3288            Ok(())
3289        }
3290    }
3291
3292    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3293        for CompositeGetRingBufferFormatsResponse
3294    {
3295        #[inline(always)]
3296        fn new_empty() -> Self {
3297            Self {
3298                ring_buffer_formats: fidl::new_empty!(fidl::encoding::Vector<SupportedFormats, 64>, D),
3299            }
3300        }
3301
3302        #[inline]
3303        unsafe fn decode(
3304            &mut self,
3305            decoder: &mut fidl::encoding::Decoder<'_, D>,
3306            offset: usize,
3307            _depth: fidl::encoding::Depth,
3308        ) -> fidl::Result<()> {
3309            decoder.debug_check_bounds::<Self>(offset);
3310            // Verify that padding bytes are zero.
3311            fidl::decode!(fidl::encoding::Vector<SupportedFormats, 64>, D, &mut self.ring_buffer_formats, decoder, offset + 0, _depth)?;
3312            Ok(())
3313        }
3314    }
3315
3316    impl fidl::encoding::ValueTypeMarker for DaiFormat {
3317        type Borrowed<'a> = &'a Self;
3318        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3319            value
3320        }
3321    }
3322
3323    unsafe impl fidl::encoding::TypeMarker for DaiFormat {
3324        type Owned = Self;
3325
3326        #[inline(always)]
3327        fn inline_align(_context: fidl::encoding::Context) -> usize {
3328            8
3329        }
3330
3331        #[inline(always)]
3332        fn inline_size(_context: fidl::encoding::Context) -> usize {
3333            48
3334        }
3335    }
3336
3337    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<DaiFormat, D>
3338        for &DaiFormat
3339    {
3340        #[inline]
3341        unsafe fn encode(
3342            self,
3343            encoder: &mut fidl::encoding::Encoder<'_, D>,
3344            offset: usize,
3345            _depth: fidl::encoding::Depth,
3346        ) -> fidl::Result<()> {
3347            encoder.debug_check_bounds::<DaiFormat>(offset);
3348            // Delegate to tuple encoding.
3349            fidl::encoding::Encode::<DaiFormat, D>::encode(
3350                (
3351                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.number_of_channels),
3352                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.channels_to_use_bitmask),
3353                    <DaiSampleFormat as fidl::encoding::ValueTypeMarker>::borrow(
3354                        &self.sample_format,
3355                    ),
3356                    <DaiFrameFormat as fidl::encoding::ValueTypeMarker>::borrow(&self.frame_format),
3357                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.frame_rate),
3358                    <u8 as fidl::encoding::ValueTypeMarker>::borrow(&self.bits_per_slot),
3359                    <u8 as fidl::encoding::ValueTypeMarker>::borrow(&self.bits_per_sample),
3360                ),
3361                encoder,
3362                offset,
3363                _depth,
3364            )
3365        }
3366    }
3367    unsafe impl<
3368            D: fidl::encoding::ResourceDialect,
3369            T0: fidl::encoding::Encode<u32, D>,
3370            T1: fidl::encoding::Encode<u64, D>,
3371            T2: fidl::encoding::Encode<DaiSampleFormat, D>,
3372            T3: fidl::encoding::Encode<DaiFrameFormat, D>,
3373            T4: fidl::encoding::Encode<u32, D>,
3374            T5: fidl::encoding::Encode<u8, D>,
3375            T6: fidl::encoding::Encode<u8, D>,
3376        > fidl::encoding::Encode<DaiFormat, D> for (T0, T1, T2, T3, T4, T5, T6)
3377    {
3378        #[inline]
3379        unsafe fn encode(
3380            self,
3381            encoder: &mut fidl::encoding::Encoder<'_, D>,
3382            offset: usize,
3383            depth: fidl::encoding::Depth,
3384        ) -> fidl::Result<()> {
3385            encoder.debug_check_bounds::<DaiFormat>(offset);
3386            // Zero out padding regions. There's no need to apply masks
3387            // because the unmasked parts will be overwritten by fields.
3388            unsafe {
3389                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
3390                (ptr as *mut u64).write_unaligned(0);
3391            }
3392            unsafe {
3393                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
3394                (ptr as *mut u64).write_unaligned(0);
3395            }
3396            unsafe {
3397                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(40);
3398                (ptr as *mut u64).write_unaligned(0);
3399            }
3400            // Write the fields.
3401            self.0.encode(encoder, offset + 0, depth)?;
3402            self.1.encode(encoder, offset + 8, depth)?;
3403            self.2.encode(encoder, offset + 16, depth)?;
3404            self.3.encode(encoder, offset + 24, depth)?;
3405            self.4.encode(encoder, offset + 40, depth)?;
3406            self.5.encode(encoder, offset + 44, depth)?;
3407            self.6.encode(encoder, offset + 45, depth)?;
3408            Ok(())
3409        }
3410    }
3411
3412    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for DaiFormat {
3413        #[inline(always)]
3414        fn new_empty() -> Self {
3415            Self {
3416                number_of_channels: fidl::new_empty!(u32, D),
3417                channels_to_use_bitmask: fidl::new_empty!(u64, D),
3418                sample_format: fidl::new_empty!(DaiSampleFormat, D),
3419                frame_format: fidl::new_empty!(DaiFrameFormat, D),
3420                frame_rate: fidl::new_empty!(u32, D),
3421                bits_per_slot: fidl::new_empty!(u8, D),
3422                bits_per_sample: fidl::new_empty!(u8, D),
3423            }
3424        }
3425
3426        #[inline]
3427        unsafe fn decode(
3428            &mut self,
3429            decoder: &mut fidl::encoding::Decoder<'_, D>,
3430            offset: usize,
3431            _depth: fidl::encoding::Depth,
3432        ) -> fidl::Result<()> {
3433            decoder.debug_check_bounds::<Self>(offset);
3434            // Verify that padding bytes are zero.
3435            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
3436            let padval = unsafe { (ptr as *const u64).read_unaligned() };
3437            let mask = 0xffffffff00000000u64;
3438            let maskedval = padval & mask;
3439            if maskedval != 0 {
3440                return Err(fidl::Error::NonZeroPadding {
3441                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
3442                });
3443            }
3444            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
3445            let padval = unsafe { (ptr as *const u64).read_unaligned() };
3446            let mask = 0xffffffffffffff00u64;
3447            let maskedval = padval & mask;
3448            if maskedval != 0 {
3449                return Err(fidl::Error::NonZeroPadding {
3450                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
3451                });
3452            }
3453            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(40) };
3454            let padval = unsafe { (ptr as *const u64).read_unaligned() };
3455            let mask = 0xffff000000000000u64;
3456            let maskedval = padval & mask;
3457            if maskedval != 0 {
3458                return Err(fidl::Error::NonZeroPadding {
3459                    padding_start: offset + 40 + ((mask as u64).trailing_zeros() / 8) as usize,
3460                });
3461            }
3462            fidl::decode!(u32, D, &mut self.number_of_channels, decoder, offset + 0, _depth)?;
3463            fidl::decode!(u64, D, &mut self.channels_to_use_bitmask, decoder, offset + 8, _depth)?;
3464            fidl::decode!(
3465                DaiSampleFormat,
3466                D,
3467                &mut self.sample_format,
3468                decoder,
3469                offset + 16,
3470                _depth
3471            )?;
3472            fidl::decode!(DaiFrameFormat, D, &mut self.frame_format, decoder, offset + 24, _depth)?;
3473            fidl::decode!(u32, D, &mut self.frame_rate, decoder, offset + 40, _depth)?;
3474            fidl::decode!(u8, D, &mut self.bits_per_slot, decoder, offset + 44, _depth)?;
3475            fidl::decode!(u8, D, &mut self.bits_per_sample, decoder, offset + 45, _depth)?;
3476            Ok(())
3477        }
3478    }
3479
3480    impl fidl::encoding::ValueTypeMarker for DaiFrameFormatCustom {
3481        type Borrowed<'a> = &'a Self;
3482        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3483            value
3484        }
3485    }
3486
3487    unsafe impl fidl::encoding::TypeMarker for DaiFrameFormatCustom {
3488        type Owned = Self;
3489
3490        #[inline(always)]
3491        fn inline_align(_context: fidl::encoding::Context) -> usize {
3492            1
3493        }
3494
3495        #[inline(always)]
3496        fn inline_size(_context: fidl::encoding::Context) -> usize {
3497            4
3498        }
3499    }
3500
3501    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<DaiFrameFormatCustom, D>
3502        for &DaiFrameFormatCustom
3503    {
3504        #[inline]
3505        unsafe fn encode(
3506            self,
3507            encoder: &mut fidl::encoding::Encoder<'_, D>,
3508            offset: usize,
3509            _depth: fidl::encoding::Depth,
3510        ) -> fidl::Result<()> {
3511            encoder.debug_check_bounds::<DaiFrameFormatCustom>(offset);
3512            // Delegate to tuple encoding.
3513            fidl::encoding::Encode::<DaiFrameFormatCustom, D>::encode(
3514                (
3515                    <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.left_justified),
3516                    <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.sclk_on_raising),
3517                    <i8 as fidl::encoding::ValueTypeMarker>::borrow(&self.frame_sync_sclks_offset),
3518                    <u8 as fidl::encoding::ValueTypeMarker>::borrow(&self.frame_sync_size),
3519                ),
3520                encoder,
3521                offset,
3522                _depth,
3523            )
3524        }
3525    }
3526    unsafe impl<
3527            D: fidl::encoding::ResourceDialect,
3528            T0: fidl::encoding::Encode<bool, D>,
3529            T1: fidl::encoding::Encode<bool, D>,
3530            T2: fidl::encoding::Encode<i8, D>,
3531            T3: fidl::encoding::Encode<u8, D>,
3532        > fidl::encoding::Encode<DaiFrameFormatCustom, D> for (T0, T1, T2, T3)
3533    {
3534        #[inline]
3535        unsafe fn encode(
3536            self,
3537            encoder: &mut fidl::encoding::Encoder<'_, D>,
3538            offset: usize,
3539            depth: fidl::encoding::Depth,
3540        ) -> fidl::Result<()> {
3541            encoder.debug_check_bounds::<DaiFrameFormatCustom>(offset);
3542            // Zero out padding regions. There's no need to apply masks
3543            // because the unmasked parts will be overwritten by fields.
3544            // Write the fields.
3545            self.0.encode(encoder, offset + 0, depth)?;
3546            self.1.encode(encoder, offset + 1, depth)?;
3547            self.2.encode(encoder, offset + 2, depth)?;
3548            self.3.encode(encoder, offset + 3, depth)?;
3549            Ok(())
3550        }
3551    }
3552
3553    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for DaiFrameFormatCustom {
3554        #[inline(always)]
3555        fn new_empty() -> Self {
3556            Self {
3557                left_justified: fidl::new_empty!(bool, D),
3558                sclk_on_raising: fidl::new_empty!(bool, D),
3559                frame_sync_sclks_offset: fidl::new_empty!(i8, D),
3560                frame_sync_size: fidl::new_empty!(u8, D),
3561            }
3562        }
3563
3564        #[inline]
3565        unsafe fn decode(
3566            &mut self,
3567            decoder: &mut fidl::encoding::Decoder<'_, D>,
3568            offset: usize,
3569            _depth: fidl::encoding::Depth,
3570        ) -> fidl::Result<()> {
3571            decoder.debug_check_bounds::<Self>(offset);
3572            // Verify that padding bytes are zero.
3573            fidl::decode!(bool, D, &mut self.left_justified, decoder, offset + 0, _depth)?;
3574            fidl::decode!(bool, D, &mut self.sclk_on_raising, decoder, offset + 1, _depth)?;
3575            fidl::decode!(i8, D, &mut self.frame_sync_sclks_offset, decoder, offset + 2, _depth)?;
3576            fidl::decode!(u8, D, &mut self.frame_sync_size, decoder, offset + 3, _depth)?;
3577            Ok(())
3578        }
3579    }
3580
3581    impl fidl::encoding::ValueTypeMarker for DaiGetPropertiesResponse {
3582        type Borrowed<'a> = &'a Self;
3583        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3584            value
3585        }
3586    }
3587
3588    unsafe impl fidl::encoding::TypeMarker for DaiGetPropertiesResponse {
3589        type Owned = Self;
3590
3591        #[inline(always)]
3592        fn inline_align(_context: fidl::encoding::Context) -> usize {
3593            8
3594        }
3595
3596        #[inline(always)]
3597        fn inline_size(_context: fidl::encoding::Context) -> usize {
3598            16
3599        }
3600    }
3601
3602    unsafe impl<D: fidl::encoding::ResourceDialect>
3603        fidl::encoding::Encode<DaiGetPropertiesResponse, D> for &DaiGetPropertiesResponse
3604    {
3605        #[inline]
3606        unsafe fn encode(
3607            self,
3608            encoder: &mut fidl::encoding::Encoder<'_, D>,
3609            offset: usize,
3610            _depth: fidl::encoding::Depth,
3611        ) -> fidl::Result<()> {
3612            encoder.debug_check_bounds::<DaiGetPropertiesResponse>(offset);
3613            // Delegate to tuple encoding.
3614            fidl::encoding::Encode::<DaiGetPropertiesResponse, D>::encode(
3615                (<DaiProperties as fidl::encoding::ValueTypeMarker>::borrow(&self.properties),),
3616                encoder,
3617                offset,
3618                _depth,
3619            )
3620        }
3621    }
3622    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<DaiProperties, D>>
3623        fidl::encoding::Encode<DaiGetPropertiesResponse, D> for (T0,)
3624    {
3625        #[inline]
3626        unsafe fn encode(
3627            self,
3628            encoder: &mut fidl::encoding::Encoder<'_, D>,
3629            offset: usize,
3630            depth: fidl::encoding::Depth,
3631        ) -> fidl::Result<()> {
3632            encoder.debug_check_bounds::<DaiGetPropertiesResponse>(offset);
3633            // Zero out padding regions. There's no need to apply masks
3634            // because the unmasked parts will be overwritten by fields.
3635            // Write the fields.
3636            self.0.encode(encoder, offset + 0, depth)?;
3637            Ok(())
3638        }
3639    }
3640
3641    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3642        for DaiGetPropertiesResponse
3643    {
3644        #[inline(always)]
3645        fn new_empty() -> Self {
3646            Self { properties: fidl::new_empty!(DaiProperties, D) }
3647        }
3648
3649        #[inline]
3650        unsafe fn decode(
3651            &mut self,
3652            decoder: &mut fidl::encoding::Decoder<'_, D>,
3653            offset: usize,
3654            _depth: fidl::encoding::Depth,
3655        ) -> fidl::Result<()> {
3656            decoder.debug_check_bounds::<Self>(offset);
3657            // Verify that padding bytes are zero.
3658            fidl::decode!(DaiProperties, D, &mut self.properties, decoder, offset + 0, _depth)?;
3659            Ok(())
3660        }
3661    }
3662
3663    impl fidl::encoding::ValueTypeMarker for DaiSupportedFormats {
3664        type Borrowed<'a> = &'a Self;
3665        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3666            value
3667        }
3668    }
3669
3670    unsafe impl fidl::encoding::TypeMarker for DaiSupportedFormats {
3671        type Owned = Self;
3672
3673        #[inline(always)]
3674        fn inline_align(_context: fidl::encoding::Context) -> usize {
3675            8
3676        }
3677
3678        #[inline(always)]
3679        fn inline_size(_context: fidl::encoding::Context) -> usize {
3680            96
3681        }
3682    }
3683
3684    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<DaiSupportedFormats, D>
3685        for &DaiSupportedFormats
3686    {
3687        #[inline]
3688        unsafe fn encode(
3689            self,
3690            encoder: &mut fidl::encoding::Encoder<'_, D>,
3691            offset: usize,
3692            _depth: fidl::encoding::Depth,
3693        ) -> fidl::Result<()> {
3694            encoder.debug_check_bounds::<DaiSupportedFormats>(offset);
3695            // Delegate to tuple encoding.
3696            fidl::encoding::Encode::<DaiSupportedFormats, D>::encode(
3697                (
3698                    <fidl::encoding::Vector<u32, 64> as fidl::encoding::ValueTypeMarker>::borrow(&self.number_of_channels),
3699                    <fidl::encoding::Vector<DaiSampleFormat, 4> as fidl::encoding::ValueTypeMarker>::borrow(&self.sample_formats),
3700                    <fidl::encoding::Vector<DaiFrameFormat, 64> as fidl::encoding::ValueTypeMarker>::borrow(&self.frame_formats),
3701                    <fidl::encoding::Vector<u32, 64> as fidl::encoding::ValueTypeMarker>::borrow(&self.frame_rates),
3702                    <fidl::encoding::Vector<u8, 8> as fidl::encoding::ValueTypeMarker>::borrow(&self.bits_per_slot),
3703                    <fidl::encoding::Vector<u8, 8> as fidl::encoding::ValueTypeMarker>::borrow(&self.bits_per_sample),
3704                ),
3705                encoder, offset, _depth
3706            )
3707        }
3708    }
3709    unsafe impl<
3710            D: fidl::encoding::ResourceDialect,
3711            T0: fidl::encoding::Encode<fidl::encoding::Vector<u32, 64>, D>,
3712            T1: fidl::encoding::Encode<fidl::encoding::Vector<DaiSampleFormat, 4>, D>,
3713            T2: fidl::encoding::Encode<fidl::encoding::Vector<DaiFrameFormat, 64>, D>,
3714            T3: fidl::encoding::Encode<fidl::encoding::Vector<u32, 64>, D>,
3715            T4: fidl::encoding::Encode<fidl::encoding::Vector<u8, 8>, D>,
3716            T5: fidl::encoding::Encode<fidl::encoding::Vector<u8, 8>, D>,
3717        > fidl::encoding::Encode<DaiSupportedFormats, D> for (T0, T1, T2, T3, T4, T5)
3718    {
3719        #[inline]
3720        unsafe fn encode(
3721            self,
3722            encoder: &mut fidl::encoding::Encoder<'_, D>,
3723            offset: usize,
3724            depth: fidl::encoding::Depth,
3725        ) -> fidl::Result<()> {
3726            encoder.debug_check_bounds::<DaiSupportedFormats>(offset);
3727            // Zero out padding regions. There's no need to apply masks
3728            // because the unmasked parts will be overwritten by fields.
3729            // Write the fields.
3730            self.0.encode(encoder, offset + 0, depth)?;
3731            self.1.encode(encoder, offset + 16, depth)?;
3732            self.2.encode(encoder, offset + 32, depth)?;
3733            self.3.encode(encoder, offset + 48, depth)?;
3734            self.4.encode(encoder, offset + 64, depth)?;
3735            self.5.encode(encoder, offset + 80, depth)?;
3736            Ok(())
3737        }
3738    }
3739
3740    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for DaiSupportedFormats {
3741        #[inline(always)]
3742        fn new_empty() -> Self {
3743            Self {
3744                number_of_channels: fidl::new_empty!(fidl::encoding::Vector<u32, 64>, D),
3745                sample_formats: fidl::new_empty!(fidl::encoding::Vector<DaiSampleFormat, 4>, D),
3746                frame_formats: fidl::new_empty!(fidl::encoding::Vector<DaiFrameFormat, 64>, D),
3747                frame_rates: fidl::new_empty!(fidl::encoding::Vector<u32, 64>, D),
3748                bits_per_slot: fidl::new_empty!(fidl::encoding::Vector<u8, 8>, D),
3749                bits_per_sample: fidl::new_empty!(fidl::encoding::Vector<u8, 8>, D),
3750            }
3751        }
3752
3753        #[inline]
3754        unsafe fn decode(
3755            &mut self,
3756            decoder: &mut fidl::encoding::Decoder<'_, D>,
3757            offset: usize,
3758            _depth: fidl::encoding::Depth,
3759        ) -> fidl::Result<()> {
3760            decoder.debug_check_bounds::<Self>(offset);
3761            // Verify that padding bytes are zero.
3762            fidl::decode!(fidl::encoding::Vector<u32, 64>, D, &mut self.number_of_channels, decoder, offset + 0, _depth)?;
3763            fidl::decode!(fidl::encoding::Vector<DaiSampleFormat, 4>, D, &mut self.sample_formats, decoder, offset + 16, _depth)?;
3764            fidl::decode!(fidl::encoding::Vector<DaiFrameFormat, 64>, D, &mut self.frame_formats, decoder, offset + 32, _depth)?;
3765            fidl::decode!(fidl::encoding::Vector<u32, 64>, D, &mut self.frame_rates, decoder, offset + 48, _depth)?;
3766            fidl::decode!(fidl::encoding::Vector<u8, 8>, D, &mut self.bits_per_slot, decoder, offset + 64, _depth)?;
3767            fidl::decode!(fidl::encoding::Vector<u8, 8>, D, &mut self.bits_per_sample, decoder, offset + 80, _depth)?;
3768            Ok(())
3769        }
3770    }
3771
3772    impl fidl::encoding::ValueTypeMarker for DaiGetDaiFormatsResponse {
3773        type Borrowed<'a> = &'a Self;
3774        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3775            value
3776        }
3777    }
3778
3779    unsafe impl fidl::encoding::TypeMarker for DaiGetDaiFormatsResponse {
3780        type Owned = Self;
3781
3782        #[inline(always)]
3783        fn inline_align(_context: fidl::encoding::Context) -> usize {
3784            8
3785        }
3786
3787        #[inline(always)]
3788        fn inline_size(_context: fidl::encoding::Context) -> usize {
3789            16
3790        }
3791    }
3792
3793    unsafe impl<D: fidl::encoding::ResourceDialect>
3794        fidl::encoding::Encode<DaiGetDaiFormatsResponse, D> for &DaiGetDaiFormatsResponse
3795    {
3796        #[inline]
3797        unsafe fn encode(
3798            self,
3799            encoder: &mut fidl::encoding::Encoder<'_, D>,
3800            offset: usize,
3801            _depth: fidl::encoding::Depth,
3802        ) -> fidl::Result<()> {
3803            encoder.debug_check_bounds::<DaiGetDaiFormatsResponse>(offset);
3804            // Delegate to tuple encoding.
3805            fidl::encoding::Encode::<DaiGetDaiFormatsResponse, D>::encode(
3806                (
3807                    <fidl::encoding::Vector<DaiSupportedFormats, 64> as fidl::encoding::ValueTypeMarker>::borrow(&self.dai_formats),
3808                ),
3809                encoder, offset, _depth
3810            )
3811        }
3812    }
3813    unsafe impl<
3814            D: fidl::encoding::ResourceDialect,
3815            T0: fidl::encoding::Encode<fidl::encoding::Vector<DaiSupportedFormats, 64>, D>,
3816        > fidl::encoding::Encode<DaiGetDaiFormatsResponse, D> for (T0,)
3817    {
3818        #[inline]
3819        unsafe fn encode(
3820            self,
3821            encoder: &mut fidl::encoding::Encoder<'_, D>,
3822            offset: usize,
3823            depth: fidl::encoding::Depth,
3824        ) -> fidl::Result<()> {
3825            encoder.debug_check_bounds::<DaiGetDaiFormatsResponse>(offset);
3826            // Zero out padding regions. There's no need to apply masks
3827            // because the unmasked parts will be overwritten by fields.
3828            // Write the fields.
3829            self.0.encode(encoder, offset + 0, depth)?;
3830            Ok(())
3831        }
3832    }
3833
3834    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3835        for DaiGetDaiFormatsResponse
3836    {
3837        #[inline(always)]
3838        fn new_empty() -> Self {
3839            Self {
3840                dai_formats: fidl::new_empty!(fidl::encoding::Vector<DaiSupportedFormats, 64>, D),
3841            }
3842        }
3843
3844        #[inline]
3845        unsafe fn decode(
3846            &mut self,
3847            decoder: &mut fidl::encoding::Decoder<'_, D>,
3848            offset: usize,
3849            _depth: fidl::encoding::Depth,
3850        ) -> fidl::Result<()> {
3851            decoder.debug_check_bounds::<Self>(offset);
3852            // Verify that padding bytes are zero.
3853            fidl::decode!(fidl::encoding::Vector<DaiSupportedFormats, 64>, D, &mut self.dai_formats, decoder, offset + 0, _depth)?;
3854            Ok(())
3855        }
3856    }
3857
3858    impl fidl::encoding::ValueTypeMarker for DaiGetRingBufferFormatsResponse {
3859        type Borrowed<'a> = &'a Self;
3860        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3861            value
3862        }
3863    }
3864
3865    unsafe impl fidl::encoding::TypeMarker for DaiGetRingBufferFormatsResponse {
3866        type Owned = Self;
3867
3868        #[inline(always)]
3869        fn inline_align(_context: fidl::encoding::Context) -> usize {
3870            8
3871        }
3872
3873        #[inline(always)]
3874        fn inline_size(_context: fidl::encoding::Context) -> usize {
3875            16
3876        }
3877    }
3878
3879    unsafe impl<D: fidl::encoding::ResourceDialect>
3880        fidl::encoding::Encode<DaiGetRingBufferFormatsResponse, D>
3881        for &DaiGetRingBufferFormatsResponse
3882    {
3883        #[inline]
3884        unsafe fn encode(
3885            self,
3886            encoder: &mut fidl::encoding::Encoder<'_, D>,
3887            offset: usize,
3888            _depth: fidl::encoding::Depth,
3889        ) -> fidl::Result<()> {
3890            encoder.debug_check_bounds::<DaiGetRingBufferFormatsResponse>(offset);
3891            // Delegate to tuple encoding.
3892            fidl::encoding::Encode::<DaiGetRingBufferFormatsResponse, D>::encode(
3893                (
3894                    <fidl::encoding::Vector<SupportedFormats, 64> as fidl::encoding::ValueTypeMarker>::borrow(&self.ring_buffer_formats),
3895                ),
3896                encoder, offset, _depth
3897            )
3898        }
3899    }
3900    unsafe impl<
3901            D: fidl::encoding::ResourceDialect,
3902            T0: fidl::encoding::Encode<fidl::encoding::Vector<SupportedFormats, 64>, D>,
3903        > fidl::encoding::Encode<DaiGetRingBufferFormatsResponse, D> for (T0,)
3904    {
3905        #[inline]
3906        unsafe fn encode(
3907            self,
3908            encoder: &mut fidl::encoding::Encoder<'_, D>,
3909            offset: usize,
3910            depth: fidl::encoding::Depth,
3911        ) -> fidl::Result<()> {
3912            encoder.debug_check_bounds::<DaiGetRingBufferFormatsResponse>(offset);
3913            // Zero out padding regions. There's no need to apply masks
3914            // because the unmasked parts will be overwritten by fields.
3915            // Write the fields.
3916            self.0.encode(encoder, offset + 0, depth)?;
3917            Ok(())
3918        }
3919    }
3920
3921    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3922        for DaiGetRingBufferFormatsResponse
3923    {
3924        #[inline(always)]
3925        fn new_empty() -> Self {
3926            Self {
3927                ring_buffer_formats: fidl::new_empty!(fidl::encoding::Vector<SupportedFormats, 64>, D),
3928            }
3929        }
3930
3931        #[inline]
3932        unsafe fn decode(
3933            &mut self,
3934            decoder: &mut fidl::encoding::Decoder<'_, D>,
3935            offset: usize,
3936            _depth: fidl::encoding::Depth,
3937        ) -> fidl::Result<()> {
3938            decoder.debug_check_bounds::<Self>(offset);
3939            // Verify that padding bytes are zero.
3940            fidl::decode!(fidl::encoding::Vector<SupportedFormats, 64>, D, &mut self.ring_buffer_formats, decoder, offset + 0, _depth)?;
3941            Ok(())
3942        }
3943    }
3944
3945    impl fidl::encoding::ValueTypeMarker for HealthGetHealthStateResponse {
3946        type Borrowed<'a> = &'a Self;
3947        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3948            value
3949        }
3950    }
3951
3952    unsafe impl fidl::encoding::TypeMarker for HealthGetHealthStateResponse {
3953        type Owned = Self;
3954
3955        #[inline(always)]
3956        fn inline_align(_context: fidl::encoding::Context) -> usize {
3957            8
3958        }
3959
3960        #[inline(always)]
3961        fn inline_size(_context: fidl::encoding::Context) -> usize {
3962            16
3963        }
3964    }
3965
3966    unsafe impl<D: fidl::encoding::ResourceDialect>
3967        fidl::encoding::Encode<HealthGetHealthStateResponse, D> for &HealthGetHealthStateResponse
3968    {
3969        #[inline]
3970        unsafe fn encode(
3971            self,
3972            encoder: &mut fidl::encoding::Encoder<'_, D>,
3973            offset: usize,
3974            _depth: fidl::encoding::Depth,
3975        ) -> fidl::Result<()> {
3976            encoder.debug_check_bounds::<HealthGetHealthStateResponse>(offset);
3977            // Delegate to tuple encoding.
3978            fidl::encoding::Encode::<HealthGetHealthStateResponse, D>::encode(
3979                (<HealthState as fidl::encoding::ValueTypeMarker>::borrow(&self.state),),
3980                encoder,
3981                offset,
3982                _depth,
3983            )
3984        }
3985    }
3986    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<HealthState, D>>
3987        fidl::encoding::Encode<HealthGetHealthStateResponse, D> for (T0,)
3988    {
3989        #[inline]
3990        unsafe fn encode(
3991            self,
3992            encoder: &mut fidl::encoding::Encoder<'_, D>,
3993            offset: usize,
3994            depth: fidl::encoding::Depth,
3995        ) -> fidl::Result<()> {
3996            encoder.debug_check_bounds::<HealthGetHealthStateResponse>(offset);
3997            // Zero out padding regions. There's no need to apply masks
3998            // because the unmasked parts will be overwritten by fields.
3999            // Write the fields.
4000            self.0.encode(encoder, offset + 0, depth)?;
4001            Ok(())
4002        }
4003    }
4004
4005    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
4006        for HealthGetHealthStateResponse
4007    {
4008        #[inline(always)]
4009        fn new_empty() -> Self {
4010            Self { state: fidl::new_empty!(HealthState, D) }
4011        }
4012
4013        #[inline]
4014        unsafe fn decode(
4015            &mut self,
4016            decoder: &mut fidl::encoding::Decoder<'_, D>,
4017            offset: usize,
4018            _depth: fidl::encoding::Depth,
4019        ) -> fidl::Result<()> {
4020            decoder.debug_check_bounds::<Self>(offset);
4021            // Verify that padding bytes are zero.
4022            fidl::decode!(HealthState, D, &mut self.state, decoder, offset + 0, _depth)?;
4023            Ok(())
4024        }
4025    }
4026
4027    impl fidl::encoding::ValueTypeMarker for PcmFormat {
4028        type Borrowed<'a> = &'a Self;
4029        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4030            value
4031        }
4032    }
4033
4034    unsafe impl fidl::encoding::TypeMarker for PcmFormat {
4035        type Owned = Self;
4036
4037        #[inline(always)]
4038        fn inline_align(_context: fidl::encoding::Context) -> usize {
4039            4
4040        }
4041
4042        #[inline(always)]
4043        fn inline_size(_context: fidl::encoding::Context) -> usize {
4044            8
4045        }
4046    }
4047
4048    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<PcmFormat, D>
4049        for &PcmFormat
4050    {
4051        #[inline]
4052        unsafe fn encode(
4053            self,
4054            encoder: &mut fidl::encoding::Encoder<'_, D>,
4055            offset: usize,
4056            _depth: fidl::encoding::Depth,
4057        ) -> fidl::Result<()> {
4058            encoder.debug_check_bounds::<PcmFormat>(offset);
4059            // Delegate to tuple encoding.
4060            fidl::encoding::Encode::<PcmFormat, D>::encode(
4061                (
4062                    <u8 as fidl::encoding::ValueTypeMarker>::borrow(&self.number_of_channels),
4063                    <SampleFormat as fidl::encoding::ValueTypeMarker>::borrow(&self.sample_format),
4064                    <u8 as fidl::encoding::ValueTypeMarker>::borrow(&self.bytes_per_sample),
4065                    <u8 as fidl::encoding::ValueTypeMarker>::borrow(&self.valid_bits_per_sample),
4066                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.frame_rate),
4067                ),
4068                encoder,
4069                offset,
4070                _depth,
4071            )
4072        }
4073    }
4074    unsafe impl<
4075            D: fidl::encoding::ResourceDialect,
4076            T0: fidl::encoding::Encode<u8, D>,
4077            T1: fidl::encoding::Encode<SampleFormat, D>,
4078            T2: fidl::encoding::Encode<u8, D>,
4079            T3: fidl::encoding::Encode<u8, D>,
4080            T4: fidl::encoding::Encode<u32, D>,
4081        > fidl::encoding::Encode<PcmFormat, D> for (T0, T1, T2, T3, T4)
4082    {
4083        #[inline]
4084        unsafe fn encode(
4085            self,
4086            encoder: &mut fidl::encoding::Encoder<'_, D>,
4087            offset: usize,
4088            depth: fidl::encoding::Depth,
4089        ) -> fidl::Result<()> {
4090            encoder.debug_check_bounds::<PcmFormat>(offset);
4091            // Zero out padding regions. There's no need to apply masks
4092            // because the unmasked parts will be overwritten by fields.
4093            // Write the fields.
4094            self.0.encode(encoder, offset + 0, depth)?;
4095            self.1.encode(encoder, offset + 1, depth)?;
4096            self.2.encode(encoder, offset + 2, depth)?;
4097            self.3.encode(encoder, offset + 3, depth)?;
4098            self.4.encode(encoder, offset + 4, depth)?;
4099            Ok(())
4100        }
4101    }
4102
4103    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for PcmFormat {
4104        #[inline(always)]
4105        fn new_empty() -> Self {
4106            Self {
4107                number_of_channels: fidl::new_empty!(u8, D),
4108                sample_format: fidl::new_empty!(SampleFormat, D),
4109                bytes_per_sample: fidl::new_empty!(u8, D),
4110                valid_bits_per_sample: fidl::new_empty!(u8, D),
4111                frame_rate: fidl::new_empty!(u32, D),
4112            }
4113        }
4114
4115        #[inline]
4116        unsafe fn decode(
4117            &mut self,
4118            decoder: &mut fidl::encoding::Decoder<'_, D>,
4119            offset: usize,
4120            _depth: fidl::encoding::Depth,
4121        ) -> fidl::Result<()> {
4122            decoder.debug_check_bounds::<Self>(offset);
4123            // Verify that padding bytes are zero.
4124            fidl::decode!(u8, D, &mut self.number_of_channels, decoder, offset + 0, _depth)?;
4125            fidl::decode!(SampleFormat, D, &mut self.sample_format, decoder, offset + 1, _depth)?;
4126            fidl::decode!(u8, D, &mut self.bytes_per_sample, decoder, offset + 2, _depth)?;
4127            fidl::decode!(u8, D, &mut self.valid_bits_per_sample, decoder, offset + 3, _depth)?;
4128            fidl::decode!(u32, D, &mut self.frame_rate, decoder, offset + 4, _depth)?;
4129            Ok(())
4130        }
4131    }
4132
4133    impl fidl::encoding::ValueTypeMarker for RingBufferGetPropertiesResponse {
4134        type Borrowed<'a> = &'a Self;
4135        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4136            value
4137        }
4138    }
4139
4140    unsafe impl fidl::encoding::TypeMarker for RingBufferGetPropertiesResponse {
4141        type Owned = Self;
4142
4143        #[inline(always)]
4144        fn inline_align(_context: fidl::encoding::Context) -> usize {
4145            8
4146        }
4147
4148        #[inline(always)]
4149        fn inline_size(_context: fidl::encoding::Context) -> usize {
4150            16
4151        }
4152    }
4153
4154    unsafe impl<D: fidl::encoding::ResourceDialect>
4155        fidl::encoding::Encode<RingBufferGetPropertiesResponse, D>
4156        for &RingBufferGetPropertiesResponse
4157    {
4158        #[inline]
4159        unsafe fn encode(
4160            self,
4161            encoder: &mut fidl::encoding::Encoder<'_, D>,
4162            offset: usize,
4163            _depth: fidl::encoding::Depth,
4164        ) -> fidl::Result<()> {
4165            encoder.debug_check_bounds::<RingBufferGetPropertiesResponse>(offset);
4166            // Delegate to tuple encoding.
4167            fidl::encoding::Encode::<RingBufferGetPropertiesResponse, D>::encode(
4168                (<RingBufferProperties as fidl::encoding::ValueTypeMarker>::borrow(
4169                    &self.properties,
4170                ),),
4171                encoder,
4172                offset,
4173                _depth,
4174            )
4175        }
4176    }
4177    unsafe impl<
4178            D: fidl::encoding::ResourceDialect,
4179            T0: fidl::encoding::Encode<RingBufferProperties, D>,
4180        > fidl::encoding::Encode<RingBufferGetPropertiesResponse, D> for (T0,)
4181    {
4182        #[inline]
4183        unsafe fn encode(
4184            self,
4185            encoder: &mut fidl::encoding::Encoder<'_, D>,
4186            offset: usize,
4187            depth: fidl::encoding::Depth,
4188        ) -> fidl::Result<()> {
4189            encoder.debug_check_bounds::<RingBufferGetPropertiesResponse>(offset);
4190            // Zero out padding regions. There's no need to apply masks
4191            // because the unmasked parts will be overwritten by fields.
4192            // Write the fields.
4193            self.0.encode(encoder, offset + 0, depth)?;
4194            Ok(())
4195        }
4196    }
4197
4198    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
4199        for RingBufferGetPropertiesResponse
4200    {
4201        #[inline(always)]
4202        fn new_empty() -> Self {
4203            Self { properties: fidl::new_empty!(RingBufferProperties, D) }
4204        }
4205
4206        #[inline]
4207        unsafe fn decode(
4208            &mut self,
4209            decoder: &mut fidl::encoding::Decoder<'_, D>,
4210            offset: usize,
4211            _depth: fidl::encoding::Depth,
4212        ) -> fidl::Result<()> {
4213            decoder.debug_check_bounds::<Self>(offset);
4214            // Verify that padding bytes are zero.
4215            fidl::decode!(
4216                RingBufferProperties,
4217                D,
4218                &mut self.properties,
4219                decoder,
4220                offset + 0,
4221                _depth
4222            )?;
4223            Ok(())
4224        }
4225    }
4226
4227    impl fidl::encoding::ValueTypeMarker for RingBufferGetVmoRequest {
4228        type Borrowed<'a> = &'a Self;
4229        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4230            value
4231        }
4232    }
4233
4234    unsafe impl fidl::encoding::TypeMarker for RingBufferGetVmoRequest {
4235        type Owned = Self;
4236
4237        #[inline(always)]
4238        fn inline_align(_context: fidl::encoding::Context) -> usize {
4239            4
4240        }
4241
4242        #[inline(always)]
4243        fn inline_size(_context: fidl::encoding::Context) -> usize {
4244            8
4245        }
4246        #[inline(always)]
4247        fn encode_is_copy() -> bool {
4248            true
4249        }
4250
4251        #[inline(always)]
4252        fn decode_is_copy() -> bool {
4253            true
4254        }
4255    }
4256
4257    unsafe impl<D: fidl::encoding::ResourceDialect>
4258        fidl::encoding::Encode<RingBufferGetVmoRequest, D> for &RingBufferGetVmoRequest
4259    {
4260        #[inline]
4261        unsafe fn encode(
4262            self,
4263            encoder: &mut fidl::encoding::Encoder<'_, D>,
4264            offset: usize,
4265            _depth: fidl::encoding::Depth,
4266        ) -> fidl::Result<()> {
4267            encoder.debug_check_bounds::<RingBufferGetVmoRequest>(offset);
4268            unsafe {
4269                // Copy the object into the buffer.
4270                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
4271                (buf_ptr as *mut RingBufferGetVmoRequest)
4272                    .write_unaligned((self as *const RingBufferGetVmoRequest).read());
4273                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
4274                // done second because the memcpy will write garbage to these bytes.
4275            }
4276            Ok(())
4277        }
4278    }
4279    unsafe impl<
4280            D: fidl::encoding::ResourceDialect,
4281            T0: fidl::encoding::Encode<u32, D>,
4282            T1: fidl::encoding::Encode<u32, D>,
4283        > fidl::encoding::Encode<RingBufferGetVmoRequest, D> for (T0, T1)
4284    {
4285        #[inline]
4286        unsafe fn encode(
4287            self,
4288            encoder: &mut fidl::encoding::Encoder<'_, D>,
4289            offset: usize,
4290            depth: fidl::encoding::Depth,
4291        ) -> fidl::Result<()> {
4292            encoder.debug_check_bounds::<RingBufferGetVmoRequest>(offset);
4293            // Zero out padding regions. There's no need to apply masks
4294            // because the unmasked parts will be overwritten by fields.
4295            // Write the fields.
4296            self.0.encode(encoder, offset + 0, depth)?;
4297            self.1.encode(encoder, offset + 4, depth)?;
4298            Ok(())
4299        }
4300    }
4301
4302    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
4303        for RingBufferGetVmoRequest
4304    {
4305        #[inline(always)]
4306        fn new_empty() -> Self {
4307            Self {
4308                min_frames: fidl::new_empty!(u32, D),
4309                clock_recovery_notifications_per_ring: fidl::new_empty!(u32, D),
4310            }
4311        }
4312
4313        #[inline]
4314        unsafe fn decode(
4315            &mut self,
4316            decoder: &mut fidl::encoding::Decoder<'_, D>,
4317            offset: usize,
4318            _depth: fidl::encoding::Depth,
4319        ) -> fidl::Result<()> {
4320            decoder.debug_check_bounds::<Self>(offset);
4321            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
4322            // Verify that padding bytes are zero.
4323            // Copy from the buffer into the object.
4324            unsafe {
4325                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 8);
4326            }
4327            Ok(())
4328        }
4329    }
4330
4331    impl fidl::encoding::ValueTypeMarker for RingBufferPositionInfo {
4332        type Borrowed<'a> = &'a Self;
4333        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4334            value
4335        }
4336    }
4337
4338    unsafe impl fidl::encoding::TypeMarker for RingBufferPositionInfo {
4339        type Owned = Self;
4340
4341        #[inline(always)]
4342        fn inline_align(_context: fidl::encoding::Context) -> usize {
4343            8
4344        }
4345
4346        #[inline(always)]
4347        fn inline_size(_context: fidl::encoding::Context) -> usize {
4348            16
4349        }
4350    }
4351
4352    unsafe impl<D: fidl::encoding::ResourceDialect>
4353        fidl::encoding::Encode<RingBufferPositionInfo, D> for &RingBufferPositionInfo
4354    {
4355        #[inline]
4356        unsafe fn encode(
4357            self,
4358            encoder: &mut fidl::encoding::Encoder<'_, D>,
4359            offset: usize,
4360            _depth: fidl::encoding::Depth,
4361        ) -> fidl::Result<()> {
4362            encoder.debug_check_bounds::<RingBufferPositionInfo>(offset);
4363            unsafe {
4364                // Copy the object into the buffer.
4365                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
4366                (buf_ptr as *mut RingBufferPositionInfo)
4367                    .write_unaligned((self as *const RingBufferPositionInfo).read());
4368                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
4369                // done second because the memcpy will write garbage to these bytes.
4370                let padding_ptr = buf_ptr.offset(8) as *mut u64;
4371                let padding_mask = 0xffffffff00000000u64;
4372                padding_ptr.write_unaligned(padding_ptr.read_unaligned() & !padding_mask);
4373            }
4374            Ok(())
4375        }
4376    }
4377    unsafe impl<
4378            D: fidl::encoding::ResourceDialect,
4379            T0: fidl::encoding::Encode<i64, D>,
4380            T1: fidl::encoding::Encode<u32, D>,
4381        > fidl::encoding::Encode<RingBufferPositionInfo, D> for (T0, T1)
4382    {
4383        #[inline]
4384        unsafe fn encode(
4385            self,
4386            encoder: &mut fidl::encoding::Encoder<'_, D>,
4387            offset: usize,
4388            depth: fidl::encoding::Depth,
4389        ) -> fidl::Result<()> {
4390            encoder.debug_check_bounds::<RingBufferPositionInfo>(offset);
4391            // Zero out padding regions. There's no need to apply masks
4392            // because the unmasked parts will be overwritten by fields.
4393            unsafe {
4394                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
4395                (ptr as *mut u64).write_unaligned(0);
4396            }
4397            // Write the fields.
4398            self.0.encode(encoder, offset + 0, depth)?;
4399            self.1.encode(encoder, offset + 8, depth)?;
4400            Ok(())
4401        }
4402    }
4403
4404    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
4405        for RingBufferPositionInfo
4406    {
4407        #[inline(always)]
4408        fn new_empty() -> Self {
4409            Self { timestamp: fidl::new_empty!(i64, D), position: fidl::new_empty!(u32, D) }
4410        }
4411
4412        #[inline]
4413        unsafe fn decode(
4414            &mut self,
4415            decoder: &mut fidl::encoding::Decoder<'_, D>,
4416            offset: usize,
4417            _depth: fidl::encoding::Depth,
4418        ) -> fidl::Result<()> {
4419            decoder.debug_check_bounds::<Self>(offset);
4420            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
4421            // Verify that padding bytes are zero.
4422            let ptr = unsafe { buf_ptr.offset(8) };
4423            let padval = unsafe { (ptr as *const u64).read_unaligned() };
4424            let mask = 0xffffffff00000000u64;
4425            let maskedval = padval & mask;
4426            if maskedval != 0 {
4427                return Err(fidl::Error::NonZeroPadding {
4428                    padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
4429                });
4430            }
4431            // Copy from the buffer into the object.
4432            unsafe {
4433                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 16);
4434            }
4435            Ok(())
4436        }
4437    }
4438
4439    impl fidl::encoding::ValueTypeMarker for RingBufferSetActiveChannelsRequest {
4440        type Borrowed<'a> = &'a Self;
4441        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4442            value
4443        }
4444    }
4445
4446    unsafe impl fidl::encoding::TypeMarker for RingBufferSetActiveChannelsRequest {
4447        type Owned = Self;
4448
4449        #[inline(always)]
4450        fn inline_align(_context: fidl::encoding::Context) -> usize {
4451            8
4452        }
4453
4454        #[inline(always)]
4455        fn inline_size(_context: fidl::encoding::Context) -> usize {
4456            8
4457        }
4458        #[inline(always)]
4459        fn encode_is_copy() -> bool {
4460            true
4461        }
4462
4463        #[inline(always)]
4464        fn decode_is_copy() -> bool {
4465            true
4466        }
4467    }
4468
4469    unsafe impl<D: fidl::encoding::ResourceDialect>
4470        fidl::encoding::Encode<RingBufferSetActiveChannelsRequest, D>
4471        for &RingBufferSetActiveChannelsRequest
4472    {
4473        #[inline]
4474        unsafe fn encode(
4475            self,
4476            encoder: &mut fidl::encoding::Encoder<'_, D>,
4477            offset: usize,
4478            _depth: fidl::encoding::Depth,
4479        ) -> fidl::Result<()> {
4480            encoder.debug_check_bounds::<RingBufferSetActiveChannelsRequest>(offset);
4481            unsafe {
4482                // Copy the object into the buffer.
4483                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
4484                (buf_ptr as *mut RingBufferSetActiveChannelsRequest)
4485                    .write_unaligned((self as *const RingBufferSetActiveChannelsRequest).read());
4486                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
4487                // done second because the memcpy will write garbage to these bytes.
4488            }
4489            Ok(())
4490        }
4491    }
4492    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u64, D>>
4493        fidl::encoding::Encode<RingBufferSetActiveChannelsRequest, D> for (T0,)
4494    {
4495        #[inline]
4496        unsafe fn encode(
4497            self,
4498            encoder: &mut fidl::encoding::Encoder<'_, D>,
4499            offset: usize,
4500            depth: fidl::encoding::Depth,
4501        ) -> fidl::Result<()> {
4502            encoder.debug_check_bounds::<RingBufferSetActiveChannelsRequest>(offset);
4503            // Zero out padding regions. There's no need to apply masks
4504            // because the unmasked parts will be overwritten by fields.
4505            // Write the fields.
4506            self.0.encode(encoder, offset + 0, depth)?;
4507            Ok(())
4508        }
4509    }
4510
4511    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
4512        for RingBufferSetActiveChannelsRequest
4513    {
4514        #[inline(always)]
4515        fn new_empty() -> Self {
4516            Self { active_channels_bitmask: fidl::new_empty!(u64, D) }
4517        }
4518
4519        #[inline]
4520        unsafe fn decode(
4521            &mut self,
4522            decoder: &mut fidl::encoding::Decoder<'_, D>,
4523            offset: usize,
4524            _depth: fidl::encoding::Depth,
4525        ) -> fidl::Result<()> {
4526            decoder.debug_check_bounds::<Self>(offset);
4527            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
4528            // Verify that padding bytes are zero.
4529            // Copy from the buffer into the object.
4530            unsafe {
4531                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 8);
4532            }
4533            Ok(())
4534        }
4535    }
4536
4537    impl fidl::encoding::ValueTypeMarker for RingBufferStartResponse {
4538        type Borrowed<'a> = &'a Self;
4539        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4540            value
4541        }
4542    }
4543
4544    unsafe impl fidl::encoding::TypeMarker for RingBufferStartResponse {
4545        type Owned = Self;
4546
4547        #[inline(always)]
4548        fn inline_align(_context: fidl::encoding::Context) -> usize {
4549            8
4550        }
4551
4552        #[inline(always)]
4553        fn inline_size(_context: fidl::encoding::Context) -> usize {
4554            8
4555        }
4556        #[inline(always)]
4557        fn encode_is_copy() -> bool {
4558            true
4559        }
4560
4561        #[inline(always)]
4562        fn decode_is_copy() -> bool {
4563            true
4564        }
4565    }
4566
4567    unsafe impl<D: fidl::encoding::ResourceDialect>
4568        fidl::encoding::Encode<RingBufferStartResponse, D> for &RingBufferStartResponse
4569    {
4570        #[inline]
4571        unsafe fn encode(
4572            self,
4573            encoder: &mut fidl::encoding::Encoder<'_, D>,
4574            offset: usize,
4575            _depth: fidl::encoding::Depth,
4576        ) -> fidl::Result<()> {
4577            encoder.debug_check_bounds::<RingBufferStartResponse>(offset);
4578            unsafe {
4579                // Copy the object into the buffer.
4580                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
4581                (buf_ptr as *mut RingBufferStartResponse)
4582                    .write_unaligned((self as *const RingBufferStartResponse).read());
4583                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
4584                // done second because the memcpy will write garbage to these bytes.
4585            }
4586            Ok(())
4587        }
4588    }
4589    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<i64, D>>
4590        fidl::encoding::Encode<RingBufferStartResponse, D> for (T0,)
4591    {
4592        #[inline]
4593        unsafe fn encode(
4594            self,
4595            encoder: &mut fidl::encoding::Encoder<'_, D>,
4596            offset: usize,
4597            depth: fidl::encoding::Depth,
4598        ) -> fidl::Result<()> {
4599            encoder.debug_check_bounds::<RingBufferStartResponse>(offset);
4600            // Zero out padding regions. There's no need to apply masks
4601            // because the unmasked parts will be overwritten by fields.
4602            // Write the fields.
4603            self.0.encode(encoder, offset + 0, depth)?;
4604            Ok(())
4605        }
4606    }
4607
4608    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
4609        for RingBufferStartResponse
4610    {
4611        #[inline(always)]
4612        fn new_empty() -> Self {
4613            Self { start_time: fidl::new_empty!(i64, D) }
4614        }
4615
4616        #[inline]
4617        unsafe fn decode(
4618            &mut self,
4619            decoder: &mut fidl::encoding::Decoder<'_, D>,
4620            offset: usize,
4621            _depth: fidl::encoding::Depth,
4622        ) -> fidl::Result<()> {
4623            decoder.debug_check_bounds::<Self>(offset);
4624            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
4625            // Verify that padding bytes are zero.
4626            // Copy from the buffer into the object.
4627            unsafe {
4628                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 8);
4629            }
4630            Ok(())
4631        }
4632    }
4633
4634    impl fidl::encoding::ValueTypeMarker for RingBufferWatchClockRecoveryPositionInfoResponse {
4635        type Borrowed<'a> = &'a Self;
4636        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4637            value
4638        }
4639    }
4640
4641    unsafe impl fidl::encoding::TypeMarker for RingBufferWatchClockRecoveryPositionInfoResponse {
4642        type Owned = Self;
4643
4644        #[inline(always)]
4645        fn inline_align(_context: fidl::encoding::Context) -> usize {
4646            8
4647        }
4648
4649        #[inline(always)]
4650        fn inline_size(_context: fidl::encoding::Context) -> usize {
4651            16
4652        }
4653    }
4654
4655    unsafe impl<D: fidl::encoding::ResourceDialect>
4656        fidl::encoding::Encode<RingBufferWatchClockRecoveryPositionInfoResponse, D>
4657        for &RingBufferWatchClockRecoveryPositionInfoResponse
4658    {
4659        #[inline]
4660        unsafe fn encode(
4661            self,
4662            encoder: &mut fidl::encoding::Encoder<'_, D>,
4663            offset: usize,
4664            _depth: fidl::encoding::Depth,
4665        ) -> fidl::Result<()> {
4666            encoder.debug_check_bounds::<RingBufferWatchClockRecoveryPositionInfoResponse>(offset);
4667            unsafe {
4668                // Copy the object into the buffer.
4669                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
4670                (buf_ptr as *mut RingBufferWatchClockRecoveryPositionInfoResponse).write_unaligned(
4671                    (self as *const RingBufferWatchClockRecoveryPositionInfoResponse).read(),
4672                );
4673                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
4674                // done second because the memcpy will write garbage to these bytes.
4675                let padding_ptr = buf_ptr.offset(8) as *mut u64;
4676                let padding_mask = 0xffffffff00000000u64;
4677                padding_ptr.write_unaligned(padding_ptr.read_unaligned() & !padding_mask);
4678            }
4679            Ok(())
4680        }
4681    }
4682    unsafe impl<
4683            D: fidl::encoding::ResourceDialect,
4684            T0: fidl::encoding::Encode<RingBufferPositionInfo, D>,
4685        > fidl::encoding::Encode<RingBufferWatchClockRecoveryPositionInfoResponse, D> for (T0,)
4686    {
4687        #[inline]
4688        unsafe fn encode(
4689            self,
4690            encoder: &mut fidl::encoding::Encoder<'_, D>,
4691            offset: usize,
4692            depth: fidl::encoding::Depth,
4693        ) -> fidl::Result<()> {
4694            encoder.debug_check_bounds::<RingBufferWatchClockRecoveryPositionInfoResponse>(offset);
4695            // Zero out padding regions. There's no need to apply masks
4696            // because the unmasked parts will be overwritten by fields.
4697            // Write the fields.
4698            self.0.encode(encoder, offset + 0, depth)?;
4699            Ok(())
4700        }
4701    }
4702
4703    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
4704        for RingBufferWatchClockRecoveryPositionInfoResponse
4705    {
4706        #[inline(always)]
4707        fn new_empty() -> Self {
4708            Self { position_info: fidl::new_empty!(RingBufferPositionInfo, D) }
4709        }
4710
4711        #[inline]
4712        unsafe fn decode(
4713            &mut self,
4714            decoder: &mut fidl::encoding::Decoder<'_, D>,
4715            offset: usize,
4716            _depth: fidl::encoding::Depth,
4717        ) -> fidl::Result<()> {
4718            decoder.debug_check_bounds::<Self>(offset);
4719            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
4720            // Verify that padding bytes are zero.
4721            let ptr = unsafe { buf_ptr.offset(8) };
4722            let padval = unsafe { (ptr as *const u64).read_unaligned() };
4723            let mask = 0xffffffff00000000u64;
4724            let maskedval = padval & mask;
4725            if maskedval != 0 {
4726                return Err(fidl::Error::NonZeroPadding {
4727                    padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
4728                });
4729            }
4730            // Copy from the buffer into the object.
4731            unsafe {
4732                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 16);
4733            }
4734            Ok(())
4735        }
4736    }
4737
4738    impl fidl::encoding::ValueTypeMarker for RingBufferSetActiveChannelsResponse {
4739        type Borrowed<'a> = &'a Self;
4740        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4741            value
4742        }
4743    }
4744
4745    unsafe impl fidl::encoding::TypeMarker for RingBufferSetActiveChannelsResponse {
4746        type Owned = Self;
4747
4748        #[inline(always)]
4749        fn inline_align(_context: fidl::encoding::Context) -> usize {
4750            8
4751        }
4752
4753        #[inline(always)]
4754        fn inline_size(_context: fidl::encoding::Context) -> usize {
4755            8
4756        }
4757        #[inline(always)]
4758        fn encode_is_copy() -> bool {
4759            true
4760        }
4761
4762        #[inline(always)]
4763        fn decode_is_copy() -> bool {
4764            true
4765        }
4766    }
4767
4768    unsafe impl<D: fidl::encoding::ResourceDialect>
4769        fidl::encoding::Encode<RingBufferSetActiveChannelsResponse, D>
4770        for &RingBufferSetActiveChannelsResponse
4771    {
4772        #[inline]
4773        unsafe fn encode(
4774            self,
4775            encoder: &mut fidl::encoding::Encoder<'_, D>,
4776            offset: usize,
4777            _depth: fidl::encoding::Depth,
4778        ) -> fidl::Result<()> {
4779            encoder.debug_check_bounds::<RingBufferSetActiveChannelsResponse>(offset);
4780            unsafe {
4781                // Copy the object into the buffer.
4782                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
4783                (buf_ptr as *mut RingBufferSetActiveChannelsResponse)
4784                    .write_unaligned((self as *const RingBufferSetActiveChannelsResponse).read());
4785                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
4786                // done second because the memcpy will write garbage to these bytes.
4787            }
4788            Ok(())
4789        }
4790    }
4791    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<i64, D>>
4792        fidl::encoding::Encode<RingBufferSetActiveChannelsResponse, D> for (T0,)
4793    {
4794        #[inline]
4795        unsafe fn encode(
4796            self,
4797            encoder: &mut fidl::encoding::Encoder<'_, D>,
4798            offset: usize,
4799            depth: fidl::encoding::Depth,
4800        ) -> fidl::Result<()> {
4801            encoder.debug_check_bounds::<RingBufferSetActiveChannelsResponse>(offset);
4802            // Zero out padding regions. There's no need to apply masks
4803            // because the unmasked parts will be overwritten by fields.
4804            // Write the fields.
4805            self.0.encode(encoder, offset + 0, depth)?;
4806            Ok(())
4807        }
4808    }
4809
4810    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
4811        for RingBufferSetActiveChannelsResponse
4812    {
4813        #[inline(always)]
4814        fn new_empty() -> Self {
4815            Self { set_time: fidl::new_empty!(i64, D) }
4816        }
4817
4818        #[inline]
4819        unsafe fn decode(
4820            &mut self,
4821            decoder: &mut fidl::encoding::Decoder<'_, D>,
4822            offset: usize,
4823            _depth: fidl::encoding::Depth,
4824        ) -> fidl::Result<()> {
4825            decoder.debug_check_bounds::<Self>(offset);
4826            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
4827            // Verify that padding bytes are zero.
4828            // Copy from the buffer into the object.
4829            unsafe {
4830                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 8);
4831            }
4832            Ok(())
4833        }
4834    }
4835
4836    impl fidl::encoding::ValueTypeMarker for RingBufferWatchDelayInfoResponse {
4837        type Borrowed<'a> = &'a Self;
4838        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4839            value
4840        }
4841    }
4842
4843    unsafe impl fidl::encoding::TypeMarker for RingBufferWatchDelayInfoResponse {
4844        type Owned = Self;
4845
4846        #[inline(always)]
4847        fn inline_align(_context: fidl::encoding::Context) -> usize {
4848            8
4849        }
4850
4851        #[inline(always)]
4852        fn inline_size(_context: fidl::encoding::Context) -> usize {
4853            16
4854        }
4855    }
4856
4857    unsafe impl<D: fidl::encoding::ResourceDialect>
4858        fidl::encoding::Encode<RingBufferWatchDelayInfoResponse, D>
4859        for &RingBufferWatchDelayInfoResponse
4860    {
4861        #[inline]
4862        unsafe fn encode(
4863            self,
4864            encoder: &mut fidl::encoding::Encoder<'_, D>,
4865            offset: usize,
4866            _depth: fidl::encoding::Depth,
4867        ) -> fidl::Result<()> {
4868            encoder.debug_check_bounds::<RingBufferWatchDelayInfoResponse>(offset);
4869            // Delegate to tuple encoding.
4870            fidl::encoding::Encode::<RingBufferWatchDelayInfoResponse, D>::encode(
4871                (<DelayInfo as fidl::encoding::ValueTypeMarker>::borrow(&self.delay_info),),
4872                encoder,
4873                offset,
4874                _depth,
4875            )
4876        }
4877    }
4878    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<DelayInfo, D>>
4879        fidl::encoding::Encode<RingBufferWatchDelayInfoResponse, D> for (T0,)
4880    {
4881        #[inline]
4882        unsafe fn encode(
4883            self,
4884            encoder: &mut fidl::encoding::Encoder<'_, D>,
4885            offset: usize,
4886            depth: fidl::encoding::Depth,
4887        ) -> fidl::Result<()> {
4888            encoder.debug_check_bounds::<RingBufferWatchDelayInfoResponse>(offset);
4889            // Zero out padding regions. There's no need to apply masks
4890            // because the unmasked parts will be overwritten by fields.
4891            // Write the fields.
4892            self.0.encode(encoder, offset + 0, depth)?;
4893            Ok(())
4894        }
4895    }
4896
4897    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
4898        for RingBufferWatchDelayInfoResponse
4899    {
4900        #[inline(always)]
4901        fn new_empty() -> Self {
4902            Self { delay_info: fidl::new_empty!(DelayInfo, D) }
4903        }
4904
4905        #[inline]
4906        unsafe fn decode(
4907            &mut self,
4908            decoder: &mut fidl::encoding::Decoder<'_, D>,
4909            offset: usize,
4910            _depth: fidl::encoding::Depth,
4911        ) -> fidl::Result<()> {
4912            decoder.debug_check_bounds::<Self>(offset);
4913            // Verify that padding bytes are zero.
4914            fidl::decode!(DelayInfo, D, &mut self.delay_info, decoder, offset + 0, _depth)?;
4915            Ok(())
4916        }
4917    }
4918
4919    impl fidl::encoding::ValueTypeMarker for StreamConfigGetPropertiesResponse {
4920        type Borrowed<'a> = &'a Self;
4921        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4922            value
4923        }
4924    }
4925
4926    unsafe impl fidl::encoding::TypeMarker for StreamConfigGetPropertiesResponse {
4927        type Owned = Self;
4928
4929        #[inline(always)]
4930        fn inline_align(_context: fidl::encoding::Context) -> usize {
4931            8
4932        }
4933
4934        #[inline(always)]
4935        fn inline_size(_context: fidl::encoding::Context) -> usize {
4936            16
4937        }
4938    }
4939
4940    unsafe impl<D: fidl::encoding::ResourceDialect>
4941        fidl::encoding::Encode<StreamConfigGetPropertiesResponse, D>
4942        for &StreamConfigGetPropertiesResponse
4943    {
4944        #[inline]
4945        unsafe fn encode(
4946            self,
4947            encoder: &mut fidl::encoding::Encoder<'_, D>,
4948            offset: usize,
4949            _depth: fidl::encoding::Depth,
4950        ) -> fidl::Result<()> {
4951            encoder.debug_check_bounds::<StreamConfigGetPropertiesResponse>(offset);
4952            // Delegate to tuple encoding.
4953            fidl::encoding::Encode::<StreamConfigGetPropertiesResponse, D>::encode(
4954                (<StreamProperties as fidl::encoding::ValueTypeMarker>::borrow(&self.properties),),
4955                encoder,
4956                offset,
4957                _depth,
4958            )
4959        }
4960    }
4961    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<StreamProperties, D>>
4962        fidl::encoding::Encode<StreamConfigGetPropertiesResponse, D> for (T0,)
4963    {
4964        #[inline]
4965        unsafe fn encode(
4966            self,
4967            encoder: &mut fidl::encoding::Encoder<'_, D>,
4968            offset: usize,
4969            depth: fidl::encoding::Depth,
4970        ) -> fidl::Result<()> {
4971            encoder.debug_check_bounds::<StreamConfigGetPropertiesResponse>(offset);
4972            // Zero out padding regions. There's no need to apply masks
4973            // because the unmasked parts will be overwritten by fields.
4974            // Write the fields.
4975            self.0.encode(encoder, offset + 0, depth)?;
4976            Ok(())
4977        }
4978    }
4979
4980    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
4981        for StreamConfigGetPropertiesResponse
4982    {
4983        #[inline(always)]
4984        fn new_empty() -> Self {
4985            Self { properties: fidl::new_empty!(StreamProperties, D) }
4986        }
4987
4988        #[inline]
4989        unsafe fn decode(
4990            &mut self,
4991            decoder: &mut fidl::encoding::Decoder<'_, D>,
4992            offset: usize,
4993            _depth: fidl::encoding::Depth,
4994        ) -> fidl::Result<()> {
4995            decoder.debug_check_bounds::<Self>(offset);
4996            // Verify that padding bytes are zero.
4997            fidl::decode!(StreamProperties, D, &mut self.properties, decoder, offset + 0, _depth)?;
4998            Ok(())
4999        }
5000    }
5001
5002    impl fidl::encoding::ValueTypeMarker for StreamConfigGetSupportedFormatsResponse {
5003        type Borrowed<'a> = &'a Self;
5004        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
5005            value
5006        }
5007    }
5008
5009    unsafe impl fidl::encoding::TypeMarker for StreamConfigGetSupportedFormatsResponse {
5010        type Owned = Self;
5011
5012        #[inline(always)]
5013        fn inline_align(_context: fidl::encoding::Context) -> usize {
5014            8
5015        }
5016
5017        #[inline(always)]
5018        fn inline_size(_context: fidl::encoding::Context) -> usize {
5019            16
5020        }
5021    }
5022
5023    unsafe impl<D: fidl::encoding::ResourceDialect>
5024        fidl::encoding::Encode<StreamConfigGetSupportedFormatsResponse, D>
5025        for &StreamConfigGetSupportedFormatsResponse
5026    {
5027        #[inline]
5028        unsafe fn encode(
5029            self,
5030            encoder: &mut fidl::encoding::Encoder<'_, D>,
5031            offset: usize,
5032            _depth: fidl::encoding::Depth,
5033        ) -> fidl::Result<()> {
5034            encoder.debug_check_bounds::<StreamConfigGetSupportedFormatsResponse>(offset);
5035            // Delegate to tuple encoding.
5036            fidl::encoding::Encode::<StreamConfigGetSupportedFormatsResponse, D>::encode(
5037                (
5038                    <fidl::encoding::Vector<SupportedFormats, 64> as fidl::encoding::ValueTypeMarker>::borrow(&self.supported_formats),
5039                ),
5040                encoder, offset, _depth
5041            )
5042        }
5043    }
5044    unsafe impl<
5045            D: fidl::encoding::ResourceDialect,
5046            T0: fidl::encoding::Encode<fidl::encoding::Vector<SupportedFormats, 64>, D>,
5047        > fidl::encoding::Encode<StreamConfigGetSupportedFormatsResponse, D> for (T0,)
5048    {
5049        #[inline]
5050        unsafe fn encode(
5051            self,
5052            encoder: &mut fidl::encoding::Encoder<'_, D>,
5053            offset: usize,
5054            depth: fidl::encoding::Depth,
5055        ) -> fidl::Result<()> {
5056            encoder.debug_check_bounds::<StreamConfigGetSupportedFormatsResponse>(offset);
5057            // Zero out padding regions. There's no need to apply masks
5058            // because the unmasked parts will be overwritten by fields.
5059            // Write the fields.
5060            self.0.encode(encoder, offset + 0, depth)?;
5061            Ok(())
5062        }
5063    }
5064
5065    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
5066        for StreamConfigGetSupportedFormatsResponse
5067    {
5068        #[inline(always)]
5069        fn new_empty() -> Self {
5070            Self {
5071                supported_formats: fidl::new_empty!(fidl::encoding::Vector<SupportedFormats, 64>, D),
5072            }
5073        }
5074
5075        #[inline]
5076        unsafe fn decode(
5077            &mut self,
5078            decoder: &mut fidl::encoding::Decoder<'_, D>,
5079            offset: usize,
5080            _depth: fidl::encoding::Depth,
5081        ) -> fidl::Result<()> {
5082            decoder.debug_check_bounds::<Self>(offset);
5083            // Verify that padding bytes are zero.
5084            fidl::decode!(fidl::encoding::Vector<SupportedFormats, 64>, D, &mut self.supported_formats, decoder, offset + 0, _depth)?;
5085            Ok(())
5086        }
5087    }
5088
5089    impl fidl::encoding::ValueTypeMarker for StreamConfigSetGainRequest {
5090        type Borrowed<'a> = &'a Self;
5091        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
5092            value
5093        }
5094    }
5095
5096    unsafe impl fidl::encoding::TypeMarker for StreamConfigSetGainRequest {
5097        type Owned = Self;
5098
5099        #[inline(always)]
5100        fn inline_align(_context: fidl::encoding::Context) -> usize {
5101            8
5102        }
5103
5104        #[inline(always)]
5105        fn inline_size(_context: fidl::encoding::Context) -> usize {
5106            16
5107        }
5108    }
5109
5110    unsafe impl<D: fidl::encoding::ResourceDialect>
5111        fidl::encoding::Encode<StreamConfigSetGainRequest, D> for &StreamConfigSetGainRequest
5112    {
5113        #[inline]
5114        unsafe fn encode(
5115            self,
5116            encoder: &mut fidl::encoding::Encoder<'_, D>,
5117            offset: usize,
5118            _depth: fidl::encoding::Depth,
5119        ) -> fidl::Result<()> {
5120            encoder.debug_check_bounds::<StreamConfigSetGainRequest>(offset);
5121            // Delegate to tuple encoding.
5122            fidl::encoding::Encode::<StreamConfigSetGainRequest, D>::encode(
5123                (<GainState as fidl::encoding::ValueTypeMarker>::borrow(&self.target_state),),
5124                encoder,
5125                offset,
5126                _depth,
5127            )
5128        }
5129    }
5130    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<GainState, D>>
5131        fidl::encoding::Encode<StreamConfigSetGainRequest, D> for (T0,)
5132    {
5133        #[inline]
5134        unsafe fn encode(
5135            self,
5136            encoder: &mut fidl::encoding::Encoder<'_, D>,
5137            offset: usize,
5138            depth: fidl::encoding::Depth,
5139        ) -> fidl::Result<()> {
5140            encoder.debug_check_bounds::<StreamConfigSetGainRequest>(offset);
5141            // Zero out padding regions. There's no need to apply masks
5142            // because the unmasked parts will be overwritten by fields.
5143            // Write the fields.
5144            self.0.encode(encoder, offset + 0, depth)?;
5145            Ok(())
5146        }
5147    }
5148
5149    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
5150        for StreamConfigSetGainRequest
5151    {
5152        #[inline(always)]
5153        fn new_empty() -> Self {
5154            Self { target_state: fidl::new_empty!(GainState, D) }
5155        }
5156
5157        #[inline]
5158        unsafe fn decode(
5159            &mut self,
5160            decoder: &mut fidl::encoding::Decoder<'_, D>,
5161            offset: usize,
5162            _depth: fidl::encoding::Depth,
5163        ) -> fidl::Result<()> {
5164            decoder.debug_check_bounds::<Self>(offset);
5165            // Verify that padding bytes are zero.
5166            fidl::decode!(GainState, D, &mut self.target_state, decoder, offset + 0, _depth)?;
5167            Ok(())
5168        }
5169    }
5170
5171    impl fidl::encoding::ValueTypeMarker for StreamConfigWatchGainStateResponse {
5172        type Borrowed<'a> = &'a Self;
5173        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
5174            value
5175        }
5176    }
5177
5178    unsafe impl fidl::encoding::TypeMarker for StreamConfigWatchGainStateResponse {
5179        type Owned = Self;
5180
5181        #[inline(always)]
5182        fn inline_align(_context: fidl::encoding::Context) -> usize {
5183            8
5184        }
5185
5186        #[inline(always)]
5187        fn inline_size(_context: fidl::encoding::Context) -> usize {
5188            16
5189        }
5190    }
5191
5192    unsafe impl<D: fidl::encoding::ResourceDialect>
5193        fidl::encoding::Encode<StreamConfigWatchGainStateResponse, D>
5194        for &StreamConfigWatchGainStateResponse
5195    {
5196        #[inline]
5197        unsafe fn encode(
5198            self,
5199            encoder: &mut fidl::encoding::Encoder<'_, D>,
5200            offset: usize,
5201            _depth: fidl::encoding::Depth,
5202        ) -> fidl::Result<()> {
5203            encoder.debug_check_bounds::<StreamConfigWatchGainStateResponse>(offset);
5204            // Delegate to tuple encoding.
5205            fidl::encoding::Encode::<StreamConfigWatchGainStateResponse, D>::encode(
5206                (<GainState as fidl::encoding::ValueTypeMarker>::borrow(&self.gain_state),),
5207                encoder,
5208                offset,
5209                _depth,
5210            )
5211        }
5212    }
5213    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<GainState, D>>
5214        fidl::encoding::Encode<StreamConfigWatchGainStateResponse, D> for (T0,)
5215    {
5216        #[inline]
5217        unsafe fn encode(
5218            self,
5219            encoder: &mut fidl::encoding::Encoder<'_, D>,
5220            offset: usize,
5221            depth: fidl::encoding::Depth,
5222        ) -> fidl::Result<()> {
5223            encoder.debug_check_bounds::<StreamConfigWatchGainStateResponse>(offset);
5224            // Zero out padding regions. There's no need to apply masks
5225            // because the unmasked parts will be overwritten by fields.
5226            // Write the fields.
5227            self.0.encode(encoder, offset + 0, depth)?;
5228            Ok(())
5229        }
5230    }
5231
5232    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
5233        for StreamConfigWatchGainStateResponse
5234    {
5235        #[inline(always)]
5236        fn new_empty() -> Self {
5237            Self { gain_state: fidl::new_empty!(GainState, D) }
5238        }
5239
5240        #[inline]
5241        unsafe fn decode(
5242            &mut self,
5243            decoder: &mut fidl::encoding::Decoder<'_, D>,
5244            offset: usize,
5245            _depth: fidl::encoding::Depth,
5246        ) -> fidl::Result<()> {
5247            decoder.debug_check_bounds::<Self>(offset);
5248            // Verify that padding bytes are zero.
5249            fidl::decode!(GainState, D, &mut self.gain_state, decoder, offset + 0, _depth)?;
5250            Ok(())
5251        }
5252    }
5253
5254    impl fidl::encoding::ValueTypeMarker for StreamConfigWatchPlugStateResponse {
5255        type Borrowed<'a> = &'a Self;
5256        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
5257            value
5258        }
5259    }
5260
5261    unsafe impl fidl::encoding::TypeMarker for StreamConfigWatchPlugStateResponse {
5262        type Owned = Self;
5263
5264        #[inline(always)]
5265        fn inline_align(_context: fidl::encoding::Context) -> usize {
5266            8
5267        }
5268
5269        #[inline(always)]
5270        fn inline_size(_context: fidl::encoding::Context) -> usize {
5271            16
5272        }
5273    }
5274
5275    unsafe impl<D: fidl::encoding::ResourceDialect>
5276        fidl::encoding::Encode<StreamConfigWatchPlugStateResponse, D>
5277        for &StreamConfigWatchPlugStateResponse
5278    {
5279        #[inline]
5280        unsafe fn encode(
5281            self,
5282            encoder: &mut fidl::encoding::Encoder<'_, D>,
5283            offset: usize,
5284            _depth: fidl::encoding::Depth,
5285        ) -> fidl::Result<()> {
5286            encoder.debug_check_bounds::<StreamConfigWatchPlugStateResponse>(offset);
5287            // Delegate to tuple encoding.
5288            fidl::encoding::Encode::<StreamConfigWatchPlugStateResponse, D>::encode(
5289                (<PlugState as fidl::encoding::ValueTypeMarker>::borrow(&self.plug_state),),
5290                encoder,
5291                offset,
5292                _depth,
5293            )
5294        }
5295    }
5296    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<PlugState, D>>
5297        fidl::encoding::Encode<StreamConfigWatchPlugStateResponse, D> for (T0,)
5298    {
5299        #[inline]
5300        unsafe fn encode(
5301            self,
5302            encoder: &mut fidl::encoding::Encoder<'_, D>,
5303            offset: usize,
5304            depth: fidl::encoding::Depth,
5305        ) -> fidl::Result<()> {
5306            encoder.debug_check_bounds::<StreamConfigWatchPlugStateResponse>(offset);
5307            // Zero out padding regions. There's no need to apply masks
5308            // because the unmasked parts will be overwritten by fields.
5309            // Write the fields.
5310            self.0.encode(encoder, offset + 0, depth)?;
5311            Ok(())
5312        }
5313    }
5314
5315    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
5316        for StreamConfigWatchPlugStateResponse
5317    {
5318        #[inline(always)]
5319        fn new_empty() -> Self {
5320            Self { plug_state: fidl::new_empty!(PlugState, D) }
5321        }
5322
5323        #[inline]
5324        unsafe fn decode(
5325            &mut self,
5326            decoder: &mut fidl::encoding::Decoder<'_, D>,
5327            offset: usize,
5328            _depth: fidl::encoding::Depth,
5329        ) -> fidl::Result<()> {
5330            decoder.debug_check_bounds::<Self>(offset);
5331            // Verify that padding bytes are zero.
5332            fidl::decode!(PlugState, D, &mut self.plug_state, decoder, offset + 0, _depth)?;
5333            Ok(())
5334        }
5335    }
5336
5337    impl ChannelAttributes {
5338        #[inline(always)]
5339        fn max_ordinal_present(&self) -> u64 {
5340            if let Some(_) = self.max_frequency {
5341                return 2;
5342            }
5343            if let Some(_) = self.min_frequency {
5344                return 1;
5345            }
5346            0
5347        }
5348    }
5349
5350    impl fidl::encoding::ValueTypeMarker for ChannelAttributes {
5351        type Borrowed<'a> = &'a Self;
5352        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
5353            value
5354        }
5355    }
5356
5357    unsafe impl fidl::encoding::TypeMarker for ChannelAttributes {
5358        type Owned = Self;
5359
5360        #[inline(always)]
5361        fn inline_align(_context: fidl::encoding::Context) -> usize {
5362            8
5363        }
5364
5365        #[inline(always)]
5366        fn inline_size(_context: fidl::encoding::Context) -> usize {
5367            16
5368        }
5369    }
5370
5371    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<ChannelAttributes, D>
5372        for &ChannelAttributes
5373    {
5374        unsafe fn encode(
5375            self,
5376            encoder: &mut fidl::encoding::Encoder<'_, D>,
5377            offset: usize,
5378            mut depth: fidl::encoding::Depth,
5379        ) -> fidl::Result<()> {
5380            encoder.debug_check_bounds::<ChannelAttributes>(offset);
5381            // Vector header
5382            let max_ordinal: u64 = self.max_ordinal_present();
5383            encoder.write_num(max_ordinal, offset);
5384            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
5385            // Calling encoder.out_of_line_offset(0) is not allowed.
5386            if max_ordinal == 0 {
5387                return Ok(());
5388            }
5389            depth.increment()?;
5390            let envelope_size = 8;
5391            let bytes_len = max_ordinal as usize * envelope_size;
5392            #[allow(unused_variables)]
5393            let offset = encoder.out_of_line_offset(bytes_len);
5394            let mut _prev_end_offset: usize = 0;
5395            if 1 > max_ordinal {
5396                return Ok(());
5397            }
5398
5399            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5400            // are envelope_size bytes.
5401            let cur_offset: usize = (1 - 1) * envelope_size;
5402
5403            // Zero reserved fields.
5404            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5405
5406            // Safety:
5407            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5408            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5409            //   envelope_size bytes, there is always sufficient room.
5410            fidl::encoding::encode_in_envelope_optional::<u32, D>(
5411                self.min_frequency.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
5412                encoder,
5413                offset + cur_offset,
5414                depth,
5415            )?;
5416
5417            _prev_end_offset = cur_offset + envelope_size;
5418            if 2 > max_ordinal {
5419                return Ok(());
5420            }
5421
5422            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5423            // are envelope_size bytes.
5424            let cur_offset: usize = (2 - 1) * envelope_size;
5425
5426            // Zero reserved fields.
5427            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5428
5429            // Safety:
5430            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5431            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5432            //   envelope_size bytes, there is always sufficient room.
5433            fidl::encoding::encode_in_envelope_optional::<u32, D>(
5434                self.max_frequency.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
5435                encoder,
5436                offset + cur_offset,
5437                depth,
5438            )?;
5439
5440            _prev_end_offset = cur_offset + envelope_size;
5441
5442            Ok(())
5443        }
5444    }
5445
5446    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ChannelAttributes {
5447        #[inline(always)]
5448        fn new_empty() -> Self {
5449            Self::default()
5450        }
5451
5452        unsafe fn decode(
5453            &mut self,
5454            decoder: &mut fidl::encoding::Decoder<'_, D>,
5455            offset: usize,
5456            mut depth: fidl::encoding::Depth,
5457        ) -> fidl::Result<()> {
5458            decoder.debug_check_bounds::<Self>(offset);
5459            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
5460                None => return Err(fidl::Error::NotNullable),
5461                Some(len) => len,
5462            };
5463            // Calling decoder.out_of_line_offset(0) is not allowed.
5464            if len == 0 {
5465                return Ok(());
5466            };
5467            depth.increment()?;
5468            let envelope_size = 8;
5469            let bytes_len = len * envelope_size;
5470            let offset = decoder.out_of_line_offset(bytes_len)?;
5471            // Decode the envelope for each type.
5472            let mut _next_ordinal_to_read = 0;
5473            let mut next_offset = offset;
5474            let end_offset = offset + bytes_len;
5475            _next_ordinal_to_read += 1;
5476            if next_offset >= end_offset {
5477                return Ok(());
5478            }
5479
5480            // Decode unknown envelopes for gaps in ordinals.
5481            while _next_ordinal_to_read < 1 {
5482                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5483                _next_ordinal_to_read += 1;
5484                next_offset += envelope_size;
5485            }
5486
5487            let next_out_of_line = decoder.next_out_of_line();
5488            let handles_before = decoder.remaining_handles();
5489            if let Some((inlined, num_bytes, num_handles)) =
5490                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5491            {
5492                let member_inline_size =
5493                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5494                if inlined != (member_inline_size <= 4) {
5495                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5496                }
5497                let inner_offset;
5498                let mut inner_depth = depth.clone();
5499                if inlined {
5500                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5501                    inner_offset = next_offset;
5502                } else {
5503                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5504                    inner_depth.increment()?;
5505                }
5506                let val_ref = self.min_frequency.get_or_insert_with(|| fidl::new_empty!(u32, D));
5507                fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
5508                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5509                {
5510                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5511                }
5512                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5513                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5514                }
5515            }
5516
5517            next_offset += envelope_size;
5518            _next_ordinal_to_read += 1;
5519            if next_offset >= end_offset {
5520                return Ok(());
5521            }
5522
5523            // Decode unknown envelopes for gaps in ordinals.
5524            while _next_ordinal_to_read < 2 {
5525                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5526                _next_ordinal_to_read += 1;
5527                next_offset += envelope_size;
5528            }
5529
5530            let next_out_of_line = decoder.next_out_of_line();
5531            let handles_before = decoder.remaining_handles();
5532            if let Some((inlined, num_bytes, num_handles)) =
5533                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5534            {
5535                let member_inline_size =
5536                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5537                if inlined != (member_inline_size <= 4) {
5538                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5539                }
5540                let inner_offset;
5541                let mut inner_depth = depth.clone();
5542                if inlined {
5543                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5544                    inner_offset = next_offset;
5545                } else {
5546                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5547                    inner_depth.increment()?;
5548                }
5549                let val_ref = self.max_frequency.get_or_insert_with(|| fidl::new_empty!(u32, D));
5550                fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
5551                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5552                {
5553                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5554                }
5555                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5556                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5557                }
5558            }
5559
5560            next_offset += envelope_size;
5561
5562            // Decode the remaining unknown envelopes.
5563            while next_offset < end_offset {
5564                _next_ordinal_to_read += 1;
5565                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5566                next_offset += envelope_size;
5567            }
5568
5569            Ok(())
5570        }
5571    }
5572
5573    impl ChannelSet {
5574        #[inline(always)]
5575        fn max_ordinal_present(&self) -> u64 {
5576            if let Some(_) = self.attributes {
5577                return 1;
5578            }
5579            0
5580        }
5581    }
5582
5583    impl fidl::encoding::ValueTypeMarker for ChannelSet {
5584        type Borrowed<'a> = &'a Self;
5585        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
5586            value
5587        }
5588    }
5589
5590    unsafe impl fidl::encoding::TypeMarker for ChannelSet {
5591        type Owned = Self;
5592
5593        #[inline(always)]
5594        fn inline_align(_context: fidl::encoding::Context) -> usize {
5595            8
5596        }
5597
5598        #[inline(always)]
5599        fn inline_size(_context: fidl::encoding::Context) -> usize {
5600            16
5601        }
5602    }
5603
5604    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<ChannelSet, D>
5605        for &ChannelSet
5606    {
5607        unsafe fn encode(
5608            self,
5609            encoder: &mut fidl::encoding::Encoder<'_, D>,
5610            offset: usize,
5611            mut depth: fidl::encoding::Depth,
5612        ) -> fidl::Result<()> {
5613            encoder.debug_check_bounds::<ChannelSet>(offset);
5614            // Vector header
5615            let max_ordinal: u64 = self.max_ordinal_present();
5616            encoder.write_num(max_ordinal, offset);
5617            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
5618            // Calling encoder.out_of_line_offset(0) is not allowed.
5619            if max_ordinal == 0 {
5620                return Ok(());
5621            }
5622            depth.increment()?;
5623            let envelope_size = 8;
5624            let bytes_len = max_ordinal as usize * envelope_size;
5625            #[allow(unused_variables)]
5626            let offset = encoder.out_of_line_offset(bytes_len);
5627            let mut _prev_end_offset: usize = 0;
5628            if 1 > max_ordinal {
5629                return Ok(());
5630            }
5631
5632            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5633            // are envelope_size bytes.
5634            let cur_offset: usize = (1 - 1) * envelope_size;
5635
5636            // Zero reserved fields.
5637            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5638
5639            // Safety:
5640            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5641            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5642            //   envelope_size bytes, there is always sufficient room.
5643            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<ChannelAttributes, 64>, D>(
5644            self.attributes.as_ref().map(<fidl::encoding::Vector<ChannelAttributes, 64> as fidl::encoding::ValueTypeMarker>::borrow),
5645            encoder, offset + cur_offset, depth
5646        )?;
5647
5648            _prev_end_offset = cur_offset + envelope_size;
5649
5650            Ok(())
5651        }
5652    }
5653
5654    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ChannelSet {
5655        #[inline(always)]
5656        fn new_empty() -> Self {
5657            Self::default()
5658        }
5659
5660        unsafe fn decode(
5661            &mut self,
5662            decoder: &mut fidl::encoding::Decoder<'_, D>,
5663            offset: usize,
5664            mut depth: fidl::encoding::Depth,
5665        ) -> fidl::Result<()> {
5666            decoder.debug_check_bounds::<Self>(offset);
5667            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
5668                None => return Err(fidl::Error::NotNullable),
5669                Some(len) => len,
5670            };
5671            // Calling decoder.out_of_line_offset(0) is not allowed.
5672            if len == 0 {
5673                return Ok(());
5674            };
5675            depth.increment()?;
5676            let envelope_size = 8;
5677            let bytes_len = len * envelope_size;
5678            let offset = decoder.out_of_line_offset(bytes_len)?;
5679            // Decode the envelope for each type.
5680            let mut _next_ordinal_to_read = 0;
5681            let mut next_offset = offset;
5682            let end_offset = offset + bytes_len;
5683            _next_ordinal_to_read += 1;
5684            if next_offset >= end_offset {
5685                return Ok(());
5686            }
5687
5688            // Decode unknown envelopes for gaps in ordinals.
5689            while _next_ordinal_to_read < 1 {
5690                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5691                _next_ordinal_to_read += 1;
5692                next_offset += envelope_size;
5693            }
5694
5695            let next_out_of_line = decoder.next_out_of_line();
5696            let handles_before = decoder.remaining_handles();
5697            if let Some((inlined, num_bytes, num_handles)) =
5698                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5699            {
5700                let member_inline_size = <fidl::encoding::Vector<ChannelAttributes, 64> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5701                if inlined != (member_inline_size <= 4) {
5702                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5703                }
5704                let inner_offset;
5705                let mut inner_depth = depth.clone();
5706                if inlined {
5707                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5708                    inner_offset = next_offset;
5709                } else {
5710                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5711                    inner_depth.increment()?;
5712                }
5713                let val_ref = self.attributes.get_or_insert_with(
5714                    || fidl::new_empty!(fidl::encoding::Vector<ChannelAttributes, 64>, D),
5715                );
5716                fidl::decode!(fidl::encoding::Vector<ChannelAttributes, 64>, D, val_ref, decoder, inner_offset, inner_depth)?;
5717                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5718                {
5719                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5720                }
5721                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5722                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5723                }
5724            }
5725
5726            next_offset += envelope_size;
5727
5728            // Decode the remaining unknown envelopes.
5729            while next_offset < end_offset {
5730                _next_ordinal_to_read += 1;
5731                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5732                next_offset += envelope_size;
5733            }
5734
5735            Ok(())
5736        }
5737    }
5738
5739    impl CodecFormatInfo {
5740        #[inline(always)]
5741        fn max_ordinal_present(&self) -> u64 {
5742            if let Some(_) = self.turn_off_delay {
5743                return 3;
5744            }
5745            if let Some(_) = self.turn_on_delay {
5746                return 2;
5747            }
5748            if let Some(_) = self.external_delay {
5749                return 1;
5750            }
5751            0
5752        }
5753    }
5754
5755    impl fidl::encoding::ValueTypeMarker for CodecFormatInfo {
5756        type Borrowed<'a> = &'a Self;
5757        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
5758            value
5759        }
5760    }
5761
5762    unsafe impl fidl::encoding::TypeMarker for CodecFormatInfo {
5763        type Owned = Self;
5764
5765        #[inline(always)]
5766        fn inline_align(_context: fidl::encoding::Context) -> usize {
5767            8
5768        }
5769
5770        #[inline(always)]
5771        fn inline_size(_context: fidl::encoding::Context) -> usize {
5772            16
5773        }
5774    }
5775
5776    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<CodecFormatInfo, D>
5777        for &CodecFormatInfo
5778    {
5779        unsafe fn encode(
5780            self,
5781            encoder: &mut fidl::encoding::Encoder<'_, D>,
5782            offset: usize,
5783            mut depth: fidl::encoding::Depth,
5784        ) -> fidl::Result<()> {
5785            encoder.debug_check_bounds::<CodecFormatInfo>(offset);
5786            // Vector header
5787            let max_ordinal: u64 = self.max_ordinal_present();
5788            encoder.write_num(max_ordinal, offset);
5789            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
5790            // Calling encoder.out_of_line_offset(0) is not allowed.
5791            if max_ordinal == 0 {
5792                return Ok(());
5793            }
5794            depth.increment()?;
5795            let envelope_size = 8;
5796            let bytes_len = max_ordinal as usize * envelope_size;
5797            #[allow(unused_variables)]
5798            let offset = encoder.out_of_line_offset(bytes_len);
5799            let mut _prev_end_offset: usize = 0;
5800            if 1 > max_ordinal {
5801                return Ok(());
5802            }
5803
5804            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5805            // are envelope_size bytes.
5806            let cur_offset: usize = (1 - 1) * envelope_size;
5807
5808            // Zero reserved fields.
5809            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5810
5811            // Safety:
5812            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5813            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5814            //   envelope_size bytes, there is always sufficient room.
5815            fidl::encoding::encode_in_envelope_optional::<i64, D>(
5816                self.external_delay.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
5817                encoder,
5818                offset + cur_offset,
5819                depth,
5820            )?;
5821
5822            _prev_end_offset = cur_offset + envelope_size;
5823            if 2 > max_ordinal {
5824                return Ok(());
5825            }
5826
5827            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5828            // are envelope_size bytes.
5829            let cur_offset: usize = (2 - 1) * envelope_size;
5830
5831            // Zero reserved fields.
5832            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5833
5834            // Safety:
5835            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5836            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5837            //   envelope_size bytes, there is always sufficient room.
5838            fidl::encoding::encode_in_envelope_optional::<i64, D>(
5839                self.turn_on_delay.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
5840                encoder,
5841                offset + cur_offset,
5842                depth,
5843            )?;
5844
5845            _prev_end_offset = cur_offset + envelope_size;
5846            if 3 > max_ordinal {
5847                return Ok(());
5848            }
5849
5850            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5851            // are envelope_size bytes.
5852            let cur_offset: usize = (3 - 1) * envelope_size;
5853
5854            // Zero reserved fields.
5855            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5856
5857            // Safety:
5858            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5859            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5860            //   envelope_size bytes, there is always sufficient room.
5861            fidl::encoding::encode_in_envelope_optional::<i64, D>(
5862                self.turn_off_delay.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
5863                encoder,
5864                offset + cur_offset,
5865                depth,
5866            )?;
5867
5868            _prev_end_offset = cur_offset + envelope_size;
5869
5870            Ok(())
5871        }
5872    }
5873
5874    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for CodecFormatInfo {
5875        #[inline(always)]
5876        fn new_empty() -> Self {
5877            Self::default()
5878        }
5879
5880        unsafe fn decode(
5881            &mut self,
5882            decoder: &mut fidl::encoding::Decoder<'_, D>,
5883            offset: usize,
5884            mut depth: fidl::encoding::Depth,
5885        ) -> fidl::Result<()> {
5886            decoder.debug_check_bounds::<Self>(offset);
5887            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
5888                None => return Err(fidl::Error::NotNullable),
5889                Some(len) => len,
5890            };
5891            // Calling decoder.out_of_line_offset(0) is not allowed.
5892            if len == 0 {
5893                return Ok(());
5894            };
5895            depth.increment()?;
5896            let envelope_size = 8;
5897            let bytes_len = len * envelope_size;
5898            let offset = decoder.out_of_line_offset(bytes_len)?;
5899            // Decode the envelope for each type.
5900            let mut _next_ordinal_to_read = 0;
5901            let mut next_offset = offset;
5902            let end_offset = offset + bytes_len;
5903            _next_ordinal_to_read += 1;
5904            if next_offset >= end_offset {
5905                return Ok(());
5906            }
5907
5908            // Decode unknown envelopes for gaps in ordinals.
5909            while _next_ordinal_to_read < 1 {
5910                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5911                _next_ordinal_to_read += 1;
5912                next_offset += envelope_size;
5913            }
5914
5915            let next_out_of_line = decoder.next_out_of_line();
5916            let handles_before = decoder.remaining_handles();
5917            if let Some((inlined, num_bytes, num_handles)) =
5918                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5919            {
5920                let member_inline_size =
5921                    <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5922                if inlined != (member_inline_size <= 4) {
5923                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5924                }
5925                let inner_offset;
5926                let mut inner_depth = depth.clone();
5927                if inlined {
5928                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5929                    inner_offset = next_offset;
5930                } else {
5931                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5932                    inner_depth.increment()?;
5933                }
5934                let val_ref = self.external_delay.get_or_insert_with(|| fidl::new_empty!(i64, D));
5935                fidl::decode!(i64, D, val_ref, decoder, inner_offset, inner_depth)?;
5936                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5937                {
5938                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5939                }
5940                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5941                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5942                }
5943            }
5944
5945            next_offset += envelope_size;
5946            _next_ordinal_to_read += 1;
5947            if next_offset >= end_offset {
5948                return Ok(());
5949            }
5950
5951            // Decode unknown envelopes for gaps in ordinals.
5952            while _next_ordinal_to_read < 2 {
5953                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5954                _next_ordinal_to_read += 1;
5955                next_offset += envelope_size;
5956            }
5957
5958            let next_out_of_line = decoder.next_out_of_line();
5959            let handles_before = decoder.remaining_handles();
5960            if let Some((inlined, num_bytes, num_handles)) =
5961                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5962            {
5963                let member_inline_size =
5964                    <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5965                if inlined != (member_inline_size <= 4) {
5966                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5967                }
5968                let inner_offset;
5969                let mut inner_depth = depth.clone();
5970                if inlined {
5971                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5972                    inner_offset = next_offset;
5973                } else {
5974                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5975                    inner_depth.increment()?;
5976                }
5977                let val_ref = self.turn_on_delay.get_or_insert_with(|| fidl::new_empty!(i64, D));
5978                fidl::decode!(i64, D, val_ref, decoder, inner_offset, inner_depth)?;
5979                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5980                {
5981                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5982                }
5983                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5984                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5985                }
5986            }
5987
5988            next_offset += envelope_size;
5989            _next_ordinal_to_read += 1;
5990            if next_offset >= end_offset {
5991                return Ok(());
5992            }
5993
5994            // Decode unknown envelopes for gaps in ordinals.
5995            while _next_ordinal_to_read < 3 {
5996                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5997                _next_ordinal_to_read += 1;
5998                next_offset += envelope_size;
5999            }
6000
6001            let next_out_of_line = decoder.next_out_of_line();
6002            let handles_before = decoder.remaining_handles();
6003            if let Some((inlined, num_bytes, num_handles)) =
6004                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6005            {
6006                let member_inline_size =
6007                    <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
6008                if inlined != (member_inline_size <= 4) {
6009                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6010                }
6011                let inner_offset;
6012                let mut inner_depth = depth.clone();
6013                if inlined {
6014                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6015                    inner_offset = next_offset;
6016                } else {
6017                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6018                    inner_depth.increment()?;
6019                }
6020                let val_ref = self.turn_off_delay.get_or_insert_with(|| fidl::new_empty!(i64, D));
6021                fidl::decode!(i64, D, val_ref, decoder, inner_offset, inner_depth)?;
6022                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6023                {
6024                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6025                }
6026                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6027                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6028                }
6029            }
6030
6031            next_offset += envelope_size;
6032
6033            // Decode the remaining unknown envelopes.
6034            while next_offset < end_offset {
6035                _next_ordinal_to_read += 1;
6036                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6037                next_offset += envelope_size;
6038            }
6039
6040            Ok(())
6041        }
6042    }
6043
6044    impl CodecProperties {
6045        #[inline(always)]
6046        fn max_ordinal_present(&self) -> u64 {
6047            if let Some(_) = self.plug_detect_capabilities {
6048                return 5;
6049            }
6050            if let Some(_) = self.unique_id {
6051                return 4;
6052            }
6053            if let Some(_) = self.product {
6054                return 3;
6055            }
6056            if let Some(_) = self.manufacturer {
6057                return 2;
6058            }
6059            if let Some(_) = self.is_input {
6060                return 1;
6061            }
6062            0
6063        }
6064    }
6065
6066    impl fidl::encoding::ValueTypeMarker for CodecProperties {
6067        type Borrowed<'a> = &'a Self;
6068        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
6069            value
6070        }
6071    }
6072
6073    unsafe impl fidl::encoding::TypeMarker for CodecProperties {
6074        type Owned = Self;
6075
6076        #[inline(always)]
6077        fn inline_align(_context: fidl::encoding::Context) -> usize {
6078            8
6079        }
6080
6081        #[inline(always)]
6082        fn inline_size(_context: fidl::encoding::Context) -> usize {
6083            16
6084        }
6085    }
6086
6087    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<CodecProperties, D>
6088        for &CodecProperties
6089    {
6090        unsafe fn encode(
6091            self,
6092            encoder: &mut fidl::encoding::Encoder<'_, D>,
6093            offset: usize,
6094            mut depth: fidl::encoding::Depth,
6095        ) -> fidl::Result<()> {
6096            encoder.debug_check_bounds::<CodecProperties>(offset);
6097            // Vector header
6098            let max_ordinal: u64 = self.max_ordinal_present();
6099            encoder.write_num(max_ordinal, offset);
6100            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
6101            // Calling encoder.out_of_line_offset(0) is not allowed.
6102            if max_ordinal == 0 {
6103                return Ok(());
6104            }
6105            depth.increment()?;
6106            let envelope_size = 8;
6107            let bytes_len = max_ordinal as usize * envelope_size;
6108            #[allow(unused_variables)]
6109            let offset = encoder.out_of_line_offset(bytes_len);
6110            let mut _prev_end_offset: usize = 0;
6111            if 1 > max_ordinal {
6112                return Ok(());
6113            }
6114
6115            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
6116            // are envelope_size bytes.
6117            let cur_offset: usize = (1 - 1) * envelope_size;
6118
6119            // Zero reserved fields.
6120            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6121
6122            // Safety:
6123            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
6124            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
6125            //   envelope_size bytes, there is always sufficient room.
6126            fidl::encoding::encode_in_envelope_optional::<bool, D>(
6127                self.is_input.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
6128                encoder,
6129                offset + cur_offset,
6130                depth,
6131            )?;
6132
6133            _prev_end_offset = cur_offset + envelope_size;
6134            if 2 > max_ordinal {
6135                return Ok(());
6136            }
6137
6138            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
6139            // are envelope_size bytes.
6140            let cur_offset: usize = (2 - 1) * envelope_size;
6141
6142            // Zero reserved fields.
6143            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6144
6145            // Safety:
6146            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
6147            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
6148            //   envelope_size bytes, there is always sufficient room.
6149            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<256>, D>(
6150                self.manufacturer.as_ref().map(
6151                    <fidl::encoding::BoundedString<256> as fidl::encoding::ValueTypeMarker>::borrow,
6152                ),
6153                encoder,
6154                offset + cur_offset,
6155                depth,
6156            )?;
6157
6158            _prev_end_offset = cur_offset + envelope_size;
6159            if 3 > max_ordinal {
6160                return Ok(());
6161            }
6162
6163            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
6164            // are envelope_size bytes.
6165            let cur_offset: usize = (3 - 1) * envelope_size;
6166
6167            // Zero reserved fields.
6168            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6169
6170            // Safety:
6171            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
6172            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
6173            //   envelope_size bytes, there is always sufficient room.
6174            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<256>, D>(
6175                self.product.as_ref().map(
6176                    <fidl::encoding::BoundedString<256> as fidl::encoding::ValueTypeMarker>::borrow,
6177                ),
6178                encoder,
6179                offset + cur_offset,
6180                depth,
6181            )?;
6182
6183            _prev_end_offset = cur_offset + envelope_size;
6184            if 4 > max_ordinal {
6185                return Ok(());
6186            }
6187
6188            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
6189            // are envelope_size bytes.
6190            let cur_offset: usize = (4 - 1) * envelope_size;
6191
6192            // Zero reserved fields.
6193            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6194
6195            // Safety:
6196            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
6197            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
6198            //   envelope_size bytes, there is always sufficient room.
6199            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Array<u8, 16>, D>(
6200                self.unique_id.as_ref().map(
6201                    <fidl::encoding::Array<u8, 16> as fidl::encoding::ValueTypeMarker>::borrow,
6202                ),
6203                encoder,
6204                offset + cur_offset,
6205                depth,
6206            )?;
6207
6208            _prev_end_offset = cur_offset + envelope_size;
6209            if 5 > max_ordinal {
6210                return Ok(());
6211            }
6212
6213            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
6214            // are envelope_size bytes.
6215            let cur_offset: usize = (5 - 1) * envelope_size;
6216
6217            // Zero reserved fields.
6218            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6219
6220            // Safety:
6221            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
6222            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
6223            //   envelope_size bytes, there is always sufficient room.
6224            fidl::encoding::encode_in_envelope_optional::<PlugDetectCapabilities, D>(
6225                self.plug_detect_capabilities
6226                    .as_ref()
6227                    .map(<PlugDetectCapabilities as fidl::encoding::ValueTypeMarker>::borrow),
6228                encoder,
6229                offset + cur_offset,
6230                depth,
6231            )?;
6232
6233            _prev_end_offset = cur_offset + envelope_size;
6234
6235            Ok(())
6236        }
6237    }
6238
6239    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for CodecProperties {
6240        #[inline(always)]
6241        fn new_empty() -> Self {
6242            Self::default()
6243        }
6244
6245        unsafe fn decode(
6246            &mut self,
6247            decoder: &mut fidl::encoding::Decoder<'_, D>,
6248            offset: usize,
6249            mut depth: fidl::encoding::Depth,
6250        ) -> fidl::Result<()> {
6251            decoder.debug_check_bounds::<Self>(offset);
6252            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
6253                None => return Err(fidl::Error::NotNullable),
6254                Some(len) => len,
6255            };
6256            // Calling decoder.out_of_line_offset(0) is not allowed.
6257            if len == 0 {
6258                return Ok(());
6259            };
6260            depth.increment()?;
6261            let envelope_size = 8;
6262            let bytes_len = len * envelope_size;
6263            let offset = decoder.out_of_line_offset(bytes_len)?;
6264            // Decode the envelope for each type.
6265            let mut _next_ordinal_to_read = 0;
6266            let mut next_offset = offset;
6267            let end_offset = offset + bytes_len;
6268            _next_ordinal_to_read += 1;
6269            if next_offset >= end_offset {
6270                return Ok(());
6271            }
6272
6273            // Decode unknown envelopes for gaps in ordinals.
6274            while _next_ordinal_to_read < 1 {
6275                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6276                _next_ordinal_to_read += 1;
6277                next_offset += envelope_size;
6278            }
6279
6280            let next_out_of_line = decoder.next_out_of_line();
6281            let handles_before = decoder.remaining_handles();
6282            if let Some((inlined, num_bytes, num_handles)) =
6283                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6284            {
6285                let member_inline_size =
6286                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
6287                if inlined != (member_inline_size <= 4) {
6288                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6289                }
6290                let inner_offset;
6291                let mut inner_depth = depth.clone();
6292                if inlined {
6293                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6294                    inner_offset = next_offset;
6295                } else {
6296                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6297                    inner_depth.increment()?;
6298                }
6299                let val_ref = self.is_input.get_or_insert_with(|| fidl::new_empty!(bool, D));
6300                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
6301                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6302                {
6303                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6304                }
6305                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6306                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6307                }
6308            }
6309
6310            next_offset += envelope_size;
6311            _next_ordinal_to_read += 1;
6312            if next_offset >= end_offset {
6313                return Ok(());
6314            }
6315
6316            // Decode unknown envelopes for gaps in ordinals.
6317            while _next_ordinal_to_read < 2 {
6318                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6319                _next_ordinal_to_read += 1;
6320                next_offset += envelope_size;
6321            }
6322
6323            let next_out_of_line = decoder.next_out_of_line();
6324            let handles_before = decoder.remaining_handles();
6325            if let Some((inlined, num_bytes, num_handles)) =
6326                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6327            {
6328                let member_inline_size =
6329                    <fidl::encoding::BoundedString<256> as fidl::encoding::TypeMarker>::inline_size(
6330                        decoder.context,
6331                    );
6332                if inlined != (member_inline_size <= 4) {
6333                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6334                }
6335                let inner_offset;
6336                let mut inner_depth = depth.clone();
6337                if inlined {
6338                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6339                    inner_offset = next_offset;
6340                } else {
6341                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6342                    inner_depth.increment()?;
6343                }
6344                let val_ref = self
6345                    .manufacturer
6346                    .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::BoundedString<256>, D));
6347                fidl::decode!(
6348                    fidl::encoding::BoundedString<256>,
6349                    D,
6350                    val_ref,
6351                    decoder,
6352                    inner_offset,
6353                    inner_depth
6354                )?;
6355                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6356                {
6357                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6358                }
6359                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6360                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6361                }
6362            }
6363
6364            next_offset += envelope_size;
6365            _next_ordinal_to_read += 1;
6366            if next_offset >= end_offset {
6367                return Ok(());
6368            }
6369
6370            // Decode unknown envelopes for gaps in ordinals.
6371            while _next_ordinal_to_read < 3 {
6372                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6373                _next_ordinal_to_read += 1;
6374                next_offset += envelope_size;
6375            }
6376
6377            let next_out_of_line = decoder.next_out_of_line();
6378            let handles_before = decoder.remaining_handles();
6379            if let Some((inlined, num_bytes, num_handles)) =
6380                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6381            {
6382                let member_inline_size =
6383                    <fidl::encoding::BoundedString<256> as fidl::encoding::TypeMarker>::inline_size(
6384                        decoder.context,
6385                    );
6386                if inlined != (member_inline_size <= 4) {
6387                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6388                }
6389                let inner_offset;
6390                let mut inner_depth = depth.clone();
6391                if inlined {
6392                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6393                    inner_offset = next_offset;
6394                } else {
6395                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6396                    inner_depth.increment()?;
6397                }
6398                let val_ref = self
6399                    .product
6400                    .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::BoundedString<256>, D));
6401                fidl::decode!(
6402                    fidl::encoding::BoundedString<256>,
6403                    D,
6404                    val_ref,
6405                    decoder,
6406                    inner_offset,
6407                    inner_depth
6408                )?;
6409                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6410                {
6411                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6412                }
6413                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6414                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6415                }
6416            }
6417
6418            next_offset += envelope_size;
6419            _next_ordinal_to_read += 1;
6420            if next_offset >= end_offset {
6421                return Ok(());
6422            }
6423
6424            // Decode unknown envelopes for gaps in ordinals.
6425            while _next_ordinal_to_read < 4 {
6426                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6427                _next_ordinal_to_read += 1;
6428                next_offset += envelope_size;
6429            }
6430
6431            let next_out_of_line = decoder.next_out_of_line();
6432            let handles_before = decoder.remaining_handles();
6433            if let Some((inlined, num_bytes, num_handles)) =
6434                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6435            {
6436                let member_inline_size =
6437                    <fidl::encoding::Array<u8, 16> as fidl::encoding::TypeMarker>::inline_size(
6438                        decoder.context,
6439                    );
6440                if inlined != (member_inline_size <= 4) {
6441                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6442                }
6443                let inner_offset;
6444                let mut inner_depth = depth.clone();
6445                if inlined {
6446                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6447                    inner_offset = next_offset;
6448                } else {
6449                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6450                    inner_depth.increment()?;
6451                }
6452                let val_ref = self
6453                    .unique_id
6454                    .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Array<u8, 16>, D));
6455                fidl::decode!(fidl::encoding::Array<u8, 16>, D, val_ref, decoder, inner_offset, inner_depth)?;
6456                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6457                {
6458                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6459                }
6460                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6461                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6462                }
6463            }
6464
6465            next_offset += envelope_size;
6466            _next_ordinal_to_read += 1;
6467            if next_offset >= end_offset {
6468                return Ok(());
6469            }
6470
6471            // Decode unknown envelopes for gaps in ordinals.
6472            while _next_ordinal_to_read < 5 {
6473                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6474                _next_ordinal_to_read += 1;
6475                next_offset += envelope_size;
6476            }
6477
6478            let next_out_of_line = decoder.next_out_of_line();
6479            let handles_before = decoder.remaining_handles();
6480            if let Some((inlined, num_bytes, num_handles)) =
6481                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6482            {
6483                let member_inline_size =
6484                    <PlugDetectCapabilities as fidl::encoding::TypeMarker>::inline_size(
6485                        decoder.context,
6486                    );
6487                if inlined != (member_inline_size <= 4) {
6488                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6489                }
6490                let inner_offset;
6491                let mut inner_depth = depth.clone();
6492                if inlined {
6493                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6494                    inner_offset = next_offset;
6495                } else {
6496                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6497                    inner_depth.increment()?;
6498                }
6499                let val_ref = self
6500                    .plug_detect_capabilities
6501                    .get_or_insert_with(|| fidl::new_empty!(PlugDetectCapabilities, D));
6502                fidl::decode!(
6503                    PlugDetectCapabilities,
6504                    D,
6505                    val_ref,
6506                    decoder,
6507                    inner_offset,
6508                    inner_depth
6509                )?;
6510                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6511                {
6512                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6513                }
6514                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6515                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6516                }
6517            }
6518
6519            next_offset += envelope_size;
6520
6521            // Decode the remaining unknown envelopes.
6522            while next_offset < end_offset {
6523                _next_ordinal_to_read += 1;
6524                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6525                next_offset += envelope_size;
6526            }
6527
6528            Ok(())
6529        }
6530    }
6531
6532    impl CompositeProperties {
6533        #[inline(always)]
6534        fn max_ordinal_present(&self) -> u64 {
6535            if let Some(_) = self.clock_domain {
6536                return 5;
6537            }
6538            if let Some(_) = self.unique_id {
6539                return 4;
6540            }
6541            if let Some(_) = self.product {
6542                return 3;
6543            }
6544            if let Some(_) = self.manufacturer {
6545                return 2;
6546            }
6547            0
6548        }
6549    }
6550
6551    impl fidl::encoding::ValueTypeMarker for CompositeProperties {
6552        type Borrowed<'a> = &'a Self;
6553        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
6554            value
6555        }
6556    }
6557
6558    unsafe impl fidl::encoding::TypeMarker for CompositeProperties {
6559        type Owned = Self;
6560
6561        #[inline(always)]
6562        fn inline_align(_context: fidl::encoding::Context) -> usize {
6563            8
6564        }
6565
6566        #[inline(always)]
6567        fn inline_size(_context: fidl::encoding::Context) -> usize {
6568            16
6569        }
6570    }
6571
6572    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<CompositeProperties, D>
6573        for &CompositeProperties
6574    {
6575        unsafe fn encode(
6576            self,
6577            encoder: &mut fidl::encoding::Encoder<'_, D>,
6578            offset: usize,
6579            mut depth: fidl::encoding::Depth,
6580        ) -> fidl::Result<()> {
6581            encoder.debug_check_bounds::<CompositeProperties>(offset);
6582            // Vector header
6583            let max_ordinal: u64 = self.max_ordinal_present();
6584            encoder.write_num(max_ordinal, offset);
6585            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
6586            // Calling encoder.out_of_line_offset(0) is not allowed.
6587            if max_ordinal == 0 {
6588                return Ok(());
6589            }
6590            depth.increment()?;
6591            let envelope_size = 8;
6592            let bytes_len = max_ordinal as usize * envelope_size;
6593            #[allow(unused_variables)]
6594            let offset = encoder.out_of_line_offset(bytes_len);
6595            let mut _prev_end_offset: usize = 0;
6596            if 2 > max_ordinal {
6597                return Ok(());
6598            }
6599
6600            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
6601            // are envelope_size bytes.
6602            let cur_offset: usize = (2 - 1) * envelope_size;
6603
6604            // Zero reserved fields.
6605            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6606
6607            // Safety:
6608            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
6609            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
6610            //   envelope_size bytes, there is always sufficient room.
6611            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<256>, D>(
6612                self.manufacturer.as_ref().map(
6613                    <fidl::encoding::BoundedString<256> as fidl::encoding::ValueTypeMarker>::borrow,
6614                ),
6615                encoder,
6616                offset + cur_offset,
6617                depth,
6618            )?;
6619
6620            _prev_end_offset = cur_offset + envelope_size;
6621            if 3 > max_ordinal {
6622                return Ok(());
6623            }
6624
6625            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
6626            // are envelope_size bytes.
6627            let cur_offset: usize = (3 - 1) * envelope_size;
6628
6629            // Zero reserved fields.
6630            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6631
6632            // Safety:
6633            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
6634            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
6635            //   envelope_size bytes, there is always sufficient room.
6636            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<256>, D>(
6637                self.product.as_ref().map(
6638                    <fidl::encoding::BoundedString<256> as fidl::encoding::ValueTypeMarker>::borrow,
6639                ),
6640                encoder,
6641                offset + cur_offset,
6642                depth,
6643            )?;
6644
6645            _prev_end_offset = cur_offset + envelope_size;
6646            if 4 > max_ordinal {
6647                return Ok(());
6648            }
6649
6650            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
6651            // are envelope_size bytes.
6652            let cur_offset: usize = (4 - 1) * envelope_size;
6653
6654            // Zero reserved fields.
6655            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6656
6657            // Safety:
6658            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
6659            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
6660            //   envelope_size bytes, there is always sufficient room.
6661            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Array<u8, 16>, D>(
6662                self.unique_id.as_ref().map(
6663                    <fidl::encoding::Array<u8, 16> as fidl::encoding::ValueTypeMarker>::borrow,
6664                ),
6665                encoder,
6666                offset + cur_offset,
6667                depth,
6668            )?;
6669
6670            _prev_end_offset = cur_offset + envelope_size;
6671            if 5 > max_ordinal {
6672                return Ok(());
6673            }
6674
6675            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
6676            // are envelope_size bytes.
6677            let cur_offset: usize = (5 - 1) * envelope_size;
6678
6679            // Zero reserved fields.
6680            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6681
6682            // Safety:
6683            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
6684            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
6685            //   envelope_size bytes, there is always sufficient room.
6686            fidl::encoding::encode_in_envelope_optional::<u32, D>(
6687                self.clock_domain.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
6688                encoder,
6689                offset + cur_offset,
6690                depth,
6691            )?;
6692
6693            _prev_end_offset = cur_offset + envelope_size;
6694
6695            Ok(())
6696        }
6697    }
6698
6699    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for CompositeProperties {
6700        #[inline(always)]
6701        fn new_empty() -> Self {
6702            Self::default()
6703        }
6704
6705        unsafe fn decode(
6706            &mut self,
6707            decoder: &mut fidl::encoding::Decoder<'_, D>,
6708            offset: usize,
6709            mut depth: fidl::encoding::Depth,
6710        ) -> fidl::Result<()> {
6711            decoder.debug_check_bounds::<Self>(offset);
6712            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
6713                None => return Err(fidl::Error::NotNullable),
6714                Some(len) => len,
6715            };
6716            // Calling decoder.out_of_line_offset(0) is not allowed.
6717            if len == 0 {
6718                return Ok(());
6719            };
6720            depth.increment()?;
6721            let envelope_size = 8;
6722            let bytes_len = len * envelope_size;
6723            let offset = decoder.out_of_line_offset(bytes_len)?;
6724            // Decode the envelope for each type.
6725            let mut _next_ordinal_to_read = 0;
6726            let mut next_offset = offset;
6727            let end_offset = offset + bytes_len;
6728            _next_ordinal_to_read += 1;
6729            if next_offset >= end_offset {
6730                return Ok(());
6731            }
6732
6733            // Decode unknown envelopes for gaps in ordinals.
6734            while _next_ordinal_to_read < 2 {
6735                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6736                _next_ordinal_to_read += 1;
6737                next_offset += envelope_size;
6738            }
6739
6740            let next_out_of_line = decoder.next_out_of_line();
6741            let handles_before = decoder.remaining_handles();
6742            if let Some((inlined, num_bytes, num_handles)) =
6743                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6744            {
6745                let member_inline_size =
6746                    <fidl::encoding::BoundedString<256> as fidl::encoding::TypeMarker>::inline_size(
6747                        decoder.context,
6748                    );
6749                if inlined != (member_inline_size <= 4) {
6750                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6751                }
6752                let inner_offset;
6753                let mut inner_depth = depth.clone();
6754                if inlined {
6755                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6756                    inner_offset = next_offset;
6757                } else {
6758                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6759                    inner_depth.increment()?;
6760                }
6761                let val_ref = self
6762                    .manufacturer
6763                    .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::BoundedString<256>, D));
6764                fidl::decode!(
6765                    fidl::encoding::BoundedString<256>,
6766                    D,
6767                    val_ref,
6768                    decoder,
6769                    inner_offset,
6770                    inner_depth
6771                )?;
6772                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6773                {
6774                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6775                }
6776                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6777                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6778                }
6779            }
6780
6781            next_offset += envelope_size;
6782            _next_ordinal_to_read += 1;
6783            if next_offset >= end_offset {
6784                return Ok(());
6785            }
6786
6787            // Decode unknown envelopes for gaps in ordinals.
6788            while _next_ordinal_to_read < 3 {
6789                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6790                _next_ordinal_to_read += 1;
6791                next_offset += envelope_size;
6792            }
6793
6794            let next_out_of_line = decoder.next_out_of_line();
6795            let handles_before = decoder.remaining_handles();
6796            if let Some((inlined, num_bytes, num_handles)) =
6797                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6798            {
6799                let member_inline_size =
6800                    <fidl::encoding::BoundedString<256> as fidl::encoding::TypeMarker>::inline_size(
6801                        decoder.context,
6802                    );
6803                if inlined != (member_inline_size <= 4) {
6804                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6805                }
6806                let inner_offset;
6807                let mut inner_depth = depth.clone();
6808                if inlined {
6809                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6810                    inner_offset = next_offset;
6811                } else {
6812                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6813                    inner_depth.increment()?;
6814                }
6815                let val_ref = self
6816                    .product
6817                    .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::BoundedString<256>, D));
6818                fidl::decode!(
6819                    fidl::encoding::BoundedString<256>,
6820                    D,
6821                    val_ref,
6822                    decoder,
6823                    inner_offset,
6824                    inner_depth
6825                )?;
6826                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6827                {
6828                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6829                }
6830                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6831                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6832                }
6833            }
6834
6835            next_offset += envelope_size;
6836            _next_ordinal_to_read += 1;
6837            if next_offset >= end_offset {
6838                return Ok(());
6839            }
6840
6841            // Decode unknown envelopes for gaps in ordinals.
6842            while _next_ordinal_to_read < 4 {
6843                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6844                _next_ordinal_to_read += 1;
6845                next_offset += envelope_size;
6846            }
6847
6848            let next_out_of_line = decoder.next_out_of_line();
6849            let handles_before = decoder.remaining_handles();
6850            if let Some((inlined, num_bytes, num_handles)) =
6851                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6852            {
6853                let member_inline_size =
6854                    <fidl::encoding::Array<u8, 16> as fidl::encoding::TypeMarker>::inline_size(
6855                        decoder.context,
6856                    );
6857                if inlined != (member_inline_size <= 4) {
6858                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6859                }
6860                let inner_offset;
6861                let mut inner_depth = depth.clone();
6862                if inlined {
6863                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6864                    inner_offset = next_offset;
6865                } else {
6866                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6867                    inner_depth.increment()?;
6868                }
6869                let val_ref = self
6870                    .unique_id
6871                    .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Array<u8, 16>, D));
6872                fidl::decode!(fidl::encoding::Array<u8, 16>, D, val_ref, decoder, inner_offset, inner_depth)?;
6873                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6874                {
6875                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6876                }
6877                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6878                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6879                }
6880            }
6881
6882            next_offset += envelope_size;
6883            _next_ordinal_to_read += 1;
6884            if next_offset >= end_offset {
6885                return Ok(());
6886            }
6887
6888            // Decode unknown envelopes for gaps in ordinals.
6889            while _next_ordinal_to_read < 5 {
6890                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6891                _next_ordinal_to_read += 1;
6892                next_offset += envelope_size;
6893            }
6894
6895            let next_out_of_line = decoder.next_out_of_line();
6896            let handles_before = decoder.remaining_handles();
6897            if let Some((inlined, num_bytes, num_handles)) =
6898                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6899            {
6900                let member_inline_size =
6901                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
6902                if inlined != (member_inline_size <= 4) {
6903                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6904                }
6905                let inner_offset;
6906                let mut inner_depth = depth.clone();
6907                if inlined {
6908                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6909                    inner_offset = next_offset;
6910                } else {
6911                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6912                    inner_depth.increment()?;
6913                }
6914                let val_ref = self.clock_domain.get_or_insert_with(|| fidl::new_empty!(u32, D));
6915                fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
6916                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6917                {
6918                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6919                }
6920                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6921                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6922                }
6923            }
6924
6925            next_offset += envelope_size;
6926
6927            // Decode the remaining unknown envelopes.
6928            while next_offset < end_offset {
6929                _next_ordinal_to_read += 1;
6930                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6931                next_offset += envelope_size;
6932            }
6933
6934            Ok(())
6935        }
6936    }
6937
6938    impl DaiProperties {
6939        #[inline(always)]
6940        fn max_ordinal_present(&self) -> u64 {
6941            if let Some(_) = self.clock_domain {
6942                return 5;
6943            }
6944            if let Some(_) = self.unique_id {
6945                return 4;
6946            }
6947            if let Some(_) = self.product_name {
6948                return 3;
6949            }
6950            if let Some(_) = self.manufacturer {
6951                return 2;
6952            }
6953            if let Some(_) = self.is_input {
6954                return 1;
6955            }
6956            0
6957        }
6958    }
6959
6960    impl fidl::encoding::ValueTypeMarker for DaiProperties {
6961        type Borrowed<'a> = &'a Self;
6962        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
6963            value
6964        }
6965    }
6966
6967    unsafe impl fidl::encoding::TypeMarker for DaiProperties {
6968        type Owned = Self;
6969
6970        #[inline(always)]
6971        fn inline_align(_context: fidl::encoding::Context) -> usize {
6972            8
6973        }
6974
6975        #[inline(always)]
6976        fn inline_size(_context: fidl::encoding::Context) -> usize {
6977            16
6978        }
6979    }
6980
6981    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<DaiProperties, D>
6982        for &DaiProperties
6983    {
6984        unsafe fn encode(
6985            self,
6986            encoder: &mut fidl::encoding::Encoder<'_, D>,
6987            offset: usize,
6988            mut depth: fidl::encoding::Depth,
6989        ) -> fidl::Result<()> {
6990            encoder.debug_check_bounds::<DaiProperties>(offset);
6991            // Vector header
6992            let max_ordinal: u64 = self.max_ordinal_present();
6993            encoder.write_num(max_ordinal, offset);
6994            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
6995            // Calling encoder.out_of_line_offset(0) is not allowed.
6996            if max_ordinal == 0 {
6997                return Ok(());
6998            }
6999            depth.increment()?;
7000            let envelope_size = 8;
7001            let bytes_len = max_ordinal as usize * envelope_size;
7002            #[allow(unused_variables)]
7003            let offset = encoder.out_of_line_offset(bytes_len);
7004            let mut _prev_end_offset: usize = 0;
7005            if 1 > max_ordinal {
7006                return Ok(());
7007            }
7008
7009            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
7010            // are envelope_size bytes.
7011            let cur_offset: usize = (1 - 1) * envelope_size;
7012
7013            // Zero reserved fields.
7014            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7015
7016            // Safety:
7017            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
7018            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
7019            //   envelope_size bytes, there is always sufficient room.
7020            fidl::encoding::encode_in_envelope_optional::<bool, D>(
7021                self.is_input.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
7022                encoder,
7023                offset + cur_offset,
7024                depth,
7025            )?;
7026
7027            _prev_end_offset = cur_offset + envelope_size;
7028            if 2 > max_ordinal {
7029                return Ok(());
7030            }
7031
7032            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
7033            // are envelope_size bytes.
7034            let cur_offset: usize = (2 - 1) * envelope_size;
7035
7036            // Zero reserved fields.
7037            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7038
7039            // Safety:
7040            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
7041            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
7042            //   envelope_size bytes, there is always sufficient room.
7043            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<256>, D>(
7044                self.manufacturer.as_ref().map(
7045                    <fidl::encoding::BoundedString<256> as fidl::encoding::ValueTypeMarker>::borrow,
7046                ),
7047                encoder,
7048                offset + cur_offset,
7049                depth,
7050            )?;
7051
7052            _prev_end_offset = cur_offset + envelope_size;
7053            if 3 > max_ordinal {
7054                return Ok(());
7055            }
7056
7057            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
7058            // are envelope_size bytes.
7059            let cur_offset: usize = (3 - 1) * envelope_size;
7060
7061            // Zero reserved fields.
7062            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7063
7064            // Safety:
7065            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
7066            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
7067            //   envelope_size bytes, there is always sufficient room.
7068            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<256>, D>(
7069                self.product_name.as_ref().map(
7070                    <fidl::encoding::BoundedString<256> as fidl::encoding::ValueTypeMarker>::borrow,
7071                ),
7072                encoder,
7073                offset + cur_offset,
7074                depth,
7075            )?;
7076
7077            _prev_end_offset = cur_offset + envelope_size;
7078            if 4 > max_ordinal {
7079                return Ok(());
7080            }
7081
7082            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
7083            // are envelope_size bytes.
7084            let cur_offset: usize = (4 - 1) * envelope_size;
7085
7086            // Zero reserved fields.
7087            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7088
7089            // Safety:
7090            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
7091            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
7092            //   envelope_size bytes, there is always sufficient room.
7093            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Array<u8, 16>, D>(
7094                self.unique_id.as_ref().map(
7095                    <fidl::encoding::Array<u8, 16> as fidl::encoding::ValueTypeMarker>::borrow,
7096                ),
7097                encoder,
7098                offset + cur_offset,
7099                depth,
7100            )?;
7101
7102            _prev_end_offset = cur_offset + envelope_size;
7103            if 5 > max_ordinal {
7104                return Ok(());
7105            }
7106
7107            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
7108            // are envelope_size bytes.
7109            let cur_offset: usize = (5 - 1) * envelope_size;
7110
7111            // Zero reserved fields.
7112            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7113
7114            // Safety:
7115            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
7116            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
7117            //   envelope_size bytes, there is always sufficient room.
7118            fidl::encoding::encode_in_envelope_optional::<u32, D>(
7119                self.clock_domain.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
7120                encoder,
7121                offset + cur_offset,
7122                depth,
7123            )?;
7124
7125            _prev_end_offset = cur_offset + envelope_size;
7126
7127            Ok(())
7128        }
7129    }
7130
7131    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for DaiProperties {
7132        #[inline(always)]
7133        fn new_empty() -> Self {
7134            Self::default()
7135        }
7136
7137        unsafe fn decode(
7138            &mut self,
7139            decoder: &mut fidl::encoding::Decoder<'_, D>,
7140            offset: usize,
7141            mut depth: fidl::encoding::Depth,
7142        ) -> fidl::Result<()> {
7143            decoder.debug_check_bounds::<Self>(offset);
7144            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
7145                None => return Err(fidl::Error::NotNullable),
7146                Some(len) => len,
7147            };
7148            // Calling decoder.out_of_line_offset(0) is not allowed.
7149            if len == 0 {
7150                return Ok(());
7151            };
7152            depth.increment()?;
7153            let envelope_size = 8;
7154            let bytes_len = len * envelope_size;
7155            let offset = decoder.out_of_line_offset(bytes_len)?;
7156            // Decode the envelope for each type.
7157            let mut _next_ordinal_to_read = 0;
7158            let mut next_offset = offset;
7159            let end_offset = offset + bytes_len;
7160            _next_ordinal_to_read += 1;
7161            if next_offset >= end_offset {
7162                return Ok(());
7163            }
7164
7165            // Decode unknown envelopes for gaps in ordinals.
7166            while _next_ordinal_to_read < 1 {
7167                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7168                _next_ordinal_to_read += 1;
7169                next_offset += envelope_size;
7170            }
7171
7172            let next_out_of_line = decoder.next_out_of_line();
7173            let handles_before = decoder.remaining_handles();
7174            if let Some((inlined, num_bytes, num_handles)) =
7175                fidl::encoding::decode_envelope_header(decoder, next_offset)?
7176            {
7177                let member_inline_size =
7178                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
7179                if inlined != (member_inline_size <= 4) {
7180                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
7181                }
7182                let inner_offset;
7183                let mut inner_depth = depth.clone();
7184                if inlined {
7185                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7186                    inner_offset = next_offset;
7187                } else {
7188                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7189                    inner_depth.increment()?;
7190                }
7191                let val_ref = self.is_input.get_or_insert_with(|| fidl::new_empty!(bool, D));
7192                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
7193                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7194                {
7195                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
7196                }
7197                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7198                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7199                }
7200            }
7201
7202            next_offset += envelope_size;
7203            _next_ordinal_to_read += 1;
7204            if next_offset >= end_offset {
7205                return Ok(());
7206            }
7207
7208            // Decode unknown envelopes for gaps in ordinals.
7209            while _next_ordinal_to_read < 2 {
7210                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7211                _next_ordinal_to_read += 1;
7212                next_offset += envelope_size;
7213            }
7214
7215            let next_out_of_line = decoder.next_out_of_line();
7216            let handles_before = decoder.remaining_handles();
7217            if let Some((inlined, num_bytes, num_handles)) =
7218                fidl::encoding::decode_envelope_header(decoder, next_offset)?
7219            {
7220                let member_inline_size =
7221                    <fidl::encoding::BoundedString<256> as fidl::encoding::TypeMarker>::inline_size(
7222                        decoder.context,
7223                    );
7224                if inlined != (member_inline_size <= 4) {
7225                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
7226                }
7227                let inner_offset;
7228                let mut inner_depth = depth.clone();
7229                if inlined {
7230                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7231                    inner_offset = next_offset;
7232                } else {
7233                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7234                    inner_depth.increment()?;
7235                }
7236                let val_ref = self
7237                    .manufacturer
7238                    .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::BoundedString<256>, D));
7239                fidl::decode!(
7240                    fidl::encoding::BoundedString<256>,
7241                    D,
7242                    val_ref,
7243                    decoder,
7244                    inner_offset,
7245                    inner_depth
7246                )?;
7247                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7248                {
7249                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
7250                }
7251                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7252                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7253                }
7254            }
7255
7256            next_offset += envelope_size;
7257            _next_ordinal_to_read += 1;
7258            if next_offset >= end_offset {
7259                return Ok(());
7260            }
7261
7262            // Decode unknown envelopes for gaps in ordinals.
7263            while _next_ordinal_to_read < 3 {
7264                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7265                _next_ordinal_to_read += 1;
7266                next_offset += envelope_size;
7267            }
7268
7269            let next_out_of_line = decoder.next_out_of_line();
7270            let handles_before = decoder.remaining_handles();
7271            if let Some((inlined, num_bytes, num_handles)) =
7272                fidl::encoding::decode_envelope_header(decoder, next_offset)?
7273            {
7274                let member_inline_size =
7275                    <fidl::encoding::BoundedString<256> as fidl::encoding::TypeMarker>::inline_size(
7276                        decoder.context,
7277                    );
7278                if inlined != (member_inline_size <= 4) {
7279                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
7280                }
7281                let inner_offset;
7282                let mut inner_depth = depth.clone();
7283                if inlined {
7284                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7285                    inner_offset = next_offset;
7286                } else {
7287                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7288                    inner_depth.increment()?;
7289                }
7290                let val_ref = self
7291                    .product_name
7292                    .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::BoundedString<256>, D));
7293                fidl::decode!(
7294                    fidl::encoding::BoundedString<256>,
7295                    D,
7296                    val_ref,
7297                    decoder,
7298                    inner_offset,
7299                    inner_depth
7300                )?;
7301                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7302                {
7303                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
7304                }
7305                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7306                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7307                }
7308            }
7309
7310            next_offset += envelope_size;
7311            _next_ordinal_to_read += 1;
7312            if next_offset >= end_offset {
7313                return Ok(());
7314            }
7315
7316            // Decode unknown envelopes for gaps in ordinals.
7317            while _next_ordinal_to_read < 4 {
7318                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7319                _next_ordinal_to_read += 1;
7320                next_offset += envelope_size;
7321            }
7322
7323            let next_out_of_line = decoder.next_out_of_line();
7324            let handles_before = decoder.remaining_handles();
7325            if let Some((inlined, num_bytes, num_handles)) =
7326                fidl::encoding::decode_envelope_header(decoder, next_offset)?
7327            {
7328                let member_inline_size =
7329                    <fidl::encoding::Array<u8, 16> as fidl::encoding::TypeMarker>::inline_size(
7330                        decoder.context,
7331                    );
7332                if inlined != (member_inline_size <= 4) {
7333                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
7334                }
7335                let inner_offset;
7336                let mut inner_depth = depth.clone();
7337                if inlined {
7338                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7339                    inner_offset = next_offset;
7340                } else {
7341                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7342                    inner_depth.increment()?;
7343                }
7344                let val_ref = self
7345                    .unique_id
7346                    .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Array<u8, 16>, D));
7347                fidl::decode!(fidl::encoding::Array<u8, 16>, D, val_ref, decoder, inner_offset, inner_depth)?;
7348                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7349                {
7350                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
7351                }
7352                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7353                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7354                }
7355            }
7356
7357            next_offset += envelope_size;
7358            _next_ordinal_to_read += 1;
7359            if next_offset >= end_offset {
7360                return Ok(());
7361            }
7362
7363            // Decode unknown envelopes for gaps in ordinals.
7364            while _next_ordinal_to_read < 5 {
7365                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7366                _next_ordinal_to_read += 1;
7367                next_offset += envelope_size;
7368            }
7369
7370            let next_out_of_line = decoder.next_out_of_line();
7371            let handles_before = decoder.remaining_handles();
7372            if let Some((inlined, num_bytes, num_handles)) =
7373                fidl::encoding::decode_envelope_header(decoder, next_offset)?
7374            {
7375                let member_inline_size =
7376                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
7377                if inlined != (member_inline_size <= 4) {
7378                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
7379                }
7380                let inner_offset;
7381                let mut inner_depth = depth.clone();
7382                if inlined {
7383                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7384                    inner_offset = next_offset;
7385                } else {
7386                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7387                    inner_depth.increment()?;
7388                }
7389                let val_ref = self.clock_domain.get_or_insert_with(|| fidl::new_empty!(u32, D));
7390                fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
7391                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7392                {
7393                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
7394                }
7395                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7396                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7397                }
7398            }
7399
7400            next_offset += envelope_size;
7401
7402            // Decode the remaining unknown envelopes.
7403            while next_offset < end_offset {
7404                _next_ordinal_to_read += 1;
7405                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7406                next_offset += envelope_size;
7407            }
7408
7409            Ok(())
7410        }
7411    }
7412
7413    impl DelayInfo {
7414        #[inline(always)]
7415        fn max_ordinal_present(&self) -> u64 {
7416            if let Some(_) = self.external_delay {
7417                return 2;
7418            }
7419            if let Some(_) = self.internal_delay {
7420                return 1;
7421            }
7422            0
7423        }
7424    }
7425
7426    impl fidl::encoding::ValueTypeMarker for DelayInfo {
7427        type Borrowed<'a> = &'a Self;
7428        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
7429            value
7430        }
7431    }
7432
7433    unsafe impl fidl::encoding::TypeMarker for DelayInfo {
7434        type Owned = Self;
7435
7436        #[inline(always)]
7437        fn inline_align(_context: fidl::encoding::Context) -> usize {
7438            8
7439        }
7440
7441        #[inline(always)]
7442        fn inline_size(_context: fidl::encoding::Context) -> usize {
7443            16
7444        }
7445    }
7446
7447    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<DelayInfo, D>
7448        for &DelayInfo
7449    {
7450        unsafe fn encode(
7451            self,
7452            encoder: &mut fidl::encoding::Encoder<'_, D>,
7453            offset: usize,
7454            mut depth: fidl::encoding::Depth,
7455        ) -> fidl::Result<()> {
7456            encoder.debug_check_bounds::<DelayInfo>(offset);
7457            // Vector header
7458            let max_ordinal: u64 = self.max_ordinal_present();
7459            encoder.write_num(max_ordinal, offset);
7460            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
7461            // Calling encoder.out_of_line_offset(0) is not allowed.
7462            if max_ordinal == 0 {
7463                return Ok(());
7464            }
7465            depth.increment()?;
7466            let envelope_size = 8;
7467            let bytes_len = max_ordinal as usize * envelope_size;
7468            #[allow(unused_variables)]
7469            let offset = encoder.out_of_line_offset(bytes_len);
7470            let mut _prev_end_offset: usize = 0;
7471            if 1 > max_ordinal {
7472                return Ok(());
7473            }
7474
7475            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
7476            // are envelope_size bytes.
7477            let cur_offset: usize = (1 - 1) * envelope_size;
7478
7479            // Zero reserved fields.
7480            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7481
7482            // Safety:
7483            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
7484            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
7485            //   envelope_size bytes, there is always sufficient room.
7486            fidl::encoding::encode_in_envelope_optional::<i64, D>(
7487                self.internal_delay.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
7488                encoder,
7489                offset + cur_offset,
7490                depth,
7491            )?;
7492
7493            _prev_end_offset = cur_offset + envelope_size;
7494            if 2 > max_ordinal {
7495                return Ok(());
7496            }
7497
7498            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
7499            // are envelope_size bytes.
7500            let cur_offset: usize = (2 - 1) * envelope_size;
7501
7502            // Zero reserved fields.
7503            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7504
7505            // Safety:
7506            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
7507            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
7508            //   envelope_size bytes, there is always sufficient room.
7509            fidl::encoding::encode_in_envelope_optional::<i64, D>(
7510                self.external_delay.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
7511                encoder,
7512                offset + cur_offset,
7513                depth,
7514            )?;
7515
7516            _prev_end_offset = cur_offset + envelope_size;
7517
7518            Ok(())
7519        }
7520    }
7521
7522    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for DelayInfo {
7523        #[inline(always)]
7524        fn new_empty() -> Self {
7525            Self::default()
7526        }
7527
7528        unsafe fn decode(
7529            &mut self,
7530            decoder: &mut fidl::encoding::Decoder<'_, D>,
7531            offset: usize,
7532            mut depth: fidl::encoding::Depth,
7533        ) -> fidl::Result<()> {
7534            decoder.debug_check_bounds::<Self>(offset);
7535            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
7536                None => return Err(fidl::Error::NotNullable),
7537                Some(len) => len,
7538            };
7539            // Calling decoder.out_of_line_offset(0) is not allowed.
7540            if len == 0 {
7541                return Ok(());
7542            };
7543            depth.increment()?;
7544            let envelope_size = 8;
7545            let bytes_len = len * envelope_size;
7546            let offset = decoder.out_of_line_offset(bytes_len)?;
7547            // Decode the envelope for each type.
7548            let mut _next_ordinal_to_read = 0;
7549            let mut next_offset = offset;
7550            let end_offset = offset + bytes_len;
7551            _next_ordinal_to_read += 1;
7552            if next_offset >= end_offset {
7553                return Ok(());
7554            }
7555
7556            // Decode unknown envelopes for gaps in ordinals.
7557            while _next_ordinal_to_read < 1 {
7558                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7559                _next_ordinal_to_read += 1;
7560                next_offset += envelope_size;
7561            }
7562
7563            let next_out_of_line = decoder.next_out_of_line();
7564            let handles_before = decoder.remaining_handles();
7565            if let Some((inlined, num_bytes, num_handles)) =
7566                fidl::encoding::decode_envelope_header(decoder, next_offset)?
7567            {
7568                let member_inline_size =
7569                    <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
7570                if inlined != (member_inline_size <= 4) {
7571                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
7572                }
7573                let inner_offset;
7574                let mut inner_depth = depth.clone();
7575                if inlined {
7576                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7577                    inner_offset = next_offset;
7578                } else {
7579                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7580                    inner_depth.increment()?;
7581                }
7582                let val_ref = self.internal_delay.get_or_insert_with(|| fidl::new_empty!(i64, D));
7583                fidl::decode!(i64, D, val_ref, decoder, inner_offset, inner_depth)?;
7584                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7585                {
7586                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
7587                }
7588                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7589                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7590                }
7591            }
7592
7593            next_offset += envelope_size;
7594            _next_ordinal_to_read += 1;
7595            if next_offset >= end_offset {
7596                return Ok(());
7597            }
7598
7599            // Decode unknown envelopes for gaps in ordinals.
7600            while _next_ordinal_to_read < 2 {
7601                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7602                _next_ordinal_to_read += 1;
7603                next_offset += envelope_size;
7604            }
7605
7606            let next_out_of_line = decoder.next_out_of_line();
7607            let handles_before = decoder.remaining_handles();
7608            if let Some((inlined, num_bytes, num_handles)) =
7609                fidl::encoding::decode_envelope_header(decoder, next_offset)?
7610            {
7611                let member_inline_size =
7612                    <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
7613                if inlined != (member_inline_size <= 4) {
7614                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
7615                }
7616                let inner_offset;
7617                let mut inner_depth = depth.clone();
7618                if inlined {
7619                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7620                    inner_offset = next_offset;
7621                } else {
7622                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7623                    inner_depth.increment()?;
7624                }
7625                let val_ref = self.external_delay.get_or_insert_with(|| fidl::new_empty!(i64, D));
7626                fidl::decode!(i64, D, val_ref, decoder, inner_offset, inner_depth)?;
7627                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7628                {
7629                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
7630                }
7631                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7632                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7633                }
7634            }
7635
7636            next_offset += envelope_size;
7637
7638            // Decode the remaining unknown envelopes.
7639            while next_offset < end_offset {
7640                _next_ordinal_to_read += 1;
7641                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7642                next_offset += envelope_size;
7643            }
7644
7645            Ok(())
7646        }
7647    }
7648
7649    impl Format {
7650        #[inline(always)]
7651        fn max_ordinal_present(&self) -> u64 {
7652            if let Some(_) = self.pcm_format {
7653                return 1;
7654            }
7655            0
7656        }
7657    }
7658
7659    impl fidl::encoding::ValueTypeMarker for Format {
7660        type Borrowed<'a> = &'a Self;
7661        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
7662            value
7663        }
7664    }
7665
7666    unsafe impl fidl::encoding::TypeMarker for Format {
7667        type Owned = Self;
7668
7669        #[inline(always)]
7670        fn inline_align(_context: fidl::encoding::Context) -> usize {
7671            8
7672        }
7673
7674        #[inline(always)]
7675        fn inline_size(_context: fidl::encoding::Context) -> usize {
7676            16
7677        }
7678    }
7679
7680    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Format, D> for &Format {
7681        unsafe fn encode(
7682            self,
7683            encoder: &mut fidl::encoding::Encoder<'_, D>,
7684            offset: usize,
7685            mut depth: fidl::encoding::Depth,
7686        ) -> fidl::Result<()> {
7687            encoder.debug_check_bounds::<Format>(offset);
7688            // Vector header
7689            let max_ordinal: u64 = self.max_ordinal_present();
7690            encoder.write_num(max_ordinal, offset);
7691            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
7692            // Calling encoder.out_of_line_offset(0) is not allowed.
7693            if max_ordinal == 0 {
7694                return Ok(());
7695            }
7696            depth.increment()?;
7697            let envelope_size = 8;
7698            let bytes_len = max_ordinal as usize * envelope_size;
7699            #[allow(unused_variables)]
7700            let offset = encoder.out_of_line_offset(bytes_len);
7701            let mut _prev_end_offset: usize = 0;
7702            if 1 > max_ordinal {
7703                return Ok(());
7704            }
7705
7706            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
7707            // are envelope_size bytes.
7708            let cur_offset: usize = (1 - 1) * envelope_size;
7709
7710            // Zero reserved fields.
7711            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7712
7713            // Safety:
7714            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
7715            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
7716            //   envelope_size bytes, there is always sufficient room.
7717            fidl::encoding::encode_in_envelope_optional::<PcmFormat, D>(
7718                self.pcm_format
7719                    .as_ref()
7720                    .map(<PcmFormat as fidl::encoding::ValueTypeMarker>::borrow),
7721                encoder,
7722                offset + cur_offset,
7723                depth,
7724            )?;
7725
7726            _prev_end_offset = cur_offset + envelope_size;
7727
7728            Ok(())
7729        }
7730    }
7731
7732    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Format {
7733        #[inline(always)]
7734        fn new_empty() -> Self {
7735            Self::default()
7736        }
7737
7738        unsafe fn decode(
7739            &mut self,
7740            decoder: &mut fidl::encoding::Decoder<'_, D>,
7741            offset: usize,
7742            mut depth: fidl::encoding::Depth,
7743        ) -> fidl::Result<()> {
7744            decoder.debug_check_bounds::<Self>(offset);
7745            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
7746                None => return Err(fidl::Error::NotNullable),
7747                Some(len) => len,
7748            };
7749            // Calling decoder.out_of_line_offset(0) is not allowed.
7750            if len == 0 {
7751                return Ok(());
7752            };
7753            depth.increment()?;
7754            let envelope_size = 8;
7755            let bytes_len = len * envelope_size;
7756            let offset = decoder.out_of_line_offset(bytes_len)?;
7757            // Decode the envelope for each type.
7758            let mut _next_ordinal_to_read = 0;
7759            let mut next_offset = offset;
7760            let end_offset = offset + bytes_len;
7761            _next_ordinal_to_read += 1;
7762            if next_offset >= end_offset {
7763                return Ok(());
7764            }
7765
7766            // Decode unknown envelopes for gaps in ordinals.
7767            while _next_ordinal_to_read < 1 {
7768                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7769                _next_ordinal_to_read += 1;
7770                next_offset += envelope_size;
7771            }
7772
7773            let next_out_of_line = decoder.next_out_of_line();
7774            let handles_before = decoder.remaining_handles();
7775            if let Some((inlined, num_bytes, num_handles)) =
7776                fidl::encoding::decode_envelope_header(decoder, next_offset)?
7777            {
7778                let member_inline_size =
7779                    <PcmFormat as fidl::encoding::TypeMarker>::inline_size(decoder.context);
7780                if inlined != (member_inline_size <= 4) {
7781                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
7782                }
7783                let inner_offset;
7784                let mut inner_depth = depth.clone();
7785                if inlined {
7786                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7787                    inner_offset = next_offset;
7788                } else {
7789                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7790                    inner_depth.increment()?;
7791                }
7792                let val_ref = self.pcm_format.get_or_insert_with(|| fidl::new_empty!(PcmFormat, D));
7793                fidl::decode!(PcmFormat, D, val_ref, decoder, inner_offset, inner_depth)?;
7794                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7795                {
7796                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
7797                }
7798                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7799                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7800                }
7801            }
7802
7803            next_offset += envelope_size;
7804
7805            // Decode the remaining unknown envelopes.
7806            while next_offset < end_offset {
7807                _next_ordinal_to_read += 1;
7808                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7809                next_offset += envelope_size;
7810            }
7811
7812            Ok(())
7813        }
7814    }
7815
7816    impl GainState {
7817        #[inline(always)]
7818        fn max_ordinal_present(&self) -> u64 {
7819            if let Some(_) = self.gain_db {
7820                return 3;
7821            }
7822            if let Some(_) = self.agc_enabled {
7823                return 2;
7824            }
7825            if let Some(_) = self.muted {
7826                return 1;
7827            }
7828            0
7829        }
7830    }
7831
7832    impl fidl::encoding::ValueTypeMarker for GainState {
7833        type Borrowed<'a> = &'a Self;
7834        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
7835            value
7836        }
7837    }
7838
7839    unsafe impl fidl::encoding::TypeMarker for GainState {
7840        type Owned = Self;
7841
7842        #[inline(always)]
7843        fn inline_align(_context: fidl::encoding::Context) -> usize {
7844            8
7845        }
7846
7847        #[inline(always)]
7848        fn inline_size(_context: fidl::encoding::Context) -> usize {
7849            16
7850        }
7851    }
7852
7853    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<GainState, D>
7854        for &GainState
7855    {
7856        unsafe fn encode(
7857            self,
7858            encoder: &mut fidl::encoding::Encoder<'_, D>,
7859            offset: usize,
7860            mut depth: fidl::encoding::Depth,
7861        ) -> fidl::Result<()> {
7862            encoder.debug_check_bounds::<GainState>(offset);
7863            // Vector header
7864            let max_ordinal: u64 = self.max_ordinal_present();
7865            encoder.write_num(max_ordinal, offset);
7866            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
7867            // Calling encoder.out_of_line_offset(0) is not allowed.
7868            if max_ordinal == 0 {
7869                return Ok(());
7870            }
7871            depth.increment()?;
7872            let envelope_size = 8;
7873            let bytes_len = max_ordinal as usize * envelope_size;
7874            #[allow(unused_variables)]
7875            let offset = encoder.out_of_line_offset(bytes_len);
7876            let mut _prev_end_offset: usize = 0;
7877            if 1 > max_ordinal {
7878                return Ok(());
7879            }
7880
7881            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
7882            // are envelope_size bytes.
7883            let cur_offset: usize = (1 - 1) * envelope_size;
7884
7885            // Zero reserved fields.
7886            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7887
7888            // Safety:
7889            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
7890            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
7891            //   envelope_size bytes, there is always sufficient room.
7892            fidl::encoding::encode_in_envelope_optional::<bool, D>(
7893                self.muted.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
7894                encoder,
7895                offset + cur_offset,
7896                depth,
7897            )?;
7898
7899            _prev_end_offset = cur_offset + envelope_size;
7900            if 2 > max_ordinal {
7901                return Ok(());
7902            }
7903
7904            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
7905            // are envelope_size bytes.
7906            let cur_offset: usize = (2 - 1) * envelope_size;
7907
7908            // Zero reserved fields.
7909            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7910
7911            // Safety:
7912            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
7913            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
7914            //   envelope_size bytes, there is always sufficient room.
7915            fidl::encoding::encode_in_envelope_optional::<bool, D>(
7916                self.agc_enabled.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
7917                encoder,
7918                offset + cur_offset,
7919                depth,
7920            )?;
7921
7922            _prev_end_offset = cur_offset + envelope_size;
7923            if 3 > max_ordinal {
7924                return Ok(());
7925            }
7926
7927            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
7928            // are envelope_size bytes.
7929            let cur_offset: usize = (3 - 1) * envelope_size;
7930
7931            // Zero reserved fields.
7932            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7933
7934            // Safety:
7935            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
7936            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
7937            //   envelope_size bytes, there is always sufficient room.
7938            fidl::encoding::encode_in_envelope_optional::<f32, D>(
7939                self.gain_db.as_ref().map(<f32 as fidl::encoding::ValueTypeMarker>::borrow),
7940                encoder,
7941                offset + cur_offset,
7942                depth,
7943            )?;
7944
7945            _prev_end_offset = cur_offset + envelope_size;
7946
7947            Ok(())
7948        }
7949    }
7950
7951    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for GainState {
7952        #[inline(always)]
7953        fn new_empty() -> Self {
7954            Self::default()
7955        }
7956
7957        unsafe fn decode(
7958            &mut self,
7959            decoder: &mut fidl::encoding::Decoder<'_, D>,
7960            offset: usize,
7961            mut depth: fidl::encoding::Depth,
7962        ) -> fidl::Result<()> {
7963            decoder.debug_check_bounds::<Self>(offset);
7964            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
7965                None => return Err(fidl::Error::NotNullable),
7966                Some(len) => len,
7967            };
7968            // Calling decoder.out_of_line_offset(0) is not allowed.
7969            if len == 0 {
7970                return Ok(());
7971            };
7972            depth.increment()?;
7973            let envelope_size = 8;
7974            let bytes_len = len * envelope_size;
7975            let offset = decoder.out_of_line_offset(bytes_len)?;
7976            // Decode the envelope for each type.
7977            let mut _next_ordinal_to_read = 0;
7978            let mut next_offset = offset;
7979            let end_offset = offset + bytes_len;
7980            _next_ordinal_to_read += 1;
7981            if next_offset >= end_offset {
7982                return Ok(());
7983            }
7984
7985            // Decode unknown envelopes for gaps in ordinals.
7986            while _next_ordinal_to_read < 1 {
7987                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7988                _next_ordinal_to_read += 1;
7989                next_offset += envelope_size;
7990            }
7991
7992            let next_out_of_line = decoder.next_out_of_line();
7993            let handles_before = decoder.remaining_handles();
7994            if let Some((inlined, num_bytes, num_handles)) =
7995                fidl::encoding::decode_envelope_header(decoder, next_offset)?
7996            {
7997                let member_inline_size =
7998                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
7999                if inlined != (member_inline_size <= 4) {
8000                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
8001                }
8002                let inner_offset;
8003                let mut inner_depth = depth.clone();
8004                if inlined {
8005                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8006                    inner_offset = next_offset;
8007                } else {
8008                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8009                    inner_depth.increment()?;
8010                }
8011                let val_ref = self.muted.get_or_insert_with(|| fidl::new_empty!(bool, D));
8012                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
8013                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8014                {
8015                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
8016                }
8017                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8018                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8019                }
8020            }
8021
8022            next_offset += envelope_size;
8023            _next_ordinal_to_read += 1;
8024            if next_offset >= end_offset {
8025                return Ok(());
8026            }
8027
8028            // Decode unknown envelopes for gaps in ordinals.
8029            while _next_ordinal_to_read < 2 {
8030                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8031                _next_ordinal_to_read += 1;
8032                next_offset += envelope_size;
8033            }
8034
8035            let next_out_of_line = decoder.next_out_of_line();
8036            let handles_before = decoder.remaining_handles();
8037            if let Some((inlined, num_bytes, num_handles)) =
8038                fidl::encoding::decode_envelope_header(decoder, next_offset)?
8039            {
8040                let member_inline_size =
8041                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
8042                if inlined != (member_inline_size <= 4) {
8043                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
8044                }
8045                let inner_offset;
8046                let mut inner_depth = depth.clone();
8047                if inlined {
8048                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8049                    inner_offset = next_offset;
8050                } else {
8051                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8052                    inner_depth.increment()?;
8053                }
8054                let val_ref = self.agc_enabled.get_or_insert_with(|| fidl::new_empty!(bool, D));
8055                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
8056                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8057                {
8058                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
8059                }
8060                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8061                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8062                }
8063            }
8064
8065            next_offset += envelope_size;
8066            _next_ordinal_to_read += 1;
8067            if next_offset >= end_offset {
8068                return Ok(());
8069            }
8070
8071            // Decode unknown envelopes for gaps in ordinals.
8072            while _next_ordinal_to_read < 3 {
8073                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8074                _next_ordinal_to_read += 1;
8075                next_offset += envelope_size;
8076            }
8077
8078            let next_out_of_line = decoder.next_out_of_line();
8079            let handles_before = decoder.remaining_handles();
8080            if let Some((inlined, num_bytes, num_handles)) =
8081                fidl::encoding::decode_envelope_header(decoder, next_offset)?
8082            {
8083                let member_inline_size =
8084                    <f32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
8085                if inlined != (member_inline_size <= 4) {
8086                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
8087                }
8088                let inner_offset;
8089                let mut inner_depth = depth.clone();
8090                if inlined {
8091                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8092                    inner_offset = next_offset;
8093                } else {
8094                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8095                    inner_depth.increment()?;
8096                }
8097                let val_ref = self.gain_db.get_or_insert_with(|| fidl::new_empty!(f32, D));
8098                fidl::decode!(f32, D, val_ref, decoder, inner_offset, inner_depth)?;
8099                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8100                {
8101                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
8102                }
8103                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8104                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8105                }
8106            }
8107
8108            next_offset += envelope_size;
8109
8110            // Decode the remaining unknown envelopes.
8111            while next_offset < end_offset {
8112                _next_ordinal_to_read += 1;
8113                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8114                next_offset += envelope_size;
8115            }
8116
8117            Ok(())
8118        }
8119    }
8120
8121    impl HealthState {
8122        #[inline(always)]
8123        fn max_ordinal_present(&self) -> u64 {
8124            if let Some(_) = self.healthy {
8125                return 1;
8126            }
8127            0
8128        }
8129    }
8130
8131    impl fidl::encoding::ValueTypeMarker for HealthState {
8132        type Borrowed<'a> = &'a Self;
8133        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
8134            value
8135        }
8136    }
8137
8138    unsafe impl fidl::encoding::TypeMarker for HealthState {
8139        type Owned = Self;
8140
8141        #[inline(always)]
8142        fn inline_align(_context: fidl::encoding::Context) -> usize {
8143            8
8144        }
8145
8146        #[inline(always)]
8147        fn inline_size(_context: fidl::encoding::Context) -> usize {
8148            16
8149        }
8150    }
8151
8152    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<HealthState, D>
8153        for &HealthState
8154    {
8155        unsafe fn encode(
8156            self,
8157            encoder: &mut fidl::encoding::Encoder<'_, D>,
8158            offset: usize,
8159            mut depth: fidl::encoding::Depth,
8160        ) -> fidl::Result<()> {
8161            encoder.debug_check_bounds::<HealthState>(offset);
8162            // Vector header
8163            let max_ordinal: u64 = self.max_ordinal_present();
8164            encoder.write_num(max_ordinal, offset);
8165            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
8166            // Calling encoder.out_of_line_offset(0) is not allowed.
8167            if max_ordinal == 0 {
8168                return Ok(());
8169            }
8170            depth.increment()?;
8171            let envelope_size = 8;
8172            let bytes_len = max_ordinal as usize * envelope_size;
8173            #[allow(unused_variables)]
8174            let offset = encoder.out_of_line_offset(bytes_len);
8175            let mut _prev_end_offset: usize = 0;
8176            if 1 > max_ordinal {
8177                return Ok(());
8178            }
8179
8180            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
8181            // are envelope_size bytes.
8182            let cur_offset: usize = (1 - 1) * envelope_size;
8183
8184            // Zero reserved fields.
8185            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
8186
8187            // Safety:
8188            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
8189            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
8190            //   envelope_size bytes, there is always sufficient room.
8191            fidl::encoding::encode_in_envelope_optional::<bool, D>(
8192                self.healthy.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
8193                encoder,
8194                offset + cur_offset,
8195                depth,
8196            )?;
8197
8198            _prev_end_offset = cur_offset + envelope_size;
8199
8200            Ok(())
8201        }
8202    }
8203
8204    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for HealthState {
8205        #[inline(always)]
8206        fn new_empty() -> Self {
8207            Self::default()
8208        }
8209
8210        unsafe fn decode(
8211            &mut self,
8212            decoder: &mut fidl::encoding::Decoder<'_, D>,
8213            offset: usize,
8214            mut depth: fidl::encoding::Depth,
8215        ) -> fidl::Result<()> {
8216            decoder.debug_check_bounds::<Self>(offset);
8217            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
8218                None => return Err(fidl::Error::NotNullable),
8219                Some(len) => len,
8220            };
8221            // Calling decoder.out_of_line_offset(0) is not allowed.
8222            if len == 0 {
8223                return Ok(());
8224            };
8225            depth.increment()?;
8226            let envelope_size = 8;
8227            let bytes_len = len * envelope_size;
8228            let offset = decoder.out_of_line_offset(bytes_len)?;
8229            // Decode the envelope for each type.
8230            let mut _next_ordinal_to_read = 0;
8231            let mut next_offset = offset;
8232            let end_offset = offset + bytes_len;
8233            _next_ordinal_to_read += 1;
8234            if next_offset >= end_offset {
8235                return Ok(());
8236            }
8237
8238            // Decode unknown envelopes for gaps in ordinals.
8239            while _next_ordinal_to_read < 1 {
8240                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8241                _next_ordinal_to_read += 1;
8242                next_offset += envelope_size;
8243            }
8244
8245            let next_out_of_line = decoder.next_out_of_line();
8246            let handles_before = decoder.remaining_handles();
8247            if let Some((inlined, num_bytes, num_handles)) =
8248                fidl::encoding::decode_envelope_header(decoder, next_offset)?
8249            {
8250                let member_inline_size =
8251                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
8252                if inlined != (member_inline_size <= 4) {
8253                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
8254                }
8255                let inner_offset;
8256                let mut inner_depth = depth.clone();
8257                if inlined {
8258                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8259                    inner_offset = next_offset;
8260                } else {
8261                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8262                    inner_depth.increment()?;
8263                }
8264                let val_ref = self.healthy.get_or_insert_with(|| fidl::new_empty!(bool, D));
8265                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
8266                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8267                {
8268                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
8269                }
8270                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8271                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8272                }
8273            }
8274
8275            next_offset += envelope_size;
8276
8277            // Decode the remaining unknown envelopes.
8278            while next_offset < end_offset {
8279                _next_ordinal_to_read += 1;
8280                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8281                next_offset += envelope_size;
8282            }
8283
8284            Ok(())
8285        }
8286    }
8287
8288    impl PcmSupportedFormats {
8289        #[inline(always)]
8290        fn max_ordinal_present(&self) -> u64 {
8291            if let Some(_) = self.frame_rates {
8292                return 5;
8293            }
8294            if let Some(_) = self.valid_bits_per_sample {
8295                return 4;
8296            }
8297            if let Some(_) = self.bytes_per_sample {
8298                return 3;
8299            }
8300            if let Some(_) = self.sample_formats {
8301                return 2;
8302            }
8303            if let Some(_) = self.channel_sets {
8304                return 1;
8305            }
8306            0
8307        }
8308    }
8309
8310    impl fidl::encoding::ValueTypeMarker for PcmSupportedFormats {
8311        type Borrowed<'a> = &'a Self;
8312        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
8313            value
8314        }
8315    }
8316
8317    unsafe impl fidl::encoding::TypeMarker for PcmSupportedFormats {
8318        type Owned = Self;
8319
8320        #[inline(always)]
8321        fn inline_align(_context: fidl::encoding::Context) -> usize {
8322            8
8323        }
8324
8325        #[inline(always)]
8326        fn inline_size(_context: fidl::encoding::Context) -> usize {
8327            16
8328        }
8329    }
8330
8331    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<PcmSupportedFormats, D>
8332        for &PcmSupportedFormats
8333    {
8334        unsafe fn encode(
8335            self,
8336            encoder: &mut fidl::encoding::Encoder<'_, D>,
8337            offset: usize,
8338            mut depth: fidl::encoding::Depth,
8339        ) -> fidl::Result<()> {
8340            encoder.debug_check_bounds::<PcmSupportedFormats>(offset);
8341            // Vector header
8342            let max_ordinal: u64 = self.max_ordinal_present();
8343            encoder.write_num(max_ordinal, offset);
8344            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
8345            // Calling encoder.out_of_line_offset(0) is not allowed.
8346            if max_ordinal == 0 {
8347                return Ok(());
8348            }
8349            depth.increment()?;
8350            let envelope_size = 8;
8351            let bytes_len = max_ordinal as usize * envelope_size;
8352            #[allow(unused_variables)]
8353            let offset = encoder.out_of_line_offset(bytes_len);
8354            let mut _prev_end_offset: usize = 0;
8355            if 1 > max_ordinal {
8356                return Ok(());
8357            }
8358
8359            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
8360            // are envelope_size bytes.
8361            let cur_offset: usize = (1 - 1) * envelope_size;
8362
8363            // Zero reserved fields.
8364            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
8365
8366            // Safety:
8367            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
8368            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
8369            //   envelope_size bytes, there is always sufficient room.
8370            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<ChannelSet, 64>, D>(
8371            self.channel_sets.as_ref().map(<fidl::encoding::Vector<ChannelSet, 64> as fidl::encoding::ValueTypeMarker>::borrow),
8372            encoder, offset + cur_offset, depth
8373        )?;
8374
8375            _prev_end_offset = cur_offset + envelope_size;
8376            if 2 > max_ordinal {
8377                return Ok(());
8378            }
8379
8380            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
8381            // are envelope_size bytes.
8382            let cur_offset: usize = (2 - 1) * envelope_size;
8383
8384            // Zero reserved fields.
8385            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
8386
8387            // Safety:
8388            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
8389            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
8390            //   envelope_size bytes, there is always sufficient room.
8391            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<SampleFormat, 3>, D>(
8392            self.sample_formats.as_ref().map(<fidl::encoding::Vector<SampleFormat, 3> as fidl::encoding::ValueTypeMarker>::borrow),
8393            encoder, offset + cur_offset, depth
8394        )?;
8395
8396            _prev_end_offset = cur_offset + envelope_size;
8397            if 3 > max_ordinal {
8398                return Ok(());
8399            }
8400
8401            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
8402            // are envelope_size bytes.
8403            let cur_offset: usize = (3 - 1) * envelope_size;
8404
8405            // Zero reserved fields.
8406            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
8407
8408            // Safety:
8409            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
8410            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
8411            //   envelope_size bytes, there is always sufficient room.
8412            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<u8, 8>, D>(
8413                self.bytes_per_sample.as_ref().map(
8414                    <fidl::encoding::Vector<u8, 8> as fidl::encoding::ValueTypeMarker>::borrow,
8415                ),
8416                encoder,
8417                offset + cur_offset,
8418                depth,
8419            )?;
8420
8421            _prev_end_offset = cur_offset + envelope_size;
8422            if 4 > max_ordinal {
8423                return Ok(());
8424            }
8425
8426            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
8427            // are envelope_size bytes.
8428            let cur_offset: usize = (4 - 1) * envelope_size;
8429
8430            // Zero reserved fields.
8431            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
8432
8433            // Safety:
8434            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
8435            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
8436            //   envelope_size bytes, there is always sufficient room.
8437            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<u8, 8>, D>(
8438                self.valid_bits_per_sample.as_ref().map(
8439                    <fidl::encoding::Vector<u8, 8> as fidl::encoding::ValueTypeMarker>::borrow,
8440                ),
8441                encoder,
8442                offset + cur_offset,
8443                depth,
8444            )?;
8445
8446            _prev_end_offset = cur_offset + envelope_size;
8447            if 5 > max_ordinal {
8448                return Ok(());
8449            }
8450
8451            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
8452            // are envelope_size bytes.
8453            let cur_offset: usize = (5 - 1) * envelope_size;
8454
8455            // Zero reserved fields.
8456            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
8457
8458            // Safety:
8459            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
8460            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
8461            //   envelope_size bytes, there is always sufficient room.
8462            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<u32, 64>, D>(
8463                self.frame_rates.as_ref().map(
8464                    <fidl::encoding::Vector<u32, 64> as fidl::encoding::ValueTypeMarker>::borrow,
8465                ),
8466                encoder,
8467                offset + cur_offset,
8468                depth,
8469            )?;
8470
8471            _prev_end_offset = cur_offset + envelope_size;
8472
8473            Ok(())
8474        }
8475    }
8476
8477    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for PcmSupportedFormats {
8478        #[inline(always)]
8479        fn new_empty() -> Self {
8480            Self::default()
8481        }
8482
8483        unsafe fn decode(
8484            &mut self,
8485            decoder: &mut fidl::encoding::Decoder<'_, D>,
8486            offset: usize,
8487            mut depth: fidl::encoding::Depth,
8488        ) -> fidl::Result<()> {
8489            decoder.debug_check_bounds::<Self>(offset);
8490            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
8491                None => return Err(fidl::Error::NotNullable),
8492                Some(len) => len,
8493            };
8494            // Calling decoder.out_of_line_offset(0) is not allowed.
8495            if len == 0 {
8496                return Ok(());
8497            };
8498            depth.increment()?;
8499            let envelope_size = 8;
8500            let bytes_len = len * envelope_size;
8501            let offset = decoder.out_of_line_offset(bytes_len)?;
8502            // Decode the envelope for each type.
8503            let mut _next_ordinal_to_read = 0;
8504            let mut next_offset = offset;
8505            let end_offset = offset + bytes_len;
8506            _next_ordinal_to_read += 1;
8507            if next_offset >= end_offset {
8508                return Ok(());
8509            }
8510
8511            // Decode unknown envelopes for gaps in ordinals.
8512            while _next_ordinal_to_read < 1 {
8513                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8514                _next_ordinal_to_read += 1;
8515                next_offset += envelope_size;
8516            }
8517
8518            let next_out_of_line = decoder.next_out_of_line();
8519            let handles_before = decoder.remaining_handles();
8520            if let Some((inlined, num_bytes, num_handles)) =
8521                fidl::encoding::decode_envelope_header(decoder, next_offset)?
8522            {
8523                let member_inline_size = <fidl::encoding::Vector<ChannelSet, 64> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
8524                if inlined != (member_inline_size <= 4) {
8525                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
8526                }
8527                let inner_offset;
8528                let mut inner_depth = depth.clone();
8529                if inlined {
8530                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8531                    inner_offset = next_offset;
8532                } else {
8533                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8534                    inner_depth.increment()?;
8535                }
8536                let val_ref = self.channel_sets.get_or_insert_with(
8537                    || fidl::new_empty!(fidl::encoding::Vector<ChannelSet, 64>, D),
8538                );
8539                fidl::decode!(fidl::encoding::Vector<ChannelSet, 64>, D, val_ref, decoder, inner_offset, inner_depth)?;
8540                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8541                {
8542                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
8543                }
8544                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8545                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8546                }
8547            }
8548
8549            next_offset += envelope_size;
8550            _next_ordinal_to_read += 1;
8551            if next_offset >= end_offset {
8552                return Ok(());
8553            }
8554
8555            // Decode unknown envelopes for gaps in ordinals.
8556            while _next_ordinal_to_read < 2 {
8557                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8558                _next_ordinal_to_read += 1;
8559                next_offset += envelope_size;
8560            }
8561
8562            let next_out_of_line = decoder.next_out_of_line();
8563            let handles_before = decoder.remaining_handles();
8564            if let Some((inlined, num_bytes, num_handles)) =
8565                fidl::encoding::decode_envelope_header(decoder, next_offset)?
8566            {
8567                let member_inline_size = <fidl::encoding::Vector<SampleFormat, 3> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
8568                if inlined != (member_inline_size <= 4) {
8569                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
8570                }
8571                let inner_offset;
8572                let mut inner_depth = depth.clone();
8573                if inlined {
8574                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8575                    inner_offset = next_offset;
8576                } else {
8577                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8578                    inner_depth.increment()?;
8579                }
8580                let val_ref = self.sample_formats.get_or_insert_with(
8581                    || fidl::new_empty!(fidl::encoding::Vector<SampleFormat, 3>, D),
8582                );
8583                fidl::decode!(fidl::encoding::Vector<SampleFormat, 3>, D, val_ref, decoder, inner_offset, inner_depth)?;
8584                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8585                {
8586                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
8587                }
8588                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8589                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8590                }
8591            }
8592
8593            next_offset += envelope_size;
8594            _next_ordinal_to_read += 1;
8595            if next_offset >= end_offset {
8596                return Ok(());
8597            }
8598
8599            // Decode unknown envelopes for gaps in ordinals.
8600            while _next_ordinal_to_read < 3 {
8601                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8602                _next_ordinal_to_read += 1;
8603                next_offset += envelope_size;
8604            }
8605
8606            let next_out_of_line = decoder.next_out_of_line();
8607            let handles_before = decoder.remaining_handles();
8608            if let Some((inlined, num_bytes, num_handles)) =
8609                fidl::encoding::decode_envelope_header(decoder, next_offset)?
8610            {
8611                let member_inline_size =
8612                    <fidl::encoding::Vector<u8, 8> as fidl::encoding::TypeMarker>::inline_size(
8613                        decoder.context,
8614                    );
8615                if inlined != (member_inline_size <= 4) {
8616                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
8617                }
8618                let inner_offset;
8619                let mut inner_depth = depth.clone();
8620                if inlined {
8621                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8622                    inner_offset = next_offset;
8623                } else {
8624                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8625                    inner_depth.increment()?;
8626                }
8627                let val_ref = self
8628                    .bytes_per_sample
8629                    .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<u8, 8>, D));
8630                fidl::decode!(fidl::encoding::Vector<u8, 8>, D, val_ref, decoder, inner_offset, inner_depth)?;
8631                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8632                {
8633                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
8634                }
8635                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8636                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8637                }
8638            }
8639
8640            next_offset += envelope_size;
8641            _next_ordinal_to_read += 1;
8642            if next_offset >= end_offset {
8643                return Ok(());
8644            }
8645
8646            // Decode unknown envelopes for gaps in ordinals.
8647            while _next_ordinal_to_read < 4 {
8648                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8649                _next_ordinal_to_read += 1;
8650                next_offset += envelope_size;
8651            }
8652
8653            let next_out_of_line = decoder.next_out_of_line();
8654            let handles_before = decoder.remaining_handles();
8655            if let Some((inlined, num_bytes, num_handles)) =
8656                fidl::encoding::decode_envelope_header(decoder, next_offset)?
8657            {
8658                let member_inline_size =
8659                    <fidl::encoding::Vector<u8, 8> as fidl::encoding::TypeMarker>::inline_size(
8660                        decoder.context,
8661                    );
8662                if inlined != (member_inline_size <= 4) {
8663                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
8664                }
8665                let inner_offset;
8666                let mut inner_depth = depth.clone();
8667                if inlined {
8668                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8669                    inner_offset = next_offset;
8670                } else {
8671                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8672                    inner_depth.increment()?;
8673                }
8674                let val_ref = self
8675                    .valid_bits_per_sample
8676                    .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<u8, 8>, D));
8677                fidl::decode!(fidl::encoding::Vector<u8, 8>, D, val_ref, decoder, inner_offset, inner_depth)?;
8678                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8679                {
8680                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
8681                }
8682                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8683                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8684                }
8685            }
8686
8687            next_offset += envelope_size;
8688            _next_ordinal_to_read += 1;
8689            if next_offset >= end_offset {
8690                return Ok(());
8691            }
8692
8693            // Decode unknown envelopes for gaps in ordinals.
8694            while _next_ordinal_to_read < 5 {
8695                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8696                _next_ordinal_to_read += 1;
8697                next_offset += envelope_size;
8698            }
8699
8700            let next_out_of_line = decoder.next_out_of_line();
8701            let handles_before = decoder.remaining_handles();
8702            if let Some((inlined, num_bytes, num_handles)) =
8703                fidl::encoding::decode_envelope_header(decoder, next_offset)?
8704            {
8705                let member_inline_size =
8706                    <fidl::encoding::Vector<u32, 64> as fidl::encoding::TypeMarker>::inline_size(
8707                        decoder.context,
8708                    );
8709                if inlined != (member_inline_size <= 4) {
8710                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
8711                }
8712                let inner_offset;
8713                let mut inner_depth = depth.clone();
8714                if inlined {
8715                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8716                    inner_offset = next_offset;
8717                } else {
8718                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8719                    inner_depth.increment()?;
8720                }
8721                let val_ref = self
8722                    .frame_rates
8723                    .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<u32, 64>, D));
8724                fidl::decode!(fidl::encoding::Vector<u32, 64>, D, val_ref, decoder, inner_offset, inner_depth)?;
8725                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8726                {
8727                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
8728                }
8729                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8730                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8731                }
8732            }
8733
8734            next_offset += envelope_size;
8735
8736            // Decode the remaining unknown envelopes.
8737            while next_offset < end_offset {
8738                _next_ordinal_to_read += 1;
8739                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8740                next_offset += envelope_size;
8741            }
8742
8743            Ok(())
8744        }
8745    }
8746
8747    impl PlugState {
8748        #[inline(always)]
8749        fn max_ordinal_present(&self) -> u64 {
8750            if let Some(_) = self.plug_state_time {
8751                return 2;
8752            }
8753            if let Some(_) = self.plugged {
8754                return 1;
8755            }
8756            0
8757        }
8758    }
8759
8760    impl fidl::encoding::ValueTypeMarker for PlugState {
8761        type Borrowed<'a> = &'a Self;
8762        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
8763            value
8764        }
8765    }
8766
8767    unsafe impl fidl::encoding::TypeMarker for PlugState {
8768        type Owned = Self;
8769
8770        #[inline(always)]
8771        fn inline_align(_context: fidl::encoding::Context) -> usize {
8772            8
8773        }
8774
8775        #[inline(always)]
8776        fn inline_size(_context: fidl::encoding::Context) -> usize {
8777            16
8778        }
8779    }
8780
8781    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<PlugState, D>
8782        for &PlugState
8783    {
8784        unsafe fn encode(
8785            self,
8786            encoder: &mut fidl::encoding::Encoder<'_, D>,
8787            offset: usize,
8788            mut depth: fidl::encoding::Depth,
8789        ) -> fidl::Result<()> {
8790            encoder.debug_check_bounds::<PlugState>(offset);
8791            // Vector header
8792            let max_ordinal: u64 = self.max_ordinal_present();
8793            encoder.write_num(max_ordinal, offset);
8794            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
8795            // Calling encoder.out_of_line_offset(0) is not allowed.
8796            if max_ordinal == 0 {
8797                return Ok(());
8798            }
8799            depth.increment()?;
8800            let envelope_size = 8;
8801            let bytes_len = max_ordinal as usize * envelope_size;
8802            #[allow(unused_variables)]
8803            let offset = encoder.out_of_line_offset(bytes_len);
8804            let mut _prev_end_offset: usize = 0;
8805            if 1 > max_ordinal {
8806                return Ok(());
8807            }
8808
8809            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
8810            // are envelope_size bytes.
8811            let cur_offset: usize = (1 - 1) * envelope_size;
8812
8813            // Zero reserved fields.
8814            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
8815
8816            // Safety:
8817            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
8818            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
8819            //   envelope_size bytes, there is always sufficient room.
8820            fidl::encoding::encode_in_envelope_optional::<bool, D>(
8821                self.plugged.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
8822                encoder,
8823                offset + cur_offset,
8824                depth,
8825            )?;
8826
8827            _prev_end_offset = cur_offset + envelope_size;
8828            if 2 > max_ordinal {
8829                return Ok(());
8830            }
8831
8832            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
8833            // are envelope_size bytes.
8834            let cur_offset: usize = (2 - 1) * envelope_size;
8835
8836            // Zero reserved fields.
8837            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
8838
8839            // Safety:
8840            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
8841            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
8842            //   envelope_size bytes, there is always sufficient room.
8843            fidl::encoding::encode_in_envelope_optional::<i64, D>(
8844                self.plug_state_time.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
8845                encoder,
8846                offset + cur_offset,
8847                depth,
8848            )?;
8849
8850            _prev_end_offset = cur_offset + envelope_size;
8851
8852            Ok(())
8853        }
8854    }
8855
8856    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for PlugState {
8857        #[inline(always)]
8858        fn new_empty() -> Self {
8859            Self::default()
8860        }
8861
8862        unsafe fn decode(
8863            &mut self,
8864            decoder: &mut fidl::encoding::Decoder<'_, D>,
8865            offset: usize,
8866            mut depth: fidl::encoding::Depth,
8867        ) -> fidl::Result<()> {
8868            decoder.debug_check_bounds::<Self>(offset);
8869            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
8870                None => return Err(fidl::Error::NotNullable),
8871                Some(len) => len,
8872            };
8873            // Calling decoder.out_of_line_offset(0) is not allowed.
8874            if len == 0 {
8875                return Ok(());
8876            };
8877            depth.increment()?;
8878            let envelope_size = 8;
8879            let bytes_len = len * envelope_size;
8880            let offset = decoder.out_of_line_offset(bytes_len)?;
8881            // Decode the envelope for each type.
8882            let mut _next_ordinal_to_read = 0;
8883            let mut next_offset = offset;
8884            let end_offset = offset + bytes_len;
8885            _next_ordinal_to_read += 1;
8886            if next_offset >= end_offset {
8887                return Ok(());
8888            }
8889
8890            // Decode unknown envelopes for gaps in ordinals.
8891            while _next_ordinal_to_read < 1 {
8892                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8893                _next_ordinal_to_read += 1;
8894                next_offset += envelope_size;
8895            }
8896
8897            let next_out_of_line = decoder.next_out_of_line();
8898            let handles_before = decoder.remaining_handles();
8899            if let Some((inlined, num_bytes, num_handles)) =
8900                fidl::encoding::decode_envelope_header(decoder, next_offset)?
8901            {
8902                let member_inline_size =
8903                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
8904                if inlined != (member_inline_size <= 4) {
8905                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
8906                }
8907                let inner_offset;
8908                let mut inner_depth = depth.clone();
8909                if inlined {
8910                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8911                    inner_offset = next_offset;
8912                } else {
8913                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8914                    inner_depth.increment()?;
8915                }
8916                let val_ref = self.plugged.get_or_insert_with(|| fidl::new_empty!(bool, D));
8917                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
8918                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8919                {
8920                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
8921                }
8922                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8923                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8924                }
8925            }
8926
8927            next_offset += envelope_size;
8928            _next_ordinal_to_read += 1;
8929            if next_offset >= end_offset {
8930                return Ok(());
8931            }
8932
8933            // Decode unknown envelopes for gaps in ordinals.
8934            while _next_ordinal_to_read < 2 {
8935                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8936                _next_ordinal_to_read += 1;
8937                next_offset += envelope_size;
8938            }
8939
8940            let next_out_of_line = decoder.next_out_of_line();
8941            let handles_before = decoder.remaining_handles();
8942            if let Some((inlined, num_bytes, num_handles)) =
8943                fidl::encoding::decode_envelope_header(decoder, next_offset)?
8944            {
8945                let member_inline_size =
8946                    <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
8947                if inlined != (member_inline_size <= 4) {
8948                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
8949                }
8950                let inner_offset;
8951                let mut inner_depth = depth.clone();
8952                if inlined {
8953                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8954                    inner_offset = next_offset;
8955                } else {
8956                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8957                    inner_depth.increment()?;
8958                }
8959                let val_ref = self.plug_state_time.get_or_insert_with(|| fidl::new_empty!(i64, D));
8960                fidl::decode!(i64, D, val_ref, decoder, inner_offset, inner_depth)?;
8961                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8962                {
8963                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
8964                }
8965                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8966                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8967                }
8968            }
8969
8970            next_offset += envelope_size;
8971
8972            // Decode the remaining unknown envelopes.
8973            while next_offset < end_offset {
8974                _next_ordinal_to_read += 1;
8975                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8976                next_offset += envelope_size;
8977            }
8978
8979            Ok(())
8980        }
8981    }
8982
8983    impl RingBufferProperties {
8984        #[inline(always)]
8985        fn max_ordinal_present(&self) -> u64 {
8986            if let Some(_) = self.driver_transfer_bytes {
8987                return 5;
8988            }
8989            if let Some(_) = self.turn_on_delay {
8990                return 4;
8991            }
8992            if let Some(_) = self.needs_cache_flush_or_invalidate {
8993                return 3;
8994            }
8995            if let Some(_) = self.fifo_depth {
8996                return 2;
8997            }
8998            if let Some(_) = self.external_delay {
8999                return 1;
9000            }
9001            0
9002        }
9003    }
9004
9005    impl fidl::encoding::ValueTypeMarker for RingBufferProperties {
9006        type Borrowed<'a> = &'a Self;
9007        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
9008            value
9009        }
9010    }
9011
9012    unsafe impl fidl::encoding::TypeMarker for RingBufferProperties {
9013        type Owned = Self;
9014
9015        #[inline(always)]
9016        fn inline_align(_context: fidl::encoding::Context) -> usize {
9017            8
9018        }
9019
9020        #[inline(always)]
9021        fn inline_size(_context: fidl::encoding::Context) -> usize {
9022            16
9023        }
9024    }
9025
9026    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<RingBufferProperties, D>
9027        for &RingBufferProperties
9028    {
9029        unsafe fn encode(
9030            self,
9031            encoder: &mut fidl::encoding::Encoder<'_, D>,
9032            offset: usize,
9033            mut depth: fidl::encoding::Depth,
9034        ) -> fidl::Result<()> {
9035            encoder.debug_check_bounds::<RingBufferProperties>(offset);
9036            // Vector header
9037            let max_ordinal: u64 = self.max_ordinal_present();
9038            encoder.write_num(max_ordinal, offset);
9039            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
9040            // Calling encoder.out_of_line_offset(0) is not allowed.
9041            if max_ordinal == 0 {
9042                return Ok(());
9043            }
9044            depth.increment()?;
9045            let envelope_size = 8;
9046            let bytes_len = max_ordinal as usize * envelope_size;
9047            #[allow(unused_variables)]
9048            let offset = encoder.out_of_line_offset(bytes_len);
9049            let mut _prev_end_offset: usize = 0;
9050            if 1 > max_ordinal {
9051                return Ok(());
9052            }
9053
9054            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
9055            // are envelope_size bytes.
9056            let cur_offset: usize = (1 - 1) * envelope_size;
9057
9058            // Zero reserved fields.
9059            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
9060
9061            // Safety:
9062            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
9063            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
9064            //   envelope_size bytes, there is always sufficient room.
9065            fidl::encoding::encode_in_envelope_optional::<i64, D>(
9066                self.external_delay.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
9067                encoder,
9068                offset + cur_offset,
9069                depth,
9070            )?;
9071
9072            _prev_end_offset = cur_offset + envelope_size;
9073            if 2 > max_ordinal {
9074                return Ok(());
9075            }
9076
9077            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
9078            // are envelope_size bytes.
9079            let cur_offset: usize = (2 - 1) * envelope_size;
9080
9081            // Zero reserved fields.
9082            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
9083
9084            // Safety:
9085            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
9086            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
9087            //   envelope_size bytes, there is always sufficient room.
9088            fidl::encoding::encode_in_envelope_optional::<u32, D>(
9089                self.fifo_depth.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
9090                encoder,
9091                offset + cur_offset,
9092                depth,
9093            )?;
9094
9095            _prev_end_offset = cur_offset + envelope_size;
9096            if 3 > max_ordinal {
9097                return Ok(());
9098            }
9099
9100            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
9101            // are envelope_size bytes.
9102            let cur_offset: usize = (3 - 1) * envelope_size;
9103
9104            // Zero reserved fields.
9105            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
9106
9107            // Safety:
9108            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
9109            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
9110            //   envelope_size bytes, there is always sufficient room.
9111            fidl::encoding::encode_in_envelope_optional::<bool, D>(
9112                self.needs_cache_flush_or_invalidate
9113                    .as_ref()
9114                    .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
9115                encoder,
9116                offset + cur_offset,
9117                depth,
9118            )?;
9119
9120            _prev_end_offset = cur_offset + envelope_size;
9121            if 4 > max_ordinal {
9122                return Ok(());
9123            }
9124
9125            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
9126            // are envelope_size bytes.
9127            let cur_offset: usize = (4 - 1) * envelope_size;
9128
9129            // Zero reserved fields.
9130            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
9131
9132            // Safety:
9133            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
9134            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
9135            //   envelope_size bytes, there is always sufficient room.
9136            fidl::encoding::encode_in_envelope_optional::<i64, D>(
9137                self.turn_on_delay.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
9138                encoder,
9139                offset + cur_offset,
9140                depth,
9141            )?;
9142
9143            _prev_end_offset = cur_offset + envelope_size;
9144            if 5 > max_ordinal {
9145                return Ok(());
9146            }
9147
9148            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
9149            // are envelope_size bytes.
9150            let cur_offset: usize = (5 - 1) * envelope_size;
9151
9152            // Zero reserved fields.
9153            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
9154
9155            // Safety:
9156            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
9157            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
9158            //   envelope_size bytes, there is always sufficient room.
9159            fidl::encoding::encode_in_envelope_optional::<u32, D>(
9160                self.driver_transfer_bytes
9161                    .as_ref()
9162                    .map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
9163                encoder,
9164                offset + cur_offset,
9165                depth,
9166            )?;
9167
9168            _prev_end_offset = cur_offset + envelope_size;
9169
9170            Ok(())
9171        }
9172    }
9173
9174    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for RingBufferProperties {
9175        #[inline(always)]
9176        fn new_empty() -> Self {
9177            Self::default()
9178        }
9179
9180        unsafe fn decode(
9181            &mut self,
9182            decoder: &mut fidl::encoding::Decoder<'_, D>,
9183            offset: usize,
9184            mut depth: fidl::encoding::Depth,
9185        ) -> fidl::Result<()> {
9186            decoder.debug_check_bounds::<Self>(offset);
9187            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
9188                None => return Err(fidl::Error::NotNullable),
9189                Some(len) => len,
9190            };
9191            // Calling decoder.out_of_line_offset(0) is not allowed.
9192            if len == 0 {
9193                return Ok(());
9194            };
9195            depth.increment()?;
9196            let envelope_size = 8;
9197            let bytes_len = len * envelope_size;
9198            let offset = decoder.out_of_line_offset(bytes_len)?;
9199            // Decode the envelope for each type.
9200            let mut _next_ordinal_to_read = 0;
9201            let mut next_offset = offset;
9202            let end_offset = offset + bytes_len;
9203            _next_ordinal_to_read += 1;
9204            if next_offset >= end_offset {
9205                return Ok(());
9206            }
9207
9208            // Decode unknown envelopes for gaps in ordinals.
9209            while _next_ordinal_to_read < 1 {
9210                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
9211                _next_ordinal_to_read += 1;
9212                next_offset += envelope_size;
9213            }
9214
9215            let next_out_of_line = decoder.next_out_of_line();
9216            let handles_before = decoder.remaining_handles();
9217            if let Some((inlined, num_bytes, num_handles)) =
9218                fidl::encoding::decode_envelope_header(decoder, next_offset)?
9219            {
9220                let member_inline_size =
9221                    <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
9222                if inlined != (member_inline_size <= 4) {
9223                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
9224                }
9225                let inner_offset;
9226                let mut inner_depth = depth.clone();
9227                if inlined {
9228                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
9229                    inner_offset = next_offset;
9230                } else {
9231                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
9232                    inner_depth.increment()?;
9233                }
9234                let val_ref = self.external_delay.get_or_insert_with(|| fidl::new_empty!(i64, D));
9235                fidl::decode!(i64, D, val_ref, decoder, inner_offset, inner_depth)?;
9236                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
9237                {
9238                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
9239                }
9240                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
9241                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
9242                }
9243            }
9244
9245            next_offset += envelope_size;
9246            _next_ordinal_to_read += 1;
9247            if next_offset >= end_offset {
9248                return Ok(());
9249            }
9250
9251            // Decode unknown envelopes for gaps in ordinals.
9252            while _next_ordinal_to_read < 2 {
9253                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
9254                _next_ordinal_to_read += 1;
9255                next_offset += envelope_size;
9256            }
9257
9258            let next_out_of_line = decoder.next_out_of_line();
9259            let handles_before = decoder.remaining_handles();
9260            if let Some((inlined, num_bytes, num_handles)) =
9261                fidl::encoding::decode_envelope_header(decoder, next_offset)?
9262            {
9263                let member_inline_size =
9264                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
9265                if inlined != (member_inline_size <= 4) {
9266                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
9267                }
9268                let inner_offset;
9269                let mut inner_depth = depth.clone();
9270                if inlined {
9271                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
9272                    inner_offset = next_offset;
9273                } else {
9274                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
9275                    inner_depth.increment()?;
9276                }
9277                let val_ref = self.fifo_depth.get_or_insert_with(|| fidl::new_empty!(u32, D));
9278                fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
9279                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
9280                {
9281                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
9282                }
9283                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
9284                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
9285                }
9286            }
9287
9288            next_offset += envelope_size;
9289            _next_ordinal_to_read += 1;
9290            if next_offset >= end_offset {
9291                return Ok(());
9292            }
9293
9294            // Decode unknown envelopes for gaps in ordinals.
9295            while _next_ordinal_to_read < 3 {
9296                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
9297                _next_ordinal_to_read += 1;
9298                next_offset += envelope_size;
9299            }
9300
9301            let next_out_of_line = decoder.next_out_of_line();
9302            let handles_before = decoder.remaining_handles();
9303            if let Some((inlined, num_bytes, num_handles)) =
9304                fidl::encoding::decode_envelope_header(decoder, next_offset)?
9305            {
9306                let member_inline_size =
9307                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
9308                if inlined != (member_inline_size <= 4) {
9309                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
9310                }
9311                let inner_offset;
9312                let mut inner_depth = depth.clone();
9313                if inlined {
9314                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
9315                    inner_offset = next_offset;
9316                } else {
9317                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
9318                    inner_depth.increment()?;
9319                }
9320                let val_ref = self
9321                    .needs_cache_flush_or_invalidate
9322                    .get_or_insert_with(|| fidl::new_empty!(bool, D));
9323                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
9324                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
9325                {
9326                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
9327                }
9328                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
9329                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
9330                }
9331            }
9332
9333            next_offset += envelope_size;
9334            _next_ordinal_to_read += 1;
9335            if next_offset >= end_offset {
9336                return Ok(());
9337            }
9338
9339            // Decode unknown envelopes for gaps in ordinals.
9340            while _next_ordinal_to_read < 4 {
9341                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
9342                _next_ordinal_to_read += 1;
9343                next_offset += envelope_size;
9344            }
9345
9346            let next_out_of_line = decoder.next_out_of_line();
9347            let handles_before = decoder.remaining_handles();
9348            if let Some((inlined, num_bytes, num_handles)) =
9349                fidl::encoding::decode_envelope_header(decoder, next_offset)?
9350            {
9351                let member_inline_size =
9352                    <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
9353                if inlined != (member_inline_size <= 4) {
9354                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
9355                }
9356                let inner_offset;
9357                let mut inner_depth = depth.clone();
9358                if inlined {
9359                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
9360                    inner_offset = next_offset;
9361                } else {
9362                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
9363                    inner_depth.increment()?;
9364                }
9365                let val_ref = self.turn_on_delay.get_or_insert_with(|| fidl::new_empty!(i64, D));
9366                fidl::decode!(i64, D, val_ref, decoder, inner_offset, inner_depth)?;
9367                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
9368                {
9369                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
9370                }
9371                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
9372                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
9373                }
9374            }
9375
9376            next_offset += envelope_size;
9377            _next_ordinal_to_read += 1;
9378            if next_offset >= end_offset {
9379                return Ok(());
9380            }
9381
9382            // Decode unknown envelopes for gaps in ordinals.
9383            while _next_ordinal_to_read < 5 {
9384                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
9385                _next_ordinal_to_read += 1;
9386                next_offset += envelope_size;
9387            }
9388
9389            let next_out_of_line = decoder.next_out_of_line();
9390            let handles_before = decoder.remaining_handles();
9391            if let Some((inlined, num_bytes, num_handles)) =
9392                fidl::encoding::decode_envelope_header(decoder, next_offset)?
9393            {
9394                let member_inline_size =
9395                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
9396                if inlined != (member_inline_size <= 4) {
9397                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
9398                }
9399                let inner_offset;
9400                let mut inner_depth = depth.clone();
9401                if inlined {
9402                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
9403                    inner_offset = next_offset;
9404                } else {
9405                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
9406                    inner_depth.increment()?;
9407                }
9408                let val_ref =
9409                    self.driver_transfer_bytes.get_or_insert_with(|| fidl::new_empty!(u32, D));
9410                fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
9411                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
9412                {
9413                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
9414                }
9415                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
9416                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
9417                }
9418            }
9419
9420            next_offset += envelope_size;
9421
9422            // Decode the remaining unknown envelopes.
9423            while next_offset < end_offset {
9424                _next_ordinal_to_read += 1;
9425                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
9426                next_offset += envelope_size;
9427            }
9428
9429            Ok(())
9430        }
9431    }
9432
9433    impl StreamProperties {
9434        #[inline(always)]
9435        fn max_ordinal_present(&self) -> u64 {
9436            if let Some(_) = self.clock_domain {
9437                return 11;
9438            }
9439            if let Some(_) = self.product {
9440                return 10;
9441            }
9442            if let Some(_) = self.manufacturer {
9443                return 9;
9444            }
9445            if let Some(_) = self.plug_detect_capabilities {
9446                return 8;
9447            }
9448            if let Some(_) = self.gain_step_db {
9449                return 7;
9450            }
9451            if let Some(_) = self.max_gain_db {
9452                return 6;
9453            }
9454            if let Some(_) = self.min_gain_db {
9455                return 5;
9456            }
9457            if let Some(_) = self.can_agc {
9458                return 4;
9459            }
9460            if let Some(_) = self.can_mute {
9461                return 3;
9462            }
9463            if let Some(_) = self.is_input {
9464                return 2;
9465            }
9466            if let Some(_) = self.unique_id {
9467                return 1;
9468            }
9469            0
9470        }
9471    }
9472
9473    impl fidl::encoding::ValueTypeMarker for StreamProperties {
9474        type Borrowed<'a> = &'a Self;
9475        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
9476            value
9477        }
9478    }
9479
9480    unsafe impl fidl::encoding::TypeMarker for StreamProperties {
9481        type Owned = Self;
9482
9483        #[inline(always)]
9484        fn inline_align(_context: fidl::encoding::Context) -> usize {
9485            8
9486        }
9487
9488        #[inline(always)]
9489        fn inline_size(_context: fidl::encoding::Context) -> usize {
9490            16
9491        }
9492    }
9493
9494    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<StreamProperties, D>
9495        for &StreamProperties
9496    {
9497        unsafe fn encode(
9498            self,
9499            encoder: &mut fidl::encoding::Encoder<'_, D>,
9500            offset: usize,
9501            mut depth: fidl::encoding::Depth,
9502        ) -> fidl::Result<()> {
9503            encoder.debug_check_bounds::<StreamProperties>(offset);
9504            // Vector header
9505            let max_ordinal: u64 = self.max_ordinal_present();
9506            encoder.write_num(max_ordinal, offset);
9507            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
9508            // Calling encoder.out_of_line_offset(0) is not allowed.
9509            if max_ordinal == 0 {
9510                return Ok(());
9511            }
9512            depth.increment()?;
9513            let envelope_size = 8;
9514            let bytes_len = max_ordinal as usize * envelope_size;
9515            #[allow(unused_variables)]
9516            let offset = encoder.out_of_line_offset(bytes_len);
9517            let mut _prev_end_offset: usize = 0;
9518            if 1 > max_ordinal {
9519                return Ok(());
9520            }
9521
9522            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
9523            // are envelope_size bytes.
9524            let cur_offset: usize = (1 - 1) * envelope_size;
9525
9526            // Zero reserved fields.
9527            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
9528
9529            // Safety:
9530            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
9531            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
9532            //   envelope_size bytes, there is always sufficient room.
9533            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Array<u8, 16>, D>(
9534                self.unique_id.as_ref().map(
9535                    <fidl::encoding::Array<u8, 16> as fidl::encoding::ValueTypeMarker>::borrow,
9536                ),
9537                encoder,
9538                offset + cur_offset,
9539                depth,
9540            )?;
9541
9542            _prev_end_offset = cur_offset + envelope_size;
9543            if 2 > max_ordinal {
9544                return Ok(());
9545            }
9546
9547            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
9548            // are envelope_size bytes.
9549            let cur_offset: usize = (2 - 1) * envelope_size;
9550
9551            // Zero reserved fields.
9552            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
9553
9554            // Safety:
9555            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
9556            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
9557            //   envelope_size bytes, there is always sufficient room.
9558            fidl::encoding::encode_in_envelope_optional::<bool, D>(
9559                self.is_input.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
9560                encoder,
9561                offset + cur_offset,
9562                depth,
9563            )?;
9564
9565            _prev_end_offset = cur_offset + envelope_size;
9566            if 3 > max_ordinal {
9567                return Ok(());
9568            }
9569
9570            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
9571            // are envelope_size bytes.
9572            let cur_offset: usize = (3 - 1) * envelope_size;
9573
9574            // Zero reserved fields.
9575            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
9576
9577            // Safety:
9578            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
9579            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
9580            //   envelope_size bytes, there is always sufficient room.
9581            fidl::encoding::encode_in_envelope_optional::<bool, D>(
9582                self.can_mute.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
9583                encoder,
9584                offset + cur_offset,
9585                depth,
9586            )?;
9587
9588            _prev_end_offset = cur_offset + envelope_size;
9589            if 4 > max_ordinal {
9590                return Ok(());
9591            }
9592
9593            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
9594            // are envelope_size bytes.
9595            let cur_offset: usize = (4 - 1) * envelope_size;
9596
9597            // Zero reserved fields.
9598            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
9599
9600            // Safety:
9601            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
9602            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
9603            //   envelope_size bytes, there is always sufficient room.
9604            fidl::encoding::encode_in_envelope_optional::<bool, D>(
9605                self.can_agc.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
9606                encoder,
9607                offset + cur_offset,
9608                depth,
9609            )?;
9610
9611            _prev_end_offset = cur_offset + envelope_size;
9612            if 5 > max_ordinal {
9613                return Ok(());
9614            }
9615
9616            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
9617            // are envelope_size bytes.
9618            let cur_offset: usize = (5 - 1) * envelope_size;
9619
9620            // Zero reserved fields.
9621            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
9622
9623            // Safety:
9624            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
9625            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
9626            //   envelope_size bytes, there is always sufficient room.
9627            fidl::encoding::encode_in_envelope_optional::<f32, D>(
9628                self.min_gain_db.as_ref().map(<f32 as fidl::encoding::ValueTypeMarker>::borrow),
9629                encoder,
9630                offset + cur_offset,
9631                depth,
9632            )?;
9633
9634            _prev_end_offset = cur_offset + envelope_size;
9635            if 6 > max_ordinal {
9636                return Ok(());
9637            }
9638
9639            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
9640            // are envelope_size bytes.
9641            let cur_offset: usize = (6 - 1) * envelope_size;
9642
9643            // Zero reserved fields.
9644            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
9645
9646            // Safety:
9647            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
9648            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
9649            //   envelope_size bytes, there is always sufficient room.
9650            fidl::encoding::encode_in_envelope_optional::<f32, D>(
9651                self.max_gain_db.as_ref().map(<f32 as fidl::encoding::ValueTypeMarker>::borrow),
9652                encoder,
9653                offset + cur_offset,
9654                depth,
9655            )?;
9656
9657            _prev_end_offset = cur_offset + envelope_size;
9658            if 7 > max_ordinal {
9659                return Ok(());
9660            }
9661
9662            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
9663            // are envelope_size bytes.
9664            let cur_offset: usize = (7 - 1) * envelope_size;
9665
9666            // Zero reserved fields.
9667            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
9668
9669            // Safety:
9670            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
9671            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
9672            //   envelope_size bytes, there is always sufficient room.
9673            fidl::encoding::encode_in_envelope_optional::<f32, D>(
9674                self.gain_step_db.as_ref().map(<f32 as fidl::encoding::ValueTypeMarker>::borrow),
9675                encoder,
9676                offset + cur_offset,
9677                depth,
9678            )?;
9679
9680            _prev_end_offset = cur_offset + envelope_size;
9681            if 8 > max_ordinal {
9682                return Ok(());
9683            }
9684
9685            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
9686            // are envelope_size bytes.
9687            let cur_offset: usize = (8 - 1) * envelope_size;
9688
9689            // Zero reserved fields.
9690            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
9691
9692            // Safety:
9693            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
9694            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
9695            //   envelope_size bytes, there is always sufficient room.
9696            fidl::encoding::encode_in_envelope_optional::<PlugDetectCapabilities, D>(
9697                self.plug_detect_capabilities
9698                    .as_ref()
9699                    .map(<PlugDetectCapabilities as fidl::encoding::ValueTypeMarker>::borrow),
9700                encoder,
9701                offset + cur_offset,
9702                depth,
9703            )?;
9704
9705            _prev_end_offset = cur_offset + envelope_size;
9706            if 9 > max_ordinal {
9707                return Ok(());
9708            }
9709
9710            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
9711            // are envelope_size bytes.
9712            let cur_offset: usize = (9 - 1) * envelope_size;
9713
9714            // Zero reserved fields.
9715            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
9716
9717            // Safety:
9718            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
9719            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
9720            //   envelope_size bytes, there is always sufficient room.
9721            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<256>, D>(
9722                self.manufacturer.as_ref().map(
9723                    <fidl::encoding::BoundedString<256> as fidl::encoding::ValueTypeMarker>::borrow,
9724                ),
9725                encoder,
9726                offset + cur_offset,
9727                depth,
9728            )?;
9729
9730            _prev_end_offset = cur_offset + envelope_size;
9731            if 10 > max_ordinal {
9732                return Ok(());
9733            }
9734
9735            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
9736            // are envelope_size bytes.
9737            let cur_offset: usize = (10 - 1) * envelope_size;
9738
9739            // Zero reserved fields.
9740            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
9741
9742            // Safety:
9743            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
9744            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
9745            //   envelope_size bytes, there is always sufficient room.
9746            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<256>, D>(
9747                self.product.as_ref().map(
9748                    <fidl::encoding::BoundedString<256> as fidl::encoding::ValueTypeMarker>::borrow,
9749                ),
9750                encoder,
9751                offset + cur_offset,
9752                depth,
9753            )?;
9754
9755            _prev_end_offset = cur_offset + envelope_size;
9756            if 11 > max_ordinal {
9757                return Ok(());
9758            }
9759
9760            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
9761            // are envelope_size bytes.
9762            let cur_offset: usize = (11 - 1) * envelope_size;
9763
9764            // Zero reserved fields.
9765            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
9766
9767            // Safety:
9768            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
9769            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
9770            //   envelope_size bytes, there is always sufficient room.
9771            fidl::encoding::encode_in_envelope_optional::<u32, D>(
9772                self.clock_domain.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
9773                encoder,
9774                offset + cur_offset,
9775                depth,
9776            )?;
9777
9778            _prev_end_offset = cur_offset + envelope_size;
9779
9780            Ok(())
9781        }
9782    }
9783
9784    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for StreamProperties {
9785        #[inline(always)]
9786        fn new_empty() -> Self {
9787            Self::default()
9788        }
9789
9790        unsafe fn decode(
9791            &mut self,
9792            decoder: &mut fidl::encoding::Decoder<'_, D>,
9793            offset: usize,
9794            mut depth: fidl::encoding::Depth,
9795        ) -> fidl::Result<()> {
9796            decoder.debug_check_bounds::<Self>(offset);
9797            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
9798                None => return Err(fidl::Error::NotNullable),
9799                Some(len) => len,
9800            };
9801            // Calling decoder.out_of_line_offset(0) is not allowed.
9802            if len == 0 {
9803                return Ok(());
9804            };
9805            depth.increment()?;
9806            let envelope_size = 8;
9807            let bytes_len = len * envelope_size;
9808            let offset = decoder.out_of_line_offset(bytes_len)?;
9809            // Decode the envelope for each type.
9810            let mut _next_ordinal_to_read = 0;
9811            let mut next_offset = offset;
9812            let end_offset = offset + bytes_len;
9813            _next_ordinal_to_read += 1;
9814            if next_offset >= end_offset {
9815                return Ok(());
9816            }
9817
9818            // Decode unknown envelopes for gaps in ordinals.
9819            while _next_ordinal_to_read < 1 {
9820                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
9821                _next_ordinal_to_read += 1;
9822                next_offset += envelope_size;
9823            }
9824
9825            let next_out_of_line = decoder.next_out_of_line();
9826            let handles_before = decoder.remaining_handles();
9827            if let Some((inlined, num_bytes, num_handles)) =
9828                fidl::encoding::decode_envelope_header(decoder, next_offset)?
9829            {
9830                let member_inline_size =
9831                    <fidl::encoding::Array<u8, 16> as fidl::encoding::TypeMarker>::inline_size(
9832                        decoder.context,
9833                    );
9834                if inlined != (member_inline_size <= 4) {
9835                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
9836                }
9837                let inner_offset;
9838                let mut inner_depth = depth.clone();
9839                if inlined {
9840                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
9841                    inner_offset = next_offset;
9842                } else {
9843                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
9844                    inner_depth.increment()?;
9845                }
9846                let val_ref = self
9847                    .unique_id
9848                    .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Array<u8, 16>, D));
9849                fidl::decode!(fidl::encoding::Array<u8, 16>, D, val_ref, decoder, inner_offset, inner_depth)?;
9850                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
9851                {
9852                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
9853                }
9854                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
9855                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
9856                }
9857            }
9858
9859            next_offset += envelope_size;
9860            _next_ordinal_to_read += 1;
9861            if next_offset >= end_offset {
9862                return Ok(());
9863            }
9864
9865            // Decode unknown envelopes for gaps in ordinals.
9866            while _next_ordinal_to_read < 2 {
9867                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
9868                _next_ordinal_to_read += 1;
9869                next_offset += envelope_size;
9870            }
9871
9872            let next_out_of_line = decoder.next_out_of_line();
9873            let handles_before = decoder.remaining_handles();
9874            if let Some((inlined, num_bytes, num_handles)) =
9875                fidl::encoding::decode_envelope_header(decoder, next_offset)?
9876            {
9877                let member_inline_size =
9878                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
9879                if inlined != (member_inline_size <= 4) {
9880                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
9881                }
9882                let inner_offset;
9883                let mut inner_depth = depth.clone();
9884                if inlined {
9885                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
9886                    inner_offset = next_offset;
9887                } else {
9888                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
9889                    inner_depth.increment()?;
9890                }
9891                let val_ref = self.is_input.get_or_insert_with(|| fidl::new_empty!(bool, D));
9892                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
9893                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
9894                {
9895                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
9896                }
9897                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
9898                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
9899                }
9900            }
9901
9902            next_offset += envelope_size;
9903            _next_ordinal_to_read += 1;
9904            if next_offset >= end_offset {
9905                return Ok(());
9906            }
9907
9908            // Decode unknown envelopes for gaps in ordinals.
9909            while _next_ordinal_to_read < 3 {
9910                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
9911                _next_ordinal_to_read += 1;
9912                next_offset += envelope_size;
9913            }
9914
9915            let next_out_of_line = decoder.next_out_of_line();
9916            let handles_before = decoder.remaining_handles();
9917            if let Some((inlined, num_bytes, num_handles)) =
9918                fidl::encoding::decode_envelope_header(decoder, next_offset)?
9919            {
9920                let member_inline_size =
9921                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
9922                if inlined != (member_inline_size <= 4) {
9923                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
9924                }
9925                let inner_offset;
9926                let mut inner_depth = depth.clone();
9927                if inlined {
9928                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
9929                    inner_offset = next_offset;
9930                } else {
9931                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
9932                    inner_depth.increment()?;
9933                }
9934                let val_ref = self.can_mute.get_or_insert_with(|| fidl::new_empty!(bool, D));
9935                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
9936                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
9937                {
9938                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
9939                }
9940                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
9941                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
9942                }
9943            }
9944
9945            next_offset += envelope_size;
9946            _next_ordinal_to_read += 1;
9947            if next_offset >= end_offset {
9948                return Ok(());
9949            }
9950
9951            // Decode unknown envelopes for gaps in ordinals.
9952            while _next_ordinal_to_read < 4 {
9953                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
9954                _next_ordinal_to_read += 1;
9955                next_offset += envelope_size;
9956            }
9957
9958            let next_out_of_line = decoder.next_out_of_line();
9959            let handles_before = decoder.remaining_handles();
9960            if let Some((inlined, num_bytes, num_handles)) =
9961                fidl::encoding::decode_envelope_header(decoder, next_offset)?
9962            {
9963                let member_inline_size =
9964                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
9965                if inlined != (member_inline_size <= 4) {
9966                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
9967                }
9968                let inner_offset;
9969                let mut inner_depth = depth.clone();
9970                if inlined {
9971                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
9972                    inner_offset = next_offset;
9973                } else {
9974                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
9975                    inner_depth.increment()?;
9976                }
9977                let val_ref = self.can_agc.get_or_insert_with(|| fidl::new_empty!(bool, D));
9978                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
9979                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
9980                {
9981                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
9982                }
9983                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
9984                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
9985                }
9986            }
9987
9988            next_offset += envelope_size;
9989            _next_ordinal_to_read += 1;
9990            if next_offset >= end_offset {
9991                return Ok(());
9992            }
9993
9994            // Decode unknown envelopes for gaps in ordinals.
9995            while _next_ordinal_to_read < 5 {
9996                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
9997                _next_ordinal_to_read += 1;
9998                next_offset += envelope_size;
9999            }
10000
10001            let next_out_of_line = decoder.next_out_of_line();
10002            let handles_before = decoder.remaining_handles();
10003            if let Some((inlined, num_bytes, num_handles)) =
10004                fidl::encoding::decode_envelope_header(decoder, next_offset)?
10005            {
10006                let member_inline_size =
10007                    <f32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
10008                if inlined != (member_inline_size <= 4) {
10009                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
10010                }
10011                let inner_offset;
10012                let mut inner_depth = depth.clone();
10013                if inlined {
10014                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
10015                    inner_offset = next_offset;
10016                } else {
10017                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
10018                    inner_depth.increment()?;
10019                }
10020                let val_ref = self.min_gain_db.get_or_insert_with(|| fidl::new_empty!(f32, D));
10021                fidl::decode!(f32, D, val_ref, decoder, inner_offset, inner_depth)?;
10022                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
10023                {
10024                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
10025                }
10026                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
10027                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
10028                }
10029            }
10030
10031            next_offset += envelope_size;
10032            _next_ordinal_to_read += 1;
10033            if next_offset >= end_offset {
10034                return Ok(());
10035            }
10036
10037            // Decode unknown envelopes for gaps in ordinals.
10038            while _next_ordinal_to_read < 6 {
10039                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10040                _next_ordinal_to_read += 1;
10041                next_offset += envelope_size;
10042            }
10043
10044            let next_out_of_line = decoder.next_out_of_line();
10045            let handles_before = decoder.remaining_handles();
10046            if let Some((inlined, num_bytes, num_handles)) =
10047                fidl::encoding::decode_envelope_header(decoder, next_offset)?
10048            {
10049                let member_inline_size =
10050                    <f32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
10051                if inlined != (member_inline_size <= 4) {
10052                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
10053                }
10054                let inner_offset;
10055                let mut inner_depth = depth.clone();
10056                if inlined {
10057                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
10058                    inner_offset = next_offset;
10059                } else {
10060                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
10061                    inner_depth.increment()?;
10062                }
10063                let val_ref = self.max_gain_db.get_or_insert_with(|| fidl::new_empty!(f32, D));
10064                fidl::decode!(f32, D, val_ref, decoder, inner_offset, inner_depth)?;
10065                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
10066                {
10067                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
10068                }
10069                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
10070                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
10071                }
10072            }
10073
10074            next_offset += envelope_size;
10075            _next_ordinal_to_read += 1;
10076            if next_offset >= end_offset {
10077                return Ok(());
10078            }
10079
10080            // Decode unknown envelopes for gaps in ordinals.
10081            while _next_ordinal_to_read < 7 {
10082                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10083                _next_ordinal_to_read += 1;
10084                next_offset += envelope_size;
10085            }
10086
10087            let next_out_of_line = decoder.next_out_of_line();
10088            let handles_before = decoder.remaining_handles();
10089            if let Some((inlined, num_bytes, num_handles)) =
10090                fidl::encoding::decode_envelope_header(decoder, next_offset)?
10091            {
10092                let member_inline_size =
10093                    <f32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
10094                if inlined != (member_inline_size <= 4) {
10095                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
10096                }
10097                let inner_offset;
10098                let mut inner_depth = depth.clone();
10099                if inlined {
10100                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
10101                    inner_offset = next_offset;
10102                } else {
10103                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
10104                    inner_depth.increment()?;
10105                }
10106                let val_ref = self.gain_step_db.get_or_insert_with(|| fidl::new_empty!(f32, D));
10107                fidl::decode!(f32, D, val_ref, decoder, inner_offset, inner_depth)?;
10108                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
10109                {
10110                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
10111                }
10112                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
10113                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
10114                }
10115            }
10116
10117            next_offset += envelope_size;
10118            _next_ordinal_to_read += 1;
10119            if next_offset >= end_offset {
10120                return Ok(());
10121            }
10122
10123            // Decode unknown envelopes for gaps in ordinals.
10124            while _next_ordinal_to_read < 8 {
10125                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10126                _next_ordinal_to_read += 1;
10127                next_offset += envelope_size;
10128            }
10129
10130            let next_out_of_line = decoder.next_out_of_line();
10131            let handles_before = decoder.remaining_handles();
10132            if let Some((inlined, num_bytes, num_handles)) =
10133                fidl::encoding::decode_envelope_header(decoder, next_offset)?
10134            {
10135                let member_inline_size =
10136                    <PlugDetectCapabilities as fidl::encoding::TypeMarker>::inline_size(
10137                        decoder.context,
10138                    );
10139                if inlined != (member_inline_size <= 4) {
10140                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
10141                }
10142                let inner_offset;
10143                let mut inner_depth = depth.clone();
10144                if inlined {
10145                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
10146                    inner_offset = next_offset;
10147                } else {
10148                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
10149                    inner_depth.increment()?;
10150                }
10151                let val_ref = self
10152                    .plug_detect_capabilities
10153                    .get_or_insert_with(|| fidl::new_empty!(PlugDetectCapabilities, D));
10154                fidl::decode!(
10155                    PlugDetectCapabilities,
10156                    D,
10157                    val_ref,
10158                    decoder,
10159                    inner_offset,
10160                    inner_depth
10161                )?;
10162                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
10163                {
10164                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
10165                }
10166                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
10167                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
10168                }
10169            }
10170
10171            next_offset += envelope_size;
10172            _next_ordinal_to_read += 1;
10173            if next_offset >= end_offset {
10174                return Ok(());
10175            }
10176
10177            // Decode unknown envelopes for gaps in ordinals.
10178            while _next_ordinal_to_read < 9 {
10179                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10180                _next_ordinal_to_read += 1;
10181                next_offset += envelope_size;
10182            }
10183
10184            let next_out_of_line = decoder.next_out_of_line();
10185            let handles_before = decoder.remaining_handles();
10186            if let Some((inlined, num_bytes, num_handles)) =
10187                fidl::encoding::decode_envelope_header(decoder, next_offset)?
10188            {
10189                let member_inline_size =
10190                    <fidl::encoding::BoundedString<256> as fidl::encoding::TypeMarker>::inline_size(
10191                        decoder.context,
10192                    );
10193                if inlined != (member_inline_size <= 4) {
10194                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
10195                }
10196                let inner_offset;
10197                let mut inner_depth = depth.clone();
10198                if inlined {
10199                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
10200                    inner_offset = next_offset;
10201                } else {
10202                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
10203                    inner_depth.increment()?;
10204                }
10205                let val_ref = self
10206                    .manufacturer
10207                    .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::BoundedString<256>, D));
10208                fidl::decode!(
10209                    fidl::encoding::BoundedString<256>,
10210                    D,
10211                    val_ref,
10212                    decoder,
10213                    inner_offset,
10214                    inner_depth
10215                )?;
10216                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
10217                {
10218                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
10219                }
10220                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
10221                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
10222                }
10223            }
10224
10225            next_offset += envelope_size;
10226            _next_ordinal_to_read += 1;
10227            if next_offset >= end_offset {
10228                return Ok(());
10229            }
10230
10231            // Decode unknown envelopes for gaps in ordinals.
10232            while _next_ordinal_to_read < 10 {
10233                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10234                _next_ordinal_to_read += 1;
10235                next_offset += envelope_size;
10236            }
10237
10238            let next_out_of_line = decoder.next_out_of_line();
10239            let handles_before = decoder.remaining_handles();
10240            if let Some((inlined, num_bytes, num_handles)) =
10241                fidl::encoding::decode_envelope_header(decoder, next_offset)?
10242            {
10243                let member_inline_size =
10244                    <fidl::encoding::BoundedString<256> as fidl::encoding::TypeMarker>::inline_size(
10245                        decoder.context,
10246                    );
10247                if inlined != (member_inline_size <= 4) {
10248                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
10249                }
10250                let inner_offset;
10251                let mut inner_depth = depth.clone();
10252                if inlined {
10253                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
10254                    inner_offset = next_offset;
10255                } else {
10256                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
10257                    inner_depth.increment()?;
10258                }
10259                let val_ref = self
10260                    .product
10261                    .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::BoundedString<256>, D));
10262                fidl::decode!(
10263                    fidl::encoding::BoundedString<256>,
10264                    D,
10265                    val_ref,
10266                    decoder,
10267                    inner_offset,
10268                    inner_depth
10269                )?;
10270                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
10271                {
10272                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
10273                }
10274                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
10275                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
10276                }
10277            }
10278
10279            next_offset += envelope_size;
10280            _next_ordinal_to_read += 1;
10281            if next_offset >= end_offset {
10282                return Ok(());
10283            }
10284
10285            // Decode unknown envelopes for gaps in ordinals.
10286            while _next_ordinal_to_read < 11 {
10287                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10288                _next_ordinal_to_read += 1;
10289                next_offset += envelope_size;
10290            }
10291
10292            let next_out_of_line = decoder.next_out_of_line();
10293            let handles_before = decoder.remaining_handles();
10294            if let Some((inlined, num_bytes, num_handles)) =
10295                fidl::encoding::decode_envelope_header(decoder, next_offset)?
10296            {
10297                let member_inline_size =
10298                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
10299                if inlined != (member_inline_size <= 4) {
10300                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
10301                }
10302                let inner_offset;
10303                let mut inner_depth = depth.clone();
10304                if inlined {
10305                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
10306                    inner_offset = next_offset;
10307                } else {
10308                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
10309                    inner_depth.increment()?;
10310                }
10311                let val_ref = self.clock_domain.get_or_insert_with(|| fidl::new_empty!(u32, D));
10312                fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
10313                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
10314                {
10315                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
10316                }
10317                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
10318                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
10319                }
10320            }
10321
10322            next_offset += envelope_size;
10323
10324            // Decode the remaining unknown envelopes.
10325            while next_offset < end_offset {
10326                _next_ordinal_to_read += 1;
10327                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10328                next_offset += envelope_size;
10329            }
10330
10331            Ok(())
10332        }
10333    }
10334
10335    impl SupportedFormats {
10336        #[inline(always)]
10337        fn max_ordinal_present(&self) -> u64 {
10338            if let Some(_) = self.pcm_supported_formats {
10339                return 1;
10340            }
10341            0
10342        }
10343    }
10344
10345    impl fidl::encoding::ValueTypeMarker for SupportedFormats {
10346        type Borrowed<'a> = &'a Self;
10347        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
10348            value
10349        }
10350    }
10351
10352    unsafe impl fidl::encoding::TypeMarker for SupportedFormats {
10353        type Owned = Self;
10354
10355        #[inline(always)]
10356        fn inline_align(_context: fidl::encoding::Context) -> usize {
10357            8
10358        }
10359
10360        #[inline(always)]
10361        fn inline_size(_context: fidl::encoding::Context) -> usize {
10362            16
10363        }
10364    }
10365
10366    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<SupportedFormats, D>
10367        for &SupportedFormats
10368    {
10369        unsafe fn encode(
10370            self,
10371            encoder: &mut fidl::encoding::Encoder<'_, D>,
10372            offset: usize,
10373            mut depth: fidl::encoding::Depth,
10374        ) -> fidl::Result<()> {
10375            encoder.debug_check_bounds::<SupportedFormats>(offset);
10376            // Vector header
10377            let max_ordinal: u64 = self.max_ordinal_present();
10378            encoder.write_num(max_ordinal, offset);
10379            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
10380            // Calling encoder.out_of_line_offset(0) is not allowed.
10381            if max_ordinal == 0 {
10382                return Ok(());
10383            }
10384            depth.increment()?;
10385            let envelope_size = 8;
10386            let bytes_len = max_ordinal as usize * envelope_size;
10387            #[allow(unused_variables)]
10388            let offset = encoder.out_of_line_offset(bytes_len);
10389            let mut _prev_end_offset: usize = 0;
10390            if 1 > max_ordinal {
10391                return Ok(());
10392            }
10393
10394            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
10395            // are envelope_size bytes.
10396            let cur_offset: usize = (1 - 1) * envelope_size;
10397
10398            // Zero reserved fields.
10399            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
10400
10401            // Safety:
10402            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
10403            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
10404            //   envelope_size bytes, there is always sufficient room.
10405            fidl::encoding::encode_in_envelope_optional::<PcmSupportedFormats, D>(
10406                self.pcm_supported_formats
10407                    .as_ref()
10408                    .map(<PcmSupportedFormats as fidl::encoding::ValueTypeMarker>::borrow),
10409                encoder,
10410                offset + cur_offset,
10411                depth,
10412            )?;
10413
10414            _prev_end_offset = cur_offset + envelope_size;
10415
10416            Ok(())
10417        }
10418    }
10419
10420    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SupportedFormats {
10421        #[inline(always)]
10422        fn new_empty() -> Self {
10423            Self::default()
10424        }
10425
10426        unsafe fn decode(
10427            &mut self,
10428            decoder: &mut fidl::encoding::Decoder<'_, D>,
10429            offset: usize,
10430            mut depth: fidl::encoding::Depth,
10431        ) -> fidl::Result<()> {
10432            decoder.debug_check_bounds::<Self>(offset);
10433            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
10434                None => return Err(fidl::Error::NotNullable),
10435                Some(len) => len,
10436            };
10437            // Calling decoder.out_of_line_offset(0) is not allowed.
10438            if len == 0 {
10439                return Ok(());
10440            };
10441            depth.increment()?;
10442            let envelope_size = 8;
10443            let bytes_len = len * envelope_size;
10444            let offset = decoder.out_of_line_offset(bytes_len)?;
10445            // Decode the envelope for each type.
10446            let mut _next_ordinal_to_read = 0;
10447            let mut next_offset = offset;
10448            let end_offset = offset + bytes_len;
10449            _next_ordinal_to_read += 1;
10450            if next_offset >= end_offset {
10451                return Ok(());
10452            }
10453
10454            // Decode unknown envelopes for gaps in ordinals.
10455            while _next_ordinal_to_read < 1 {
10456                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10457                _next_ordinal_to_read += 1;
10458                next_offset += envelope_size;
10459            }
10460
10461            let next_out_of_line = decoder.next_out_of_line();
10462            let handles_before = decoder.remaining_handles();
10463            if let Some((inlined, num_bytes, num_handles)) =
10464                fidl::encoding::decode_envelope_header(decoder, next_offset)?
10465            {
10466                let member_inline_size =
10467                    <PcmSupportedFormats as fidl::encoding::TypeMarker>::inline_size(
10468                        decoder.context,
10469                    );
10470                if inlined != (member_inline_size <= 4) {
10471                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
10472                }
10473                let inner_offset;
10474                let mut inner_depth = depth.clone();
10475                if inlined {
10476                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
10477                    inner_offset = next_offset;
10478                } else {
10479                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
10480                    inner_depth.increment()?;
10481                }
10482                let val_ref = self
10483                    .pcm_supported_formats
10484                    .get_or_insert_with(|| fidl::new_empty!(PcmSupportedFormats, D));
10485                fidl::decode!(PcmSupportedFormats, D, val_ref, decoder, inner_offset, inner_depth)?;
10486                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
10487                {
10488                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
10489                }
10490                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
10491                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
10492                }
10493            }
10494
10495            next_offset += envelope_size;
10496
10497            // Decode the remaining unknown envelopes.
10498            while next_offset < end_offset {
10499                _next_ordinal_to_read += 1;
10500                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10501                next_offset += envelope_size;
10502            }
10503
10504            Ok(())
10505        }
10506    }
10507
10508    impl fidl::encoding::ValueTypeMarker for DaiFrameFormat {
10509        type Borrowed<'a> = &'a Self;
10510        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
10511            value
10512        }
10513    }
10514
10515    unsafe impl fidl::encoding::TypeMarker for DaiFrameFormat {
10516        type Owned = Self;
10517
10518        #[inline(always)]
10519        fn inline_align(_context: fidl::encoding::Context) -> usize {
10520            8
10521        }
10522
10523        #[inline(always)]
10524        fn inline_size(_context: fidl::encoding::Context) -> usize {
10525            16
10526        }
10527    }
10528
10529    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<DaiFrameFormat, D>
10530        for &DaiFrameFormat
10531    {
10532        #[inline]
10533        unsafe fn encode(
10534            self,
10535            encoder: &mut fidl::encoding::Encoder<'_, D>,
10536            offset: usize,
10537            _depth: fidl::encoding::Depth,
10538        ) -> fidl::Result<()> {
10539            encoder.debug_check_bounds::<DaiFrameFormat>(offset);
10540            encoder.write_num::<u64>(self.ordinal(), offset);
10541            match self {
10542                DaiFrameFormat::FrameFormatStandard(ref val) => {
10543                    fidl::encoding::encode_in_envelope::<DaiFrameFormatStandard, D>(
10544                        <DaiFrameFormatStandard as fidl::encoding::ValueTypeMarker>::borrow(val),
10545                        encoder,
10546                        offset + 8,
10547                        _depth,
10548                    )
10549                }
10550                DaiFrameFormat::FrameFormatCustom(ref val) => {
10551                    fidl::encoding::encode_in_envelope::<DaiFrameFormatCustom, D>(
10552                        <DaiFrameFormatCustom as fidl::encoding::ValueTypeMarker>::borrow(val),
10553                        encoder,
10554                        offset + 8,
10555                        _depth,
10556                    )
10557                }
10558            }
10559        }
10560    }
10561
10562    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for DaiFrameFormat {
10563        #[inline(always)]
10564        fn new_empty() -> Self {
10565            Self::FrameFormatStandard(fidl::new_empty!(DaiFrameFormatStandard, D))
10566        }
10567
10568        #[inline]
10569        unsafe fn decode(
10570            &mut self,
10571            decoder: &mut fidl::encoding::Decoder<'_, D>,
10572            offset: usize,
10573            mut depth: fidl::encoding::Depth,
10574        ) -> fidl::Result<()> {
10575            decoder.debug_check_bounds::<Self>(offset);
10576            #[allow(unused_variables)]
10577            let next_out_of_line = decoder.next_out_of_line();
10578            let handles_before = decoder.remaining_handles();
10579            let (ordinal, inlined, num_bytes, num_handles) =
10580                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
10581
10582            let member_inline_size = match ordinal {
10583                1 => <DaiFrameFormatStandard as fidl::encoding::TypeMarker>::inline_size(
10584                    decoder.context,
10585                ),
10586                2 => <DaiFrameFormatCustom as fidl::encoding::TypeMarker>::inline_size(
10587                    decoder.context,
10588                ),
10589                _ => return Err(fidl::Error::UnknownUnionTag),
10590            };
10591
10592            if inlined != (member_inline_size <= 4) {
10593                return Err(fidl::Error::InvalidInlineBitInEnvelope);
10594            }
10595            let _inner_offset;
10596            if inlined {
10597                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
10598                _inner_offset = offset + 8;
10599            } else {
10600                depth.increment()?;
10601                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
10602            }
10603            match ordinal {
10604                1 => {
10605                    #[allow(irrefutable_let_patterns)]
10606                    if let DaiFrameFormat::FrameFormatStandard(_) = self {
10607                        // Do nothing, read the value into the object
10608                    } else {
10609                        // Initialize `self` to the right variant
10610                        *self = DaiFrameFormat::FrameFormatStandard(fidl::new_empty!(
10611                            DaiFrameFormatStandard,
10612                            D
10613                        ));
10614                    }
10615                    #[allow(irrefutable_let_patterns)]
10616                    if let DaiFrameFormat::FrameFormatStandard(ref mut val) = self {
10617                        fidl::decode!(
10618                            DaiFrameFormatStandard,
10619                            D,
10620                            val,
10621                            decoder,
10622                            _inner_offset,
10623                            depth
10624                        )?;
10625                    } else {
10626                        unreachable!()
10627                    }
10628                }
10629                2 => {
10630                    #[allow(irrefutable_let_patterns)]
10631                    if let DaiFrameFormat::FrameFormatCustom(_) = self {
10632                        // Do nothing, read the value into the object
10633                    } else {
10634                        // Initialize `self` to the right variant
10635                        *self = DaiFrameFormat::FrameFormatCustom(fidl::new_empty!(
10636                            DaiFrameFormatCustom,
10637                            D
10638                        ));
10639                    }
10640                    #[allow(irrefutable_let_patterns)]
10641                    if let DaiFrameFormat::FrameFormatCustom(ref mut val) = self {
10642                        fidl::decode!(DaiFrameFormatCustom, D, val, decoder, _inner_offset, depth)?;
10643                    } else {
10644                        unreachable!()
10645                    }
10646                }
10647                ordinal => panic!("unexpected ordinal {:?}", ordinal),
10648            }
10649            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
10650                return Err(fidl::Error::InvalidNumBytesInEnvelope);
10651            }
10652            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
10653                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
10654            }
10655            Ok(())
10656        }
10657    }
10658}