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