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