fidl_fuchsia_audio_device_common/
fidl_fuchsia_audio_device_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
11/// Common aliases, consts and types used by more than one of the fuchsia.audio.device protocols.
12pub type ClockDomain = u32;
13
14pub type ElementId = u64;
15
16pub type TokenId = u64;
17
18pub type TopologyId = u64;
19
20/// For devices with Codec drivers, there is only one DAI_INTERCONNECT entity. When a method
21/// requires us to address the interconnect by ID, we use element_id 1. Codec drivers that
22/// implement signalprocessing should not assign this ID to other elements.
23pub const DEFAULT_DAI_INTERCONNECT_ELEMENT_ID: u64 = 1;
24
25/// Maximum number of channels that a device can report as supported.
26pub const MAX_COUNT_CHANNELS: u32 =
27    fidl_fuchsia_hardware_audio::MAX_COUNT_CHANNELS_IN_RING_BUFFER as u32;
28
29/// Maximum number of `ChannelSet`s that a device can report in a single PcmFormatSet.
30pub const MAX_COUNT_CHANNEL_SETS: u32 = fidl_fuchsia_hardware_audio::MAX_COUNT_CHANNEL_SETS as u32;
31
32pub const MAX_COUNT_DAI_FORMATS: u32 = fidl_fuchsia_hardware_audio::MAX_COUNT_DAI_FORMATS as u32;
33
34/// Maximum number of audio devices in the system at any time.
35pub const MAX_COUNT_DEVICES: u32 = 256;
36
37/// Maximum number of `PcmFormatSet`s that a device can report as supported.
38pub const MAX_COUNT_FORMATS: u32 = fidl_fuchsia_hardware_audio::MAX_COUNT_FORMATS as u32;
39
40/// Maximum number of processing elements supported by a single device.
41pub const MAX_COUNT_PROCESSING_ELEMENTS: u32 =
42    fidl_fuchsia_hardware_audio_signalprocessing::MAX_COUNT_PROCESSING_ELEMENTS as u32;
43
44/// Maximum number of frame rates that a device can report in a PcmFormatSet.
45pub const MAX_COUNT_RATES: u32 = fidl_fuchsia_hardware_audio::MAX_COUNT_SUPPORTED_RATES as u32;
46
47/// Maximum number of distinct sample formats that a single PcmFormatSet can contain.
48pub const MAX_COUNT_SAMPLE_TYPES: u32 = 32;
49
50/// Maximum length of the strings for device, manufacturer and product names.
51pub const MAX_STRING_SIZE: u32 = fidl_fuchsia_hardware_audio::MAX_UI_STRING_SIZE as u32;
52
53/// The length of the device's unique ID, in bytes.
54pub const UNIQUE_INSTANCE_ID_SIZE: u32 = fidl_fuchsia_hardware_audio::UNIQUE_ID_SIZE as u32;
55
56/// Errors returned by `Control/CodecStart`.
57#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
58pub enum ControlCodecStartError {
59    /// This device has encountered an error and can no longer be controlled.
60    DeviceError,
61    /// This device type does not support the method that was called.
62    WrongDeviceType,
63    /// The previous `CodecStart` call has not yet completed.
64    AlreadyPending,
65    /// `SetDaiFormat` was not called before making this call.
66    DaiFormatNotSet,
67    /// The device was already started when this call was made.
68    AlreadyStarted,
69    /// The driver returned some other error. This call may be retried.
70    Other,
71    #[doc(hidden)]
72    __SourceBreaking { unknown_ordinal: u32 },
73}
74
75/// Pattern that matches an unknown `ControlCodecStartError` member.
76#[macro_export]
77macro_rules! ControlCodecStartErrorUnknown {
78    () => {
79        _
80    };
81}
82
83impl ControlCodecStartError {
84    #[inline]
85    pub fn from_primitive(prim: u32) -> Option<Self> {
86        match prim {
87            1 => Some(Self::DeviceError),
88            2 => Some(Self::WrongDeviceType),
89            3 => Some(Self::AlreadyPending),
90            4 => Some(Self::DaiFormatNotSet),
91            5 => Some(Self::AlreadyStarted),
92            6 => Some(Self::Other),
93            _ => None,
94        }
95    }
96
97    #[inline]
98    pub fn from_primitive_allow_unknown(prim: u32) -> Self {
99        match prim {
100            1 => Self::DeviceError,
101            2 => Self::WrongDeviceType,
102            3 => Self::AlreadyPending,
103            4 => Self::DaiFormatNotSet,
104            5 => Self::AlreadyStarted,
105            6 => Self::Other,
106            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
107        }
108    }
109
110    #[inline]
111    pub fn unknown() -> Self {
112        Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
113    }
114
115    #[inline]
116    pub const fn into_primitive(self) -> u32 {
117        match self {
118            Self::DeviceError => 1,
119            Self::WrongDeviceType => 2,
120            Self::AlreadyPending => 3,
121            Self::DaiFormatNotSet => 4,
122            Self::AlreadyStarted => 5,
123            Self::Other => 6,
124            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
125        }
126    }
127
128    #[inline]
129    pub fn is_unknown(&self) -> bool {
130        match self {
131            Self::__SourceBreaking { unknown_ordinal: _ } => true,
132            _ => false,
133        }
134    }
135}
136
137/// Errors returned by `Control/CodecStop`.
138#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
139pub enum ControlCodecStopError {
140    /// This device has encountered an error and can no longer be controlled.
141    DeviceError,
142    /// This device type does not support the method that was called.
143    WrongDeviceType,
144    /// The previous `CodecStop` call has not yet completed.
145    AlreadyPending,
146    /// `SetDaiFormat` was not called before making this call.
147    DaiFormatNotSet,
148    /// The device was already stopped when this call was made.
149    AlreadyStopped,
150    /// The driver returned some other error. This call may be retried.
151    Other,
152    #[doc(hidden)]
153    __SourceBreaking { unknown_ordinal: u32 },
154}
155
156/// Pattern that matches an unknown `ControlCodecStopError` member.
157#[macro_export]
158macro_rules! ControlCodecStopErrorUnknown {
159    () => {
160        _
161    };
162}
163
164impl ControlCodecStopError {
165    #[inline]
166    pub fn from_primitive(prim: u32) -> Option<Self> {
167        match prim {
168            1 => Some(Self::DeviceError),
169            2 => Some(Self::WrongDeviceType),
170            3 => Some(Self::AlreadyPending),
171            4 => Some(Self::DaiFormatNotSet),
172            5 => Some(Self::AlreadyStopped),
173            6 => Some(Self::Other),
174            _ => None,
175        }
176    }
177
178    #[inline]
179    pub fn from_primitive_allow_unknown(prim: u32) -> Self {
180        match prim {
181            1 => Self::DeviceError,
182            2 => Self::WrongDeviceType,
183            3 => Self::AlreadyPending,
184            4 => Self::DaiFormatNotSet,
185            5 => Self::AlreadyStopped,
186            6 => Self::Other,
187            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
188        }
189    }
190
191    #[inline]
192    pub fn unknown() -> Self {
193        Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
194    }
195
196    #[inline]
197    pub const fn into_primitive(self) -> u32 {
198        match self {
199            Self::DeviceError => 1,
200            Self::WrongDeviceType => 2,
201            Self::AlreadyPending => 3,
202            Self::DaiFormatNotSet => 4,
203            Self::AlreadyStopped => 5,
204            Self::Other => 6,
205            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
206        }
207    }
208
209    #[inline]
210    pub fn is_unknown(&self) -> bool {
211        match self {
212            Self::__SourceBreaking { unknown_ordinal: _ } => true,
213            _ => false,
214        }
215    }
216}
217
218/// Errors returned by `Control/CreateRingBuffer`.
219#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
220pub enum ControlCreateRingBufferError {
221    /// This device has encountered an error and can no longer be controlled.
222    DeviceError,
223    /// This device type does not support the method that was called.
224    WrongDeviceType,
225    /// The previous `CreateRingBuffer` call has not yet completed.
226    AlreadyPending,
227    /// The required `element_id` is missing or does not refer to a `RING_BUFFER` element.
228    InvalidElementId,
229    /// The required `options` is missing.
230    InvalidOptions,
231    /// The required `options.format` is missing.
232    InvalidFormat,
233    /// The required `options.ring_buffer_min_bytes` is missing.
234    InvalidMinBytes,
235    /// The required `ring_buffer_server` is missing.
236    InvalidRingBuffer,
237    /// An active `RingBuffer` instance already exists for this `Control`.
238    AlreadyAllocated,
239    /// The device does not support the specified format.
240    FormatMismatch,
241    /// The device cannot create a ring buffer with the specified options.
242    BadRingBufferOption,
243    /// The driver returned some other error. This call may be retried.
244    Other,
245    #[doc(hidden)]
246    __SourceBreaking { unknown_ordinal: u32 },
247}
248
249/// Pattern that matches an unknown `ControlCreateRingBufferError` member.
250#[macro_export]
251macro_rules! ControlCreateRingBufferErrorUnknown {
252    () => {
253        _
254    };
255}
256
257impl ControlCreateRingBufferError {
258    #[inline]
259    pub fn from_primitive(prim: u32) -> Option<Self> {
260        match prim {
261            1 => Some(Self::DeviceError),
262            2 => Some(Self::WrongDeviceType),
263            3 => Some(Self::AlreadyPending),
264            4 => Some(Self::InvalidElementId),
265            5 => Some(Self::InvalidOptions),
266            6 => Some(Self::InvalidFormat),
267            7 => Some(Self::InvalidMinBytes),
268            8 => Some(Self::InvalidRingBuffer),
269            9 => Some(Self::AlreadyAllocated),
270            10 => Some(Self::FormatMismatch),
271            11 => Some(Self::BadRingBufferOption),
272            12 => Some(Self::Other),
273            _ => None,
274        }
275    }
276
277    #[inline]
278    pub fn from_primitive_allow_unknown(prim: u32) -> Self {
279        match prim {
280            1 => Self::DeviceError,
281            2 => Self::WrongDeviceType,
282            3 => Self::AlreadyPending,
283            4 => Self::InvalidElementId,
284            5 => Self::InvalidOptions,
285            6 => Self::InvalidFormat,
286            7 => Self::InvalidMinBytes,
287            8 => Self::InvalidRingBuffer,
288            9 => Self::AlreadyAllocated,
289            10 => Self::FormatMismatch,
290            11 => Self::BadRingBufferOption,
291            12 => Self::Other,
292            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
293        }
294    }
295
296    #[inline]
297    pub fn unknown() -> Self {
298        Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
299    }
300
301    #[inline]
302    pub const fn into_primitive(self) -> u32 {
303        match self {
304            Self::DeviceError => 1,
305            Self::WrongDeviceType => 2,
306            Self::AlreadyPending => 3,
307            Self::InvalidElementId => 4,
308            Self::InvalidOptions => 5,
309            Self::InvalidFormat => 6,
310            Self::InvalidMinBytes => 7,
311            Self::InvalidRingBuffer => 8,
312            Self::AlreadyAllocated => 9,
313            Self::FormatMismatch => 10,
314            Self::BadRingBufferOption => 11,
315            Self::Other => 12,
316            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
317        }
318    }
319
320    #[inline]
321    pub fn is_unknown(&self) -> bool {
322        match self {
323            Self::__SourceBreaking { unknown_ordinal: _ } => true,
324            _ => false,
325        }
326    }
327}
328
329/// Errors returned by `ControlCreator/Create`.
330#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
331pub enum ControlCreatorError {
332    /// The required `token_id` is missing.
333    InvalidTokenId,
334    /// The required `control_server` is missing.
335    InvalidControl,
336    /// No device with `token_id` was found. Either this token has never been
337    /// used, or the device with `token_id` has been removed.
338    DeviceNotFound,
339    /// The device with `token_id` encountered an error and cannot be controlled.
340    DeviceError,
341    /// A `Control` associated with `token_id` already exists. This device is
342    /// already being actively controlled.
343    AlreadyAllocated,
344    #[doc(hidden)]
345    __SourceBreaking { unknown_ordinal: u32 },
346}
347
348/// Pattern that matches an unknown `ControlCreatorError` member.
349#[macro_export]
350macro_rules! ControlCreatorErrorUnknown {
351    () => {
352        _
353    };
354}
355
356impl ControlCreatorError {
357    #[inline]
358    pub fn from_primitive(prim: u32) -> Option<Self> {
359        match prim {
360            1 => Some(Self::InvalidTokenId),
361            2 => Some(Self::InvalidControl),
362            3 => Some(Self::DeviceNotFound),
363            4 => Some(Self::DeviceError),
364            5 => Some(Self::AlreadyAllocated),
365            _ => None,
366        }
367    }
368
369    #[inline]
370    pub fn from_primitive_allow_unknown(prim: u32) -> Self {
371        match prim {
372            1 => Self::InvalidTokenId,
373            2 => Self::InvalidControl,
374            3 => Self::DeviceNotFound,
375            4 => Self::DeviceError,
376            5 => Self::AlreadyAllocated,
377            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
378        }
379    }
380
381    #[inline]
382    pub fn unknown() -> Self {
383        Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
384    }
385
386    #[inline]
387    pub const fn into_primitive(self) -> u32 {
388        match self {
389            Self::InvalidTokenId => 1,
390            Self::InvalidControl => 2,
391            Self::DeviceNotFound => 3,
392            Self::DeviceError => 4,
393            Self::AlreadyAllocated => 5,
394            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
395        }
396    }
397
398    #[inline]
399    pub fn is_unknown(&self) -> bool {
400        match self {
401            Self::__SourceBreaking { unknown_ordinal: _ } => true,
402            _ => false,
403        }
404    }
405}
406
407/// Errors returned by `Control/Reset`.
408#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
409pub enum ControlResetError {
410    /// This device has encountered an error and can no longer be controlled.
411    DeviceError,
412    /// This device type does not support the method that was called.
413    WrongDeviceType,
414    /// The previous `Reset` call has not yet completed.
415    AlreadyPending,
416    #[doc(hidden)]
417    __SourceBreaking { unknown_ordinal: u32 },
418}
419
420/// Pattern that matches an unknown `ControlResetError` member.
421#[macro_export]
422macro_rules! ControlResetErrorUnknown {
423    () => {
424        _
425    };
426}
427
428impl ControlResetError {
429    #[inline]
430    pub fn from_primitive(prim: u32) -> Option<Self> {
431        match prim {
432            1 => Some(Self::DeviceError),
433            2 => Some(Self::WrongDeviceType),
434            3 => Some(Self::AlreadyPending),
435            _ => None,
436        }
437    }
438
439    #[inline]
440    pub fn from_primitive_allow_unknown(prim: u32) -> Self {
441        match prim {
442            1 => Self::DeviceError,
443            2 => Self::WrongDeviceType,
444            3 => Self::AlreadyPending,
445            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
446        }
447    }
448
449    #[inline]
450    pub fn unknown() -> Self {
451        Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
452    }
453
454    #[inline]
455    pub const fn into_primitive(self) -> u32 {
456        match self {
457            Self::DeviceError => 1,
458            Self::WrongDeviceType => 2,
459            Self::AlreadyPending => 3,
460            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
461        }
462    }
463
464    #[inline]
465    pub fn is_unknown(&self) -> bool {
466        match self {
467            Self::__SourceBreaking { unknown_ordinal: _ } => true,
468            _ => false,
469        }
470    }
471}
472
473/// Errors returned by `Control/SetDaiFormat`.
474#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
475pub enum ControlSetDaiFormatError {
476    /// This device has encountered an error and can no longer be controlled.
477    DeviceError,
478    /// This device type does not support the method that was called.
479    WrongDeviceType,
480    /// The previous `SetDaiFormat` call has not yet completed.
481    AlreadyPending,
482    /// The required `element_id` is missing or does not refer to a `DAI_INTERCONNECT` element.
483    InvalidElementId,
484    /// The required `dai_format` is missing or invalid.
485    InvalidDaiFormat,
486    /// The device does not support the specified dai_format.
487    FormatMismatch,
488    /// The driver returned some other error. This call may be retried.
489    Other,
490    #[doc(hidden)]
491    __SourceBreaking { unknown_ordinal: u32 },
492}
493
494/// Pattern that matches an unknown `ControlSetDaiFormatError` member.
495#[macro_export]
496macro_rules! ControlSetDaiFormatErrorUnknown {
497    () => {
498        _
499    };
500}
501
502impl ControlSetDaiFormatError {
503    #[inline]
504    pub fn from_primitive(prim: u32) -> Option<Self> {
505        match prim {
506            1 => Some(Self::DeviceError),
507            2 => Some(Self::WrongDeviceType),
508            3 => Some(Self::AlreadyPending),
509            4 => Some(Self::InvalidElementId),
510            5 => Some(Self::InvalidDaiFormat),
511            6 => Some(Self::FormatMismatch),
512            7 => Some(Self::Other),
513            _ => None,
514        }
515    }
516
517    #[inline]
518    pub fn from_primitive_allow_unknown(prim: u32) -> Self {
519        match prim {
520            1 => Self::DeviceError,
521            2 => Self::WrongDeviceType,
522            3 => Self::AlreadyPending,
523            4 => Self::InvalidElementId,
524            5 => Self::InvalidDaiFormat,
525            6 => Self::FormatMismatch,
526            7 => Self::Other,
527            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
528        }
529    }
530
531    #[inline]
532    pub fn unknown() -> Self {
533        Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
534    }
535
536    #[inline]
537    pub const fn into_primitive(self) -> u32 {
538        match self {
539            Self::DeviceError => 1,
540            Self::WrongDeviceType => 2,
541            Self::AlreadyPending => 3,
542            Self::InvalidElementId => 4,
543            Self::InvalidDaiFormat => 5,
544            Self::FormatMismatch => 6,
545            Self::Other => 7,
546            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
547        }
548    }
549
550    #[inline]
551    pub fn is_unknown(&self) -> bool {
552        match self {
553            Self::__SourceBreaking { unknown_ordinal: _ } => true,
554            _ => false,
555        }
556    }
557}
558
559/// The protocol used by the driver.
560#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
561pub enum DeviceType {
562    /// The device uses the `fuchsia.hardware.audio/Codec` protocol.
563    Codec,
564    /// The device uses the `fuchsia.hardware.audio/Composite` protocol.
565    Composite,
566    #[doc(hidden)]
567    __SourceBreaking { unknown_ordinal: u32 },
568}
569
570/// Pattern that matches an unknown `DeviceType` member.
571#[macro_export]
572macro_rules! DeviceTypeUnknown {
573    () => {
574        _
575    };
576}
577
578impl DeviceType {
579    #[inline]
580    pub fn from_primitive(prim: u32) -> Option<Self> {
581        match prim {
582            1 => Some(Self::Codec),
583            2 => Some(Self::Composite),
584            _ => None,
585        }
586    }
587
588    #[inline]
589    pub fn from_primitive_allow_unknown(prim: u32) -> Self {
590        match prim {
591            1 => Self::Codec,
592            2 => Self::Composite,
593            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
594        }
595    }
596
597    #[inline]
598    pub fn unknown() -> Self {
599        Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
600    }
601
602    #[inline]
603    pub const fn into_primitive(self) -> u32 {
604        match self {
605            Self::Codec => 1,
606            Self::Composite => 2,
607            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
608        }
609    }
610
611    #[inline]
612    pub fn is_unknown(&self) -> bool {
613        match self {
614            Self::__SourceBreaking { unknown_ordinal: _ } => true,
615            _ => false,
616        }
617    }
618}
619
620/// Errors returned by `Observer/GetReferenceClock`.
621#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
622pub enum ObserverGetReferenceClockError {
623    /// This device has encountered an error and can no longer be observed.
624    DeviceError,
625    /// This device type does not support the method that was called.
626    WrongDeviceType,
627    /// The device's reference clock could not be returned.
628    DeviceClockUnavailable,
629    #[doc(hidden)]
630    __SourceBreaking { unknown_ordinal: u32 },
631}
632
633/// Pattern that matches an unknown `ObserverGetReferenceClockError` member.
634#[macro_export]
635macro_rules! ObserverGetReferenceClockErrorUnknown {
636    () => {
637        _
638    };
639}
640
641impl ObserverGetReferenceClockError {
642    #[inline]
643    pub fn from_primitive(prim: u32) -> Option<Self> {
644        match prim {
645            1 => Some(Self::DeviceError),
646            2 => Some(Self::WrongDeviceType),
647            3 => Some(Self::DeviceClockUnavailable),
648            _ => None,
649        }
650    }
651
652    #[inline]
653    pub fn from_primitive_allow_unknown(prim: u32) -> Self {
654        match prim {
655            1 => Self::DeviceError,
656            2 => Self::WrongDeviceType,
657            3 => Self::DeviceClockUnavailable,
658            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
659        }
660    }
661
662    #[inline]
663    pub fn unknown() -> Self {
664        Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
665    }
666
667    #[inline]
668    pub const fn into_primitive(self) -> u32 {
669        match self {
670            Self::DeviceError => 1,
671            Self::WrongDeviceType => 2,
672            Self::DeviceClockUnavailable => 3,
673            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
674        }
675    }
676
677    #[inline]
678    pub fn is_unknown(&self) -> bool {
679        match self {
680            Self::__SourceBreaking { unknown_ordinal: _ } => true,
681            _ => false,
682        }
683    }
684}
685
686/// Errors returned by `Observer/WatchPlugState`.
687#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
688pub enum ObserverWatchPlugStateError {
689    /// This device has encountered an error and can no longer be observed.
690    DeviceError,
691    /// This device type does not support the method that was called.
692    WrongDeviceType,
693    /// The previous `WatchPlugState` call has not yet completed.
694    AlreadyPending,
695    #[doc(hidden)]
696    __SourceBreaking { unknown_ordinal: u32 },
697}
698
699/// Pattern that matches an unknown `ObserverWatchPlugStateError` member.
700#[macro_export]
701macro_rules! ObserverWatchPlugStateErrorUnknown {
702    () => {
703        _
704    };
705}
706
707impl ObserverWatchPlugStateError {
708    #[inline]
709    pub fn from_primitive(prim: u32) -> Option<Self> {
710        match prim {
711            1 => Some(Self::DeviceError),
712            2 => Some(Self::WrongDeviceType),
713            3 => Some(Self::AlreadyPending),
714            _ => None,
715        }
716    }
717
718    #[inline]
719    pub fn from_primitive_allow_unknown(prim: u32) -> Self {
720        match prim {
721            1 => Self::DeviceError,
722            2 => Self::WrongDeviceType,
723            3 => Self::AlreadyPending,
724            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
725        }
726    }
727
728    #[inline]
729    pub fn unknown() -> Self {
730        Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
731    }
732
733    #[inline]
734    pub const fn into_primitive(self) -> u32 {
735        match self {
736            Self::DeviceError => 1,
737            Self::WrongDeviceType => 2,
738            Self::AlreadyPending => 3,
739            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
740        }
741    }
742
743    #[inline]
744    pub fn is_unknown(&self) -> bool {
745        match self {
746            Self::__SourceBreaking { unknown_ordinal: _ } => true,
747            _ => false,
748        }
749    }
750}
751
752/// The device's hot-plug capabilities.
753#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
754pub enum PlugDetectCapabilities {
755    /// Device is always plugged in. Plug state cannot change.
756    Hardwired,
757    /// Device can be un/plugged and can asynchronously notify of changes.
758    Pluggable,
759    #[doc(hidden)]
760    __SourceBreaking { unknown_ordinal: u32 },
761}
762
763/// Pattern that matches an unknown `PlugDetectCapabilities` member.
764#[macro_export]
765macro_rules! PlugDetectCapabilitiesUnknown {
766    () => {
767        _
768    };
769}
770
771impl PlugDetectCapabilities {
772    #[inline]
773    pub fn from_primitive(prim: u32) -> Option<Self> {
774        match prim {
775            0 => Some(Self::Hardwired),
776            1 => Some(Self::Pluggable),
777            _ => None,
778        }
779    }
780
781    #[inline]
782    pub fn from_primitive_allow_unknown(prim: u32) -> Self {
783        match prim {
784            0 => Self::Hardwired,
785            1 => Self::Pluggable,
786            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
787        }
788    }
789
790    #[inline]
791    pub fn unknown() -> Self {
792        Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
793    }
794
795    #[inline]
796    pub const fn into_primitive(self) -> u32 {
797        match self {
798            Self::Hardwired => 0,
799            Self::Pluggable => 1,
800            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
801        }
802    }
803
804    #[inline]
805    pub fn is_unknown(&self) -> bool {
806        match self {
807            Self::__SourceBreaking { unknown_ordinal: _ } => true,
808            _ => false,
809        }
810    }
811}
812
813/// The current plugged-in state for the device.
814#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
815pub enum PlugState {
816    /// Connected and available for audio streaming.
817    Plugged,
818    /// Not connected; unavailable for audio streaming.
819    Unplugged,
820    #[doc(hidden)]
821    __SourceBreaking { unknown_ordinal: u32 },
822}
823
824/// Pattern that matches an unknown `PlugState` member.
825#[macro_export]
826macro_rules! PlugStateUnknown {
827    () => {
828        _
829    };
830}
831
832impl PlugState {
833    #[inline]
834    pub fn from_primitive(prim: u32) -> Option<Self> {
835        match prim {
836            1 => Some(Self::Plugged),
837            2 => Some(Self::Unplugged),
838            _ => None,
839        }
840    }
841
842    #[inline]
843    pub fn from_primitive_allow_unknown(prim: u32) -> Self {
844        match prim {
845            1 => Self::Plugged,
846            2 => Self::Unplugged,
847            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
848        }
849    }
850
851    #[inline]
852    pub fn unknown() -> Self {
853        Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
854    }
855
856    #[inline]
857    pub const fn into_primitive(self) -> u32 {
858        match self {
859            Self::Plugged => 1,
860            Self::Unplugged => 2,
861            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
862        }
863    }
864
865    #[inline]
866    pub fn is_unknown(&self) -> bool {
867        match self {
868            Self::__SourceBreaking { unknown_ordinal: _ } => true,
869            _ => false,
870        }
871    }
872}
873
874/// Errors returned by the `Provider` protocol.
875#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
876pub enum ProviderAddDeviceError {
877    /// The required `device_name` is incorrectly formed, empty or missing.
878    InvalidName,
879    /// The required `device_type` is missing.
880    InvalidType,
881    /// The required `driver_client` is invalid or missing.
882    InvalidDriverClient,
883    /// The protocol in `driver_client` is incompatible with `device_type` or is not supported yet.
884    WrongClientType,
885    #[doc(hidden)]
886    __SourceBreaking { unknown_ordinal: u32 },
887}
888
889/// Pattern that matches an unknown `ProviderAddDeviceError` member.
890#[macro_export]
891macro_rules! ProviderAddDeviceErrorUnknown {
892    () => {
893        _
894    };
895}
896
897impl ProviderAddDeviceError {
898    #[inline]
899    pub fn from_primitive(prim: u32) -> Option<Self> {
900        match prim {
901            1 => Some(Self::InvalidName),
902            2 => Some(Self::InvalidType),
903            3 => Some(Self::InvalidDriverClient),
904            4 => Some(Self::WrongClientType),
905            _ => None,
906        }
907    }
908
909    #[inline]
910    pub fn from_primitive_allow_unknown(prim: u32) -> Self {
911        match prim {
912            1 => Self::InvalidName,
913            2 => Self::InvalidType,
914            3 => Self::InvalidDriverClient,
915            4 => Self::WrongClientType,
916            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
917        }
918    }
919
920    #[inline]
921    pub fn unknown() -> Self {
922        Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
923    }
924
925    #[inline]
926    pub const fn into_primitive(self) -> u32 {
927        match self {
928            Self::InvalidName => 1,
929            Self::InvalidType => 2,
930            Self::InvalidDriverClient => 3,
931            Self::WrongClientType => 4,
932            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
933        }
934    }
935
936    #[inline]
937    pub fn is_unknown(&self) -> bool {
938        match self {
939            Self::__SourceBreaking { unknown_ordinal: _ } => true,
940            _ => false,
941        }
942    }
943}
944
945/// Errors returned by `Registry/CreateObserver`.
946#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
947pub enum RegistryCreateObserverError {
948    /// The required `token_id` is missing.
949    InvalidTokenId,
950    /// The required `observer_server` is missing.
951    InvalidObserver,
952    /// No device with `token_id` was found. Either this token has never been
953    /// used, or the device with `token_id` has been removed.
954    DeviceNotFound,
955    /// The device with `token_id` has encountered an error and can no longer be observed.
956    DeviceError,
957    #[doc(hidden)]
958    __SourceBreaking { unknown_ordinal: u32 },
959}
960
961/// Pattern that matches an unknown `RegistryCreateObserverError` member.
962#[macro_export]
963macro_rules! RegistryCreateObserverErrorUnknown {
964    () => {
965        _
966    };
967}
968
969impl RegistryCreateObserverError {
970    #[inline]
971    pub fn from_primitive(prim: u32) -> Option<Self> {
972        match prim {
973            1 => Some(Self::InvalidTokenId),
974            2 => Some(Self::InvalidObserver),
975            3 => Some(Self::DeviceNotFound),
976            4 => Some(Self::DeviceError),
977            _ => None,
978        }
979    }
980
981    #[inline]
982    pub fn from_primitive_allow_unknown(prim: u32) -> Self {
983        match prim {
984            1 => Self::InvalidTokenId,
985            2 => Self::InvalidObserver,
986            3 => Self::DeviceNotFound,
987            4 => Self::DeviceError,
988            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
989        }
990    }
991
992    #[inline]
993    pub fn unknown() -> Self {
994        Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
995    }
996
997    #[inline]
998    pub const fn into_primitive(self) -> u32 {
999        match self {
1000            Self::InvalidTokenId => 1,
1001            Self::InvalidObserver => 2,
1002            Self::DeviceNotFound => 3,
1003            Self::DeviceError => 4,
1004            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
1005        }
1006    }
1007
1008    #[inline]
1009    pub fn is_unknown(&self) -> bool {
1010        match self {
1011            Self::__SourceBreaking { unknown_ordinal: _ } => true,
1012            _ => false,
1013        }
1014    }
1015}
1016
1017/// Errors returned by `Registry/WatchDeviceRemoved`.
1018#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
1019pub enum RegistryWatchDeviceRemovedError {
1020    /// The previous `WatchDeviceRemoved` call has not yet completed.
1021    AlreadyPending,
1022    #[doc(hidden)]
1023    __SourceBreaking { unknown_ordinal: u32 },
1024}
1025
1026/// Pattern that matches an unknown `RegistryWatchDeviceRemovedError` member.
1027#[macro_export]
1028macro_rules! RegistryWatchDeviceRemovedErrorUnknown {
1029    () => {
1030        _
1031    };
1032}
1033
1034impl RegistryWatchDeviceRemovedError {
1035    #[inline]
1036    pub fn from_primitive(prim: u32) -> Option<Self> {
1037        match prim {
1038            1 => Some(Self::AlreadyPending),
1039            _ => None,
1040        }
1041    }
1042
1043    #[inline]
1044    pub fn from_primitive_allow_unknown(prim: u32) -> Self {
1045        match prim {
1046            1 => Self::AlreadyPending,
1047            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
1048        }
1049    }
1050
1051    #[inline]
1052    pub fn unknown() -> Self {
1053        Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
1054    }
1055
1056    #[inline]
1057    pub const fn into_primitive(self) -> u32 {
1058        match self {
1059            Self::AlreadyPending => 1,
1060            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
1061        }
1062    }
1063
1064    #[inline]
1065    pub fn is_unknown(&self) -> bool {
1066        match self {
1067            Self::__SourceBreaking { unknown_ordinal: _ } => true,
1068            _ => false,
1069        }
1070    }
1071}
1072
1073/// Errors returned by `Registry/WatchDevicesAdded`.
1074#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
1075pub enum RegistryWatchDevicesAddedError {
1076    /// The previous `WatchDevicesAdded` call has not yet completed.
1077    AlreadyPending,
1078    #[doc(hidden)]
1079    __SourceBreaking { unknown_ordinal: u32 },
1080}
1081
1082/// Pattern that matches an unknown `RegistryWatchDevicesAddedError` member.
1083#[macro_export]
1084macro_rules! RegistryWatchDevicesAddedErrorUnknown {
1085    () => {
1086        _
1087    };
1088}
1089
1090impl RegistryWatchDevicesAddedError {
1091    #[inline]
1092    pub fn from_primitive(prim: u32) -> Option<Self> {
1093        match prim {
1094            1 => Some(Self::AlreadyPending),
1095            _ => None,
1096        }
1097    }
1098
1099    #[inline]
1100    pub fn from_primitive_allow_unknown(prim: u32) -> Self {
1101        match prim {
1102            1 => Self::AlreadyPending,
1103            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
1104        }
1105    }
1106
1107    #[inline]
1108    pub fn unknown() -> Self {
1109        Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
1110    }
1111
1112    #[inline]
1113    pub const fn into_primitive(self) -> u32 {
1114        match self {
1115            Self::AlreadyPending => 1,
1116            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
1117        }
1118    }
1119
1120    #[inline]
1121    pub fn is_unknown(&self) -> bool {
1122        match self {
1123            Self::__SourceBreaking { unknown_ordinal: _ } => true,
1124            _ => false,
1125        }
1126    }
1127}
1128
1129/// Errors returned by `RingBuffer/SetActiveChannels`.
1130#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
1131pub enum RingBufferSetActiveChannelsError {
1132    /// This device has encountered an error and can no longer be controlled.
1133    DeviceError,
1134    /// The previous `SetActiveChannels` call has not yet completed.
1135    AlreadyPending,
1136    /// The device does not support `SetActiveChannels`. Individual channels
1137    /// cannot be deactivated (all channels are always active).
1138    MethodNotSupported,
1139    /// The required `channel_bitmask` is missing.
1140    InvalidChannelBitmask,
1141    /// The passed `channel_bitmask` specifies channels that are beyond the
1142    /// range of channels currently configured for this ring buffer.
1143    ChannelOutOfRange,
1144    #[doc(hidden)]
1145    __SourceBreaking { unknown_ordinal: u32 },
1146}
1147
1148/// Pattern that matches an unknown `RingBufferSetActiveChannelsError` member.
1149#[macro_export]
1150macro_rules! RingBufferSetActiveChannelsErrorUnknown {
1151    () => {
1152        _
1153    };
1154}
1155
1156impl RingBufferSetActiveChannelsError {
1157    #[inline]
1158    pub fn from_primitive(prim: u32) -> Option<Self> {
1159        match prim {
1160            1 => Some(Self::DeviceError),
1161            2 => Some(Self::AlreadyPending),
1162            3 => Some(Self::MethodNotSupported),
1163            4 => Some(Self::InvalidChannelBitmask),
1164            5 => Some(Self::ChannelOutOfRange),
1165            _ => None,
1166        }
1167    }
1168
1169    #[inline]
1170    pub fn from_primitive_allow_unknown(prim: u32) -> Self {
1171        match prim {
1172            1 => Self::DeviceError,
1173            2 => Self::AlreadyPending,
1174            3 => Self::MethodNotSupported,
1175            4 => Self::InvalidChannelBitmask,
1176            5 => Self::ChannelOutOfRange,
1177            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
1178        }
1179    }
1180
1181    #[inline]
1182    pub fn unknown() -> Self {
1183        Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
1184    }
1185
1186    #[inline]
1187    pub const fn into_primitive(self) -> u32 {
1188        match self {
1189            Self::DeviceError => 1,
1190            Self::AlreadyPending => 2,
1191            Self::MethodNotSupported => 3,
1192            Self::InvalidChannelBitmask => 4,
1193            Self::ChannelOutOfRange => 5,
1194            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
1195        }
1196    }
1197
1198    #[inline]
1199    pub fn is_unknown(&self) -> bool {
1200        match self {
1201            Self::__SourceBreaking { unknown_ordinal: _ } => true,
1202            _ => false,
1203        }
1204    }
1205}
1206
1207/// Errors returned by `RingBuffer/Start`.
1208#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
1209pub enum RingBufferStartError {
1210    /// This device has encountered an error and can no longer be controlled.
1211    DeviceError,
1212    /// The previous `Start` call has not yet completed.
1213    AlreadyPending,
1214    /// `Start` was called on a ring buffer that is already started.
1215    AlreadyStarted,
1216    #[doc(hidden)]
1217    __SourceBreaking { unknown_ordinal: u32 },
1218}
1219
1220/// Pattern that matches an unknown `RingBufferStartError` member.
1221#[macro_export]
1222macro_rules! RingBufferStartErrorUnknown {
1223    () => {
1224        _
1225    };
1226}
1227
1228impl RingBufferStartError {
1229    #[inline]
1230    pub fn from_primitive(prim: u32) -> Option<Self> {
1231        match prim {
1232            1 => Some(Self::DeviceError),
1233            2 => Some(Self::AlreadyPending),
1234            3 => Some(Self::AlreadyStarted),
1235            _ => None,
1236        }
1237    }
1238
1239    #[inline]
1240    pub fn from_primitive_allow_unknown(prim: u32) -> Self {
1241        match prim {
1242            1 => Self::DeviceError,
1243            2 => Self::AlreadyPending,
1244            3 => Self::AlreadyStarted,
1245            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
1246        }
1247    }
1248
1249    #[inline]
1250    pub fn unknown() -> Self {
1251        Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
1252    }
1253
1254    #[inline]
1255    pub const fn into_primitive(self) -> u32 {
1256        match self {
1257            Self::DeviceError => 1,
1258            Self::AlreadyPending => 2,
1259            Self::AlreadyStarted => 3,
1260            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
1261        }
1262    }
1263
1264    #[inline]
1265    pub fn is_unknown(&self) -> bool {
1266        match self {
1267            Self::__SourceBreaking { unknown_ordinal: _ } => true,
1268            _ => false,
1269        }
1270    }
1271}
1272
1273/// Errors returned by `RingBuffer/Stop`.
1274#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
1275pub enum RingBufferStopError {
1276    /// This device has encountered an error and can no longer be controlled.
1277    DeviceError,
1278    /// The previous `Stop` call has not yet completed.
1279    AlreadyPending,
1280    /// `Stop` was called on a ring buffer that is already stopped.
1281    AlreadyStopped,
1282    #[doc(hidden)]
1283    __SourceBreaking { unknown_ordinal: u32 },
1284}
1285
1286/// Pattern that matches an unknown `RingBufferStopError` member.
1287#[macro_export]
1288macro_rules! RingBufferStopErrorUnknown {
1289    () => {
1290        _
1291    };
1292}
1293
1294impl RingBufferStopError {
1295    #[inline]
1296    pub fn from_primitive(prim: u32) -> Option<Self> {
1297        match prim {
1298            1 => Some(Self::DeviceError),
1299            2 => Some(Self::AlreadyPending),
1300            3 => Some(Self::AlreadyStopped),
1301            _ => None,
1302        }
1303    }
1304
1305    #[inline]
1306    pub fn from_primitive_allow_unknown(prim: u32) -> Self {
1307        match prim {
1308            1 => Self::DeviceError,
1309            2 => Self::AlreadyPending,
1310            3 => Self::AlreadyStopped,
1311            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
1312        }
1313    }
1314
1315    #[inline]
1316    pub fn unknown() -> Self {
1317        Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
1318    }
1319
1320    #[inline]
1321    pub const fn into_primitive(self) -> u32 {
1322        match self {
1323            Self::DeviceError => 1,
1324            Self::AlreadyPending => 2,
1325            Self::AlreadyStopped => 3,
1326            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
1327        }
1328    }
1329
1330    #[inline]
1331    pub fn is_unknown(&self) -> bool {
1332        match self {
1333            Self::__SourceBreaking { unknown_ordinal: _ } => true,
1334            _ => false,
1335        }
1336    }
1337}
1338
1339/// Errors returned by `RingBuffer/WatchDelayInfo`.
1340#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
1341pub enum RingBufferWatchDelayInfoError {
1342    /// This device has encountered an error and can no longer be observed.
1343    DeviceError,
1344    /// The previous `WatchDelayInfo` call has not yet completed.
1345    AlreadyPending,
1346    #[doc(hidden)]
1347    __SourceBreaking { unknown_ordinal: u32 },
1348}
1349
1350/// Pattern that matches an unknown `RingBufferWatchDelayInfoError` member.
1351#[macro_export]
1352macro_rules! RingBufferWatchDelayInfoErrorUnknown {
1353    () => {
1354        _
1355    };
1356}
1357
1358impl RingBufferWatchDelayInfoError {
1359    #[inline]
1360    pub fn from_primitive(prim: u32) -> Option<Self> {
1361        match prim {
1362            1 => Some(Self::DeviceError),
1363            2 => Some(Self::AlreadyPending),
1364            _ => None,
1365        }
1366    }
1367
1368    #[inline]
1369    pub fn from_primitive_allow_unknown(prim: u32) -> Self {
1370        match prim {
1371            1 => Self::DeviceError,
1372            2 => Self::AlreadyPending,
1373            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
1374        }
1375    }
1376
1377    #[inline]
1378    pub fn unknown() -> Self {
1379        Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
1380    }
1381
1382    #[inline]
1383    pub const fn into_primitive(self) -> u32 {
1384        match self {
1385            Self::DeviceError => 1,
1386            Self::AlreadyPending => 2,
1387            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
1388        }
1389    }
1390
1391    #[inline]
1392    pub fn is_unknown(&self) -> bool {
1393        match self {
1394            Self::__SourceBreaking { unknown_ordinal: _ } => true,
1395            _ => false,
1396        }
1397    }
1398}
1399
1400/// The attributes (e.g. frequency range) of a single channel.
1401#[derive(Clone, Debug, Default, PartialEq)]
1402pub struct ChannelAttributes {
1403    /// Minimum frequency that this channel guarantees to emit/capture, in Hz.
1404    /// If absent, this channel extends to the bottom of the device range.
1405    ///
1406    /// Optional.
1407    pub min_frequency: Option<u32>,
1408    /// Maximum frequency that this channel guarantees to emit/capture, in Hz.
1409    /// If absent, this channel extends to the top of the device range.
1410    ///
1411    /// Optional.
1412    pub max_frequency: Option<u32>,
1413    #[doc(hidden)]
1414    pub __source_breaking: fidl::marker::SourceBreaking,
1415}
1416
1417impl fidl::Persistable for ChannelAttributes {}
1418
1419/// One possible channel configuration for the device.
1420#[derive(Clone, Debug, Default, PartialEq)]
1421pub struct ChannelSet {
1422    /// Each item in this vector describes the attributes (e.g. frequency range)
1423    /// of that channel. The length of this vector defines the number of
1424    /// channels supported by this ChannelSet. Must contain at least one entry.
1425    ///
1426    /// Required.
1427    pub attributes: Option<Vec<ChannelAttributes>>,
1428    #[doc(hidden)]
1429    pub __source_breaking: fidl::marker::SourceBreaking,
1430}
1431
1432impl fidl::Persistable for ChannelSet {}
1433
1434#[derive(Clone, Debug, Default, PartialEq)]
1435pub struct ControlCreatorCreateResponse {
1436    #[doc(hidden)]
1437    pub __source_breaking: fidl::marker::SourceBreaking,
1438}
1439
1440impl fidl::Persistable for ControlCreatorCreateResponse {}
1441
1442#[derive(Clone, Debug, Default, PartialEq)]
1443pub struct ControlSetDaiFormatRequest {
1444    /// The element ID for an `ENDPOINT` of type `DAI_INTERCONNECT`.
1445    ///
1446    /// Required for Composite; ignored for Codec.
1447    pub element_id: Option<u64>,
1448    pub dai_format: Option<fidl_fuchsia_hardware_audio::DaiFormat>,
1449    #[doc(hidden)]
1450    pub __source_breaking: fidl::marker::SourceBreaking,
1451}
1452
1453impl fidl::Persistable for ControlSetDaiFormatRequest {}
1454
1455#[derive(Clone, Debug, Default, PartialEq)]
1456pub struct ControlCodecStartResponse {
1457    pub start_time: Option<i64>,
1458    #[doc(hidden)]
1459    pub __source_breaking: fidl::marker::SourceBreaking,
1460}
1461
1462impl fidl::Persistable for ControlCodecStartResponse {}
1463
1464#[derive(Clone, Debug, Default, PartialEq)]
1465pub struct ControlCodecStopResponse {
1466    pub stop_time: Option<i64>,
1467    #[doc(hidden)]
1468    pub __source_breaking: fidl::marker::SourceBreaking,
1469}
1470
1471impl fidl::Persistable for ControlCodecStopResponse {}
1472
1473#[derive(Clone, Debug, Default, PartialEq)]
1474pub struct ControlResetResponse {
1475    #[doc(hidden)]
1476    pub __source_breaking: fidl::marker::SourceBreaking,
1477}
1478
1479impl fidl::Persistable for ControlResetResponse {}
1480
1481#[derive(Clone, Debug, Default, PartialEq)]
1482pub struct ControlSetDaiFormatResponse {
1483    pub state: Option<fidl_fuchsia_hardware_audio::CodecFormatInfo>,
1484    #[doc(hidden)]
1485    pub __source_breaking: fidl::marker::SourceBreaking,
1486}
1487
1488impl fidl::Persistable for ControlSetDaiFormatResponse {}
1489
1490#[derive(Clone, Debug, Default, PartialEq)]
1491pub struct DelayInfo {
1492    /// The driver's best estimate of the delay internal to the hardware it abstracts for
1493    /// the chosen format. This duration must be non-negative.
1494    ///
1495    /// Required.
1496    pub internal_delay: Option<i64>,
1497    /// The amount of pipeline delay beyond the interconnect (subsequent to the
1498    /// DMA "read" position for output devices, or prior to the DMA "write"
1499    /// position for input devices). If present, this duration must be non-negative.
1500    ///
1501    /// Optional.
1502    pub external_delay: Option<i64>,
1503    #[doc(hidden)]
1504    pub __source_breaking: fidl::marker::SourceBreaking,
1505}
1506
1507impl fidl::Persistable for DelayInfo {}
1508
1509/// This table represents the possible Dai formats that this endpoint can support.
1510#[derive(Clone, Debug, Default, PartialEq)]
1511pub struct ElementDaiFormatSet {
1512    /// The ID of the element being described. This must match an ENDPOINT (DAI_INTERCONNECT)
1513    /// entry in the list of elements contained in the device's `Info` table. If describing the
1514    /// supported DAI formats for a Codec device, this value should be
1515    /// `DEFAULT_DAI_INTERCONNECT_ELEMENT_ID` (1).
1516    ///
1517    /// Required.
1518    pub element_id: Option<u64>,
1519    /// The dai_format_set entries that this element supports.
1520    ///
1521    /// Required. Must contain at least one entry.
1522    pub format_sets: Option<Vec<fidl_fuchsia_hardware_audio::DaiSupportedFormats>>,
1523    #[doc(hidden)]
1524    pub __source_breaking: fidl::marker::SourceBreaking,
1525}
1526
1527impl fidl::Persistable for ElementDaiFormatSet {}
1528
1529/// This table represents the possible RingBuffer formats that this endpoint can support.
1530#[derive(Clone, Debug, Default, PartialEq)]
1531pub struct ElementRingBufferFormatSet {
1532    /// The ID of the element being described. This must match an ENDPOINT (RING_BUFFER) entry
1533    /// in the list of elements contained in the device's `Info` table.
1534    ///
1535    /// Required.
1536    pub element_id: Option<u64>,
1537    /// The ring_buffer_format_set entries that this element supports.
1538    ///
1539    /// Required. Must contain at least one entry.
1540    pub format_sets: Option<Vec<PcmFormatSet>>,
1541    #[doc(hidden)]
1542    pub __source_breaking: fidl::marker::SourceBreaking,
1543}
1544
1545impl fidl::Persistable for ElementRingBufferFormatSet {}
1546
1547/// When a device is detected (or added via `Provider/AddDevice`), it is
1548/// queried for its properties and capabilities. Once this enumeration process
1549/// completes, it is announced to clients that are watching for device arrivals
1550/// via `Registry/WatchDevicesAdded`.
1551///
1552/// An `Info` table is returned for each audio device that has been added.
1553#[derive(Clone, Debug, Default, PartialEq)]
1554pub struct Info {
1555    /// A device identifier that is guaranteed unique for this boot session, but
1556    /// may change across reboots.
1557    ///
1558    /// Required.
1559    pub token_id: Option<u64>,
1560    /// The protocol used by the driver.
1561    ///
1562    /// Required.
1563    pub device_type: Option<DeviceType>,
1564    /// The device's high-level name, as received from devfs or the `Provider/AddDevice` caller.
1565    /// This string must be non-empty.
1566    ///
1567    /// Required.
1568    pub device_name: Option<String>,
1569    /// The name of the device's manufacturer.
1570    /// If present, this string must be non-empty.
1571    ///
1572    /// Optional.
1573    pub manufacturer: Option<String>,
1574    /// The device's high-level product name.
1575    /// If present, this string must be non-empty.
1576    ///
1577    /// Optional.
1578    pub product: Option<String>,
1579    /// A 16-character ID provided by the driver that (if present) can be used
1580    /// to differentiate instances of the same device. This value should not
1581    /// change across system reboots.
1582    ///
1583    /// Optional.
1584    pub unique_instance_id: Option<[u8; 16]>,
1585    /// Whether the device is a source (is_input TRUE) or destination (is_input FALSE) of audio.
1586    ///
1587    /// Optional for Codec; absent for Composite.
1588    pub is_input: Option<bool>,
1589    /// The union of all formats the device can support, across all combinations of device
1590    /// configuration settings.
1591    /// If the device exposes one or more RingBuffer ENDPOINT elements, this field must be present
1592    /// and its vector must contain exactly one entry for each relevant ENDPOINT element.
1593    /// If the device exposes NO RingBuffer ENDPOINT elements, this field must be omitted (entirely
1594    /// absent, rather than populated with an empty vector).
1595    /// If present, must contain at least one element.
1596    ///
1597    /// Optional for Composite; absent for Codec.
1598    pub ring_buffer_format_sets: Option<Vec<ElementRingBufferFormatSet>>,
1599    /// The union of all DAI formats the device can support, across all combinations
1600    /// of device configuration settings.
1601    /// If the device exposes one or more Dai ENDPOINT elements, this field must be present and its
1602    /// vector must contain exactly one entry for each relevant ENDPOINT element.
1603    /// If the device exposes NO Dai ENDPOINT elements, this field must be omitted (entirely absent,
1604    /// rather than populated with an empty vector).
1605    /// If present, must contain at least one element.
1606    ///
1607    /// Required for Codec; optional for Composite.
1608    pub dai_format_sets: Option<Vec<ElementDaiFormatSet>>,
1609    /// The device's hot-plug capabilities.
1610    ///
1611    /// Required for Codec; absent for Composite.
1612    pub plug_detect_caps: Option<PlugDetectCapabilities>,
1613    /// An identifier for the clock domain in which the device's clock hardware
1614    /// operates. Devices in the same clock domain remain perfectly
1615    /// synchronized. They may drift relative to some other clock domain, but
1616    /// all clocks in that domain will do so perfectly  _together_. Although
1617    /// their clocks have the same rate, their positions may be offset by an
1618    /// arbitrary, fixed amount.
1619    ///
1620    /// There are two special values for clock domain:
1621    ///
1622    /// *  `CLOCK_DOMAIN_MONOTONIC` means the hardware is driven by the system
1623    ///    montonic clock and will always be synchronized with that timeline.
1624    ///
1625    /// *  `CLOCK_DOMAIN_EXTERNAL` means the hardware is not synchronized with any
1626    ///    other known clocks (even any other clocks in `CLOCK_DOMAIN_EXTERNAL`).
1627    ///
1628    /// Required for Composite; absent for Codec.
1629    pub clock_domain: Option<u32>,
1630    /// The vector of supported signal-processing elements.
1631    /// If present, must contain at least one element.
1632    ///
1633    /// Required for Composite; optional for Codec.
1634    pub signal_processing_elements:
1635        Option<Vec<fidl_fuchsia_hardware_audio_signalprocessing::Element>>,
1636    /// The vector of supported signal-processing topologies.
1637    /// If present, must contain at least one element.
1638    ///
1639    /// Required for Composite; optional for Codec.
1640    pub signal_processing_topologies:
1641        Option<Vec<fidl_fuchsia_hardware_audio_signalprocessing::Topology>>,
1642    #[doc(hidden)]
1643    pub __source_breaking: fidl::marker::SourceBreaking,
1644}
1645
1646impl fidl::Persistable for Info {}
1647
1648#[derive(Clone, Debug, Default, PartialEq)]
1649pub struct ObserverWatchPlugStateResponse {
1650    /// The device's current plug state.
1651    pub state: Option<PlugState>,
1652    /// The time (in CLOCK_MONOTONIC) of the most-recent change in plug state.
1653    pub plug_time: Option<i64>,
1654    #[doc(hidden)]
1655    pub __source_breaking: fidl::marker::SourceBreaking,
1656}
1657
1658impl fidl::Persistable for ObserverWatchPlugStateResponse {}
1659
1660/// This table contains vectors representing three dimensions of device
1661/// configuration (channelization, sample format, frame rate). The device should
1662/// support all combinations of the items in these vectors.
1663#[derive(Clone, Debug, Default, PartialEq)]
1664pub struct PcmFormatSet {
1665    /// The number of channel sets that the device supports. This must contain
1666    /// at least one `ChannelSet` entry.
1667    ///
1668    /// Required.
1669    pub channel_sets: Option<Vec<ChannelSet>>,
1670    /// The number of sample formats that the device supports. This must
1671    /// contain least one `AudioSampleFormat` entry.
1672    ///
1673    /// Required.
1674    pub sample_types: Option<Vec<fidl_fuchsia_audio::SampleType>>,
1675    /// The number of frame rates that the device supports. This must contain at
1676    /// least one frame rate entry.
1677    ///
1678    /// Required.
1679    pub frame_rates: Option<Vec<u32>>,
1680    #[doc(hidden)]
1681    pub __source_breaking: fidl::marker::SourceBreaking,
1682}
1683
1684impl fidl::Persistable for PcmFormatSet {}
1685
1686#[derive(Clone, Debug, Default, PartialEq)]
1687pub struct ProviderAddDeviceResponse {
1688    #[doc(hidden)]
1689    pub __source_breaking: fidl::marker::SourceBreaking,
1690}
1691
1692impl fidl::Persistable for ProviderAddDeviceResponse {}
1693
1694#[derive(Clone, Debug, Default, PartialEq)]
1695pub struct RegistryCreateObserverResponse {
1696    #[doc(hidden)]
1697    pub __source_breaking: fidl::marker::SourceBreaking,
1698}
1699
1700impl fidl::Persistable for RegistryCreateObserverResponse {}
1701
1702#[derive(Clone, Debug, Default, PartialEq)]
1703pub struct RegistryWatchDeviceRemovedResponse {
1704    /// The token of the device least-recently removed.
1705    pub token_id: Option<u64>,
1706    #[doc(hidden)]
1707    pub __source_breaking: fidl::marker::SourceBreaking,
1708}
1709
1710impl fidl::Persistable for RegistryWatchDeviceRemovedResponse {}
1711
1712#[derive(Clone, Debug, Default, PartialEq)]
1713pub struct RegistryWatchDevicesAddedResponse {
1714    /// Devices added since `WatchDevicesAdded` was last called. When called
1715    /// for the first time, this method returns all available audio devices
1716    /// (even an empty vector, if no audio devices are present). Subsequent
1717    /// calls will pend until additional devices become available.
1718    pub devices: Option<Vec<Info>>,
1719    #[doc(hidden)]
1720    pub __source_breaking: fidl::marker::SourceBreaking,
1721}
1722
1723impl fidl::Persistable for RegistryWatchDevicesAddedResponse {}
1724
1725/// Parameters specified by a caller when creating a ring buffer.
1726#[derive(Clone, Debug, Default, PartialEq)]
1727pub struct RingBufferOptions {
1728    /// The format (sample format, channelization, frame rate) of the ring
1729    /// buffer to be created.
1730    ///
1731    /// Required.
1732    pub format: Option<fidl_fuchsia_audio::Format>,
1733    /// The minimum number of bytes required in the ring buffer. The actual
1734    /// buffer may be larger, as required by the encoding, driver, device or OS.
1735    ///
1736    /// Required.
1737    pub ring_buffer_min_bytes: Option<u32>,
1738    #[doc(hidden)]
1739    pub __source_breaking: fidl::marker::SourceBreaking,
1740}
1741
1742impl fidl::Persistable for RingBufferOptions {}
1743
1744/// Information about the ring buffer or associated audio stream.
1745#[derive(Clone, Debug, Default, PartialEq)]
1746pub struct RingBufferProperties {
1747    /// The number of bits (starting with the most significant) that are valid,
1748    /// within each individual sample. This may be be smaller than the actual
1749    /// sample size, in the case of an input ring buffer fed by an 18-bit ADC
1750    /// for example. Any additional bits of precision should be ignored.
1751    ///
1752    /// Required.
1753    pub valid_bits_per_sample: Option<u8>,
1754    /// The maximum delay until disabled channels become fully operational,
1755    /// after calling `SetActiveChannels`. This is the worst-case duration when
1756    /// reenabling all channels. The value must be non-negative.
1757    ///
1758    /// Required.
1759    pub turn_on_delay: Option<i64>,
1760    #[doc(hidden)]
1761    pub __source_breaking: fidl::marker::SourceBreaking,
1762}
1763
1764impl fidl::Persistable for RingBufferProperties {}
1765
1766#[derive(Clone, Debug, Default, PartialEq)]
1767pub struct RingBufferSetActiveChannelsRequest {
1768    /// The channels to be activated (all others should be deactivated). No
1769    /// bit should be set above the `channel_count` specified in the ring
1770    /// buffer format (e.g. for a four-channel stream, `channel_bitmask`
1771    /// must be in the [0x00, 0x0F] range).
1772    ///
1773    /// Required.
1774    pub channel_bitmask: Option<u64>,
1775    #[doc(hidden)]
1776    pub __source_breaking: fidl::marker::SourceBreaking,
1777}
1778
1779impl fidl::Persistable for RingBufferSetActiveChannelsRequest {}
1780
1781#[derive(Clone, Debug, Default, PartialEq)]
1782pub struct RingBufferStartRequest {
1783    #[doc(hidden)]
1784    pub __source_breaking: fidl::marker::SourceBreaking,
1785}
1786
1787impl fidl::Persistable for RingBufferStartRequest {}
1788
1789#[derive(Clone, Debug, Default, PartialEq)]
1790pub struct RingBufferStopRequest {
1791    #[doc(hidden)]
1792    pub __source_breaking: fidl::marker::SourceBreaking,
1793}
1794
1795impl fidl::Persistable for RingBufferStopRequest {}
1796
1797#[derive(Clone, Debug, Default, PartialEq)]
1798pub struct RingBufferSetActiveChannelsResponse {
1799    /// The CLOCK_MONOTONIC time when the hardware was configured. Note:
1800    /// this does not include the effects of `turn_on_delay` on streams.
1801    ///
1802    /// Required.
1803    pub set_time: Option<i64>,
1804    #[doc(hidden)]
1805    pub __source_breaking: fidl::marker::SourceBreaking,
1806}
1807
1808impl fidl::Persistable for RingBufferSetActiveChannelsResponse {}
1809
1810#[derive(Clone, Debug, Default, PartialEq)]
1811pub struct RingBufferStartResponse {
1812    /// The CLOCK_MONOTONIC time when the stream was started.
1813    ///
1814    /// Required.
1815    pub start_time: Option<i64>,
1816    #[doc(hidden)]
1817    pub __source_breaking: fidl::marker::SourceBreaking,
1818}
1819
1820impl fidl::Persistable for RingBufferStartResponse {}
1821
1822#[derive(Clone, Debug, Default, PartialEq)]
1823pub struct RingBufferStopResponse {
1824    #[doc(hidden)]
1825    pub __source_breaking: fidl::marker::SourceBreaking,
1826}
1827
1828impl fidl::Persistable for RingBufferStopResponse {}
1829
1830#[derive(Clone, Debug, Default, PartialEq)]
1831pub struct RingBufferWatchDelayInfoResponse {
1832    /// Required.
1833    pub delay_info: Option<DelayInfo>,
1834    #[doc(hidden)]
1835    pub __source_breaking: fidl::marker::SourceBreaking,
1836}
1837
1838impl fidl::Persistable for RingBufferWatchDelayInfoResponse {}
1839
1840mod internal {
1841    use super::*;
1842    unsafe impl fidl::encoding::TypeMarker for ControlCodecStartError {
1843        type Owned = Self;
1844
1845        #[inline(always)]
1846        fn inline_align(_context: fidl::encoding::Context) -> usize {
1847            std::mem::align_of::<u32>()
1848        }
1849
1850        #[inline(always)]
1851        fn inline_size(_context: fidl::encoding::Context) -> usize {
1852            std::mem::size_of::<u32>()
1853        }
1854
1855        #[inline(always)]
1856        fn encode_is_copy() -> bool {
1857            false
1858        }
1859
1860        #[inline(always)]
1861        fn decode_is_copy() -> bool {
1862            false
1863        }
1864    }
1865
1866    impl fidl::encoding::ValueTypeMarker for ControlCodecStartError {
1867        type Borrowed<'a> = Self;
1868        #[inline(always)]
1869        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1870            *value
1871        }
1872    }
1873
1874    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
1875        for ControlCodecStartError
1876    {
1877        #[inline]
1878        unsafe fn encode(
1879            self,
1880            encoder: &mut fidl::encoding::Encoder<'_, D>,
1881            offset: usize,
1882            _depth: fidl::encoding::Depth,
1883        ) -> fidl::Result<()> {
1884            encoder.debug_check_bounds::<Self>(offset);
1885            encoder.write_num(self.into_primitive(), offset);
1886            Ok(())
1887        }
1888    }
1889
1890    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1891        for ControlCodecStartError
1892    {
1893        #[inline(always)]
1894        fn new_empty() -> Self {
1895            Self::unknown()
1896        }
1897
1898        #[inline]
1899        unsafe fn decode(
1900            &mut self,
1901            decoder: &mut fidl::encoding::Decoder<'_, D>,
1902            offset: usize,
1903            _depth: fidl::encoding::Depth,
1904        ) -> fidl::Result<()> {
1905            decoder.debug_check_bounds::<Self>(offset);
1906            let prim = decoder.read_num::<u32>(offset);
1907
1908            *self = Self::from_primitive_allow_unknown(prim);
1909            Ok(())
1910        }
1911    }
1912    unsafe impl fidl::encoding::TypeMarker for ControlCodecStopError {
1913        type Owned = Self;
1914
1915        #[inline(always)]
1916        fn inline_align(_context: fidl::encoding::Context) -> usize {
1917            std::mem::align_of::<u32>()
1918        }
1919
1920        #[inline(always)]
1921        fn inline_size(_context: fidl::encoding::Context) -> usize {
1922            std::mem::size_of::<u32>()
1923        }
1924
1925        #[inline(always)]
1926        fn encode_is_copy() -> bool {
1927            false
1928        }
1929
1930        #[inline(always)]
1931        fn decode_is_copy() -> bool {
1932            false
1933        }
1934    }
1935
1936    impl fidl::encoding::ValueTypeMarker for ControlCodecStopError {
1937        type Borrowed<'a> = Self;
1938        #[inline(always)]
1939        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1940            *value
1941        }
1942    }
1943
1944    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
1945        for ControlCodecStopError
1946    {
1947        #[inline]
1948        unsafe fn encode(
1949            self,
1950            encoder: &mut fidl::encoding::Encoder<'_, D>,
1951            offset: usize,
1952            _depth: fidl::encoding::Depth,
1953        ) -> fidl::Result<()> {
1954            encoder.debug_check_bounds::<Self>(offset);
1955            encoder.write_num(self.into_primitive(), offset);
1956            Ok(())
1957        }
1958    }
1959
1960    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ControlCodecStopError {
1961        #[inline(always)]
1962        fn new_empty() -> Self {
1963            Self::unknown()
1964        }
1965
1966        #[inline]
1967        unsafe fn decode(
1968            &mut self,
1969            decoder: &mut fidl::encoding::Decoder<'_, D>,
1970            offset: usize,
1971            _depth: fidl::encoding::Depth,
1972        ) -> fidl::Result<()> {
1973            decoder.debug_check_bounds::<Self>(offset);
1974            let prim = decoder.read_num::<u32>(offset);
1975
1976            *self = Self::from_primitive_allow_unknown(prim);
1977            Ok(())
1978        }
1979    }
1980    unsafe impl fidl::encoding::TypeMarker for ControlCreateRingBufferError {
1981        type Owned = Self;
1982
1983        #[inline(always)]
1984        fn inline_align(_context: fidl::encoding::Context) -> usize {
1985            std::mem::align_of::<u32>()
1986        }
1987
1988        #[inline(always)]
1989        fn inline_size(_context: fidl::encoding::Context) -> usize {
1990            std::mem::size_of::<u32>()
1991        }
1992
1993        #[inline(always)]
1994        fn encode_is_copy() -> bool {
1995            false
1996        }
1997
1998        #[inline(always)]
1999        fn decode_is_copy() -> bool {
2000            false
2001        }
2002    }
2003
2004    impl fidl::encoding::ValueTypeMarker for ControlCreateRingBufferError {
2005        type Borrowed<'a> = Self;
2006        #[inline(always)]
2007        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2008            *value
2009        }
2010    }
2011
2012    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
2013        for ControlCreateRingBufferError
2014    {
2015        #[inline]
2016        unsafe fn encode(
2017            self,
2018            encoder: &mut fidl::encoding::Encoder<'_, D>,
2019            offset: usize,
2020            _depth: fidl::encoding::Depth,
2021        ) -> fidl::Result<()> {
2022            encoder.debug_check_bounds::<Self>(offset);
2023            encoder.write_num(self.into_primitive(), offset);
2024            Ok(())
2025        }
2026    }
2027
2028    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2029        for ControlCreateRingBufferError
2030    {
2031        #[inline(always)]
2032        fn new_empty() -> Self {
2033            Self::unknown()
2034        }
2035
2036        #[inline]
2037        unsafe fn decode(
2038            &mut self,
2039            decoder: &mut fidl::encoding::Decoder<'_, D>,
2040            offset: usize,
2041            _depth: fidl::encoding::Depth,
2042        ) -> fidl::Result<()> {
2043            decoder.debug_check_bounds::<Self>(offset);
2044            let prim = decoder.read_num::<u32>(offset);
2045
2046            *self = Self::from_primitive_allow_unknown(prim);
2047            Ok(())
2048        }
2049    }
2050    unsafe impl fidl::encoding::TypeMarker for ControlCreatorError {
2051        type Owned = Self;
2052
2053        #[inline(always)]
2054        fn inline_align(_context: fidl::encoding::Context) -> usize {
2055            std::mem::align_of::<u32>()
2056        }
2057
2058        #[inline(always)]
2059        fn inline_size(_context: fidl::encoding::Context) -> usize {
2060            std::mem::size_of::<u32>()
2061        }
2062
2063        #[inline(always)]
2064        fn encode_is_copy() -> bool {
2065            false
2066        }
2067
2068        #[inline(always)]
2069        fn decode_is_copy() -> bool {
2070            false
2071        }
2072    }
2073
2074    impl fidl::encoding::ValueTypeMarker for ControlCreatorError {
2075        type Borrowed<'a> = Self;
2076        #[inline(always)]
2077        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2078            *value
2079        }
2080    }
2081
2082    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
2083        for ControlCreatorError
2084    {
2085        #[inline]
2086        unsafe fn encode(
2087            self,
2088            encoder: &mut fidl::encoding::Encoder<'_, D>,
2089            offset: usize,
2090            _depth: fidl::encoding::Depth,
2091        ) -> fidl::Result<()> {
2092            encoder.debug_check_bounds::<Self>(offset);
2093            encoder.write_num(self.into_primitive(), offset);
2094            Ok(())
2095        }
2096    }
2097
2098    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ControlCreatorError {
2099        #[inline(always)]
2100        fn new_empty() -> Self {
2101            Self::unknown()
2102        }
2103
2104        #[inline]
2105        unsafe fn decode(
2106            &mut self,
2107            decoder: &mut fidl::encoding::Decoder<'_, D>,
2108            offset: usize,
2109            _depth: fidl::encoding::Depth,
2110        ) -> fidl::Result<()> {
2111            decoder.debug_check_bounds::<Self>(offset);
2112            let prim = decoder.read_num::<u32>(offset);
2113
2114            *self = Self::from_primitive_allow_unknown(prim);
2115            Ok(())
2116        }
2117    }
2118    unsafe impl fidl::encoding::TypeMarker for ControlResetError {
2119        type Owned = Self;
2120
2121        #[inline(always)]
2122        fn inline_align(_context: fidl::encoding::Context) -> usize {
2123            std::mem::align_of::<u32>()
2124        }
2125
2126        #[inline(always)]
2127        fn inline_size(_context: fidl::encoding::Context) -> usize {
2128            std::mem::size_of::<u32>()
2129        }
2130
2131        #[inline(always)]
2132        fn encode_is_copy() -> bool {
2133            false
2134        }
2135
2136        #[inline(always)]
2137        fn decode_is_copy() -> bool {
2138            false
2139        }
2140    }
2141
2142    impl fidl::encoding::ValueTypeMarker for ControlResetError {
2143        type Borrowed<'a> = Self;
2144        #[inline(always)]
2145        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2146            *value
2147        }
2148    }
2149
2150    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
2151        for ControlResetError
2152    {
2153        #[inline]
2154        unsafe fn encode(
2155            self,
2156            encoder: &mut fidl::encoding::Encoder<'_, D>,
2157            offset: usize,
2158            _depth: fidl::encoding::Depth,
2159        ) -> fidl::Result<()> {
2160            encoder.debug_check_bounds::<Self>(offset);
2161            encoder.write_num(self.into_primitive(), offset);
2162            Ok(())
2163        }
2164    }
2165
2166    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ControlResetError {
2167        #[inline(always)]
2168        fn new_empty() -> Self {
2169            Self::unknown()
2170        }
2171
2172        #[inline]
2173        unsafe fn decode(
2174            &mut self,
2175            decoder: &mut fidl::encoding::Decoder<'_, D>,
2176            offset: usize,
2177            _depth: fidl::encoding::Depth,
2178        ) -> fidl::Result<()> {
2179            decoder.debug_check_bounds::<Self>(offset);
2180            let prim = decoder.read_num::<u32>(offset);
2181
2182            *self = Self::from_primitive_allow_unknown(prim);
2183            Ok(())
2184        }
2185    }
2186    unsafe impl fidl::encoding::TypeMarker for ControlSetDaiFormatError {
2187        type Owned = Self;
2188
2189        #[inline(always)]
2190        fn inline_align(_context: fidl::encoding::Context) -> usize {
2191            std::mem::align_of::<u32>()
2192        }
2193
2194        #[inline(always)]
2195        fn inline_size(_context: fidl::encoding::Context) -> usize {
2196            std::mem::size_of::<u32>()
2197        }
2198
2199        #[inline(always)]
2200        fn encode_is_copy() -> bool {
2201            false
2202        }
2203
2204        #[inline(always)]
2205        fn decode_is_copy() -> bool {
2206            false
2207        }
2208    }
2209
2210    impl fidl::encoding::ValueTypeMarker for ControlSetDaiFormatError {
2211        type Borrowed<'a> = Self;
2212        #[inline(always)]
2213        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2214            *value
2215        }
2216    }
2217
2218    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
2219        for ControlSetDaiFormatError
2220    {
2221        #[inline]
2222        unsafe fn encode(
2223            self,
2224            encoder: &mut fidl::encoding::Encoder<'_, D>,
2225            offset: usize,
2226            _depth: fidl::encoding::Depth,
2227        ) -> fidl::Result<()> {
2228            encoder.debug_check_bounds::<Self>(offset);
2229            encoder.write_num(self.into_primitive(), offset);
2230            Ok(())
2231        }
2232    }
2233
2234    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2235        for ControlSetDaiFormatError
2236    {
2237        #[inline(always)]
2238        fn new_empty() -> Self {
2239            Self::unknown()
2240        }
2241
2242        #[inline]
2243        unsafe fn decode(
2244            &mut self,
2245            decoder: &mut fidl::encoding::Decoder<'_, D>,
2246            offset: usize,
2247            _depth: fidl::encoding::Depth,
2248        ) -> fidl::Result<()> {
2249            decoder.debug_check_bounds::<Self>(offset);
2250            let prim = decoder.read_num::<u32>(offset);
2251
2252            *self = Self::from_primitive_allow_unknown(prim);
2253            Ok(())
2254        }
2255    }
2256    unsafe impl fidl::encoding::TypeMarker for DeviceType {
2257        type Owned = Self;
2258
2259        #[inline(always)]
2260        fn inline_align(_context: fidl::encoding::Context) -> usize {
2261            std::mem::align_of::<u32>()
2262        }
2263
2264        #[inline(always)]
2265        fn inline_size(_context: fidl::encoding::Context) -> usize {
2266            std::mem::size_of::<u32>()
2267        }
2268
2269        #[inline(always)]
2270        fn encode_is_copy() -> bool {
2271            false
2272        }
2273
2274        #[inline(always)]
2275        fn decode_is_copy() -> bool {
2276            false
2277        }
2278    }
2279
2280    impl fidl::encoding::ValueTypeMarker for DeviceType {
2281        type Borrowed<'a> = Self;
2282        #[inline(always)]
2283        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2284            *value
2285        }
2286    }
2287
2288    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for DeviceType {
2289        #[inline]
2290        unsafe fn encode(
2291            self,
2292            encoder: &mut fidl::encoding::Encoder<'_, D>,
2293            offset: usize,
2294            _depth: fidl::encoding::Depth,
2295        ) -> fidl::Result<()> {
2296            encoder.debug_check_bounds::<Self>(offset);
2297            encoder.write_num(self.into_primitive(), offset);
2298            Ok(())
2299        }
2300    }
2301
2302    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for DeviceType {
2303        #[inline(always)]
2304        fn new_empty() -> Self {
2305            Self::unknown()
2306        }
2307
2308        #[inline]
2309        unsafe fn decode(
2310            &mut self,
2311            decoder: &mut fidl::encoding::Decoder<'_, D>,
2312            offset: usize,
2313            _depth: fidl::encoding::Depth,
2314        ) -> fidl::Result<()> {
2315            decoder.debug_check_bounds::<Self>(offset);
2316            let prim = decoder.read_num::<u32>(offset);
2317
2318            *self = Self::from_primitive_allow_unknown(prim);
2319            Ok(())
2320        }
2321    }
2322    unsafe impl fidl::encoding::TypeMarker for ObserverGetReferenceClockError {
2323        type Owned = Self;
2324
2325        #[inline(always)]
2326        fn inline_align(_context: fidl::encoding::Context) -> usize {
2327            std::mem::align_of::<u32>()
2328        }
2329
2330        #[inline(always)]
2331        fn inline_size(_context: fidl::encoding::Context) -> usize {
2332            std::mem::size_of::<u32>()
2333        }
2334
2335        #[inline(always)]
2336        fn encode_is_copy() -> bool {
2337            false
2338        }
2339
2340        #[inline(always)]
2341        fn decode_is_copy() -> bool {
2342            false
2343        }
2344    }
2345
2346    impl fidl::encoding::ValueTypeMarker for ObserverGetReferenceClockError {
2347        type Borrowed<'a> = Self;
2348        #[inline(always)]
2349        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2350            *value
2351        }
2352    }
2353
2354    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
2355        for ObserverGetReferenceClockError
2356    {
2357        #[inline]
2358        unsafe fn encode(
2359            self,
2360            encoder: &mut fidl::encoding::Encoder<'_, D>,
2361            offset: usize,
2362            _depth: fidl::encoding::Depth,
2363        ) -> fidl::Result<()> {
2364            encoder.debug_check_bounds::<Self>(offset);
2365            encoder.write_num(self.into_primitive(), offset);
2366            Ok(())
2367        }
2368    }
2369
2370    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2371        for ObserverGetReferenceClockError
2372    {
2373        #[inline(always)]
2374        fn new_empty() -> Self {
2375            Self::unknown()
2376        }
2377
2378        #[inline]
2379        unsafe fn decode(
2380            &mut self,
2381            decoder: &mut fidl::encoding::Decoder<'_, D>,
2382            offset: usize,
2383            _depth: fidl::encoding::Depth,
2384        ) -> fidl::Result<()> {
2385            decoder.debug_check_bounds::<Self>(offset);
2386            let prim = decoder.read_num::<u32>(offset);
2387
2388            *self = Self::from_primitive_allow_unknown(prim);
2389            Ok(())
2390        }
2391    }
2392    unsafe impl fidl::encoding::TypeMarker for ObserverWatchPlugStateError {
2393        type Owned = Self;
2394
2395        #[inline(always)]
2396        fn inline_align(_context: fidl::encoding::Context) -> usize {
2397            std::mem::align_of::<u32>()
2398        }
2399
2400        #[inline(always)]
2401        fn inline_size(_context: fidl::encoding::Context) -> usize {
2402            std::mem::size_of::<u32>()
2403        }
2404
2405        #[inline(always)]
2406        fn encode_is_copy() -> bool {
2407            false
2408        }
2409
2410        #[inline(always)]
2411        fn decode_is_copy() -> bool {
2412            false
2413        }
2414    }
2415
2416    impl fidl::encoding::ValueTypeMarker for ObserverWatchPlugStateError {
2417        type Borrowed<'a> = Self;
2418        #[inline(always)]
2419        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2420            *value
2421        }
2422    }
2423
2424    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
2425        for ObserverWatchPlugStateError
2426    {
2427        #[inline]
2428        unsafe fn encode(
2429            self,
2430            encoder: &mut fidl::encoding::Encoder<'_, D>,
2431            offset: usize,
2432            _depth: fidl::encoding::Depth,
2433        ) -> fidl::Result<()> {
2434            encoder.debug_check_bounds::<Self>(offset);
2435            encoder.write_num(self.into_primitive(), offset);
2436            Ok(())
2437        }
2438    }
2439
2440    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2441        for ObserverWatchPlugStateError
2442    {
2443        #[inline(always)]
2444        fn new_empty() -> Self {
2445            Self::unknown()
2446        }
2447
2448        #[inline]
2449        unsafe fn decode(
2450            &mut self,
2451            decoder: &mut fidl::encoding::Decoder<'_, D>,
2452            offset: usize,
2453            _depth: fidl::encoding::Depth,
2454        ) -> fidl::Result<()> {
2455            decoder.debug_check_bounds::<Self>(offset);
2456            let prim = decoder.read_num::<u32>(offset);
2457
2458            *self = Self::from_primitive_allow_unknown(prim);
2459            Ok(())
2460        }
2461    }
2462    unsafe impl fidl::encoding::TypeMarker for PlugDetectCapabilities {
2463        type Owned = Self;
2464
2465        #[inline(always)]
2466        fn inline_align(_context: fidl::encoding::Context) -> usize {
2467            std::mem::align_of::<u32>()
2468        }
2469
2470        #[inline(always)]
2471        fn inline_size(_context: fidl::encoding::Context) -> usize {
2472            std::mem::size_of::<u32>()
2473        }
2474
2475        #[inline(always)]
2476        fn encode_is_copy() -> bool {
2477            false
2478        }
2479
2480        #[inline(always)]
2481        fn decode_is_copy() -> bool {
2482            false
2483        }
2484    }
2485
2486    impl fidl::encoding::ValueTypeMarker for PlugDetectCapabilities {
2487        type Borrowed<'a> = Self;
2488        #[inline(always)]
2489        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2490            *value
2491        }
2492    }
2493
2494    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
2495        for PlugDetectCapabilities
2496    {
2497        #[inline]
2498        unsafe fn encode(
2499            self,
2500            encoder: &mut fidl::encoding::Encoder<'_, D>,
2501            offset: usize,
2502            _depth: fidl::encoding::Depth,
2503        ) -> fidl::Result<()> {
2504            encoder.debug_check_bounds::<Self>(offset);
2505            encoder.write_num(self.into_primitive(), offset);
2506            Ok(())
2507        }
2508    }
2509
2510    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2511        for PlugDetectCapabilities
2512    {
2513        #[inline(always)]
2514        fn new_empty() -> Self {
2515            Self::unknown()
2516        }
2517
2518        #[inline]
2519        unsafe fn decode(
2520            &mut self,
2521            decoder: &mut fidl::encoding::Decoder<'_, D>,
2522            offset: usize,
2523            _depth: fidl::encoding::Depth,
2524        ) -> fidl::Result<()> {
2525            decoder.debug_check_bounds::<Self>(offset);
2526            let prim = decoder.read_num::<u32>(offset);
2527
2528            *self = Self::from_primitive_allow_unknown(prim);
2529            Ok(())
2530        }
2531    }
2532    unsafe impl fidl::encoding::TypeMarker for PlugState {
2533        type Owned = Self;
2534
2535        #[inline(always)]
2536        fn inline_align(_context: fidl::encoding::Context) -> usize {
2537            std::mem::align_of::<u32>()
2538        }
2539
2540        #[inline(always)]
2541        fn inline_size(_context: fidl::encoding::Context) -> usize {
2542            std::mem::size_of::<u32>()
2543        }
2544
2545        #[inline(always)]
2546        fn encode_is_copy() -> bool {
2547            false
2548        }
2549
2550        #[inline(always)]
2551        fn decode_is_copy() -> bool {
2552            false
2553        }
2554    }
2555
2556    impl fidl::encoding::ValueTypeMarker for PlugState {
2557        type Borrowed<'a> = Self;
2558        #[inline(always)]
2559        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2560            *value
2561        }
2562    }
2563
2564    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for PlugState {
2565        #[inline]
2566        unsafe fn encode(
2567            self,
2568            encoder: &mut fidl::encoding::Encoder<'_, D>,
2569            offset: usize,
2570            _depth: fidl::encoding::Depth,
2571        ) -> fidl::Result<()> {
2572            encoder.debug_check_bounds::<Self>(offset);
2573            encoder.write_num(self.into_primitive(), offset);
2574            Ok(())
2575        }
2576    }
2577
2578    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for PlugState {
2579        #[inline(always)]
2580        fn new_empty() -> Self {
2581            Self::unknown()
2582        }
2583
2584        #[inline]
2585        unsafe fn decode(
2586            &mut self,
2587            decoder: &mut fidl::encoding::Decoder<'_, D>,
2588            offset: usize,
2589            _depth: fidl::encoding::Depth,
2590        ) -> fidl::Result<()> {
2591            decoder.debug_check_bounds::<Self>(offset);
2592            let prim = decoder.read_num::<u32>(offset);
2593
2594            *self = Self::from_primitive_allow_unknown(prim);
2595            Ok(())
2596        }
2597    }
2598    unsafe impl fidl::encoding::TypeMarker for ProviderAddDeviceError {
2599        type Owned = Self;
2600
2601        #[inline(always)]
2602        fn inline_align(_context: fidl::encoding::Context) -> usize {
2603            std::mem::align_of::<u32>()
2604        }
2605
2606        #[inline(always)]
2607        fn inline_size(_context: fidl::encoding::Context) -> usize {
2608            std::mem::size_of::<u32>()
2609        }
2610
2611        #[inline(always)]
2612        fn encode_is_copy() -> bool {
2613            false
2614        }
2615
2616        #[inline(always)]
2617        fn decode_is_copy() -> bool {
2618            false
2619        }
2620    }
2621
2622    impl fidl::encoding::ValueTypeMarker for ProviderAddDeviceError {
2623        type Borrowed<'a> = Self;
2624        #[inline(always)]
2625        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2626            *value
2627        }
2628    }
2629
2630    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
2631        for ProviderAddDeviceError
2632    {
2633        #[inline]
2634        unsafe fn encode(
2635            self,
2636            encoder: &mut fidl::encoding::Encoder<'_, D>,
2637            offset: usize,
2638            _depth: fidl::encoding::Depth,
2639        ) -> fidl::Result<()> {
2640            encoder.debug_check_bounds::<Self>(offset);
2641            encoder.write_num(self.into_primitive(), offset);
2642            Ok(())
2643        }
2644    }
2645
2646    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2647        for ProviderAddDeviceError
2648    {
2649        #[inline(always)]
2650        fn new_empty() -> Self {
2651            Self::unknown()
2652        }
2653
2654        #[inline]
2655        unsafe fn decode(
2656            &mut self,
2657            decoder: &mut fidl::encoding::Decoder<'_, D>,
2658            offset: usize,
2659            _depth: fidl::encoding::Depth,
2660        ) -> fidl::Result<()> {
2661            decoder.debug_check_bounds::<Self>(offset);
2662            let prim = decoder.read_num::<u32>(offset);
2663
2664            *self = Self::from_primitive_allow_unknown(prim);
2665            Ok(())
2666        }
2667    }
2668    unsafe impl fidl::encoding::TypeMarker for RegistryCreateObserverError {
2669        type Owned = Self;
2670
2671        #[inline(always)]
2672        fn inline_align(_context: fidl::encoding::Context) -> usize {
2673            std::mem::align_of::<u32>()
2674        }
2675
2676        #[inline(always)]
2677        fn inline_size(_context: fidl::encoding::Context) -> usize {
2678            std::mem::size_of::<u32>()
2679        }
2680
2681        #[inline(always)]
2682        fn encode_is_copy() -> bool {
2683            false
2684        }
2685
2686        #[inline(always)]
2687        fn decode_is_copy() -> bool {
2688            false
2689        }
2690    }
2691
2692    impl fidl::encoding::ValueTypeMarker for RegistryCreateObserverError {
2693        type Borrowed<'a> = Self;
2694        #[inline(always)]
2695        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2696            *value
2697        }
2698    }
2699
2700    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
2701        for RegistryCreateObserverError
2702    {
2703        #[inline]
2704        unsafe fn encode(
2705            self,
2706            encoder: &mut fidl::encoding::Encoder<'_, D>,
2707            offset: usize,
2708            _depth: fidl::encoding::Depth,
2709        ) -> fidl::Result<()> {
2710            encoder.debug_check_bounds::<Self>(offset);
2711            encoder.write_num(self.into_primitive(), offset);
2712            Ok(())
2713        }
2714    }
2715
2716    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2717        for RegistryCreateObserverError
2718    {
2719        #[inline(always)]
2720        fn new_empty() -> Self {
2721            Self::unknown()
2722        }
2723
2724        #[inline]
2725        unsafe fn decode(
2726            &mut self,
2727            decoder: &mut fidl::encoding::Decoder<'_, D>,
2728            offset: usize,
2729            _depth: fidl::encoding::Depth,
2730        ) -> fidl::Result<()> {
2731            decoder.debug_check_bounds::<Self>(offset);
2732            let prim = decoder.read_num::<u32>(offset);
2733
2734            *self = Self::from_primitive_allow_unknown(prim);
2735            Ok(())
2736        }
2737    }
2738    unsafe impl fidl::encoding::TypeMarker for RegistryWatchDeviceRemovedError {
2739        type Owned = Self;
2740
2741        #[inline(always)]
2742        fn inline_align(_context: fidl::encoding::Context) -> usize {
2743            std::mem::align_of::<u32>()
2744        }
2745
2746        #[inline(always)]
2747        fn inline_size(_context: fidl::encoding::Context) -> usize {
2748            std::mem::size_of::<u32>()
2749        }
2750
2751        #[inline(always)]
2752        fn encode_is_copy() -> bool {
2753            false
2754        }
2755
2756        #[inline(always)]
2757        fn decode_is_copy() -> bool {
2758            false
2759        }
2760    }
2761
2762    impl fidl::encoding::ValueTypeMarker for RegistryWatchDeviceRemovedError {
2763        type Borrowed<'a> = Self;
2764        #[inline(always)]
2765        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2766            *value
2767        }
2768    }
2769
2770    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
2771        for RegistryWatchDeviceRemovedError
2772    {
2773        #[inline]
2774        unsafe fn encode(
2775            self,
2776            encoder: &mut fidl::encoding::Encoder<'_, D>,
2777            offset: usize,
2778            _depth: fidl::encoding::Depth,
2779        ) -> fidl::Result<()> {
2780            encoder.debug_check_bounds::<Self>(offset);
2781            encoder.write_num(self.into_primitive(), offset);
2782            Ok(())
2783        }
2784    }
2785
2786    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2787        for RegistryWatchDeviceRemovedError
2788    {
2789        #[inline(always)]
2790        fn new_empty() -> Self {
2791            Self::unknown()
2792        }
2793
2794        #[inline]
2795        unsafe fn decode(
2796            &mut self,
2797            decoder: &mut fidl::encoding::Decoder<'_, D>,
2798            offset: usize,
2799            _depth: fidl::encoding::Depth,
2800        ) -> fidl::Result<()> {
2801            decoder.debug_check_bounds::<Self>(offset);
2802            let prim = decoder.read_num::<u32>(offset);
2803
2804            *self = Self::from_primitive_allow_unknown(prim);
2805            Ok(())
2806        }
2807    }
2808    unsafe impl fidl::encoding::TypeMarker for RegistryWatchDevicesAddedError {
2809        type Owned = Self;
2810
2811        #[inline(always)]
2812        fn inline_align(_context: fidl::encoding::Context) -> usize {
2813            std::mem::align_of::<u32>()
2814        }
2815
2816        #[inline(always)]
2817        fn inline_size(_context: fidl::encoding::Context) -> usize {
2818            std::mem::size_of::<u32>()
2819        }
2820
2821        #[inline(always)]
2822        fn encode_is_copy() -> bool {
2823            false
2824        }
2825
2826        #[inline(always)]
2827        fn decode_is_copy() -> bool {
2828            false
2829        }
2830    }
2831
2832    impl fidl::encoding::ValueTypeMarker for RegistryWatchDevicesAddedError {
2833        type Borrowed<'a> = Self;
2834        #[inline(always)]
2835        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2836            *value
2837        }
2838    }
2839
2840    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
2841        for RegistryWatchDevicesAddedError
2842    {
2843        #[inline]
2844        unsafe fn encode(
2845            self,
2846            encoder: &mut fidl::encoding::Encoder<'_, D>,
2847            offset: usize,
2848            _depth: fidl::encoding::Depth,
2849        ) -> fidl::Result<()> {
2850            encoder.debug_check_bounds::<Self>(offset);
2851            encoder.write_num(self.into_primitive(), offset);
2852            Ok(())
2853        }
2854    }
2855
2856    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2857        for RegistryWatchDevicesAddedError
2858    {
2859        #[inline(always)]
2860        fn new_empty() -> Self {
2861            Self::unknown()
2862        }
2863
2864        #[inline]
2865        unsafe fn decode(
2866            &mut self,
2867            decoder: &mut fidl::encoding::Decoder<'_, D>,
2868            offset: usize,
2869            _depth: fidl::encoding::Depth,
2870        ) -> fidl::Result<()> {
2871            decoder.debug_check_bounds::<Self>(offset);
2872            let prim = decoder.read_num::<u32>(offset);
2873
2874            *self = Self::from_primitive_allow_unknown(prim);
2875            Ok(())
2876        }
2877    }
2878    unsafe impl fidl::encoding::TypeMarker for RingBufferSetActiveChannelsError {
2879        type Owned = Self;
2880
2881        #[inline(always)]
2882        fn inline_align(_context: fidl::encoding::Context) -> usize {
2883            std::mem::align_of::<u32>()
2884        }
2885
2886        #[inline(always)]
2887        fn inline_size(_context: fidl::encoding::Context) -> usize {
2888            std::mem::size_of::<u32>()
2889        }
2890
2891        #[inline(always)]
2892        fn encode_is_copy() -> bool {
2893            false
2894        }
2895
2896        #[inline(always)]
2897        fn decode_is_copy() -> bool {
2898            false
2899        }
2900    }
2901
2902    impl fidl::encoding::ValueTypeMarker for RingBufferSetActiveChannelsError {
2903        type Borrowed<'a> = Self;
2904        #[inline(always)]
2905        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2906            *value
2907        }
2908    }
2909
2910    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
2911        for RingBufferSetActiveChannelsError
2912    {
2913        #[inline]
2914        unsafe fn encode(
2915            self,
2916            encoder: &mut fidl::encoding::Encoder<'_, D>,
2917            offset: usize,
2918            _depth: fidl::encoding::Depth,
2919        ) -> fidl::Result<()> {
2920            encoder.debug_check_bounds::<Self>(offset);
2921            encoder.write_num(self.into_primitive(), offset);
2922            Ok(())
2923        }
2924    }
2925
2926    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2927        for RingBufferSetActiveChannelsError
2928    {
2929        #[inline(always)]
2930        fn new_empty() -> Self {
2931            Self::unknown()
2932        }
2933
2934        #[inline]
2935        unsafe fn decode(
2936            &mut self,
2937            decoder: &mut fidl::encoding::Decoder<'_, D>,
2938            offset: usize,
2939            _depth: fidl::encoding::Depth,
2940        ) -> fidl::Result<()> {
2941            decoder.debug_check_bounds::<Self>(offset);
2942            let prim = decoder.read_num::<u32>(offset);
2943
2944            *self = Self::from_primitive_allow_unknown(prim);
2945            Ok(())
2946        }
2947    }
2948    unsafe impl fidl::encoding::TypeMarker for RingBufferStartError {
2949        type Owned = Self;
2950
2951        #[inline(always)]
2952        fn inline_align(_context: fidl::encoding::Context) -> usize {
2953            std::mem::align_of::<u32>()
2954        }
2955
2956        #[inline(always)]
2957        fn inline_size(_context: fidl::encoding::Context) -> usize {
2958            std::mem::size_of::<u32>()
2959        }
2960
2961        #[inline(always)]
2962        fn encode_is_copy() -> bool {
2963            false
2964        }
2965
2966        #[inline(always)]
2967        fn decode_is_copy() -> bool {
2968            false
2969        }
2970    }
2971
2972    impl fidl::encoding::ValueTypeMarker for RingBufferStartError {
2973        type Borrowed<'a> = Self;
2974        #[inline(always)]
2975        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2976            *value
2977        }
2978    }
2979
2980    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
2981        for RingBufferStartError
2982    {
2983        #[inline]
2984        unsafe fn encode(
2985            self,
2986            encoder: &mut fidl::encoding::Encoder<'_, D>,
2987            offset: usize,
2988            _depth: fidl::encoding::Depth,
2989        ) -> fidl::Result<()> {
2990            encoder.debug_check_bounds::<Self>(offset);
2991            encoder.write_num(self.into_primitive(), offset);
2992            Ok(())
2993        }
2994    }
2995
2996    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for RingBufferStartError {
2997        #[inline(always)]
2998        fn new_empty() -> Self {
2999            Self::unknown()
3000        }
3001
3002        #[inline]
3003        unsafe fn decode(
3004            &mut self,
3005            decoder: &mut fidl::encoding::Decoder<'_, D>,
3006            offset: usize,
3007            _depth: fidl::encoding::Depth,
3008        ) -> fidl::Result<()> {
3009            decoder.debug_check_bounds::<Self>(offset);
3010            let prim = decoder.read_num::<u32>(offset);
3011
3012            *self = Self::from_primitive_allow_unknown(prim);
3013            Ok(())
3014        }
3015    }
3016    unsafe impl fidl::encoding::TypeMarker for RingBufferStopError {
3017        type Owned = Self;
3018
3019        #[inline(always)]
3020        fn inline_align(_context: fidl::encoding::Context) -> usize {
3021            std::mem::align_of::<u32>()
3022        }
3023
3024        #[inline(always)]
3025        fn inline_size(_context: fidl::encoding::Context) -> usize {
3026            std::mem::size_of::<u32>()
3027        }
3028
3029        #[inline(always)]
3030        fn encode_is_copy() -> bool {
3031            false
3032        }
3033
3034        #[inline(always)]
3035        fn decode_is_copy() -> bool {
3036            false
3037        }
3038    }
3039
3040    impl fidl::encoding::ValueTypeMarker for RingBufferStopError {
3041        type Borrowed<'a> = Self;
3042        #[inline(always)]
3043        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3044            *value
3045        }
3046    }
3047
3048    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
3049        for RingBufferStopError
3050    {
3051        #[inline]
3052        unsafe fn encode(
3053            self,
3054            encoder: &mut fidl::encoding::Encoder<'_, D>,
3055            offset: usize,
3056            _depth: fidl::encoding::Depth,
3057        ) -> fidl::Result<()> {
3058            encoder.debug_check_bounds::<Self>(offset);
3059            encoder.write_num(self.into_primitive(), offset);
3060            Ok(())
3061        }
3062    }
3063
3064    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for RingBufferStopError {
3065        #[inline(always)]
3066        fn new_empty() -> Self {
3067            Self::unknown()
3068        }
3069
3070        #[inline]
3071        unsafe fn decode(
3072            &mut self,
3073            decoder: &mut fidl::encoding::Decoder<'_, D>,
3074            offset: usize,
3075            _depth: fidl::encoding::Depth,
3076        ) -> fidl::Result<()> {
3077            decoder.debug_check_bounds::<Self>(offset);
3078            let prim = decoder.read_num::<u32>(offset);
3079
3080            *self = Self::from_primitive_allow_unknown(prim);
3081            Ok(())
3082        }
3083    }
3084    unsafe impl fidl::encoding::TypeMarker for RingBufferWatchDelayInfoError {
3085        type Owned = Self;
3086
3087        #[inline(always)]
3088        fn inline_align(_context: fidl::encoding::Context) -> usize {
3089            std::mem::align_of::<u32>()
3090        }
3091
3092        #[inline(always)]
3093        fn inline_size(_context: fidl::encoding::Context) -> usize {
3094            std::mem::size_of::<u32>()
3095        }
3096
3097        #[inline(always)]
3098        fn encode_is_copy() -> bool {
3099            false
3100        }
3101
3102        #[inline(always)]
3103        fn decode_is_copy() -> bool {
3104            false
3105        }
3106    }
3107
3108    impl fidl::encoding::ValueTypeMarker for RingBufferWatchDelayInfoError {
3109        type Borrowed<'a> = Self;
3110        #[inline(always)]
3111        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3112            *value
3113        }
3114    }
3115
3116    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
3117        for RingBufferWatchDelayInfoError
3118    {
3119        #[inline]
3120        unsafe fn encode(
3121            self,
3122            encoder: &mut fidl::encoding::Encoder<'_, D>,
3123            offset: usize,
3124            _depth: fidl::encoding::Depth,
3125        ) -> fidl::Result<()> {
3126            encoder.debug_check_bounds::<Self>(offset);
3127            encoder.write_num(self.into_primitive(), offset);
3128            Ok(())
3129        }
3130    }
3131
3132    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3133        for RingBufferWatchDelayInfoError
3134    {
3135        #[inline(always)]
3136        fn new_empty() -> Self {
3137            Self::unknown()
3138        }
3139
3140        #[inline]
3141        unsafe fn decode(
3142            &mut self,
3143            decoder: &mut fidl::encoding::Decoder<'_, D>,
3144            offset: usize,
3145            _depth: fidl::encoding::Depth,
3146        ) -> fidl::Result<()> {
3147            decoder.debug_check_bounds::<Self>(offset);
3148            let prim = decoder.read_num::<u32>(offset);
3149
3150            *self = Self::from_primitive_allow_unknown(prim);
3151            Ok(())
3152        }
3153    }
3154
3155    impl ChannelAttributes {
3156        #[inline(always)]
3157        fn max_ordinal_present(&self) -> u64 {
3158            if let Some(_) = self.max_frequency {
3159                return 2;
3160            }
3161            if let Some(_) = self.min_frequency {
3162                return 1;
3163            }
3164            0
3165        }
3166    }
3167
3168    impl fidl::encoding::ValueTypeMarker for ChannelAttributes {
3169        type Borrowed<'a> = &'a Self;
3170        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3171            value
3172        }
3173    }
3174
3175    unsafe impl fidl::encoding::TypeMarker for ChannelAttributes {
3176        type Owned = Self;
3177
3178        #[inline(always)]
3179        fn inline_align(_context: fidl::encoding::Context) -> usize {
3180            8
3181        }
3182
3183        #[inline(always)]
3184        fn inline_size(_context: fidl::encoding::Context) -> usize {
3185            16
3186        }
3187    }
3188
3189    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<ChannelAttributes, D>
3190        for &ChannelAttributes
3191    {
3192        unsafe fn encode(
3193            self,
3194            encoder: &mut fidl::encoding::Encoder<'_, D>,
3195            offset: usize,
3196            mut depth: fidl::encoding::Depth,
3197        ) -> fidl::Result<()> {
3198            encoder.debug_check_bounds::<ChannelAttributes>(offset);
3199            // Vector header
3200            let max_ordinal: u64 = self.max_ordinal_present();
3201            encoder.write_num(max_ordinal, offset);
3202            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
3203            // Calling encoder.out_of_line_offset(0) is not allowed.
3204            if max_ordinal == 0 {
3205                return Ok(());
3206            }
3207            depth.increment()?;
3208            let envelope_size = 8;
3209            let bytes_len = max_ordinal as usize * envelope_size;
3210            #[allow(unused_variables)]
3211            let offset = encoder.out_of_line_offset(bytes_len);
3212            let mut _prev_end_offset: usize = 0;
3213            if 1 > max_ordinal {
3214                return Ok(());
3215            }
3216
3217            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3218            // are envelope_size bytes.
3219            let cur_offset: usize = (1 - 1) * envelope_size;
3220
3221            // Zero reserved fields.
3222            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3223
3224            // Safety:
3225            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3226            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3227            //   envelope_size bytes, there is always sufficient room.
3228            fidl::encoding::encode_in_envelope_optional::<u32, D>(
3229                self.min_frequency.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
3230                encoder,
3231                offset + cur_offset,
3232                depth,
3233            )?;
3234
3235            _prev_end_offset = cur_offset + envelope_size;
3236            if 2 > max_ordinal {
3237                return Ok(());
3238            }
3239
3240            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3241            // are envelope_size bytes.
3242            let cur_offset: usize = (2 - 1) * envelope_size;
3243
3244            // Zero reserved fields.
3245            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3246
3247            // Safety:
3248            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3249            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3250            //   envelope_size bytes, there is always sufficient room.
3251            fidl::encoding::encode_in_envelope_optional::<u32, D>(
3252                self.max_frequency.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
3253                encoder,
3254                offset + cur_offset,
3255                depth,
3256            )?;
3257
3258            _prev_end_offset = cur_offset + envelope_size;
3259
3260            Ok(())
3261        }
3262    }
3263
3264    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ChannelAttributes {
3265        #[inline(always)]
3266        fn new_empty() -> Self {
3267            Self::default()
3268        }
3269
3270        unsafe fn decode(
3271            &mut self,
3272            decoder: &mut fidl::encoding::Decoder<'_, D>,
3273            offset: usize,
3274            mut depth: fidl::encoding::Depth,
3275        ) -> fidl::Result<()> {
3276            decoder.debug_check_bounds::<Self>(offset);
3277            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
3278                None => return Err(fidl::Error::NotNullable),
3279                Some(len) => len,
3280            };
3281            // Calling decoder.out_of_line_offset(0) is not allowed.
3282            if len == 0 {
3283                return Ok(());
3284            };
3285            depth.increment()?;
3286            let envelope_size = 8;
3287            let bytes_len = len * envelope_size;
3288            let offset = decoder.out_of_line_offset(bytes_len)?;
3289            // Decode the envelope for each type.
3290            let mut _next_ordinal_to_read = 0;
3291            let mut next_offset = offset;
3292            let end_offset = offset + bytes_len;
3293            _next_ordinal_to_read += 1;
3294            if next_offset >= end_offset {
3295                return Ok(());
3296            }
3297
3298            // Decode unknown envelopes for gaps in ordinals.
3299            while _next_ordinal_to_read < 1 {
3300                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3301                _next_ordinal_to_read += 1;
3302                next_offset += envelope_size;
3303            }
3304
3305            let next_out_of_line = decoder.next_out_of_line();
3306            let handles_before = decoder.remaining_handles();
3307            if let Some((inlined, num_bytes, num_handles)) =
3308                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3309            {
3310                let member_inline_size =
3311                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3312                if inlined != (member_inline_size <= 4) {
3313                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3314                }
3315                let inner_offset;
3316                let mut inner_depth = depth.clone();
3317                if inlined {
3318                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3319                    inner_offset = next_offset;
3320                } else {
3321                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3322                    inner_depth.increment()?;
3323                }
3324                let val_ref = self.min_frequency.get_or_insert_with(|| fidl::new_empty!(u32, D));
3325                fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
3326                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3327                {
3328                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3329                }
3330                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3331                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3332                }
3333            }
3334
3335            next_offset += envelope_size;
3336            _next_ordinal_to_read += 1;
3337            if next_offset >= end_offset {
3338                return Ok(());
3339            }
3340
3341            // Decode unknown envelopes for gaps in ordinals.
3342            while _next_ordinal_to_read < 2 {
3343                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3344                _next_ordinal_to_read += 1;
3345                next_offset += envelope_size;
3346            }
3347
3348            let next_out_of_line = decoder.next_out_of_line();
3349            let handles_before = decoder.remaining_handles();
3350            if let Some((inlined, num_bytes, num_handles)) =
3351                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3352            {
3353                let member_inline_size =
3354                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3355                if inlined != (member_inline_size <= 4) {
3356                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3357                }
3358                let inner_offset;
3359                let mut inner_depth = depth.clone();
3360                if inlined {
3361                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3362                    inner_offset = next_offset;
3363                } else {
3364                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3365                    inner_depth.increment()?;
3366                }
3367                let val_ref = self.max_frequency.get_or_insert_with(|| fidl::new_empty!(u32, D));
3368                fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
3369                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3370                {
3371                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3372                }
3373                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3374                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3375                }
3376            }
3377
3378            next_offset += envelope_size;
3379
3380            // Decode the remaining unknown envelopes.
3381            while next_offset < end_offset {
3382                _next_ordinal_to_read += 1;
3383                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3384                next_offset += envelope_size;
3385            }
3386
3387            Ok(())
3388        }
3389    }
3390
3391    impl ChannelSet {
3392        #[inline(always)]
3393        fn max_ordinal_present(&self) -> u64 {
3394            if let Some(_) = self.attributes {
3395                return 1;
3396            }
3397            0
3398        }
3399    }
3400
3401    impl fidl::encoding::ValueTypeMarker for ChannelSet {
3402        type Borrowed<'a> = &'a Self;
3403        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3404            value
3405        }
3406    }
3407
3408    unsafe impl fidl::encoding::TypeMarker for ChannelSet {
3409        type Owned = Self;
3410
3411        #[inline(always)]
3412        fn inline_align(_context: fidl::encoding::Context) -> usize {
3413            8
3414        }
3415
3416        #[inline(always)]
3417        fn inline_size(_context: fidl::encoding::Context) -> usize {
3418            16
3419        }
3420    }
3421
3422    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<ChannelSet, D>
3423        for &ChannelSet
3424    {
3425        unsafe fn encode(
3426            self,
3427            encoder: &mut fidl::encoding::Encoder<'_, D>,
3428            offset: usize,
3429            mut depth: fidl::encoding::Depth,
3430        ) -> fidl::Result<()> {
3431            encoder.debug_check_bounds::<ChannelSet>(offset);
3432            // Vector header
3433            let max_ordinal: u64 = self.max_ordinal_present();
3434            encoder.write_num(max_ordinal, offset);
3435            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
3436            // Calling encoder.out_of_line_offset(0) is not allowed.
3437            if max_ordinal == 0 {
3438                return Ok(());
3439            }
3440            depth.increment()?;
3441            let envelope_size = 8;
3442            let bytes_len = max_ordinal as usize * envelope_size;
3443            #[allow(unused_variables)]
3444            let offset = encoder.out_of_line_offset(bytes_len);
3445            let mut _prev_end_offset: usize = 0;
3446            if 1 > max_ordinal {
3447                return Ok(());
3448            }
3449
3450            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3451            // are envelope_size bytes.
3452            let cur_offset: usize = (1 - 1) * envelope_size;
3453
3454            // Zero reserved fields.
3455            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3456
3457            // Safety:
3458            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3459            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3460            //   envelope_size bytes, there is always sufficient room.
3461            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<ChannelAttributes, 64>, D>(
3462            self.attributes.as_ref().map(<fidl::encoding::Vector<ChannelAttributes, 64> as fidl::encoding::ValueTypeMarker>::borrow),
3463            encoder, offset + cur_offset, depth
3464        )?;
3465
3466            _prev_end_offset = cur_offset + envelope_size;
3467
3468            Ok(())
3469        }
3470    }
3471
3472    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ChannelSet {
3473        #[inline(always)]
3474        fn new_empty() -> Self {
3475            Self::default()
3476        }
3477
3478        unsafe fn decode(
3479            &mut self,
3480            decoder: &mut fidl::encoding::Decoder<'_, D>,
3481            offset: usize,
3482            mut depth: fidl::encoding::Depth,
3483        ) -> fidl::Result<()> {
3484            decoder.debug_check_bounds::<Self>(offset);
3485            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
3486                None => return Err(fidl::Error::NotNullable),
3487                Some(len) => len,
3488            };
3489            // Calling decoder.out_of_line_offset(0) is not allowed.
3490            if len == 0 {
3491                return Ok(());
3492            };
3493            depth.increment()?;
3494            let envelope_size = 8;
3495            let bytes_len = len * envelope_size;
3496            let offset = decoder.out_of_line_offset(bytes_len)?;
3497            // Decode the envelope for each type.
3498            let mut _next_ordinal_to_read = 0;
3499            let mut next_offset = offset;
3500            let end_offset = offset + bytes_len;
3501            _next_ordinal_to_read += 1;
3502            if next_offset >= end_offset {
3503                return Ok(());
3504            }
3505
3506            // Decode unknown envelopes for gaps in ordinals.
3507            while _next_ordinal_to_read < 1 {
3508                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3509                _next_ordinal_to_read += 1;
3510                next_offset += envelope_size;
3511            }
3512
3513            let next_out_of_line = decoder.next_out_of_line();
3514            let handles_before = decoder.remaining_handles();
3515            if let Some((inlined, num_bytes, num_handles)) =
3516                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3517            {
3518                let member_inline_size = <fidl::encoding::Vector<ChannelAttributes, 64> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3519                if inlined != (member_inline_size <= 4) {
3520                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3521                }
3522                let inner_offset;
3523                let mut inner_depth = depth.clone();
3524                if inlined {
3525                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3526                    inner_offset = next_offset;
3527                } else {
3528                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3529                    inner_depth.increment()?;
3530                }
3531                let val_ref = self.attributes.get_or_insert_with(
3532                    || fidl::new_empty!(fidl::encoding::Vector<ChannelAttributes, 64>, D),
3533                );
3534                fidl::decode!(fidl::encoding::Vector<ChannelAttributes, 64>, D, val_ref, decoder, inner_offset, inner_depth)?;
3535                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3536                {
3537                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3538                }
3539                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3540                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3541                }
3542            }
3543
3544            next_offset += envelope_size;
3545
3546            // Decode the remaining unknown envelopes.
3547            while next_offset < end_offset {
3548                _next_ordinal_to_read += 1;
3549                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3550                next_offset += envelope_size;
3551            }
3552
3553            Ok(())
3554        }
3555    }
3556
3557    impl ControlCreatorCreateResponse {
3558        #[inline(always)]
3559        fn max_ordinal_present(&self) -> u64 {
3560            0
3561        }
3562    }
3563
3564    impl fidl::encoding::ValueTypeMarker for ControlCreatorCreateResponse {
3565        type Borrowed<'a> = &'a Self;
3566        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3567            value
3568        }
3569    }
3570
3571    unsafe impl fidl::encoding::TypeMarker for ControlCreatorCreateResponse {
3572        type Owned = Self;
3573
3574        #[inline(always)]
3575        fn inline_align(_context: fidl::encoding::Context) -> usize {
3576            8
3577        }
3578
3579        #[inline(always)]
3580        fn inline_size(_context: fidl::encoding::Context) -> usize {
3581            16
3582        }
3583    }
3584
3585    unsafe impl<D: fidl::encoding::ResourceDialect>
3586        fidl::encoding::Encode<ControlCreatorCreateResponse, D> for &ControlCreatorCreateResponse
3587    {
3588        unsafe fn encode(
3589            self,
3590            encoder: &mut fidl::encoding::Encoder<'_, D>,
3591            offset: usize,
3592            mut depth: fidl::encoding::Depth,
3593        ) -> fidl::Result<()> {
3594            encoder.debug_check_bounds::<ControlCreatorCreateResponse>(offset);
3595            // Vector header
3596            let max_ordinal: u64 = self.max_ordinal_present();
3597            encoder.write_num(max_ordinal, offset);
3598            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
3599            // Calling encoder.out_of_line_offset(0) is not allowed.
3600            if max_ordinal == 0 {
3601                return Ok(());
3602            }
3603            depth.increment()?;
3604            let envelope_size = 8;
3605            let bytes_len = max_ordinal as usize * envelope_size;
3606            #[allow(unused_variables)]
3607            let offset = encoder.out_of_line_offset(bytes_len);
3608            let mut _prev_end_offset: usize = 0;
3609
3610            Ok(())
3611        }
3612    }
3613
3614    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3615        for ControlCreatorCreateResponse
3616    {
3617        #[inline(always)]
3618        fn new_empty() -> Self {
3619            Self::default()
3620        }
3621
3622        unsafe fn decode(
3623            &mut self,
3624            decoder: &mut fidl::encoding::Decoder<'_, D>,
3625            offset: usize,
3626            mut depth: fidl::encoding::Depth,
3627        ) -> fidl::Result<()> {
3628            decoder.debug_check_bounds::<Self>(offset);
3629            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
3630                None => return Err(fidl::Error::NotNullable),
3631                Some(len) => len,
3632            };
3633            // Calling decoder.out_of_line_offset(0) is not allowed.
3634            if len == 0 {
3635                return Ok(());
3636            };
3637            depth.increment()?;
3638            let envelope_size = 8;
3639            let bytes_len = len * envelope_size;
3640            let offset = decoder.out_of_line_offset(bytes_len)?;
3641            // Decode the envelope for each type.
3642            let mut _next_ordinal_to_read = 0;
3643            let mut next_offset = offset;
3644            let end_offset = offset + bytes_len;
3645
3646            // Decode the remaining unknown envelopes.
3647            while next_offset < end_offset {
3648                _next_ordinal_to_read += 1;
3649                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3650                next_offset += envelope_size;
3651            }
3652
3653            Ok(())
3654        }
3655    }
3656
3657    impl ControlSetDaiFormatRequest {
3658        #[inline(always)]
3659        fn max_ordinal_present(&self) -> u64 {
3660            if let Some(_) = self.dai_format {
3661                return 2;
3662            }
3663            if let Some(_) = self.element_id {
3664                return 1;
3665            }
3666            0
3667        }
3668    }
3669
3670    impl fidl::encoding::ValueTypeMarker for ControlSetDaiFormatRequest {
3671        type Borrowed<'a> = &'a Self;
3672        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3673            value
3674        }
3675    }
3676
3677    unsafe impl fidl::encoding::TypeMarker for ControlSetDaiFormatRequest {
3678        type Owned = Self;
3679
3680        #[inline(always)]
3681        fn inline_align(_context: fidl::encoding::Context) -> usize {
3682            8
3683        }
3684
3685        #[inline(always)]
3686        fn inline_size(_context: fidl::encoding::Context) -> usize {
3687            16
3688        }
3689    }
3690
3691    unsafe impl<D: fidl::encoding::ResourceDialect>
3692        fidl::encoding::Encode<ControlSetDaiFormatRequest, D> for &ControlSetDaiFormatRequest
3693    {
3694        unsafe fn encode(
3695            self,
3696            encoder: &mut fidl::encoding::Encoder<'_, D>,
3697            offset: usize,
3698            mut depth: fidl::encoding::Depth,
3699        ) -> fidl::Result<()> {
3700            encoder.debug_check_bounds::<ControlSetDaiFormatRequest>(offset);
3701            // Vector header
3702            let max_ordinal: u64 = self.max_ordinal_present();
3703            encoder.write_num(max_ordinal, offset);
3704            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
3705            // Calling encoder.out_of_line_offset(0) is not allowed.
3706            if max_ordinal == 0 {
3707                return Ok(());
3708            }
3709            depth.increment()?;
3710            let envelope_size = 8;
3711            let bytes_len = max_ordinal as usize * envelope_size;
3712            #[allow(unused_variables)]
3713            let offset = encoder.out_of_line_offset(bytes_len);
3714            let mut _prev_end_offset: usize = 0;
3715            if 1 > max_ordinal {
3716                return Ok(());
3717            }
3718
3719            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3720            // are envelope_size bytes.
3721            let cur_offset: usize = (1 - 1) * envelope_size;
3722
3723            // Zero reserved fields.
3724            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3725
3726            // Safety:
3727            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3728            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3729            //   envelope_size bytes, there is always sufficient room.
3730            fidl::encoding::encode_in_envelope_optional::<u64, D>(
3731                self.element_id.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
3732                encoder,
3733                offset + cur_offset,
3734                depth,
3735            )?;
3736
3737            _prev_end_offset = cur_offset + envelope_size;
3738            if 2 > max_ordinal {
3739                return Ok(());
3740            }
3741
3742            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3743            // are envelope_size bytes.
3744            let cur_offset: usize = (2 - 1) * envelope_size;
3745
3746            // Zero reserved fields.
3747            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3748
3749            // Safety:
3750            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3751            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3752            //   envelope_size bytes, there is always sufficient room.
3753            fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_hardware_audio::DaiFormat, D>(
3754            self.dai_format.as_ref().map(<fidl_fuchsia_hardware_audio::DaiFormat as fidl::encoding::ValueTypeMarker>::borrow),
3755            encoder, offset + cur_offset, depth
3756        )?;
3757
3758            _prev_end_offset = cur_offset + envelope_size;
3759
3760            Ok(())
3761        }
3762    }
3763
3764    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3765        for ControlSetDaiFormatRequest
3766    {
3767        #[inline(always)]
3768        fn new_empty() -> Self {
3769            Self::default()
3770        }
3771
3772        unsafe fn decode(
3773            &mut self,
3774            decoder: &mut fidl::encoding::Decoder<'_, D>,
3775            offset: usize,
3776            mut depth: fidl::encoding::Depth,
3777        ) -> fidl::Result<()> {
3778            decoder.debug_check_bounds::<Self>(offset);
3779            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
3780                None => return Err(fidl::Error::NotNullable),
3781                Some(len) => len,
3782            };
3783            // Calling decoder.out_of_line_offset(0) is not allowed.
3784            if len == 0 {
3785                return Ok(());
3786            };
3787            depth.increment()?;
3788            let envelope_size = 8;
3789            let bytes_len = len * envelope_size;
3790            let offset = decoder.out_of_line_offset(bytes_len)?;
3791            // Decode the envelope for each type.
3792            let mut _next_ordinal_to_read = 0;
3793            let mut next_offset = offset;
3794            let end_offset = offset + bytes_len;
3795            _next_ordinal_to_read += 1;
3796            if next_offset >= end_offset {
3797                return Ok(());
3798            }
3799
3800            // Decode unknown envelopes for gaps in ordinals.
3801            while _next_ordinal_to_read < 1 {
3802                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3803                _next_ordinal_to_read += 1;
3804                next_offset += envelope_size;
3805            }
3806
3807            let next_out_of_line = decoder.next_out_of_line();
3808            let handles_before = decoder.remaining_handles();
3809            if let Some((inlined, num_bytes, num_handles)) =
3810                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3811            {
3812                let member_inline_size =
3813                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3814                if inlined != (member_inline_size <= 4) {
3815                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3816                }
3817                let inner_offset;
3818                let mut inner_depth = depth.clone();
3819                if inlined {
3820                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3821                    inner_offset = next_offset;
3822                } else {
3823                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3824                    inner_depth.increment()?;
3825                }
3826                let val_ref = self.element_id.get_or_insert_with(|| fidl::new_empty!(u64, D));
3827                fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
3828                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3829                {
3830                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3831                }
3832                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3833                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3834                }
3835            }
3836
3837            next_offset += envelope_size;
3838            _next_ordinal_to_read += 1;
3839            if next_offset >= end_offset {
3840                return Ok(());
3841            }
3842
3843            // Decode unknown envelopes for gaps in ordinals.
3844            while _next_ordinal_to_read < 2 {
3845                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3846                _next_ordinal_to_read += 1;
3847                next_offset += envelope_size;
3848            }
3849
3850            let next_out_of_line = decoder.next_out_of_line();
3851            let handles_before = decoder.remaining_handles();
3852            if let Some((inlined, num_bytes, num_handles)) =
3853                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3854            {
3855                let member_inline_size = <fidl_fuchsia_hardware_audio::DaiFormat as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3856                if inlined != (member_inline_size <= 4) {
3857                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3858                }
3859                let inner_offset;
3860                let mut inner_depth = depth.clone();
3861                if inlined {
3862                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3863                    inner_offset = next_offset;
3864                } else {
3865                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3866                    inner_depth.increment()?;
3867                }
3868                let val_ref = self.dai_format.get_or_insert_with(|| {
3869                    fidl::new_empty!(fidl_fuchsia_hardware_audio::DaiFormat, D)
3870                });
3871                fidl::decode!(
3872                    fidl_fuchsia_hardware_audio::DaiFormat,
3873                    D,
3874                    val_ref,
3875                    decoder,
3876                    inner_offset,
3877                    inner_depth
3878                )?;
3879                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3880                {
3881                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3882                }
3883                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3884                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3885                }
3886            }
3887
3888            next_offset += envelope_size;
3889
3890            // Decode the remaining unknown envelopes.
3891            while next_offset < end_offset {
3892                _next_ordinal_to_read += 1;
3893                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3894                next_offset += envelope_size;
3895            }
3896
3897            Ok(())
3898        }
3899    }
3900
3901    impl ControlCodecStartResponse {
3902        #[inline(always)]
3903        fn max_ordinal_present(&self) -> u64 {
3904            if let Some(_) = self.start_time {
3905                return 1;
3906            }
3907            0
3908        }
3909    }
3910
3911    impl fidl::encoding::ValueTypeMarker for ControlCodecStartResponse {
3912        type Borrowed<'a> = &'a Self;
3913        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3914            value
3915        }
3916    }
3917
3918    unsafe impl fidl::encoding::TypeMarker for ControlCodecStartResponse {
3919        type Owned = Self;
3920
3921        #[inline(always)]
3922        fn inline_align(_context: fidl::encoding::Context) -> usize {
3923            8
3924        }
3925
3926        #[inline(always)]
3927        fn inline_size(_context: fidl::encoding::Context) -> usize {
3928            16
3929        }
3930    }
3931
3932    unsafe impl<D: fidl::encoding::ResourceDialect>
3933        fidl::encoding::Encode<ControlCodecStartResponse, D> for &ControlCodecStartResponse
3934    {
3935        unsafe fn encode(
3936            self,
3937            encoder: &mut fidl::encoding::Encoder<'_, D>,
3938            offset: usize,
3939            mut depth: fidl::encoding::Depth,
3940        ) -> fidl::Result<()> {
3941            encoder.debug_check_bounds::<ControlCodecStartResponse>(offset);
3942            // Vector header
3943            let max_ordinal: u64 = self.max_ordinal_present();
3944            encoder.write_num(max_ordinal, offset);
3945            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
3946            // Calling encoder.out_of_line_offset(0) is not allowed.
3947            if max_ordinal == 0 {
3948                return Ok(());
3949            }
3950            depth.increment()?;
3951            let envelope_size = 8;
3952            let bytes_len = max_ordinal as usize * envelope_size;
3953            #[allow(unused_variables)]
3954            let offset = encoder.out_of_line_offset(bytes_len);
3955            let mut _prev_end_offset: usize = 0;
3956            if 1 > max_ordinal {
3957                return Ok(());
3958            }
3959
3960            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3961            // are envelope_size bytes.
3962            let cur_offset: usize = (1 - 1) * envelope_size;
3963
3964            // Zero reserved fields.
3965            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3966
3967            // Safety:
3968            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3969            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3970            //   envelope_size bytes, there is always sufficient room.
3971            fidl::encoding::encode_in_envelope_optional::<i64, D>(
3972                self.start_time.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
3973                encoder,
3974                offset + cur_offset,
3975                depth,
3976            )?;
3977
3978            _prev_end_offset = cur_offset + envelope_size;
3979
3980            Ok(())
3981        }
3982    }
3983
3984    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3985        for ControlCodecStartResponse
3986    {
3987        #[inline(always)]
3988        fn new_empty() -> Self {
3989            Self::default()
3990        }
3991
3992        unsafe fn decode(
3993            &mut self,
3994            decoder: &mut fidl::encoding::Decoder<'_, D>,
3995            offset: usize,
3996            mut depth: fidl::encoding::Depth,
3997        ) -> fidl::Result<()> {
3998            decoder.debug_check_bounds::<Self>(offset);
3999            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
4000                None => return Err(fidl::Error::NotNullable),
4001                Some(len) => len,
4002            };
4003            // Calling decoder.out_of_line_offset(0) is not allowed.
4004            if len == 0 {
4005                return Ok(());
4006            };
4007            depth.increment()?;
4008            let envelope_size = 8;
4009            let bytes_len = len * envelope_size;
4010            let offset = decoder.out_of_line_offset(bytes_len)?;
4011            // Decode the envelope for each type.
4012            let mut _next_ordinal_to_read = 0;
4013            let mut next_offset = offset;
4014            let end_offset = offset + bytes_len;
4015            _next_ordinal_to_read += 1;
4016            if next_offset >= end_offset {
4017                return Ok(());
4018            }
4019
4020            // Decode unknown envelopes for gaps in ordinals.
4021            while _next_ordinal_to_read < 1 {
4022                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4023                _next_ordinal_to_read += 1;
4024                next_offset += envelope_size;
4025            }
4026
4027            let next_out_of_line = decoder.next_out_of_line();
4028            let handles_before = decoder.remaining_handles();
4029            if let Some((inlined, num_bytes, num_handles)) =
4030                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4031            {
4032                let member_inline_size =
4033                    <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4034                if inlined != (member_inline_size <= 4) {
4035                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4036                }
4037                let inner_offset;
4038                let mut inner_depth = depth.clone();
4039                if inlined {
4040                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4041                    inner_offset = next_offset;
4042                } else {
4043                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4044                    inner_depth.increment()?;
4045                }
4046                let val_ref = self.start_time.get_or_insert_with(|| fidl::new_empty!(i64, D));
4047                fidl::decode!(i64, D, val_ref, decoder, inner_offset, inner_depth)?;
4048                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4049                {
4050                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4051                }
4052                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4053                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4054                }
4055            }
4056
4057            next_offset += envelope_size;
4058
4059            // Decode the remaining unknown envelopes.
4060            while next_offset < end_offset {
4061                _next_ordinal_to_read += 1;
4062                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4063                next_offset += envelope_size;
4064            }
4065
4066            Ok(())
4067        }
4068    }
4069
4070    impl ControlCodecStopResponse {
4071        #[inline(always)]
4072        fn max_ordinal_present(&self) -> u64 {
4073            if let Some(_) = self.stop_time {
4074                return 1;
4075            }
4076            0
4077        }
4078    }
4079
4080    impl fidl::encoding::ValueTypeMarker for ControlCodecStopResponse {
4081        type Borrowed<'a> = &'a Self;
4082        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4083            value
4084        }
4085    }
4086
4087    unsafe impl fidl::encoding::TypeMarker for ControlCodecStopResponse {
4088        type Owned = Self;
4089
4090        #[inline(always)]
4091        fn inline_align(_context: fidl::encoding::Context) -> usize {
4092            8
4093        }
4094
4095        #[inline(always)]
4096        fn inline_size(_context: fidl::encoding::Context) -> usize {
4097            16
4098        }
4099    }
4100
4101    unsafe impl<D: fidl::encoding::ResourceDialect>
4102        fidl::encoding::Encode<ControlCodecStopResponse, D> for &ControlCodecStopResponse
4103    {
4104        unsafe fn encode(
4105            self,
4106            encoder: &mut fidl::encoding::Encoder<'_, D>,
4107            offset: usize,
4108            mut depth: fidl::encoding::Depth,
4109        ) -> fidl::Result<()> {
4110            encoder.debug_check_bounds::<ControlCodecStopResponse>(offset);
4111            // Vector header
4112            let max_ordinal: u64 = self.max_ordinal_present();
4113            encoder.write_num(max_ordinal, offset);
4114            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
4115            // Calling encoder.out_of_line_offset(0) is not allowed.
4116            if max_ordinal == 0 {
4117                return Ok(());
4118            }
4119            depth.increment()?;
4120            let envelope_size = 8;
4121            let bytes_len = max_ordinal as usize * envelope_size;
4122            #[allow(unused_variables)]
4123            let offset = encoder.out_of_line_offset(bytes_len);
4124            let mut _prev_end_offset: usize = 0;
4125            if 1 > max_ordinal {
4126                return Ok(());
4127            }
4128
4129            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4130            // are envelope_size bytes.
4131            let cur_offset: usize = (1 - 1) * envelope_size;
4132
4133            // Zero reserved fields.
4134            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4135
4136            // Safety:
4137            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4138            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4139            //   envelope_size bytes, there is always sufficient room.
4140            fidl::encoding::encode_in_envelope_optional::<i64, D>(
4141                self.stop_time.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
4142                encoder,
4143                offset + cur_offset,
4144                depth,
4145            )?;
4146
4147            _prev_end_offset = cur_offset + envelope_size;
4148
4149            Ok(())
4150        }
4151    }
4152
4153    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
4154        for ControlCodecStopResponse
4155    {
4156        #[inline(always)]
4157        fn new_empty() -> Self {
4158            Self::default()
4159        }
4160
4161        unsafe fn decode(
4162            &mut self,
4163            decoder: &mut fidl::encoding::Decoder<'_, D>,
4164            offset: usize,
4165            mut depth: fidl::encoding::Depth,
4166        ) -> fidl::Result<()> {
4167            decoder.debug_check_bounds::<Self>(offset);
4168            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
4169                None => return Err(fidl::Error::NotNullable),
4170                Some(len) => len,
4171            };
4172            // Calling decoder.out_of_line_offset(0) is not allowed.
4173            if len == 0 {
4174                return Ok(());
4175            };
4176            depth.increment()?;
4177            let envelope_size = 8;
4178            let bytes_len = len * envelope_size;
4179            let offset = decoder.out_of_line_offset(bytes_len)?;
4180            // Decode the envelope for each type.
4181            let mut _next_ordinal_to_read = 0;
4182            let mut next_offset = offset;
4183            let end_offset = offset + bytes_len;
4184            _next_ordinal_to_read += 1;
4185            if next_offset >= end_offset {
4186                return Ok(());
4187            }
4188
4189            // Decode unknown envelopes for gaps in ordinals.
4190            while _next_ordinal_to_read < 1 {
4191                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4192                _next_ordinal_to_read += 1;
4193                next_offset += envelope_size;
4194            }
4195
4196            let next_out_of_line = decoder.next_out_of_line();
4197            let handles_before = decoder.remaining_handles();
4198            if let Some((inlined, num_bytes, num_handles)) =
4199                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4200            {
4201                let member_inline_size =
4202                    <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4203                if inlined != (member_inline_size <= 4) {
4204                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4205                }
4206                let inner_offset;
4207                let mut inner_depth = depth.clone();
4208                if inlined {
4209                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4210                    inner_offset = next_offset;
4211                } else {
4212                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4213                    inner_depth.increment()?;
4214                }
4215                let val_ref = self.stop_time.get_or_insert_with(|| fidl::new_empty!(i64, D));
4216                fidl::decode!(i64, D, val_ref, decoder, inner_offset, inner_depth)?;
4217                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4218                {
4219                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4220                }
4221                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4222                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4223                }
4224            }
4225
4226            next_offset += envelope_size;
4227
4228            // Decode the remaining unknown envelopes.
4229            while next_offset < end_offset {
4230                _next_ordinal_to_read += 1;
4231                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4232                next_offset += envelope_size;
4233            }
4234
4235            Ok(())
4236        }
4237    }
4238
4239    impl ControlResetResponse {
4240        #[inline(always)]
4241        fn max_ordinal_present(&self) -> u64 {
4242            0
4243        }
4244    }
4245
4246    impl fidl::encoding::ValueTypeMarker for ControlResetResponse {
4247        type Borrowed<'a> = &'a Self;
4248        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4249            value
4250        }
4251    }
4252
4253    unsafe impl fidl::encoding::TypeMarker for ControlResetResponse {
4254        type Owned = Self;
4255
4256        #[inline(always)]
4257        fn inline_align(_context: fidl::encoding::Context) -> usize {
4258            8
4259        }
4260
4261        #[inline(always)]
4262        fn inline_size(_context: fidl::encoding::Context) -> usize {
4263            16
4264        }
4265    }
4266
4267    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<ControlResetResponse, D>
4268        for &ControlResetResponse
4269    {
4270        unsafe fn encode(
4271            self,
4272            encoder: &mut fidl::encoding::Encoder<'_, D>,
4273            offset: usize,
4274            mut depth: fidl::encoding::Depth,
4275        ) -> fidl::Result<()> {
4276            encoder.debug_check_bounds::<ControlResetResponse>(offset);
4277            // Vector header
4278            let max_ordinal: u64 = self.max_ordinal_present();
4279            encoder.write_num(max_ordinal, offset);
4280            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
4281            // Calling encoder.out_of_line_offset(0) is not allowed.
4282            if max_ordinal == 0 {
4283                return Ok(());
4284            }
4285            depth.increment()?;
4286            let envelope_size = 8;
4287            let bytes_len = max_ordinal as usize * envelope_size;
4288            #[allow(unused_variables)]
4289            let offset = encoder.out_of_line_offset(bytes_len);
4290            let mut _prev_end_offset: usize = 0;
4291
4292            Ok(())
4293        }
4294    }
4295
4296    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ControlResetResponse {
4297        #[inline(always)]
4298        fn new_empty() -> Self {
4299            Self::default()
4300        }
4301
4302        unsafe fn decode(
4303            &mut self,
4304            decoder: &mut fidl::encoding::Decoder<'_, D>,
4305            offset: usize,
4306            mut depth: fidl::encoding::Depth,
4307        ) -> fidl::Result<()> {
4308            decoder.debug_check_bounds::<Self>(offset);
4309            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
4310                None => return Err(fidl::Error::NotNullable),
4311                Some(len) => len,
4312            };
4313            // Calling decoder.out_of_line_offset(0) is not allowed.
4314            if len == 0 {
4315                return Ok(());
4316            };
4317            depth.increment()?;
4318            let envelope_size = 8;
4319            let bytes_len = len * envelope_size;
4320            let offset = decoder.out_of_line_offset(bytes_len)?;
4321            // Decode the envelope for each type.
4322            let mut _next_ordinal_to_read = 0;
4323            let mut next_offset = offset;
4324            let end_offset = offset + bytes_len;
4325
4326            // Decode the remaining unknown envelopes.
4327            while next_offset < end_offset {
4328                _next_ordinal_to_read += 1;
4329                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4330                next_offset += envelope_size;
4331            }
4332
4333            Ok(())
4334        }
4335    }
4336
4337    impl ControlSetDaiFormatResponse {
4338        #[inline(always)]
4339        fn max_ordinal_present(&self) -> u64 {
4340            if let Some(_) = self.state {
4341                return 1;
4342            }
4343            0
4344        }
4345    }
4346
4347    impl fidl::encoding::ValueTypeMarker for ControlSetDaiFormatResponse {
4348        type Borrowed<'a> = &'a Self;
4349        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4350            value
4351        }
4352    }
4353
4354    unsafe impl fidl::encoding::TypeMarker for ControlSetDaiFormatResponse {
4355        type Owned = Self;
4356
4357        #[inline(always)]
4358        fn inline_align(_context: fidl::encoding::Context) -> usize {
4359            8
4360        }
4361
4362        #[inline(always)]
4363        fn inline_size(_context: fidl::encoding::Context) -> usize {
4364            16
4365        }
4366    }
4367
4368    unsafe impl<D: fidl::encoding::ResourceDialect>
4369        fidl::encoding::Encode<ControlSetDaiFormatResponse, D> for &ControlSetDaiFormatResponse
4370    {
4371        unsafe fn encode(
4372            self,
4373            encoder: &mut fidl::encoding::Encoder<'_, D>,
4374            offset: usize,
4375            mut depth: fidl::encoding::Depth,
4376        ) -> fidl::Result<()> {
4377            encoder.debug_check_bounds::<ControlSetDaiFormatResponse>(offset);
4378            // Vector header
4379            let max_ordinal: u64 = self.max_ordinal_present();
4380            encoder.write_num(max_ordinal, offset);
4381            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
4382            // Calling encoder.out_of_line_offset(0) is not allowed.
4383            if max_ordinal == 0 {
4384                return Ok(());
4385            }
4386            depth.increment()?;
4387            let envelope_size = 8;
4388            let bytes_len = max_ordinal as usize * envelope_size;
4389            #[allow(unused_variables)]
4390            let offset = encoder.out_of_line_offset(bytes_len);
4391            let mut _prev_end_offset: usize = 0;
4392            if 1 > max_ordinal {
4393                return Ok(());
4394            }
4395
4396            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4397            // are envelope_size bytes.
4398            let cur_offset: usize = (1 - 1) * envelope_size;
4399
4400            // Zero reserved fields.
4401            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4402
4403            // Safety:
4404            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4405            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4406            //   envelope_size bytes, there is always sufficient room.
4407            fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_hardware_audio::CodecFormatInfo, D>(
4408            self.state.as_ref().map(<fidl_fuchsia_hardware_audio::CodecFormatInfo as fidl::encoding::ValueTypeMarker>::borrow),
4409            encoder, offset + cur_offset, depth
4410        )?;
4411
4412            _prev_end_offset = cur_offset + envelope_size;
4413
4414            Ok(())
4415        }
4416    }
4417
4418    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
4419        for ControlSetDaiFormatResponse
4420    {
4421        #[inline(always)]
4422        fn new_empty() -> Self {
4423            Self::default()
4424        }
4425
4426        unsafe fn decode(
4427            &mut self,
4428            decoder: &mut fidl::encoding::Decoder<'_, D>,
4429            offset: usize,
4430            mut depth: fidl::encoding::Depth,
4431        ) -> fidl::Result<()> {
4432            decoder.debug_check_bounds::<Self>(offset);
4433            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
4434                None => return Err(fidl::Error::NotNullable),
4435                Some(len) => len,
4436            };
4437            // Calling decoder.out_of_line_offset(0) is not allowed.
4438            if len == 0 {
4439                return Ok(());
4440            };
4441            depth.increment()?;
4442            let envelope_size = 8;
4443            let bytes_len = len * envelope_size;
4444            let offset = decoder.out_of_line_offset(bytes_len)?;
4445            // Decode the envelope for each type.
4446            let mut _next_ordinal_to_read = 0;
4447            let mut next_offset = offset;
4448            let end_offset = offset + bytes_len;
4449            _next_ordinal_to_read += 1;
4450            if next_offset >= end_offset {
4451                return Ok(());
4452            }
4453
4454            // Decode unknown envelopes for gaps in ordinals.
4455            while _next_ordinal_to_read < 1 {
4456                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4457                _next_ordinal_to_read += 1;
4458                next_offset += envelope_size;
4459            }
4460
4461            let next_out_of_line = decoder.next_out_of_line();
4462            let handles_before = decoder.remaining_handles();
4463            if let Some((inlined, num_bytes, num_handles)) =
4464                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4465            {
4466                let member_inline_size = <fidl_fuchsia_hardware_audio::CodecFormatInfo as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4467                if inlined != (member_inline_size <= 4) {
4468                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4469                }
4470                let inner_offset;
4471                let mut inner_depth = depth.clone();
4472                if inlined {
4473                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4474                    inner_offset = next_offset;
4475                } else {
4476                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4477                    inner_depth.increment()?;
4478                }
4479                let val_ref = self.state.get_or_insert_with(|| {
4480                    fidl::new_empty!(fidl_fuchsia_hardware_audio::CodecFormatInfo, D)
4481                });
4482                fidl::decode!(
4483                    fidl_fuchsia_hardware_audio::CodecFormatInfo,
4484                    D,
4485                    val_ref,
4486                    decoder,
4487                    inner_offset,
4488                    inner_depth
4489                )?;
4490                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4491                {
4492                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4493                }
4494                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4495                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4496                }
4497            }
4498
4499            next_offset += envelope_size;
4500
4501            // Decode the remaining unknown envelopes.
4502            while next_offset < end_offset {
4503                _next_ordinal_to_read += 1;
4504                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4505                next_offset += envelope_size;
4506            }
4507
4508            Ok(())
4509        }
4510    }
4511
4512    impl DelayInfo {
4513        #[inline(always)]
4514        fn max_ordinal_present(&self) -> u64 {
4515            if let Some(_) = self.external_delay {
4516                return 2;
4517            }
4518            if let Some(_) = self.internal_delay {
4519                return 1;
4520            }
4521            0
4522        }
4523    }
4524
4525    impl fidl::encoding::ValueTypeMarker for DelayInfo {
4526        type Borrowed<'a> = &'a Self;
4527        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4528            value
4529        }
4530    }
4531
4532    unsafe impl fidl::encoding::TypeMarker for DelayInfo {
4533        type Owned = Self;
4534
4535        #[inline(always)]
4536        fn inline_align(_context: fidl::encoding::Context) -> usize {
4537            8
4538        }
4539
4540        #[inline(always)]
4541        fn inline_size(_context: fidl::encoding::Context) -> usize {
4542            16
4543        }
4544    }
4545
4546    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<DelayInfo, D>
4547        for &DelayInfo
4548    {
4549        unsafe fn encode(
4550            self,
4551            encoder: &mut fidl::encoding::Encoder<'_, D>,
4552            offset: usize,
4553            mut depth: fidl::encoding::Depth,
4554        ) -> fidl::Result<()> {
4555            encoder.debug_check_bounds::<DelayInfo>(offset);
4556            // Vector header
4557            let max_ordinal: u64 = self.max_ordinal_present();
4558            encoder.write_num(max_ordinal, offset);
4559            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
4560            // Calling encoder.out_of_line_offset(0) is not allowed.
4561            if max_ordinal == 0 {
4562                return Ok(());
4563            }
4564            depth.increment()?;
4565            let envelope_size = 8;
4566            let bytes_len = max_ordinal as usize * envelope_size;
4567            #[allow(unused_variables)]
4568            let offset = encoder.out_of_line_offset(bytes_len);
4569            let mut _prev_end_offset: usize = 0;
4570            if 1 > max_ordinal {
4571                return Ok(());
4572            }
4573
4574            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4575            // are envelope_size bytes.
4576            let cur_offset: usize = (1 - 1) * envelope_size;
4577
4578            // Zero reserved fields.
4579            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4580
4581            // Safety:
4582            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4583            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4584            //   envelope_size bytes, there is always sufficient room.
4585            fidl::encoding::encode_in_envelope_optional::<i64, D>(
4586                self.internal_delay.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
4587                encoder,
4588                offset + cur_offset,
4589                depth,
4590            )?;
4591
4592            _prev_end_offset = cur_offset + envelope_size;
4593            if 2 > max_ordinal {
4594                return Ok(());
4595            }
4596
4597            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4598            // are envelope_size bytes.
4599            let cur_offset: usize = (2 - 1) * envelope_size;
4600
4601            // Zero reserved fields.
4602            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4603
4604            // Safety:
4605            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4606            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4607            //   envelope_size bytes, there is always sufficient room.
4608            fidl::encoding::encode_in_envelope_optional::<i64, D>(
4609                self.external_delay.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
4610                encoder,
4611                offset + cur_offset,
4612                depth,
4613            )?;
4614
4615            _prev_end_offset = cur_offset + envelope_size;
4616
4617            Ok(())
4618        }
4619    }
4620
4621    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for DelayInfo {
4622        #[inline(always)]
4623        fn new_empty() -> Self {
4624            Self::default()
4625        }
4626
4627        unsafe fn decode(
4628            &mut self,
4629            decoder: &mut fidl::encoding::Decoder<'_, D>,
4630            offset: usize,
4631            mut depth: fidl::encoding::Depth,
4632        ) -> fidl::Result<()> {
4633            decoder.debug_check_bounds::<Self>(offset);
4634            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
4635                None => return Err(fidl::Error::NotNullable),
4636                Some(len) => len,
4637            };
4638            // Calling decoder.out_of_line_offset(0) is not allowed.
4639            if len == 0 {
4640                return Ok(());
4641            };
4642            depth.increment()?;
4643            let envelope_size = 8;
4644            let bytes_len = len * envelope_size;
4645            let offset = decoder.out_of_line_offset(bytes_len)?;
4646            // Decode the envelope for each type.
4647            let mut _next_ordinal_to_read = 0;
4648            let mut next_offset = offset;
4649            let end_offset = offset + bytes_len;
4650            _next_ordinal_to_read += 1;
4651            if next_offset >= end_offset {
4652                return Ok(());
4653            }
4654
4655            // Decode unknown envelopes for gaps in ordinals.
4656            while _next_ordinal_to_read < 1 {
4657                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4658                _next_ordinal_to_read += 1;
4659                next_offset += envelope_size;
4660            }
4661
4662            let next_out_of_line = decoder.next_out_of_line();
4663            let handles_before = decoder.remaining_handles();
4664            if let Some((inlined, num_bytes, num_handles)) =
4665                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4666            {
4667                let member_inline_size =
4668                    <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4669                if inlined != (member_inline_size <= 4) {
4670                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4671                }
4672                let inner_offset;
4673                let mut inner_depth = depth.clone();
4674                if inlined {
4675                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4676                    inner_offset = next_offset;
4677                } else {
4678                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4679                    inner_depth.increment()?;
4680                }
4681                let val_ref = self.internal_delay.get_or_insert_with(|| fidl::new_empty!(i64, D));
4682                fidl::decode!(i64, D, val_ref, decoder, inner_offset, inner_depth)?;
4683                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4684                {
4685                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4686                }
4687                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4688                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4689                }
4690            }
4691
4692            next_offset += envelope_size;
4693            _next_ordinal_to_read += 1;
4694            if next_offset >= end_offset {
4695                return Ok(());
4696            }
4697
4698            // Decode unknown envelopes for gaps in ordinals.
4699            while _next_ordinal_to_read < 2 {
4700                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4701                _next_ordinal_to_read += 1;
4702                next_offset += envelope_size;
4703            }
4704
4705            let next_out_of_line = decoder.next_out_of_line();
4706            let handles_before = decoder.remaining_handles();
4707            if let Some((inlined, num_bytes, num_handles)) =
4708                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4709            {
4710                let member_inline_size =
4711                    <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4712                if inlined != (member_inline_size <= 4) {
4713                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4714                }
4715                let inner_offset;
4716                let mut inner_depth = depth.clone();
4717                if inlined {
4718                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4719                    inner_offset = next_offset;
4720                } else {
4721                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4722                    inner_depth.increment()?;
4723                }
4724                let val_ref = self.external_delay.get_or_insert_with(|| fidl::new_empty!(i64, D));
4725                fidl::decode!(i64, D, val_ref, decoder, inner_offset, inner_depth)?;
4726                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4727                {
4728                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4729                }
4730                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4731                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4732                }
4733            }
4734
4735            next_offset += envelope_size;
4736
4737            // Decode the remaining unknown envelopes.
4738            while next_offset < end_offset {
4739                _next_ordinal_to_read += 1;
4740                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4741                next_offset += envelope_size;
4742            }
4743
4744            Ok(())
4745        }
4746    }
4747
4748    impl ElementDaiFormatSet {
4749        #[inline(always)]
4750        fn max_ordinal_present(&self) -> u64 {
4751            if let Some(_) = self.format_sets {
4752                return 2;
4753            }
4754            if let Some(_) = self.element_id {
4755                return 1;
4756            }
4757            0
4758        }
4759    }
4760
4761    impl fidl::encoding::ValueTypeMarker for ElementDaiFormatSet {
4762        type Borrowed<'a> = &'a Self;
4763        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4764            value
4765        }
4766    }
4767
4768    unsafe impl fidl::encoding::TypeMarker for ElementDaiFormatSet {
4769        type Owned = Self;
4770
4771        #[inline(always)]
4772        fn inline_align(_context: fidl::encoding::Context) -> usize {
4773            8
4774        }
4775
4776        #[inline(always)]
4777        fn inline_size(_context: fidl::encoding::Context) -> usize {
4778            16
4779        }
4780    }
4781
4782    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<ElementDaiFormatSet, D>
4783        for &ElementDaiFormatSet
4784    {
4785        unsafe fn encode(
4786            self,
4787            encoder: &mut fidl::encoding::Encoder<'_, D>,
4788            offset: usize,
4789            mut depth: fidl::encoding::Depth,
4790        ) -> fidl::Result<()> {
4791            encoder.debug_check_bounds::<ElementDaiFormatSet>(offset);
4792            // Vector header
4793            let max_ordinal: u64 = self.max_ordinal_present();
4794            encoder.write_num(max_ordinal, offset);
4795            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
4796            // Calling encoder.out_of_line_offset(0) is not allowed.
4797            if max_ordinal == 0 {
4798                return Ok(());
4799            }
4800            depth.increment()?;
4801            let envelope_size = 8;
4802            let bytes_len = max_ordinal as usize * envelope_size;
4803            #[allow(unused_variables)]
4804            let offset = encoder.out_of_line_offset(bytes_len);
4805            let mut _prev_end_offset: usize = 0;
4806            if 1 > max_ordinal {
4807                return Ok(());
4808            }
4809
4810            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4811            // are envelope_size bytes.
4812            let cur_offset: usize = (1 - 1) * envelope_size;
4813
4814            // Zero reserved fields.
4815            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4816
4817            // Safety:
4818            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4819            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4820            //   envelope_size bytes, there is always sufficient room.
4821            fidl::encoding::encode_in_envelope_optional::<u64, D>(
4822                self.element_id.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
4823                encoder,
4824                offset + cur_offset,
4825                depth,
4826            )?;
4827
4828            _prev_end_offset = cur_offset + envelope_size;
4829            if 2 > max_ordinal {
4830                return Ok(());
4831            }
4832
4833            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4834            // are envelope_size bytes.
4835            let cur_offset: usize = (2 - 1) * envelope_size;
4836
4837            // Zero reserved fields.
4838            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4839
4840            // Safety:
4841            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4842            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4843            //   envelope_size bytes, there is always sufficient room.
4844            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<fidl_fuchsia_hardware_audio::DaiSupportedFormats, 64>, D>(
4845            self.format_sets.as_ref().map(<fidl::encoding::Vector<fidl_fuchsia_hardware_audio::DaiSupportedFormats, 64> as fidl::encoding::ValueTypeMarker>::borrow),
4846            encoder, offset + cur_offset, depth
4847        )?;
4848
4849            _prev_end_offset = cur_offset + envelope_size;
4850
4851            Ok(())
4852        }
4853    }
4854
4855    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ElementDaiFormatSet {
4856        #[inline(always)]
4857        fn new_empty() -> Self {
4858            Self::default()
4859        }
4860
4861        unsafe fn decode(
4862            &mut self,
4863            decoder: &mut fidl::encoding::Decoder<'_, D>,
4864            offset: usize,
4865            mut depth: fidl::encoding::Depth,
4866        ) -> fidl::Result<()> {
4867            decoder.debug_check_bounds::<Self>(offset);
4868            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
4869                None => return Err(fidl::Error::NotNullable),
4870                Some(len) => len,
4871            };
4872            // Calling decoder.out_of_line_offset(0) is not allowed.
4873            if len == 0 {
4874                return Ok(());
4875            };
4876            depth.increment()?;
4877            let envelope_size = 8;
4878            let bytes_len = len * envelope_size;
4879            let offset = decoder.out_of_line_offset(bytes_len)?;
4880            // Decode the envelope for each type.
4881            let mut _next_ordinal_to_read = 0;
4882            let mut next_offset = offset;
4883            let end_offset = offset + bytes_len;
4884            _next_ordinal_to_read += 1;
4885            if next_offset >= end_offset {
4886                return Ok(());
4887            }
4888
4889            // Decode unknown envelopes for gaps in ordinals.
4890            while _next_ordinal_to_read < 1 {
4891                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4892                _next_ordinal_to_read += 1;
4893                next_offset += envelope_size;
4894            }
4895
4896            let next_out_of_line = decoder.next_out_of_line();
4897            let handles_before = decoder.remaining_handles();
4898            if let Some((inlined, num_bytes, num_handles)) =
4899                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4900            {
4901                let member_inline_size =
4902                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4903                if inlined != (member_inline_size <= 4) {
4904                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4905                }
4906                let inner_offset;
4907                let mut inner_depth = depth.clone();
4908                if inlined {
4909                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4910                    inner_offset = next_offset;
4911                } else {
4912                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4913                    inner_depth.increment()?;
4914                }
4915                let val_ref = self.element_id.get_or_insert_with(|| fidl::new_empty!(u64, D));
4916                fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
4917                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4918                {
4919                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4920                }
4921                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4922                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4923                }
4924            }
4925
4926            next_offset += envelope_size;
4927            _next_ordinal_to_read += 1;
4928            if next_offset >= end_offset {
4929                return Ok(());
4930            }
4931
4932            // Decode unknown envelopes for gaps in ordinals.
4933            while _next_ordinal_to_read < 2 {
4934                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4935                _next_ordinal_to_read += 1;
4936                next_offset += envelope_size;
4937            }
4938
4939            let next_out_of_line = decoder.next_out_of_line();
4940            let handles_before = decoder.remaining_handles();
4941            if let Some((inlined, num_bytes, num_handles)) =
4942                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4943            {
4944                let member_inline_size = <fidl::encoding::Vector<
4945                    fidl_fuchsia_hardware_audio::DaiSupportedFormats,
4946                    64,
4947                > as fidl::encoding::TypeMarker>::inline_size(
4948                    decoder.context
4949                );
4950                if inlined != (member_inline_size <= 4) {
4951                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4952                }
4953                let inner_offset;
4954                let mut inner_depth = depth.clone();
4955                if inlined {
4956                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4957                    inner_offset = next_offset;
4958                } else {
4959                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4960                    inner_depth.increment()?;
4961                }
4962                let val_ref =
4963                self.format_sets.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<fidl_fuchsia_hardware_audio::DaiSupportedFormats, 64>, D));
4964                fidl::decode!(fidl::encoding::Vector<fidl_fuchsia_hardware_audio::DaiSupportedFormats, 64>, D, val_ref, decoder, inner_offset, inner_depth)?;
4965                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4966                {
4967                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4968                }
4969                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4970                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4971                }
4972            }
4973
4974            next_offset += envelope_size;
4975
4976            // Decode the remaining unknown envelopes.
4977            while next_offset < end_offset {
4978                _next_ordinal_to_read += 1;
4979                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4980                next_offset += envelope_size;
4981            }
4982
4983            Ok(())
4984        }
4985    }
4986
4987    impl ElementRingBufferFormatSet {
4988        #[inline(always)]
4989        fn max_ordinal_present(&self) -> u64 {
4990            if let Some(_) = self.format_sets {
4991                return 2;
4992            }
4993            if let Some(_) = self.element_id {
4994                return 1;
4995            }
4996            0
4997        }
4998    }
4999
5000    impl fidl::encoding::ValueTypeMarker for ElementRingBufferFormatSet {
5001        type Borrowed<'a> = &'a Self;
5002        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
5003            value
5004        }
5005    }
5006
5007    unsafe impl fidl::encoding::TypeMarker for ElementRingBufferFormatSet {
5008        type Owned = Self;
5009
5010        #[inline(always)]
5011        fn inline_align(_context: fidl::encoding::Context) -> usize {
5012            8
5013        }
5014
5015        #[inline(always)]
5016        fn inline_size(_context: fidl::encoding::Context) -> usize {
5017            16
5018        }
5019    }
5020
5021    unsafe impl<D: fidl::encoding::ResourceDialect>
5022        fidl::encoding::Encode<ElementRingBufferFormatSet, D> for &ElementRingBufferFormatSet
5023    {
5024        unsafe fn encode(
5025            self,
5026            encoder: &mut fidl::encoding::Encoder<'_, D>,
5027            offset: usize,
5028            mut depth: fidl::encoding::Depth,
5029        ) -> fidl::Result<()> {
5030            encoder.debug_check_bounds::<ElementRingBufferFormatSet>(offset);
5031            // Vector header
5032            let max_ordinal: u64 = self.max_ordinal_present();
5033            encoder.write_num(max_ordinal, offset);
5034            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
5035            // Calling encoder.out_of_line_offset(0) is not allowed.
5036            if max_ordinal == 0 {
5037                return Ok(());
5038            }
5039            depth.increment()?;
5040            let envelope_size = 8;
5041            let bytes_len = max_ordinal as usize * envelope_size;
5042            #[allow(unused_variables)]
5043            let offset = encoder.out_of_line_offset(bytes_len);
5044            let mut _prev_end_offset: usize = 0;
5045            if 1 > max_ordinal {
5046                return Ok(());
5047            }
5048
5049            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5050            // are envelope_size bytes.
5051            let cur_offset: usize = (1 - 1) * envelope_size;
5052
5053            // Zero reserved fields.
5054            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5055
5056            // Safety:
5057            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5058            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5059            //   envelope_size bytes, there is always sufficient room.
5060            fidl::encoding::encode_in_envelope_optional::<u64, D>(
5061                self.element_id.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
5062                encoder,
5063                offset + cur_offset,
5064                depth,
5065            )?;
5066
5067            _prev_end_offset = cur_offset + envelope_size;
5068            if 2 > max_ordinal {
5069                return Ok(());
5070            }
5071
5072            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5073            // are envelope_size bytes.
5074            let cur_offset: usize = (2 - 1) * envelope_size;
5075
5076            // Zero reserved fields.
5077            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5078
5079            // Safety:
5080            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5081            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5082            //   envelope_size bytes, there is always sufficient room.
5083            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<PcmFormatSet, 64>, D>(
5084            self.format_sets.as_ref().map(<fidl::encoding::Vector<PcmFormatSet, 64> as fidl::encoding::ValueTypeMarker>::borrow),
5085            encoder, offset + cur_offset, depth
5086        )?;
5087
5088            _prev_end_offset = cur_offset + envelope_size;
5089
5090            Ok(())
5091        }
5092    }
5093
5094    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
5095        for ElementRingBufferFormatSet
5096    {
5097        #[inline(always)]
5098        fn new_empty() -> Self {
5099            Self::default()
5100        }
5101
5102        unsafe fn decode(
5103            &mut self,
5104            decoder: &mut fidl::encoding::Decoder<'_, D>,
5105            offset: usize,
5106            mut depth: fidl::encoding::Depth,
5107        ) -> fidl::Result<()> {
5108            decoder.debug_check_bounds::<Self>(offset);
5109            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
5110                None => return Err(fidl::Error::NotNullable),
5111                Some(len) => len,
5112            };
5113            // Calling decoder.out_of_line_offset(0) is not allowed.
5114            if len == 0 {
5115                return Ok(());
5116            };
5117            depth.increment()?;
5118            let envelope_size = 8;
5119            let bytes_len = len * envelope_size;
5120            let offset = decoder.out_of_line_offset(bytes_len)?;
5121            // Decode the envelope for each type.
5122            let mut _next_ordinal_to_read = 0;
5123            let mut next_offset = offset;
5124            let end_offset = offset + bytes_len;
5125            _next_ordinal_to_read += 1;
5126            if next_offset >= end_offset {
5127                return Ok(());
5128            }
5129
5130            // Decode unknown envelopes for gaps in ordinals.
5131            while _next_ordinal_to_read < 1 {
5132                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5133                _next_ordinal_to_read += 1;
5134                next_offset += envelope_size;
5135            }
5136
5137            let next_out_of_line = decoder.next_out_of_line();
5138            let handles_before = decoder.remaining_handles();
5139            if let Some((inlined, num_bytes, num_handles)) =
5140                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5141            {
5142                let member_inline_size =
5143                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5144                if inlined != (member_inline_size <= 4) {
5145                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5146                }
5147                let inner_offset;
5148                let mut inner_depth = depth.clone();
5149                if inlined {
5150                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5151                    inner_offset = next_offset;
5152                } else {
5153                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5154                    inner_depth.increment()?;
5155                }
5156                let val_ref = self.element_id.get_or_insert_with(|| fidl::new_empty!(u64, D));
5157                fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
5158                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5159                {
5160                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5161                }
5162                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5163                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5164                }
5165            }
5166
5167            next_offset += envelope_size;
5168            _next_ordinal_to_read += 1;
5169            if next_offset >= end_offset {
5170                return Ok(());
5171            }
5172
5173            // Decode unknown envelopes for gaps in ordinals.
5174            while _next_ordinal_to_read < 2 {
5175                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5176                _next_ordinal_to_read += 1;
5177                next_offset += envelope_size;
5178            }
5179
5180            let next_out_of_line = decoder.next_out_of_line();
5181            let handles_before = decoder.remaining_handles();
5182            if let Some((inlined, num_bytes, num_handles)) =
5183                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5184            {
5185                let member_inline_size = <fidl::encoding::Vector<PcmFormatSet, 64> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5186                if inlined != (member_inline_size <= 4) {
5187                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5188                }
5189                let inner_offset;
5190                let mut inner_depth = depth.clone();
5191                if inlined {
5192                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5193                    inner_offset = next_offset;
5194                } else {
5195                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5196                    inner_depth.increment()?;
5197                }
5198                let val_ref = self.format_sets.get_or_insert_with(
5199                    || fidl::new_empty!(fidl::encoding::Vector<PcmFormatSet, 64>, D),
5200                );
5201                fidl::decode!(fidl::encoding::Vector<PcmFormatSet, 64>, D, val_ref, decoder, inner_offset, inner_depth)?;
5202                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5203                {
5204                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5205                }
5206                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5207                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5208                }
5209            }
5210
5211            next_offset += envelope_size;
5212
5213            // Decode the remaining unknown envelopes.
5214            while next_offset < end_offset {
5215                _next_ordinal_to_read += 1;
5216                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5217                next_offset += envelope_size;
5218            }
5219
5220            Ok(())
5221        }
5222    }
5223
5224    impl Info {
5225        #[inline(always)]
5226        fn max_ordinal_present(&self) -> u64 {
5227            if let Some(_) = self.signal_processing_topologies {
5228                return 13;
5229            }
5230            if let Some(_) = self.signal_processing_elements {
5231                return 12;
5232            }
5233            if let Some(_) = self.clock_domain {
5234                return 11;
5235            }
5236            if let Some(_) = self.plug_detect_caps {
5237                return 10;
5238            }
5239            if let Some(_) = self.dai_format_sets {
5240                return 9;
5241            }
5242            if let Some(_) = self.ring_buffer_format_sets {
5243                return 8;
5244            }
5245            if let Some(_) = self.is_input {
5246                return 7;
5247            }
5248            if let Some(_) = self.unique_instance_id {
5249                return 6;
5250            }
5251            if let Some(_) = self.product {
5252                return 5;
5253            }
5254            if let Some(_) = self.manufacturer {
5255                return 4;
5256            }
5257            if let Some(_) = self.device_name {
5258                return 3;
5259            }
5260            if let Some(_) = self.device_type {
5261                return 2;
5262            }
5263            if let Some(_) = self.token_id {
5264                return 1;
5265            }
5266            0
5267        }
5268    }
5269
5270    impl fidl::encoding::ValueTypeMarker for Info {
5271        type Borrowed<'a> = &'a Self;
5272        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
5273            value
5274        }
5275    }
5276
5277    unsafe impl fidl::encoding::TypeMarker for Info {
5278        type Owned = Self;
5279
5280        #[inline(always)]
5281        fn inline_align(_context: fidl::encoding::Context) -> usize {
5282            8
5283        }
5284
5285        #[inline(always)]
5286        fn inline_size(_context: fidl::encoding::Context) -> usize {
5287            16
5288        }
5289    }
5290
5291    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Info, D> for &Info {
5292        unsafe fn encode(
5293            self,
5294            encoder: &mut fidl::encoding::Encoder<'_, D>,
5295            offset: usize,
5296            mut depth: fidl::encoding::Depth,
5297        ) -> fidl::Result<()> {
5298            encoder.debug_check_bounds::<Info>(offset);
5299            // Vector header
5300            let max_ordinal: u64 = self.max_ordinal_present();
5301            encoder.write_num(max_ordinal, offset);
5302            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
5303            // Calling encoder.out_of_line_offset(0) is not allowed.
5304            if max_ordinal == 0 {
5305                return Ok(());
5306            }
5307            depth.increment()?;
5308            let envelope_size = 8;
5309            let bytes_len = max_ordinal as usize * envelope_size;
5310            #[allow(unused_variables)]
5311            let offset = encoder.out_of_line_offset(bytes_len);
5312            let mut _prev_end_offset: usize = 0;
5313            if 1 > max_ordinal {
5314                return Ok(());
5315            }
5316
5317            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5318            // are envelope_size bytes.
5319            let cur_offset: usize = (1 - 1) * envelope_size;
5320
5321            // Zero reserved fields.
5322            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5323
5324            // Safety:
5325            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5326            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5327            //   envelope_size bytes, there is always sufficient room.
5328            fidl::encoding::encode_in_envelope_optional::<u64, D>(
5329                self.token_id.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
5330                encoder,
5331                offset + cur_offset,
5332                depth,
5333            )?;
5334
5335            _prev_end_offset = cur_offset + envelope_size;
5336            if 2 > max_ordinal {
5337                return Ok(());
5338            }
5339
5340            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5341            // are envelope_size bytes.
5342            let cur_offset: usize = (2 - 1) * envelope_size;
5343
5344            // Zero reserved fields.
5345            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5346
5347            // Safety:
5348            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5349            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5350            //   envelope_size bytes, there is always sufficient room.
5351            fidl::encoding::encode_in_envelope_optional::<DeviceType, D>(
5352                self.device_type
5353                    .as_ref()
5354                    .map(<DeviceType as fidl::encoding::ValueTypeMarker>::borrow),
5355                encoder,
5356                offset + cur_offset,
5357                depth,
5358            )?;
5359
5360            _prev_end_offset = cur_offset + envelope_size;
5361            if 3 > max_ordinal {
5362                return Ok(());
5363            }
5364
5365            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5366            // are envelope_size bytes.
5367            let cur_offset: usize = (3 - 1) * envelope_size;
5368
5369            // Zero reserved fields.
5370            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5371
5372            // Safety:
5373            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5374            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5375            //   envelope_size bytes, there is always sufficient room.
5376            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<256>, D>(
5377                self.device_name.as_ref().map(
5378                    <fidl::encoding::BoundedString<256> as fidl::encoding::ValueTypeMarker>::borrow,
5379                ),
5380                encoder,
5381                offset + cur_offset,
5382                depth,
5383            )?;
5384
5385            _prev_end_offset = cur_offset + envelope_size;
5386            if 4 > max_ordinal {
5387                return Ok(());
5388            }
5389
5390            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5391            // are envelope_size bytes.
5392            let cur_offset: usize = (4 - 1) * envelope_size;
5393
5394            // Zero reserved fields.
5395            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5396
5397            // Safety:
5398            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5399            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5400            //   envelope_size bytes, there is always sufficient room.
5401            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<256>, D>(
5402                self.manufacturer.as_ref().map(
5403                    <fidl::encoding::BoundedString<256> as fidl::encoding::ValueTypeMarker>::borrow,
5404                ),
5405                encoder,
5406                offset + cur_offset,
5407                depth,
5408            )?;
5409
5410            _prev_end_offset = cur_offset + envelope_size;
5411            if 5 > max_ordinal {
5412                return Ok(());
5413            }
5414
5415            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5416            // are envelope_size bytes.
5417            let cur_offset: usize = (5 - 1) * envelope_size;
5418
5419            // Zero reserved fields.
5420            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5421
5422            // Safety:
5423            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5424            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5425            //   envelope_size bytes, there is always sufficient room.
5426            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<256>, D>(
5427                self.product.as_ref().map(
5428                    <fidl::encoding::BoundedString<256> as fidl::encoding::ValueTypeMarker>::borrow,
5429                ),
5430                encoder,
5431                offset + cur_offset,
5432                depth,
5433            )?;
5434
5435            _prev_end_offset = cur_offset + envelope_size;
5436            if 6 > max_ordinal {
5437                return Ok(());
5438            }
5439
5440            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5441            // are envelope_size bytes.
5442            let cur_offset: usize = (6 - 1) * envelope_size;
5443
5444            // Zero reserved fields.
5445            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5446
5447            // Safety:
5448            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5449            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5450            //   envelope_size bytes, there is always sufficient room.
5451            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Array<u8, 16>, D>(
5452                self.unique_instance_id.as_ref().map(
5453                    <fidl::encoding::Array<u8, 16> as fidl::encoding::ValueTypeMarker>::borrow,
5454                ),
5455                encoder,
5456                offset + cur_offset,
5457                depth,
5458            )?;
5459
5460            _prev_end_offset = cur_offset + envelope_size;
5461            if 7 > max_ordinal {
5462                return Ok(());
5463            }
5464
5465            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5466            // are envelope_size bytes.
5467            let cur_offset: usize = (7 - 1) * envelope_size;
5468
5469            // Zero reserved fields.
5470            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5471
5472            // Safety:
5473            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5474            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5475            //   envelope_size bytes, there is always sufficient room.
5476            fidl::encoding::encode_in_envelope_optional::<bool, D>(
5477                self.is_input.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
5478                encoder,
5479                offset + cur_offset,
5480                depth,
5481            )?;
5482
5483            _prev_end_offset = cur_offset + envelope_size;
5484            if 8 > max_ordinal {
5485                return Ok(());
5486            }
5487
5488            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5489            // are envelope_size bytes.
5490            let cur_offset: usize = (8 - 1) * envelope_size;
5491
5492            // Zero reserved fields.
5493            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5494
5495            // Safety:
5496            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5497            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5498            //   envelope_size bytes, there is always sufficient room.
5499            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<ElementRingBufferFormatSet, 64>, D>(
5500            self.ring_buffer_format_sets.as_ref().map(<fidl::encoding::Vector<ElementRingBufferFormatSet, 64> as fidl::encoding::ValueTypeMarker>::borrow),
5501            encoder, offset + cur_offset, depth
5502        )?;
5503
5504            _prev_end_offset = cur_offset + envelope_size;
5505            if 9 > max_ordinal {
5506                return Ok(());
5507            }
5508
5509            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5510            // are envelope_size bytes.
5511            let cur_offset: usize = (9 - 1) * envelope_size;
5512
5513            // Zero reserved fields.
5514            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5515
5516            // Safety:
5517            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5518            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5519            //   envelope_size bytes, there is always sufficient room.
5520            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<ElementDaiFormatSet, 64>, D>(
5521            self.dai_format_sets.as_ref().map(<fidl::encoding::Vector<ElementDaiFormatSet, 64> as fidl::encoding::ValueTypeMarker>::borrow),
5522            encoder, offset + cur_offset, depth
5523        )?;
5524
5525            _prev_end_offset = cur_offset + envelope_size;
5526            if 10 > max_ordinal {
5527                return Ok(());
5528            }
5529
5530            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5531            // are envelope_size bytes.
5532            let cur_offset: usize = (10 - 1) * envelope_size;
5533
5534            // Zero reserved fields.
5535            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5536
5537            // Safety:
5538            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5539            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5540            //   envelope_size bytes, there is always sufficient room.
5541            fidl::encoding::encode_in_envelope_optional::<PlugDetectCapabilities, D>(
5542                self.plug_detect_caps
5543                    .as_ref()
5544                    .map(<PlugDetectCapabilities as fidl::encoding::ValueTypeMarker>::borrow),
5545                encoder,
5546                offset + cur_offset,
5547                depth,
5548            )?;
5549
5550            _prev_end_offset = cur_offset + envelope_size;
5551            if 11 > max_ordinal {
5552                return Ok(());
5553            }
5554
5555            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5556            // are envelope_size bytes.
5557            let cur_offset: usize = (11 - 1) * envelope_size;
5558
5559            // Zero reserved fields.
5560            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5561
5562            // Safety:
5563            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5564            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5565            //   envelope_size bytes, there is always sufficient room.
5566            fidl::encoding::encode_in_envelope_optional::<u32, D>(
5567                self.clock_domain.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
5568                encoder,
5569                offset + cur_offset,
5570                depth,
5571            )?;
5572
5573            _prev_end_offset = cur_offset + envelope_size;
5574            if 12 > max_ordinal {
5575                return Ok(());
5576            }
5577
5578            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5579            // are envelope_size bytes.
5580            let cur_offset: usize = (12 - 1) * envelope_size;
5581
5582            // Zero reserved fields.
5583            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5584
5585            // Safety:
5586            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5587            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5588            //   envelope_size bytes, there is always sufficient room.
5589            fidl::encoding::encode_in_envelope_optional::<
5590                fidl::encoding::Vector<fidl_fuchsia_hardware_audio_signalprocessing::Element, 64>,
5591                D,
5592            >(
5593                self.signal_processing_elements.as_ref().map(
5594                    <fidl::encoding::Vector<
5595                        fidl_fuchsia_hardware_audio_signalprocessing::Element,
5596                        64,
5597                    > as fidl::encoding::ValueTypeMarker>::borrow,
5598                ),
5599                encoder,
5600                offset + cur_offset,
5601                depth,
5602            )?;
5603
5604            _prev_end_offset = cur_offset + envelope_size;
5605            if 13 > max_ordinal {
5606                return Ok(());
5607            }
5608
5609            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5610            // are envelope_size bytes.
5611            let cur_offset: usize = (13 - 1) * envelope_size;
5612
5613            // Zero reserved fields.
5614            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5615
5616            // Safety:
5617            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5618            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5619            //   envelope_size bytes, there is always sufficient room.
5620            fidl::encoding::encode_in_envelope_optional::<
5621                fidl::encoding::Vector<fidl_fuchsia_hardware_audio_signalprocessing::Topology, 64>,
5622                D,
5623            >(
5624                self.signal_processing_topologies.as_ref().map(
5625                    <fidl::encoding::Vector<
5626                        fidl_fuchsia_hardware_audio_signalprocessing::Topology,
5627                        64,
5628                    > as fidl::encoding::ValueTypeMarker>::borrow,
5629                ),
5630                encoder,
5631                offset + cur_offset,
5632                depth,
5633            )?;
5634
5635            _prev_end_offset = cur_offset + envelope_size;
5636
5637            Ok(())
5638        }
5639    }
5640
5641    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Info {
5642        #[inline(always)]
5643        fn new_empty() -> Self {
5644            Self::default()
5645        }
5646
5647        unsafe fn decode(
5648            &mut self,
5649            decoder: &mut fidl::encoding::Decoder<'_, D>,
5650            offset: usize,
5651            mut depth: fidl::encoding::Depth,
5652        ) -> fidl::Result<()> {
5653            decoder.debug_check_bounds::<Self>(offset);
5654            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
5655                None => return Err(fidl::Error::NotNullable),
5656                Some(len) => len,
5657            };
5658            // Calling decoder.out_of_line_offset(0) is not allowed.
5659            if len == 0 {
5660                return Ok(());
5661            };
5662            depth.increment()?;
5663            let envelope_size = 8;
5664            let bytes_len = len * envelope_size;
5665            let offset = decoder.out_of_line_offset(bytes_len)?;
5666            // Decode the envelope for each type.
5667            let mut _next_ordinal_to_read = 0;
5668            let mut next_offset = offset;
5669            let end_offset = offset + bytes_len;
5670            _next_ordinal_to_read += 1;
5671            if next_offset >= end_offset {
5672                return Ok(());
5673            }
5674
5675            // Decode unknown envelopes for gaps in ordinals.
5676            while _next_ordinal_to_read < 1 {
5677                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5678                _next_ordinal_to_read += 1;
5679                next_offset += envelope_size;
5680            }
5681
5682            let next_out_of_line = decoder.next_out_of_line();
5683            let handles_before = decoder.remaining_handles();
5684            if let Some((inlined, num_bytes, num_handles)) =
5685                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5686            {
5687                let member_inline_size =
5688                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5689                if inlined != (member_inline_size <= 4) {
5690                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5691                }
5692                let inner_offset;
5693                let mut inner_depth = depth.clone();
5694                if inlined {
5695                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5696                    inner_offset = next_offset;
5697                } else {
5698                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5699                    inner_depth.increment()?;
5700                }
5701                let val_ref = self.token_id.get_or_insert_with(|| fidl::new_empty!(u64, D));
5702                fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
5703                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5704                {
5705                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5706                }
5707                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5708                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5709                }
5710            }
5711
5712            next_offset += envelope_size;
5713            _next_ordinal_to_read += 1;
5714            if next_offset >= end_offset {
5715                return Ok(());
5716            }
5717
5718            // Decode unknown envelopes for gaps in ordinals.
5719            while _next_ordinal_to_read < 2 {
5720                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5721                _next_ordinal_to_read += 1;
5722                next_offset += envelope_size;
5723            }
5724
5725            let next_out_of_line = decoder.next_out_of_line();
5726            let handles_before = decoder.remaining_handles();
5727            if let Some((inlined, num_bytes, num_handles)) =
5728                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5729            {
5730                let member_inline_size =
5731                    <DeviceType as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5732                if inlined != (member_inline_size <= 4) {
5733                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5734                }
5735                let inner_offset;
5736                let mut inner_depth = depth.clone();
5737                if inlined {
5738                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5739                    inner_offset = next_offset;
5740                } else {
5741                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5742                    inner_depth.increment()?;
5743                }
5744                let val_ref =
5745                    self.device_type.get_or_insert_with(|| fidl::new_empty!(DeviceType, D));
5746                fidl::decode!(DeviceType, D, val_ref, decoder, inner_offset, inner_depth)?;
5747                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5748                {
5749                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5750                }
5751                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5752                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5753                }
5754            }
5755
5756            next_offset += envelope_size;
5757            _next_ordinal_to_read += 1;
5758            if next_offset >= end_offset {
5759                return Ok(());
5760            }
5761
5762            // Decode unknown envelopes for gaps in ordinals.
5763            while _next_ordinal_to_read < 3 {
5764                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5765                _next_ordinal_to_read += 1;
5766                next_offset += envelope_size;
5767            }
5768
5769            let next_out_of_line = decoder.next_out_of_line();
5770            let handles_before = decoder.remaining_handles();
5771            if let Some((inlined, num_bytes, num_handles)) =
5772                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5773            {
5774                let member_inline_size =
5775                    <fidl::encoding::BoundedString<256> as fidl::encoding::TypeMarker>::inline_size(
5776                        decoder.context,
5777                    );
5778                if inlined != (member_inline_size <= 4) {
5779                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5780                }
5781                let inner_offset;
5782                let mut inner_depth = depth.clone();
5783                if inlined {
5784                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5785                    inner_offset = next_offset;
5786                } else {
5787                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5788                    inner_depth.increment()?;
5789                }
5790                let val_ref = self
5791                    .device_name
5792                    .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::BoundedString<256>, D));
5793                fidl::decode!(
5794                    fidl::encoding::BoundedString<256>,
5795                    D,
5796                    val_ref,
5797                    decoder,
5798                    inner_offset,
5799                    inner_depth
5800                )?;
5801                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5802                {
5803                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5804                }
5805                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5806                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5807                }
5808            }
5809
5810            next_offset += envelope_size;
5811            _next_ordinal_to_read += 1;
5812            if next_offset >= end_offset {
5813                return Ok(());
5814            }
5815
5816            // Decode unknown envelopes for gaps in ordinals.
5817            while _next_ordinal_to_read < 4 {
5818                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5819                _next_ordinal_to_read += 1;
5820                next_offset += envelope_size;
5821            }
5822
5823            let next_out_of_line = decoder.next_out_of_line();
5824            let handles_before = decoder.remaining_handles();
5825            if let Some((inlined, num_bytes, num_handles)) =
5826                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5827            {
5828                let member_inline_size =
5829                    <fidl::encoding::BoundedString<256> as fidl::encoding::TypeMarker>::inline_size(
5830                        decoder.context,
5831                    );
5832                if inlined != (member_inline_size <= 4) {
5833                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5834                }
5835                let inner_offset;
5836                let mut inner_depth = depth.clone();
5837                if inlined {
5838                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5839                    inner_offset = next_offset;
5840                } else {
5841                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5842                    inner_depth.increment()?;
5843                }
5844                let val_ref = self
5845                    .manufacturer
5846                    .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::BoundedString<256>, D));
5847                fidl::decode!(
5848                    fidl::encoding::BoundedString<256>,
5849                    D,
5850                    val_ref,
5851                    decoder,
5852                    inner_offset,
5853                    inner_depth
5854                )?;
5855                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5856                {
5857                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5858                }
5859                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5860                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5861                }
5862            }
5863
5864            next_offset += envelope_size;
5865            _next_ordinal_to_read += 1;
5866            if next_offset >= end_offset {
5867                return Ok(());
5868            }
5869
5870            // Decode unknown envelopes for gaps in ordinals.
5871            while _next_ordinal_to_read < 5 {
5872                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5873                _next_ordinal_to_read += 1;
5874                next_offset += envelope_size;
5875            }
5876
5877            let next_out_of_line = decoder.next_out_of_line();
5878            let handles_before = decoder.remaining_handles();
5879            if let Some((inlined, num_bytes, num_handles)) =
5880                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5881            {
5882                let member_inline_size =
5883                    <fidl::encoding::BoundedString<256> as fidl::encoding::TypeMarker>::inline_size(
5884                        decoder.context,
5885                    );
5886                if inlined != (member_inline_size <= 4) {
5887                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5888                }
5889                let inner_offset;
5890                let mut inner_depth = depth.clone();
5891                if inlined {
5892                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5893                    inner_offset = next_offset;
5894                } else {
5895                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5896                    inner_depth.increment()?;
5897                }
5898                let val_ref = self
5899                    .product
5900                    .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::BoundedString<256>, D));
5901                fidl::decode!(
5902                    fidl::encoding::BoundedString<256>,
5903                    D,
5904                    val_ref,
5905                    decoder,
5906                    inner_offset,
5907                    inner_depth
5908                )?;
5909                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5910                {
5911                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5912                }
5913                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5914                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5915                }
5916            }
5917
5918            next_offset += envelope_size;
5919            _next_ordinal_to_read += 1;
5920            if next_offset >= end_offset {
5921                return Ok(());
5922            }
5923
5924            // Decode unknown envelopes for gaps in ordinals.
5925            while _next_ordinal_to_read < 6 {
5926                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5927                _next_ordinal_to_read += 1;
5928                next_offset += envelope_size;
5929            }
5930
5931            let next_out_of_line = decoder.next_out_of_line();
5932            let handles_before = decoder.remaining_handles();
5933            if let Some((inlined, num_bytes, num_handles)) =
5934                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5935            {
5936                let member_inline_size =
5937                    <fidl::encoding::Array<u8, 16> as fidl::encoding::TypeMarker>::inline_size(
5938                        decoder.context,
5939                    );
5940                if inlined != (member_inline_size <= 4) {
5941                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5942                }
5943                let inner_offset;
5944                let mut inner_depth = depth.clone();
5945                if inlined {
5946                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5947                    inner_offset = next_offset;
5948                } else {
5949                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5950                    inner_depth.increment()?;
5951                }
5952                let val_ref = self
5953                    .unique_instance_id
5954                    .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Array<u8, 16>, D));
5955                fidl::decode!(fidl::encoding::Array<u8, 16>, D, val_ref, decoder, inner_offset, inner_depth)?;
5956                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5957                {
5958                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5959                }
5960                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5961                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5962                }
5963            }
5964
5965            next_offset += envelope_size;
5966            _next_ordinal_to_read += 1;
5967            if next_offset >= end_offset {
5968                return Ok(());
5969            }
5970
5971            // Decode unknown envelopes for gaps in ordinals.
5972            while _next_ordinal_to_read < 7 {
5973                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5974                _next_ordinal_to_read += 1;
5975                next_offset += envelope_size;
5976            }
5977
5978            let next_out_of_line = decoder.next_out_of_line();
5979            let handles_before = decoder.remaining_handles();
5980            if let Some((inlined, num_bytes, num_handles)) =
5981                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5982            {
5983                let member_inline_size =
5984                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5985                if inlined != (member_inline_size <= 4) {
5986                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5987                }
5988                let inner_offset;
5989                let mut inner_depth = depth.clone();
5990                if inlined {
5991                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5992                    inner_offset = next_offset;
5993                } else {
5994                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5995                    inner_depth.increment()?;
5996                }
5997                let val_ref = self.is_input.get_or_insert_with(|| fidl::new_empty!(bool, D));
5998                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
5999                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6000                {
6001                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6002                }
6003                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6004                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6005                }
6006            }
6007
6008            next_offset += envelope_size;
6009            _next_ordinal_to_read += 1;
6010            if next_offset >= end_offset {
6011                return Ok(());
6012            }
6013
6014            // Decode unknown envelopes for gaps in ordinals.
6015            while _next_ordinal_to_read < 8 {
6016                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6017                _next_ordinal_to_read += 1;
6018                next_offset += envelope_size;
6019            }
6020
6021            let next_out_of_line = decoder.next_out_of_line();
6022            let handles_before = decoder.remaining_handles();
6023            if let Some((inlined, num_bytes, num_handles)) =
6024                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6025            {
6026                let member_inline_size = <fidl::encoding::Vector<ElementRingBufferFormatSet, 64> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
6027                if inlined != (member_inline_size <= 4) {
6028                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6029                }
6030                let inner_offset;
6031                let mut inner_depth = depth.clone();
6032                if inlined {
6033                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6034                    inner_offset = next_offset;
6035                } else {
6036                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6037                    inner_depth.increment()?;
6038                }
6039                let val_ref = self.ring_buffer_format_sets.get_or_insert_with(
6040                    || fidl::new_empty!(fidl::encoding::Vector<ElementRingBufferFormatSet, 64>, D),
6041                );
6042                fidl::decode!(fidl::encoding::Vector<ElementRingBufferFormatSet, 64>, D, val_ref, decoder, inner_offset, inner_depth)?;
6043                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6044                {
6045                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6046                }
6047                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6048                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6049                }
6050            }
6051
6052            next_offset += envelope_size;
6053            _next_ordinal_to_read += 1;
6054            if next_offset >= end_offset {
6055                return Ok(());
6056            }
6057
6058            // Decode unknown envelopes for gaps in ordinals.
6059            while _next_ordinal_to_read < 9 {
6060                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6061                _next_ordinal_to_read += 1;
6062                next_offset += envelope_size;
6063            }
6064
6065            let next_out_of_line = decoder.next_out_of_line();
6066            let handles_before = decoder.remaining_handles();
6067            if let Some((inlined, num_bytes, num_handles)) =
6068                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6069            {
6070                let member_inline_size = <fidl::encoding::Vector<ElementDaiFormatSet, 64> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
6071                if inlined != (member_inline_size <= 4) {
6072                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6073                }
6074                let inner_offset;
6075                let mut inner_depth = depth.clone();
6076                if inlined {
6077                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6078                    inner_offset = next_offset;
6079                } else {
6080                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6081                    inner_depth.increment()?;
6082                }
6083                let val_ref = self.dai_format_sets.get_or_insert_with(
6084                    || fidl::new_empty!(fidl::encoding::Vector<ElementDaiFormatSet, 64>, D),
6085                );
6086                fidl::decode!(fidl::encoding::Vector<ElementDaiFormatSet, 64>, D, val_ref, decoder, inner_offset, inner_depth)?;
6087                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6088                {
6089                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6090                }
6091                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6092                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6093                }
6094            }
6095
6096            next_offset += envelope_size;
6097            _next_ordinal_to_read += 1;
6098            if next_offset >= end_offset {
6099                return Ok(());
6100            }
6101
6102            // Decode unknown envelopes for gaps in ordinals.
6103            while _next_ordinal_to_read < 10 {
6104                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6105                _next_ordinal_to_read += 1;
6106                next_offset += envelope_size;
6107            }
6108
6109            let next_out_of_line = decoder.next_out_of_line();
6110            let handles_before = decoder.remaining_handles();
6111            if let Some((inlined, num_bytes, num_handles)) =
6112                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6113            {
6114                let member_inline_size =
6115                    <PlugDetectCapabilities as fidl::encoding::TypeMarker>::inline_size(
6116                        decoder.context,
6117                    );
6118                if inlined != (member_inline_size <= 4) {
6119                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6120                }
6121                let inner_offset;
6122                let mut inner_depth = depth.clone();
6123                if inlined {
6124                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6125                    inner_offset = next_offset;
6126                } else {
6127                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6128                    inner_depth.increment()?;
6129                }
6130                let val_ref = self
6131                    .plug_detect_caps
6132                    .get_or_insert_with(|| fidl::new_empty!(PlugDetectCapabilities, D));
6133                fidl::decode!(
6134                    PlugDetectCapabilities,
6135                    D,
6136                    val_ref,
6137                    decoder,
6138                    inner_offset,
6139                    inner_depth
6140                )?;
6141                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6142                {
6143                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6144                }
6145                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6146                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6147                }
6148            }
6149
6150            next_offset += envelope_size;
6151            _next_ordinal_to_read += 1;
6152            if next_offset >= end_offset {
6153                return Ok(());
6154            }
6155
6156            // Decode unknown envelopes for gaps in ordinals.
6157            while _next_ordinal_to_read < 11 {
6158                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6159                _next_ordinal_to_read += 1;
6160                next_offset += envelope_size;
6161            }
6162
6163            let next_out_of_line = decoder.next_out_of_line();
6164            let handles_before = decoder.remaining_handles();
6165            if let Some((inlined, num_bytes, num_handles)) =
6166                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6167            {
6168                let member_inline_size =
6169                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
6170                if inlined != (member_inline_size <= 4) {
6171                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6172                }
6173                let inner_offset;
6174                let mut inner_depth = depth.clone();
6175                if inlined {
6176                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6177                    inner_offset = next_offset;
6178                } else {
6179                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6180                    inner_depth.increment()?;
6181                }
6182                let val_ref = self.clock_domain.get_or_insert_with(|| fidl::new_empty!(u32, D));
6183                fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
6184                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6185                {
6186                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6187                }
6188                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6189                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6190                }
6191            }
6192
6193            next_offset += envelope_size;
6194            _next_ordinal_to_read += 1;
6195            if next_offset >= end_offset {
6196                return Ok(());
6197            }
6198
6199            // Decode unknown envelopes for gaps in ordinals.
6200            while _next_ordinal_to_read < 12 {
6201                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6202                _next_ordinal_to_read += 1;
6203                next_offset += envelope_size;
6204            }
6205
6206            let next_out_of_line = decoder.next_out_of_line();
6207            let handles_before = decoder.remaining_handles();
6208            if let Some((inlined, num_bytes, num_handles)) =
6209                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6210            {
6211                let member_inline_size = <fidl::encoding::Vector<
6212                    fidl_fuchsia_hardware_audio_signalprocessing::Element,
6213                    64,
6214                > as fidl::encoding::TypeMarker>::inline_size(
6215                    decoder.context
6216                );
6217                if inlined != (member_inline_size <= 4) {
6218                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6219                }
6220                let inner_offset;
6221                let mut inner_depth = depth.clone();
6222                if inlined {
6223                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6224                    inner_offset = next_offset;
6225                } else {
6226                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6227                    inner_depth.increment()?;
6228                }
6229                let val_ref =
6230                self.signal_processing_elements.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<fidl_fuchsia_hardware_audio_signalprocessing::Element, 64>, D));
6231                fidl::decode!(fidl::encoding::Vector<fidl_fuchsia_hardware_audio_signalprocessing::Element, 64>, D, val_ref, decoder, inner_offset, inner_depth)?;
6232                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6233                {
6234                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6235                }
6236                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6237                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6238                }
6239            }
6240
6241            next_offset += envelope_size;
6242            _next_ordinal_to_read += 1;
6243            if next_offset >= end_offset {
6244                return Ok(());
6245            }
6246
6247            // Decode unknown envelopes for gaps in ordinals.
6248            while _next_ordinal_to_read < 13 {
6249                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6250                _next_ordinal_to_read += 1;
6251                next_offset += envelope_size;
6252            }
6253
6254            let next_out_of_line = decoder.next_out_of_line();
6255            let handles_before = decoder.remaining_handles();
6256            if let Some((inlined, num_bytes, num_handles)) =
6257                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6258            {
6259                let member_inline_size = <fidl::encoding::Vector<
6260                    fidl_fuchsia_hardware_audio_signalprocessing::Topology,
6261                    64,
6262                > as fidl::encoding::TypeMarker>::inline_size(
6263                    decoder.context
6264                );
6265                if inlined != (member_inline_size <= 4) {
6266                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6267                }
6268                let inner_offset;
6269                let mut inner_depth = depth.clone();
6270                if inlined {
6271                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6272                    inner_offset = next_offset;
6273                } else {
6274                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6275                    inner_depth.increment()?;
6276                }
6277                let val_ref =
6278                self.signal_processing_topologies.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<fidl_fuchsia_hardware_audio_signalprocessing::Topology, 64>, D));
6279                fidl::decode!(fidl::encoding::Vector<fidl_fuchsia_hardware_audio_signalprocessing::Topology, 64>, D, val_ref, decoder, inner_offset, inner_depth)?;
6280                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6281                {
6282                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6283                }
6284                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6285                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6286                }
6287            }
6288
6289            next_offset += envelope_size;
6290
6291            // Decode the remaining unknown envelopes.
6292            while next_offset < end_offset {
6293                _next_ordinal_to_read += 1;
6294                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6295                next_offset += envelope_size;
6296            }
6297
6298            Ok(())
6299        }
6300    }
6301
6302    impl ObserverWatchPlugStateResponse {
6303        #[inline(always)]
6304        fn max_ordinal_present(&self) -> u64 {
6305            if let Some(_) = self.plug_time {
6306                return 2;
6307            }
6308            if let Some(_) = self.state {
6309                return 1;
6310            }
6311            0
6312        }
6313    }
6314
6315    impl fidl::encoding::ValueTypeMarker for ObserverWatchPlugStateResponse {
6316        type Borrowed<'a> = &'a Self;
6317        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
6318            value
6319        }
6320    }
6321
6322    unsafe impl fidl::encoding::TypeMarker for ObserverWatchPlugStateResponse {
6323        type Owned = Self;
6324
6325        #[inline(always)]
6326        fn inline_align(_context: fidl::encoding::Context) -> usize {
6327            8
6328        }
6329
6330        #[inline(always)]
6331        fn inline_size(_context: fidl::encoding::Context) -> usize {
6332            16
6333        }
6334    }
6335
6336    unsafe impl<D: fidl::encoding::ResourceDialect>
6337        fidl::encoding::Encode<ObserverWatchPlugStateResponse, D>
6338        for &ObserverWatchPlugStateResponse
6339    {
6340        unsafe fn encode(
6341            self,
6342            encoder: &mut fidl::encoding::Encoder<'_, D>,
6343            offset: usize,
6344            mut depth: fidl::encoding::Depth,
6345        ) -> fidl::Result<()> {
6346            encoder.debug_check_bounds::<ObserverWatchPlugStateResponse>(offset);
6347            // Vector header
6348            let max_ordinal: u64 = self.max_ordinal_present();
6349            encoder.write_num(max_ordinal, offset);
6350            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
6351            // Calling encoder.out_of_line_offset(0) is not allowed.
6352            if max_ordinal == 0 {
6353                return Ok(());
6354            }
6355            depth.increment()?;
6356            let envelope_size = 8;
6357            let bytes_len = max_ordinal as usize * envelope_size;
6358            #[allow(unused_variables)]
6359            let offset = encoder.out_of_line_offset(bytes_len);
6360            let mut _prev_end_offset: usize = 0;
6361            if 1 > max_ordinal {
6362                return Ok(());
6363            }
6364
6365            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
6366            // are envelope_size bytes.
6367            let cur_offset: usize = (1 - 1) * envelope_size;
6368
6369            // Zero reserved fields.
6370            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6371
6372            // Safety:
6373            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
6374            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
6375            //   envelope_size bytes, there is always sufficient room.
6376            fidl::encoding::encode_in_envelope_optional::<PlugState, D>(
6377                self.state.as_ref().map(<PlugState as fidl::encoding::ValueTypeMarker>::borrow),
6378                encoder,
6379                offset + cur_offset,
6380                depth,
6381            )?;
6382
6383            _prev_end_offset = cur_offset + envelope_size;
6384            if 2 > max_ordinal {
6385                return Ok(());
6386            }
6387
6388            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
6389            // are envelope_size bytes.
6390            let cur_offset: usize = (2 - 1) * envelope_size;
6391
6392            // Zero reserved fields.
6393            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6394
6395            // Safety:
6396            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
6397            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
6398            //   envelope_size bytes, there is always sufficient room.
6399            fidl::encoding::encode_in_envelope_optional::<i64, D>(
6400                self.plug_time.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
6401                encoder,
6402                offset + cur_offset,
6403                depth,
6404            )?;
6405
6406            _prev_end_offset = cur_offset + envelope_size;
6407
6408            Ok(())
6409        }
6410    }
6411
6412    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
6413        for ObserverWatchPlugStateResponse
6414    {
6415        #[inline(always)]
6416        fn new_empty() -> Self {
6417            Self::default()
6418        }
6419
6420        unsafe fn decode(
6421            &mut self,
6422            decoder: &mut fidl::encoding::Decoder<'_, D>,
6423            offset: usize,
6424            mut depth: fidl::encoding::Depth,
6425        ) -> fidl::Result<()> {
6426            decoder.debug_check_bounds::<Self>(offset);
6427            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
6428                None => return Err(fidl::Error::NotNullable),
6429                Some(len) => len,
6430            };
6431            // Calling decoder.out_of_line_offset(0) is not allowed.
6432            if len == 0 {
6433                return Ok(());
6434            };
6435            depth.increment()?;
6436            let envelope_size = 8;
6437            let bytes_len = len * envelope_size;
6438            let offset = decoder.out_of_line_offset(bytes_len)?;
6439            // Decode the envelope for each type.
6440            let mut _next_ordinal_to_read = 0;
6441            let mut next_offset = offset;
6442            let end_offset = offset + bytes_len;
6443            _next_ordinal_to_read += 1;
6444            if next_offset >= end_offset {
6445                return Ok(());
6446            }
6447
6448            // Decode unknown envelopes for gaps in ordinals.
6449            while _next_ordinal_to_read < 1 {
6450                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6451                _next_ordinal_to_read += 1;
6452                next_offset += envelope_size;
6453            }
6454
6455            let next_out_of_line = decoder.next_out_of_line();
6456            let handles_before = decoder.remaining_handles();
6457            if let Some((inlined, num_bytes, num_handles)) =
6458                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6459            {
6460                let member_inline_size =
6461                    <PlugState as fidl::encoding::TypeMarker>::inline_size(decoder.context);
6462                if inlined != (member_inline_size <= 4) {
6463                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6464                }
6465                let inner_offset;
6466                let mut inner_depth = depth.clone();
6467                if inlined {
6468                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6469                    inner_offset = next_offset;
6470                } else {
6471                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6472                    inner_depth.increment()?;
6473                }
6474                let val_ref = self.state.get_or_insert_with(|| fidl::new_empty!(PlugState, D));
6475                fidl::decode!(PlugState, D, val_ref, decoder, inner_offset, inner_depth)?;
6476                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6477                {
6478                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6479                }
6480                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6481                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6482                }
6483            }
6484
6485            next_offset += envelope_size;
6486            _next_ordinal_to_read += 1;
6487            if next_offset >= end_offset {
6488                return Ok(());
6489            }
6490
6491            // Decode unknown envelopes for gaps in ordinals.
6492            while _next_ordinal_to_read < 2 {
6493                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6494                _next_ordinal_to_read += 1;
6495                next_offset += envelope_size;
6496            }
6497
6498            let next_out_of_line = decoder.next_out_of_line();
6499            let handles_before = decoder.remaining_handles();
6500            if let Some((inlined, num_bytes, num_handles)) =
6501                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6502            {
6503                let member_inline_size =
6504                    <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
6505                if inlined != (member_inline_size <= 4) {
6506                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6507                }
6508                let inner_offset;
6509                let mut inner_depth = depth.clone();
6510                if inlined {
6511                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6512                    inner_offset = next_offset;
6513                } else {
6514                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6515                    inner_depth.increment()?;
6516                }
6517                let val_ref = self.plug_time.get_or_insert_with(|| fidl::new_empty!(i64, D));
6518                fidl::decode!(i64, D, val_ref, decoder, inner_offset, inner_depth)?;
6519                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6520                {
6521                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6522                }
6523                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6524                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6525                }
6526            }
6527
6528            next_offset += envelope_size;
6529
6530            // Decode the remaining unknown envelopes.
6531            while next_offset < end_offset {
6532                _next_ordinal_to_read += 1;
6533                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6534                next_offset += envelope_size;
6535            }
6536
6537            Ok(())
6538        }
6539    }
6540
6541    impl PcmFormatSet {
6542        #[inline(always)]
6543        fn max_ordinal_present(&self) -> u64 {
6544            if let Some(_) = self.frame_rates {
6545                return 3;
6546            }
6547            if let Some(_) = self.sample_types {
6548                return 2;
6549            }
6550            if let Some(_) = self.channel_sets {
6551                return 1;
6552            }
6553            0
6554        }
6555    }
6556
6557    impl fidl::encoding::ValueTypeMarker for PcmFormatSet {
6558        type Borrowed<'a> = &'a Self;
6559        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
6560            value
6561        }
6562    }
6563
6564    unsafe impl fidl::encoding::TypeMarker for PcmFormatSet {
6565        type Owned = Self;
6566
6567        #[inline(always)]
6568        fn inline_align(_context: fidl::encoding::Context) -> usize {
6569            8
6570        }
6571
6572        #[inline(always)]
6573        fn inline_size(_context: fidl::encoding::Context) -> usize {
6574            16
6575        }
6576    }
6577
6578    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<PcmFormatSet, D>
6579        for &PcmFormatSet
6580    {
6581        unsafe fn encode(
6582            self,
6583            encoder: &mut fidl::encoding::Encoder<'_, D>,
6584            offset: usize,
6585            mut depth: fidl::encoding::Depth,
6586        ) -> fidl::Result<()> {
6587            encoder.debug_check_bounds::<PcmFormatSet>(offset);
6588            // Vector header
6589            let max_ordinal: u64 = self.max_ordinal_present();
6590            encoder.write_num(max_ordinal, offset);
6591            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
6592            // Calling encoder.out_of_line_offset(0) is not allowed.
6593            if max_ordinal == 0 {
6594                return Ok(());
6595            }
6596            depth.increment()?;
6597            let envelope_size = 8;
6598            let bytes_len = max_ordinal as usize * envelope_size;
6599            #[allow(unused_variables)]
6600            let offset = encoder.out_of_line_offset(bytes_len);
6601            let mut _prev_end_offset: usize = 0;
6602            if 1 > max_ordinal {
6603                return Ok(());
6604            }
6605
6606            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
6607            // are envelope_size bytes.
6608            let cur_offset: usize = (1 - 1) * envelope_size;
6609
6610            // Zero reserved fields.
6611            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6612
6613            // Safety:
6614            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
6615            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
6616            //   envelope_size bytes, there is always sufficient room.
6617            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<ChannelSet, 64>, D>(
6618            self.channel_sets.as_ref().map(<fidl::encoding::Vector<ChannelSet, 64> as fidl::encoding::ValueTypeMarker>::borrow),
6619            encoder, offset + cur_offset, depth
6620        )?;
6621
6622            _prev_end_offset = cur_offset + envelope_size;
6623            if 2 > max_ordinal {
6624                return Ok(());
6625            }
6626
6627            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
6628            // are envelope_size bytes.
6629            let cur_offset: usize = (2 - 1) * envelope_size;
6630
6631            // Zero reserved fields.
6632            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6633
6634            // Safety:
6635            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
6636            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
6637            //   envelope_size bytes, there is always sufficient room.
6638            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<fidl_fuchsia_audio::SampleType, 32>, D>(
6639            self.sample_types.as_ref().map(<fidl::encoding::Vector<fidl_fuchsia_audio::SampleType, 32> as fidl::encoding::ValueTypeMarker>::borrow),
6640            encoder, offset + cur_offset, depth
6641        )?;
6642
6643            _prev_end_offset = cur_offset + envelope_size;
6644            if 3 > max_ordinal {
6645                return Ok(());
6646            }
6647
6648            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
6649            // are envelope_size bytes.
6650            let cur_offset: usize = (3 - 1) * envelope_size;
6651
6652            // Zero reserved fields.
6653            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6654
6655            // Safety:
6656            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
6657            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
6658            //   envelope_size bytes, there is always sufficient room.
6659            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<u32, 64>, D>(
6660                self.frame_rates.as_ref().map(
6661                    <fidl::encoding::Vector<u32, 64> as fidl::encoding::ValueTypeMarker>::borrow,
6662                ),
6663                encoder,
6664                offset + cur_offset,
6665                depth,
6666            )?;
6667
6668            _prev_end_offset = cur_offset + envelope_size;
6669
6670            Ok(())
6671        }
6672    }
6673
6674    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for PcmFormatSet {
6675        #[inline(always)]
6676        fn new_empty() -> Self {
6677            Self::default()
6678        }
6679
6680        unsafe fn decode(
6681            &mut self,
6682            decoder: &mut fidl::encoding::Decoder<'_, D>,
6683            offset: usize,
6684            mut depth: fidl::encoding::Depth,
6685        ) -> fidl::Result<()> {
6686            decoder.debug_check_bounds::<Self>(offset);
6687            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
6688                None => return Err(fidl::Error::NotNullable),
6689                Some(len) => len,
6690            };
6691            // Calling decoder.out_of_line_offset(0) is not allowed.
6692            if len == 0 {
6693                return Ok(());
6694            };
6695            depth.increment()?;
6696            let envelope_size = 8;
6697            let bytes_len = len * envelope_size;
6698            let offset = decoder.out_of_line_offset(bytes_len)?;
6699            // Decode the envelope for each type.
6700            let mut _next_ordinal_to_read = 0;
6701            let mut next_offset = offset;
6702            let end_offset = offset + bytes_len;
6703            _next_ordinal_to_read += 1;
6704            if next_offset >= end_offset {
6705                return Ok(());
6706            }
6707
6708            // Decode unknown envelopes for gaps in ordinals.
6709            while _next_ordinal_to_read < 1 {
6710                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6711                _next_ordinal_to_read += 1;
6712                next_offset += envelope_size;
6713            }
6714
6715            let next_out_of_line = decoder.next_out_of_line();
6716            let handles_before = decoder.remaining_handles();
6717            if let Some((inlined, num_bytes, num_handles)) =
6718                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6719            {
6720                let member_inline_size = <fidl::encoding::Vector<ChannelSet, 64> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
6721                if inlined != (member_inline_size <= 4) {
6722                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6723                }
6724                let inner_offset;
6725                let mut inner_depth = depth.clone();
6726                if inlined {
6727                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6728                    inner_offset = next_offset;
6729                } else {
6730                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6731                    inner_depth.increment()?;
6732                }
6733                let val_ref = self.channel_sets.get_or_insert_with(
6734                    || fidl::new_empty!(fidl::encoding::Vector<ChannelSet, 64>, D),
6735                );
6736                fidl::decode!(fidl::encoding::Vector<ChannelSet, 64>, D, val_ref, decoder, inner_offset, inner_depth)?;
6737                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6738                {
6739                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6740                }
6741                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6742                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6743                }
6744            }
6745
6746            next_offset += envelope_size;
6747            _next_ordinal_to_read += 1;
6748            if next_offset >= end_offset {
6749                return Ok(());
6750            }
6751
6752            // Decode unknown envelopes for gaps in ordinals.
6753            while _next_ordinal_to_read < 2 {
6754                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6755                _next_ordinal_to_read += 1;
6756                next_offset += envelope_size;
6757            }
6758
6759            let next_out_of_line = decoder.next_out_of_line();
6760            let handles_before = decoder.remaining_handles();
6761            if let Some((inlined, num_bytes, num_handles)) =
6762                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6763            {
6764                let member_inline_size = <fidl::encoding::Vector<fidl_fuchsia_audio::SampleType, 32> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
6765                if inlined != (member_inline_size <= 4) {
6766                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6767                }
6768                let inner_offset;
6769                let mut inner_depth = depth.clone();
6770                if inlined {
6771                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6772                    inner_offset = next_offset;
6773                } else {
6774                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6775                    inner_depth.increment()?;
6776                }
6777                let val_ref =
6778                self.sample_types.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<fidl_fuchsia_audio::SampleType, 32>, D));
6779                fidl::decode!(fidl::encoding::Vector<fidl_fuchsia_audio::SampleType, 32>, D, val_ref, decoder, inner_offset, inner_depth)?;
6780                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6781                {
6782                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6783                }
6784                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6785                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6786                }
6787            }
6788
6789            next_offset += envelope_size;
6790            _next_ordinal_to_read += 1;
6791            if next_offset >= end_offset {
6792                return Ok(());
6793            }
6794
6795            // Decode unknown envelopes for gaps in ordinals.
6796            while _next_ordinal_to_read < 3 {
6797                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6798                _next_ordinal_to_read += 1;
6799                next_offset += envelope_size;
6800            }
6801
6802            let next_out_of_line = decoder.next_out_of_line();
6803            let handles_before = decoder.remaining_handles();
6804            if let Some((inlined, num_bytes, num_handles)) =
6805                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6806            {
6807                let member_inline_size =
6808                    <fidl::encoding::Vector<u32, 64> as fidl::encoding::TypeMarker>::inline_size(
6809                        decoder.context,
6810                    );
6811                if inlined != (member_inline_size <= 4) {
6812                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6813                }
6814                let inner_offset;
6815                let mut inner_depth = depth.clone();
6816                if inlined {
6817                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6818                    inner_offset = next_offset;
6819                } else {
6820                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6821                    inner_depth.increment()?;
6822                }
6823                let val_ref = self
6824                    .frame_rates
6825                    .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<u32, 64>, D));
6826                fidl::decode!(fidl::encoding::Vector<u32, 64>, D, val_ref, decoder, inner_offset, inner_depth)?;
6827                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6828                {
6829                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6830                }
6831                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6832                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6833                }
6834            }
6835
6836            next_offset += envelope_size;
6837
6838            // Decode the remaining unknown envelopes.
6839            while next_offset < end_offset {
6840                _next_ordinal_to_read += 1;
6841                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6842                next_offset += envelope_size;
6843            }
6844
6845            Ok(())
6846        }
6847    }
6848
6849    impl ProviderAddDeviceResponse {
6850        #[inline(always)]
6851        fn max_ordinal_present(&self) -> u64 {
6852            0
6853        }
6854    }
6855
6856    impl fidl::encoding::ValueTypeMarker for ProviderAddDeviceResponse {
6857        type Borrowed<'a> = &'a Self;
6858        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
6859            value
6860        }
6861    }
6862
6863    unsafe impl fidl::encoding::TypeMarker for ProviderAddDeviceResponse {
6864        type Owned = Self;
6865
6866        #[inline(always)]
6867        fn inline_align(_context: fidl::encoding::Context) -> usize {
6868            8
6869        }
6870
6871        #[inline(always)]
6872        fn inline_size(_context: fidl::encoding::Context) -> usize {
6873            16
6874        }
6875    }
6876
6877    unsafe impl<D: fidl::encoding::ResourceDialect>
6878        fidl::encoding::Encode<ProviderAddDeviceResponse, D> for &ProviderAddDeviceResponse
6879    {
6880        unsafe fn encode(
6881            self,
6882            encoder: &mut fidl::encoding::Encoder<'_, D>,
6883            offset: usize,
6884            mut depth: fidl::encoding::Depth,
6885        ) -> fidl::Result<()> {
6886            encoder.debug_check_bounds::<ProviderAddDeviceResponse>(offset);
6887            // Vector header
6888            let max_ordinal: u64 = self.max_ordinal_present();
6889            encoder.write_num(max_ordinal, offset);
6890            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
6891            // Calling encoder.out_of_line_offset(0) is not allowed.
6892            if max_ordinal == 0 {
6893                return Ok(());
6894            }
6895            depth.increment()?;
6896            let envelope_size = 8;
6897            let bytes_len = max_ordinal as usize * envelope_size;
6898            #[allow(unused_variables)]
6899            let offset = encoder.out_of_line_offset(bytes_len);
6900            let mut _prev_end_offset: usize = 0;
6901
6902            Ok(())
6903        }
6904    }
6905
6906    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
6907        for ProviderAddDeviceResponse
6908    {
6909        #[inline(always)]
6910        fn new_empty() -> Self {
6911            Self::default()
6912        }
6913
6914        unsafe fn decode(
6915            &mut self,
6916            decoder: &mut fidl::encoding::Decoder<'_, D>,
6917            offset: usize,
6918            mut depth: fidl::encoding::Depth,
6919        ) -> fidl::Result<()> {
6920            decoder.debug_check_bounds::<Self>(offset);
6921            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
6922                None => return Err(fidl::Error::NotNullable),
6923                Some(len) => len,
6924            };
6925            // Calling decoder.out_of_line_offset(0) is not allowed.
6926            if len == 0 {
6927                return Ok(());
6928            };
6929            depth.increment()?;
6930            let envelope_size = 8;
6931            let bytes_len = len * envelope_size;
6932            let offset = decoder.out_of_line_offset(bytes_len)?;
6933            // Decode the envelope for each type.
6934            let mut _next_ordinal_to_read = 0;
6935            let mut next_offset = offset;
6936            let end_offset = offset + bytes_len;
6937
6938            // Decode the remaining unknown envelopes.
6939            while next_offset < end_offset {
6940                _next_ordinal_to_read += 1;
6941                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6942                next_offset += envelope_size;
6943            }
6944
6945            Ok(())
6946        }
6947    }
6948
6949    impl RegistryCreateObserverResponse {
6950        #[inline(always)]
6951        fn max_ordinal_present(&self) -> u64 {
6952            0
6953        }
6954    }
6955
6956    impl fidl::encoding::ValueTypeMarker for RegistryCreateObserverResponse {
6957        type Borrowed<'a> = &'a Self;
6958        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
6959            value
6960        }
6961    }
6962
6963    unsafe impl fidl::encoding::TypeMarker for RegistryCreateObserverResponse {
6964        type Owned = Self;
6965
6966        #[inline(always)]
6967        fn inline_align(_context: fidl::encoding::Context) -> usize {
6968            8
6969        }
6970
6971        #[inline(always)]
6972        fn inline_size(_context: fidl::encoding::Context) -> usize {
6973            16
6974        }
6975    }
6976
6977    unsafe impl<D: fidl::encoding::ResourceDialect>
6978        fidl::encoding::Encode<RegistryCreateObserverResponse, D>
6979        for &RegistryCreateObserverResponse
6980    {
6981        unsafe fn encode(
6982            self,
6983            encoder: &mut fidl::encoding::Encoder<'_, D>,
6984            offset: usize,
6985            mut depth: fidl::encoding::Depth,
6986        ) -> fidl::Result<()> {
6987            encoder.debug_check_bounds::<RegistryCreateObserverResponse>(offset);
6988            // Vector header
6989            let max_ordinal: u64 = self.max_ordinal_present();
6990            encoder.write_num(max_ordinal, offset);
6991            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
6992            // Calling encoder.out_of_line_offset(0) is not allowed.
6993            if max_ordinal == 0 {
6994                return Ok(());
6995            }
6996            depth.increment()?;
6997            let envelope_size = 8;
6998            let bytes_len = max_ordinal as usize * envelope_size;
6999            #[allow(unused_variables)]
7000            let offset = encoder.out_of_line_offset(bytes_len);
7001            let mut _prev_end_offset: usize = 0;
7002
7003            Ok(())
7004        }
7005    }
7006
7007    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
7008        for RegistryCreateObserverResponse
7009    {
7010        #[inline(always)]
7011        fn new_empty() -> Self {
7012            Self::default()
7013        }
7014
7015        unsafe fn decode(
7016            &mut self,
7017            decoder: &mut fidl::encoding::Decoder<'_, D>,
7018            offset: usize,
7019            mut depth: fidl::encoding::Depth,
7020        ) -> fidl::Result<()> {
7021            decoder.debug_check_bounds::<Self>(offset);
7022            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
7023                None => return Err(fidl::Error::NotNullable),
7024                Some(len) => len,
7025            };
7026            // Calling decoder.out_of_line_offset(0) is not allowed.
7027            if len == 0 {
7028                return Ok(());
7029            };
7030            depth.increment()?;
7031            let envelope_size = 8;
7032            let bytes_len = len * envelope_size;
7033            let offset = decoder.out_of_line_offset(bytes_len)?;
7034            // Decode the envelope for each type.
7035            let mut _next_ordinal_to_read = 0;
7036            let mut next_offset = offset;
7037            let end_offset = offset + bytes_len;
7038
7039            // Decode the remaining unknown envelopes.
7040            while next_offset < end_offset {
7041                _next_ordinal_to_read += 1;
7042                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7043                next_offset += envelope_size;
7044            }
7045
7046            Ok(())
7047        }
7048    }
7049
7050    impl RegistryWatchDeviceRemovedResponse {
7051        #[inline(always)]
7052        fn max_ordinal_present(&self) -> u64 {
7053            if let Some(_) = self.token_id {
7054                return 1;
7055            }
7056            0
7057        }
7058    }
7059
7060    impl fidl::encoding::ValueTypeMarker for RegistryWatchDeviceRemovedResponse {
7061        type Borrowed<'a> = &'a Self;
7062        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
7063            value
7064        }
7065    }
7066
7067    unsafe impl fidl::encoding::TypeMarker for RegistryWatchDeviceRemovedResponse {
7068        type Owned = Self;
7069
7070        #[inline(always)]
7071        fn inline_align(_context: fidl::encoding::Context) -> usize {
7072            8
7073        }
7074
7075        #[inline(always)]
7076        fn inline_size(_context: fidl::encoding::Context) -> usize {
7077            16
7078        }
7079    }
7080
7081    unsafe impl<D: fidl::encoding::ResourceDialect>
7082        fidl::encoding::Encode<RegistryWatchDeviceRemovedResponse, D>
7083        for &RegistryWatchDeviceRemovedResponse
7084    {
7085        unsafe fn encode(
7086            self,
7087            encoder: &mut fidl::encoding::Encoder<'_, D>,
7088            offset: usize,
7089            mut depth: fidl::encoding::Depth,
7090        ) -> fidl::Result<()> {
7091            encoder.debug_check_bounds::<RegistryWatchDeviceRemovedResponse>(offset);
7092            // Vector header
7093            let max_ordinal: u64 = self.max_ordinal_present();
7094            encoder.write_num(max_ordinal, offset);
7095            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
7096            // Calling encoder.out_of_line_offset(0) is not allowed.
7097            if max_ordinal == 0 {
7098                return Ok(());
7099            }
7100            depth.increment()?;
7101            let envelope_size = 8;
7102            let bytes_len = max_ordinal as usize * envelope_size;
7103            #[allow(unused_variables)]
7104            let offset = encoder.out_of_line_offset(bytes_len);
7105            let mut _prev_end_offset: usize = 0;
7106            if 1 > max_ordinal {
7107                return Ok(());
7108            }
7109
7110            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
7111            // are envelope_size bytes.
7112            let cur_offset: usize = (1 - 1) * envelope_size;
7113
7114            // Zero reserved fields.
7115            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7116
7117            // Safety:
7118            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
7119            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
7120            //   envelope_size bytes, there is always sufficient room.
7121            fidl::encoding::encode_in_envelope_optional::<u64, D>(
7122                self.token_id.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
7123                encoder,
7124                offset + cur_offset,
7125                depth,
7126            )?;
7127
7128            _prev_end_offset = cur_offset + envelope_size;
7129
7130            Ok(())
7131        }
7132    }
7133
7134    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
7135        for RegistryWatchDeviceRemovedResponse
7136    {
7137        #[inline(always)]
7138        fn new_empty() -> Self {
7139            Self::default()
7140        }
7141
7142        unsafe fn decode(
7143            &mut self,
7144            decoder: &mut fidl::encoding::Decoder<'_, D>,
7145            offset: usize,
7146            mut depth: fidl::encoding::Depth,
7147        ) -> fidl::Result<()> {
7148            decoder.debug_check_bounds::<Self>(offset);
7149            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
7150                None => return Err(fidl::Error::NotNullable),
7151                Some(len) => len,
7152            };
7153            // Calling decoder.out_of_line_offset(0) is not allowed.
7154            if len == 0 {
7155                return Ok(());
7156            };
7157            depth.increment()?;
7158            let envelope_size = 8;
7159            let bytes_len = len * envelope_size;
7160            let offset = decoder.out_of_line_offset(bytes_len)?;
7161            // Decode the envelope for each type.
7162            let mut _next_ordinal_to_read = 0;
7163            let mut next_offset = offset;
7164            let end_offset = offset + bytes_len;
7165            _next_ordinal_to_read += 1;
7166            if next_offset >= end_offset {
7167                return Ok(());
7168            }
7169
7170            // Decode unknown envelopes for gaps in ordinals.
7171            while _next_ordinal_to_read < 1 {
7172                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7173                _next_ordinal_to_read += 1;
7174                next_offset += envelope_size;
7175            }
7176
7177            let next_out_of_line = decoder.next_out_of_line();
7178            let handles_before = decoder.remaining_handles();
7179            if let Some((inlined, num_bytes, num_handles)) =
7180                fidl::encoding::decode_envelope_header(decoder, next_offset)?
7181            {
7182                let member_inline_size =
7183                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
7184                if inlined != (member_inline_size <= 4) {
7185                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
7186                }
7187                let inner_offset;
7188                let mut inner_depth = depth.clone();
7189                if inlined {
7190                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7191                    inner_offset = next_offset;
7192                } else {
7193                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7194                    inner_depth.increment()?;
7195                }
7196                let val_ref = self.token_id.get_or_insert_with(|| fidl::new_empty!(u64, D));
7197                fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
7198                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7199                {
7200                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
7201                }
7202                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7203                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7204                }
7205            }
7206
7207            next_offset += envelope_size;
7208
7209            // Decode the remaining unknown envelopes.
7210            while next_offset < end_offset {
7211                _next_ordinal_to_read += 1;
7212                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7213                next_offset += envelope_size;
7214            }
7215
7216            Ok(())
7217        }
7218    }
7219
7220    impl RegistryWatchDevicesAddedResponse {
7221        #[inline(always)]
7222        fn max_ordinal_present(&self) -> u64 {
7223            if let Some(_) = self.devices {
7224                return 1;
7225            }
7226            0
7227        }
7228    }
7229
7230    impl fidl::encoding::ValueTypeMarker for RegistryWatchDevicesAddedResponse {
7231        type Borrowed<'a> = &'a Self;
7232        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
7233            value
7234        }
7235    }
7236
7237    unsafe impl fidl::encoding::TypeMarker for RegistryWatchDevicesAddedResponse {
7238        type Owned = Self;
7239
7240        #[inline(always)]
7241        fn inline_align(_context: fidl::encoding::Context) -> usize {
7242            8
7243        }
7244
7245        #[inline(always)]
7246        fn inline_size(_context: fidl::encoding::Context) -> usize {
7247            16
7248        }
7249    }
7250
7251    unsafe impl<D: fidl::encoding::ResourceDialect>
7252        fidl::encoding::Encode<RegistryWatchDevicesAddedResponse, D>
7253        for &RegistryWatchDevicesAddedResponse
7254    {
7255        unsafe fn encode(
7256            self,
7257            encoder: &mut fidl::encoding::Encoder<'_, D>,
7258            offset: usize,
7259            mut depth: fidl::encoding::Depth,
7260        ) -> fidl::Result<()> {
7261            encoder.debug_check_bounds::<RegistryWatchDevicesAddedResponse>(offset);
7262            // Vector header
7263            let max_ordinal: u64 = self.max_ordinal_present();
7264            encoder.write_num(max_ordinal, offset);
7265            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
7266            // Calling encoder.out_of_line_offset(0) is not allowed.
7267            if max_ordinal == 0 {
7268                return Ok(());
7269            }
7270            depth.increment()?;
7271            let envelope_size = 8;
7272            let bytes_len = max_ordinal as usize * envelope_size;
7273            #[allow(unused_variables)]
7274            let offset = encoder.out_of_line_offset(bytes_len);
7275            let mut _prev_end_offset: usize = 0;
7276            if 1 > max_ordinal {
7277                return Ok(());
7278            }
7279
7280            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
7281            // are envelope_size bytes.
7282            let cur_offset: usize = (1 - 1) * envelope_size;
7283
7284            // Zero reserved fields.
7285            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7286
7287            // Safety:
7288            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
7289            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
7290            //   envelope_size bytes, there is always sufficient room.
7291            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<Info, 256>, D>(
7292                self.devices.as_ref().map(
7293                    <fidl::encoding::Vector<Info, 256> as fidl::encoding::ValueTypeMarker>::borrow,
7294                ),
7295                encoder,
7296                offset + cur_offset,
7297                depth,
7298            )?;
7299
7300            _prev_end_offset = cur_offset + envelope_size;
7301
7302            Ok(())
7303        }
7304    }
7305
7306    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
7307        for RegistryWatchDevicesAddedResponse
7308    {
7309        #[inline(always)]
7310        fn new_empty() -> Self {
7311            Self::default()
7312        }
7313
7314        unsafe fn decode(
7315            &mut self,
7316            decoder: &mut fidl::encoding::Decoder<'_, D>,
7317            offset: usize,
7318            mut depth: fidl::encoding::Depth,
7319        ) -> fidl::Result<()> {
7320            decoder.debug_check_bounds::<Self>(offset);
7321            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
7322                None => return Err(fidl::Error::NotNullable),
7323                Some(len) => len,
7324            };
7325            // Calling decoder.out_of_line_offset(0) is not allowed.
7326            if len == 0 {
7327                return Ok(());
7328            };
7329            depth.increment()?;
7330            let envelope_size = 8;
7331            let bytes_len = len * envelope_size;
7332            let offset = decoder.out_of_line_offset(bytes_len)?;
7333            // Decode the envelope for each type.
7334            let mut _next_ordinal_to_read = 0;
7335            let mut next_offset = offset;
7336            let end_offset = offset + bytes_len;
7337            _next_ordinal_to_read += 1;
7338            if next_offset >= end_offset {
7339                return Ok(());
7340            }
7341
7342            // Decode unknown envelopes for gaps in ordinals.
7343            while _next_ordinal_to_read < 1 {
7344                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7345                _next_ordinal_to_read += 1;
7346                next_offset += envelope_size;
7347            }
7348
7349            let next_out_of_line = decoder.next_out_of_line();
7350            let handles_before = decoder.remaining_handles();
7351            if let Some((inlined, num_bytes, num_handles)) =
7352                fidl::encoding::decode_envelope_header(decoder, next_offset)?
7353            {
7354                let member_inline_size =
7355                    <fidl::encoding::Vector<Info, 256> as fidl::encoding::TypeMarker>::inline_size(
7356                        decoder.context,
7357                    );
7358                if inlined != (member_inline_size <= 4) {
7359                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
7360                }
7361                let inner_offset;
7362                let mut inner_depth = depth.clone();
7363                if inlined {
7364                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7365                    inner_offset = next_offset;
7366                } else {
7367                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7368                    inner_depth.increment()?;
7369                }
7370                let val_ref = self
7371                    .devices
7372                    .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<Info, 256>, D));
7373                fidl::decode!(fidl::encoding::Vector<Info, 256>, D, val_ref, decoder, inner_offset, inner_depth)?;
7374                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7375                {
7376                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
7377                }
7378                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7379                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7380                }
7381            }
7382
7383            next_offset += envelope_size;
7384
7385            // Decode the remaining unknown envelopes.
7386            while next_offset < end_offset {
7387                _next_ordinal_to_read += 1;
7388                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7389                next_offset += envelope_size;
7390            }
7391
7392            Ok(())
7393        }
7394    }
7395
7396    impl RingBufferOptions {
7397        #[inline(always)]
7398        fn max_ordinal_present(&self) -> u64 {
7399            if let Some(_) = self.ring_buffer_min_bytes {
7400                return 2;
7401            }
7402            if let Some(_) = self.format {
7403                return 1;
7404            }
7405            0
7406        }
7407    }
7408
7409    impl fidl::encoding::ValueTypeMarker for RingBufferOptions {
7410        type Borrowed<'a> = &'a Self;
7411        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
7412            value
7413        }
7414    }
7415
7416    unsafe impl fidl::encoding::TypeMarker for RingBufferOptions {
7417        type Owned = Self;
7418
7419        #[inline(always)]
7420        fn inline_align(_context: fidl::encoding::Context) -> usize {
7421            8
7422        }
7423
7424        #[inline(always)]
7425        fn inline_size(_context: fidl::encoding::Context) -> usize {
7426            16
7427        }
7428    }
7429
7430    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<RingBufferOptions, D>
7431        for &RingBufferOptions
7432    {
7433        unsafe fn encode(
7434            self,
7435            encoder: &mut fidl::encoding::Encoder<'_, D>,
7436            offset: usize,
7437            mut depth: fidl::encoding::Depth,
7438        ) -> fidl::Result<()> {
7439            encoder.debug_check_bounds::<RingBufferOptions>(offset);
7440            // Vector header
7441            let max_ordinal: u64 = self.max_ordinal_present();
7442            encoder.write_num(max_ordinal, offset);
7443            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
7444            // Calling encoder.out_of_line_offset(0) is not allowed.
7445            if max_ordinal == 0 {
7446                return Ok(());
7447            }
7448            depth.increment()?;
7449            let envelope_size = 8;
7450            let bytes_len = max_ordinal as usize * envelope_size;
7451            #[allow(unused_variables)]
7452            let offset = encoder.out_of_line_offset(bytes_len);
7453            let mut _prev_end_offset: usize = 0;
7454            if 1 > max_ordinal {
7455                return Ok(());
7456            }
7457
7458            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
7459            // are envelope_size bytes.
7460            let cur_offset: usize = (1 - 1) * envelope_size;
7461
7462            // Zero reserved fields.
7463            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7464
7465            // Safety:
7466            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
7467            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
7468            //   envelope_size bytes, there is always sufficient room.
7469            fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_audio::Format, D>(
7470                self.format
7471                    .as_ref()
7472                    .map(<fidl_fuchsia_audio::Format as fidl::encoding::ValueTypeMarker>::borrow),
7473                encoder,
7474                offset + cur_offset,
7475                depth,
7476            )?;
7477
7478            _prev_end_offset = cur_offset + envelope_size;
7479            if 2 > max_ordinal {
7480                return Ok(());
7481            }
7482
7483            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
7484            // are envelope_size bytes.
7485            let cur_offset: usize = (2 - 1) * envelope_size;
7486
7487            // Zero reserved fields.
7488            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7489
7490            // Safety:
7491            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
7492            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
7493            //   envelope_size bytes, there is always sufficient room.
7494            fidl::encoding::encode_in_envelope_optional::<u32, D>(
7495                self.ring_buffer_min_bytes
7496                    .as_ref()
7497                    .map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
7498                encoder,
7499                offset + cur_offset,
7500                depth,
7501            )?;
7502
7503            _prev_end_offset = cur_offset + envelope_size;
7504
7505            Ok(())
7506        }
7507    }
7508
7509    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for RingBufferOptions {
7510        #[inline(always)]
7511        fn new_empty() -> Self {
7512            Self::default()
7513        }
7514
7515        unsafe fn decode(
7516            &mut self,
7517            decoder: &mut fidl::encoding::Decoder<'_, D>,
7518            offset: usize,
7519            mut depth: fidl::encoding::Depth,
7520        ) -> fidl::Result<()> {
7521            decoder.debug_check_bounds::<Self>(offset);
7522            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
7523                None => return Err(fidl::Error::NotNullable),
7524                Some(len) => len,
7525            };
7526            // Calling decoder.out_of_line_offset(0) is not allowed.
7527            if len == 0 {
7528                return Ok(());
7529            };
7530            depth.increment()?;
7531            let envelope_size = 8;
7532            let bytes_len = len * envelope_size;
7533            let offset = decoder.out_of_line_offset(bytes_len)?;
7534            // Decode the envelope for each type.
7535            let mut _next_ordinal_to_read = 0;
7536            let mut next_offset = offset;
7537            let end_offset = offset + bytes_len;
7538            _next_ordinal_to_read += 1;
7539            if next_offset >= end_offset {
7540                return Ok(());
7541            }
7542
7543            // Decode unknown envelopes for gaps in ordinals.
7544            while _next_ordinal_to_read < 1 {
7545                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7546                _next_ordinal_to_read += 1;
7547                next_offset += envelope_size;
7548            }
7549
7550            let next_out_of_line = decoder.next_out_of_line();
7551            let handles_before = decoder.remaining_handles();
7552            if let Some((inlined, num_bytes, num_handles)) =
7553                fidl::encoding::decode_envelope_header(decoder, next_offset)?
7554            {
7555                let member_inline_size =
7556                    <fidl_fuchsia_audio::Format as fidl::encoding::TypeMarker>::inline_size(
7557                        decoder.context,
7558                    );
7559                if inlined != (member_inline_size <= 4) {
7560                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
7561                }
7562                let inner_offset;
7563                let mut inner_depth = depth.clone();
7564                if inlined {
7565                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7566                    inner_offset = next_offset;
7567                } else {
7568                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7569                    inner_depth.increment()?;
7570                }
7571                let val_ref = self
7572                    .format
7573                    .get_or_insert_with(|| fidl::new_empty!(fidl_fuchsia_audio::Format, D));
7574                fidl::decode!(
7575                    fidl_fuchsia_audio::Format,
7576                    D,
7577                    val_ref,
7578                    decoder,
7579                    inner_offset,
7580                    inner_depth
7581                )?;
7582                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7583                {
7584                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
7585                }
7586                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7587                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7588                }
7589            }
7590
7591            next_offset += envelope_size;
7592            _next_ordinal_to_read += 1;
7593            if next_offset >= end_offset {
7594                return Ok(());
7595            }
7596
7597            // Decode unknown envelopes for gaps in ordinals.
7598            while _next_ordinal_to_read < 2 {
7599                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7600                _next_ordinal_to_read += 1;
7601                next_offset += envelope_size;
7602            }
7603
7604            let next_out_of_line = decoder.next_out_of_line();
7605            let handles_before = decoder.remaining_handles();
7606            if let Some((inlined, num_bytes, num_handles)) =
7607                fidl::encoding::decode_envelope_header(decoder, next_offset)?
7608            {
7609                let member_inline_size =
7610                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
7611                if inlined != (member_inline_size <= 4) {
7612                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
7613                }
7614                let inner_offset;
7615                let mut inner_depth = depth.clone();
7616                if inlined {
7617                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7618                    inner_offset = next_offset;
7619                } else {
7620                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7621                    inner_depth.increment()?;
7622                }
7623                let val_ref =
7624                    self.ring_buffer_min_bytes.get_or_insert_with(|| fidl::new_empty!(u32, D));
7625                fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
7626                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7627                {
7628                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
7629                }
7630                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7631                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7632                }
7633            }
7634
7635            next_offset += envelope_size;
7636
7637            // Decode the remaining unknown envelopes.
7638            while next_offset < end_offset {
7639                _next_ordinal_to_read += 1;
7640                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7641                next_offset += envelope_size;
7642            }
7643
7644            Ok(())
7645        }
7646    }
7647
7648    impl RingBufferProperties {
7649        #[inline(always)]
7650        fn max_ordinal_present(&self) -> u64 {
7651            if let Some(_) = self.turn_on_delay {
7652                return 2;
7653            }
7654            if let Some(_) = self.valid_bits_per_sample {
7655                return 1;
7656            }
7657            0
7658        }
7659    }
7660
7661    impl fidl::encoding::ValueTypeMarker for RingBufferProperties {
7662        type Borrowed<'a> = &'a Self;
7663        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
7664            value
7665        }
7666    }
7667
7668    unsafe impl fidl::encoding::TypeMarker for RingBufferProperties {
7669        type Owned = Self;
7670
7671        #[inline(always)]
7672        fn inline_align(_context: fidl::encoding::Context) -> usize {
7673            8
7674        }
7675
7676        #[inline(always)]
7677        fn inline_size(_context: fidl::encoding::Context) -> usize {
7678            16
7679        }
7680    }
7681
7682    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<RingBufferProperties, D>
7683        for &RingBufferProperties
7684    {
7685        unsafe fn encode(
7686            self,
7687            encoder: &mut fidl::encoding::Encoder<'_, D>,
7688            offset: usize,
7689            mut depth: fidl::encoding::Depth,
7690        ) -> fidl::Result<()> {
7691            encoder.debug_check_bounds::<RingBufferProperties>(offset);
7692            // Vector header
7693            let max_ordinal: u64 = self.max_ordinal_present();
7694            encoder.write_num(max_ordinal, offset);
7695            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
7696            // Calling encoder.out_of_line_offset(0) is not allowed.
7697            if max_ordinal == 0 {
7698                return Ok(());
7699            }
7700            depth.increment()?;
7701            let envelope_size = 8;
7702            let bytes_len = max_ordinal as usize * envelope_size;
7703            #[allow(unused_variables)]
7704            let offset = encoder.out_of_line_offset(bytes_len);
7705            let mut _prev_end_offset: usize = 0;
7706            if 1 > max_ordinal {
7707                return Ok(());
7708            }
7709
7710            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
7711            // are envelope_size bytes.
7712            let cur_offset: usize = (1 - 1) * envelope_size;
7713
7714            // Zero reserved fields.
7715            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7716
7717            // Safety:
7718            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
7719            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
7720            //   envelope_size bytes, there is always sufficient room.
7721            fidl::encoding::encode_in_envelope_optional::<u8, D>(
7722                self.valid_bits_per_sample
7723                    .as_ref()
7724                    .map(<u8 as fidl::encoding::ValueTypeMarker>::borrow),
7725                encoder,
7726                offset + cur_offset,
7727                depth,
7728            )?;
7729
7730            _prev_end_offset = cur_offset + envelope_size;
7731            if 2 > max_ordinal {
7732                return Ok(());
7733            }
7734
7735            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
7736            // are envelope_size bytes.
7737            let cur_offset: usize = (2 - 1) * envelope_size;
7738
7739            // Zero reserved fields.
7740            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7741
7742            // Safety:
7743            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
7744            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
7745            //   envelope_size bytes, there is always sufficient room.
7746            fidl::encoding::encode_in_envelope_optional::<i64, D>(
7747                self.turn_on_delay.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
7748                encoder,
7749                offset + cur_offset,
7750                depth,
7751            )?;
7752
7753            _prev_end_offset = cur_offset + envelope_size;
7754
7755            Ok(())
7756        }
7757    }
7758
7759    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for RingBufferProperties {
7760        #[inline(always)]
7761        fn new_empty() -> Self {
7762            Self::default()
7763        }
7764
7765        unsafe fn decode(
7766            &mut self,
7767            decoder: &mut fidl::encoding::Decoder<'_, D>,
7768            offset: usize,
7769            mut depth: fidl::encoding::Depth,
7770        ) -> fidl::Result<()> {
7771            decoder.debug_check_bounds::<Self>(offset);
7772            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
7773                None => return Err(fidl::Error::NotNullable),
7774                Some(len) => len,
7775            };
7776            // Calling decoder.out_of_line_offset(0) is not allowed.
7777            if len == 0 {
7778                return Ok(());
7779            };
7780            depth.increment()?;
7781            let envelope_size = 8;
7782            let bytes_len = len * envelope_size;
7783            let offset = decoder.out_of_line_offset(bytes_len)?;
7784            // Decode the envelope for each type.
7785            let mut _next_ordinal_to_read = 0;
7786            let mut next_offset = offset;
7787            let end_offset = offset + bytes_len;
7788            _next_ordinal_to_read += 1;
7789            if next_offset >= end_offset {
7790                return Ok(());
7791            }
7792
7793            // Decode unknown envelopes for gaps in ordinals.
7794            while _next_ordinal_to_read < 1 {
7795                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7796                _next_ordinal_to_read += 1;
7797                next_offset += envelope_size;
7798            }
7799
7800            let next_out_of_line = decoder.next_out_of_line();
7801            let handles_before = decoder.remaining_handles();
7802            if let Some((inlined, num_bytes, num_handles)) =
7803                fidl::encoding::decode_envelope_header(decoder, next_offset)?
7804            {
7805                let member_inline_size =
7806                    <u8 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
7807                if inlined != (member_inline_size <= 4) {
7808                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
7809                }
7810                let inner_offset;
7811                let mut inner_depth = depth.clone();
7812                if inlined {
7813                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7814                    inner_offset = next_offset;
7815                } else {
7816                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7817                    inner_depth.increment()?;
7818                }
7819                let val_ref =
7820                    self.valid_bits_per_sample.get_or_insert_with(|| fidl::new_empty!(u8, D));
7821                fidl::decode!(u8, D, val_ref, decoder, inner_offset, inner_depth)?;
7822                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7823                {
7824                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
7825                }
7826                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7827                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7828                }
7829            }
7830
7831            next_offset += envelope_size;
7832            _next_ordinal_to_read += 1;
7833            if next_offset >= end_offset {
7834                return Ok(());
7835            }
7836
7837            // Decode unknown envelopes for gaps in ordinals.
7838            while _next_ordinal_to_read < 2 {
7839                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7840                _next_ordinal_to_read += 1;
7841                next_offset += envelope_size;
7842            }
7843
7844            let next_out_of_line = decoder.next_out_of_line();
7845            let handles_before = decoder.remaining_handles();
7846            if let Some((inlined, num_bytes, num_handles)) =
7847                fidl::encoding::decode_envelope_header(decoder, next_offset)?
7848            {
7849                let member_inline_size =
7850                    <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
7851                if inlined != (member_inline_size <= 4) {
7852                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
7853                }
7854                let inner_offset;
7855                let mut inner_depth = depth.clone();
7856                if inlined {
7857                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7858                    inner_offset = next_offset;
7859                } else {
7860                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7861                    inner_depth.increment()?;
7862                }
7863                let val_ref = self.turn_on_delay.get_or_insert_with(|| fidl::new_empty!(i64, D));
7864                fidl::decode!(i64, D, val_ref, decoder, inner_offset, inner_depth)?;
7865                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7866                {
7867                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
7868                }
7869                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7870                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7871                }
7872            }
7873
7874            next_offset += envelope_size;
7875
7876            // Decode the remaining unknown envelopes.
7877            while next_offset < end_offset {
7878                _next_ordinal_to_read += 1;
7879                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7880                next_offset += envelope_size;
7881            }
7882
7883            Ok(())
7884        }
7885    }
7886
7887    impl RingBufferSetActiveChannelsRequest {
7888        #[inline(always)]
7889        fn max_ordinal_present(&self) -> u64 {
7890            if let Some(_) = self.channel_bitmask {
7891                return 1;
7892            }
7893            0
7894        }
7895    }
7896
7897    impl fidl::encoding::ValueTypeMarker for RingBufferSetActiveChannelsRequest {
7898        type Borrowed<'a> = &'a Self;
7899        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
7900            value
7901        }
7902    }
7903
7904    unsafe impl fidl::encoding::TypeMarker for RingBufferSetActiveChannelsRequest {
7905        type Owned = Self;
7906
7907        #[inline(always)]
7908        fn inline_align(_context: fidl::encoding::Context) -> usize {
7909            8
7910        }
7911
7912        #[inline(always)]
7913        fn inline_size(_context: fidl::encoding::Context) -> usize {
7914            16
7915        }
7916    }
7917
7918    unsafe impl<D: fidl::encoding::ResourceDialect>
7919        fidl::encoding::Encode<RingBufferSetActiveChannelsRequest, D>
7920        for &RingBufferSetActiveChannelsRequest
7921    {
7922        unsafe fn encode(
7923            self,
7924            encoder: &mut fidl::encoding::Encoder<'_, D>,
7925            offset: usize,
7926            mut depth: fidl::encoding::Depth,
7927        ) -> fidl::Result<()> {
7928            encoder.debug_check_bounds::<RingBufferSetActiveChannelsRequest>(offset);
7929            // Vector header
7930            let max_ordinal: u64 = self.max_ordinal_present();
7931            encoder.write_num(max_ordinal, offset);
7932            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
7933            // Calling encoder.out_of_line_offset(0) is not allowed.
7934            if max_ordinal == 0 {
7935                return Ok(());
7936            }
7937            depth.increment()?;
7938            let envelope_size = 8;
7939            let bytes_len = max_ordinal as usize * envelope_size;
7940            #[allow(unused_variables)]
7941            let offset = encoder.out_of_line_offset(bytes_len);
7942            let mut _prev_end_offset: usize = 0;
7943            if 1 > max_ordinal {
7944                return Ok(());
7945            }
7946
7947            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
7948            // are envelope_size bytes.
7949            let cur_offset: usize = (1 - 1) * envelope_size;
7950
7951            // Zero reserved fields.
7952            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7953
7954            // Safety:
7955            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
7956            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
7957            //   envelope_size bytes, there is always sufficient room.
7958            fidl::encoding::encode_in_envelope_optional::<u64, D>(
7959                self.channel_bitmask.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
7960                encoder,
7961                offset + cur_offset,
7962                depth,
7963            )?;
7964
7965            _prev_end_offset = cur_offset + envelope_size;
7966
7967            Ok(())
7968        }
7969    }
7970
7971    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
7972        for RingBufferSetActiveChannelsRequest
7973    {
7974        #[inline(always)]
7975        fn new_empty() -> Self {
7976            Self::default()
7977        }
7978
7979        unsafe fn decode(
7980            &mut self,
7981            decoder: &mut fidl::encoding::Decoder<'_, D>,
7982            offset: usize,
7983            mut depth: fidl::encoding::Depth,
7984        ) -> fidl::Result<()> {
7985            decoder.debug_check_bounds::<Self>(offset);
7986            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
7987                None => return Err(fidl::Error::NotNullable),
7988                Some(len) => len,
7989            };
7990            // Calling decoder.out_of_line_offset(0) is not allowed.
7991            if len == 0 {
7992                return Ok(());
7993            };
7994            depth.increment()?;
7995            let envelope_size = 8;
7996            let bytes_len = len * envelope_size;
7997            let offset = decoder.out_of_line_offset(bytes_len)?;
7998            // Decode the envelope for each type.
7999            let mut _next_ordinal_to_read = 0;
8000            let mut next_offset = offset;
8001            let end_offset = offset + bytes_len;
8002            _next_ordinal_to_read += 1;
8003            if next_offset >= end_offset {
8004                return Ok(());
8005            }
8006
8007            // Decode unknown envelopes for gaps in ordinals.
8008            while _next_ordinal_to_read < 1 {
8009                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8010                _next_ordinal_to_read += 1;
8011                next_offset += envelope_size;
8012            }
8013
8014            let next_out_of_line = decoder.next_out_of_line();
8015            let handles_before = decoder.remaining_handles();
8016            if let Some((inlined, num_bytes, num_handles)) =
8017                fidl::encoding::decode_envelope_header(decoder, next_offset)?
8018            {
8019                let member_inline_size =
8020                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
8021                if inlined != (member_inline_size <= 4) {
8022                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
8023                }
8024                let inner_offset;
8025                let mut inner_depth = depth.clone();
8026                if inlined {
8027                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8028                    inner_offset = next_offset;
8029                } else {
8030                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8031                    inner_depth.increment()?;
8032                }
8033                let val_ref = self.channel_bitmask.get_or_insert_with(|| fidl::new_empty!(u64, D));
8034                fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
8035                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8036                {
8037                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
8038                }
8039                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8040                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8041                }
8042            }
8043
8044            next_offset += envelope_size;
8045
8046            // Decode the remaining unknown envelopes.
8047            while next_offset < end_offset {
8048                _next_ordinal_to_read += 1;
8049                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8050                next_offset += envelope_size;
8051            }
8052
8053            Ok(())
8054        }
8055    }
8056
8057    impl RingBufferStartRequest {
8058        #[inline(always)]
8059        fn max_ordinal_present(&self) -> u64 {
8060            0
8061        }
8062    }
8063
8064    impl fidl::encoding::ValueTypeMarker for RingBufferStartRequest {
8065        type Borrowed<'a> = &'a Self;
8066        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
8067            value
8068        }
8069    }
8070
8071    unsafe impl fidl::encoding::TypeMarker for RingBufferStartRequest {
8072        type Owned = Self;
8073
8074        #[inline(always)]
8075        fn inline_align(_context: fidl::encoding::Context) -> usize {
8076            8
8077        }
8078
8079        #[inline(always)]
8080        fn inline_size(_context: fidl::encoding::Context) -> usize {
8081            16
8082        }
8083    }
8084
8085    unsafe impl<D: fidl::encoding::ResourceDialect>
8086        fidl::encoding::Encode<RingBufferStartRequest, D> for &RingBufferStartRequest
8087    {
8088        unsafe fn encode(
8089            self,
8090            encoder: &mut fidl::encoding::Encoder<'_, D>,
8091            offset: usize,
8092            mut depth: fidl::encoding::Depth,
8093        ) -> fidl::Result<()> {
8094            encoder.debug_check_bounds::<RingBufferStartRequest>(offset);
8095            // Vector header
8096            let max_ordinal: u64 = self.max_ordinal_present();
8097            encoder.write_num(max_ordinal, offset);
8098            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
8099            // Calling encoder.out_of_line_offset(0) is not allowed.
8100            if max_ordinal == 0 {
8101                return Ok(());
8102            }
8103            depth.increment()?;
8104            let envelope_size = 8;
8105            let bytes_len = max_ordinal as usize * envelope_size;
8106            #[allow(unused_variables)]
8107            let offset = encoder.out_of_line_offset(bytes_len);
8108            let mut _prev_end_offset: usize = 0;
8109
8110            Ok(())
8111        }
8112    }
8113
8114    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
8115        for RingBufferStartRequest
8116    {
8117        #[inline(always)]
8118        fn new_empty() -> Self {
8119            Self::default()
8120        }
8121
8122        unsafe fn decode(
8123            &mut self,
8124            decoder: &mut fidl::encoding::Decoder<'_, D>,
8125            offset: usize,
8126            mut depth: fidl::encoding::Depth,
8127        ) -> fidl::Result<()> {
8128            decoder.debug_check_bounds::<Self>(offset);
8129            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
8130                None => return Err(fidl::Error::NotNullable),
8131                Some(len) => len,
8132            };
8133            // Calling decoder.out_of_line_offset(0) is not allowed.
8134            if len == 0 {
8135                return Ok(());
8136            };
8137            depth.increment()?;
8138            let envelope_size = 8;
8139            let bytes_len = len * envelope_size;
8140            let offset = decoder.out_of_line_offset(bytes_len)?;
8141            // Decode the envelope for each type.
8142            let mut _next_ordinal_to_read = 0;
8143            let mut next_offset = offset;
8144            let end_offset = offset + bytes_len;
8145
8146            // Decode the remaining unknown envelopes.
8147            while next_offset < end_offset {
8148                _next_ordinal_to_read += 1;
8149                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8150                next_offset += envelope_size;
8151            }
8152
8153            Ok(())
8154        }
8155    }
8156
8157    impl RingBufferStopRequest {
8158        #[inline(always)]
8159        fn max_ordinal_present(&self) -> u64 {
8160            0
8161        }
8162    }
8163
8164    impl fidl::encoding::ValueTypeMarker for RingBufferStopRequest {
8165        type Borrowed<'a> = &'a Self;
8166        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
8167            value
8168        }
8169    }
8170
8171    unsafe impl fidl::encoding::TypeMarker for RingBufferStopRequest {
8172        type Owned = Self;
8173
8174        #[inline(always)]
8175        fn inline_align(_context: fidl::encoding::Context) -> usize {
8176            8
8177        }
8178
8179        #[inline(always)]
8180        fn inline_size(_context: fidl::encoding::Context) -> usize {
8181            16
8182        }
8183    }
8184
8185    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<RingBufferStopRequest, D>
8186        for &RingBufferStopRequest
8187    {
8188        unsafe fn encode(
8189            self,
8190            encoder: &mut fidl::encoding::Encoder<'_, D>,
8191            offset: usize,
8192            mut depth: fidl::encoding::Depth,
8193        ) -> fidl::Result<()> {
8194            encoder.debug_check_bounds::<RingBufferStopRequest>(offset);
8195            // Vector header
8196            let max_ordinal: u64 = self.max_ordinal_present();
8197            encoder.write_num(max_ordinal, offset);
8198            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
8199            // Calling encoder.out_of_line_offset(0) is not allowed.
8200            if max_ordinal == 0 {
8201                return Ok(());
8202            }
8203            depth.increment()?;
8204            let envelope_size = 8;
8205            let bytes_len = max_ordinal as usize * envelope_size;
8206            #[allow(unused_variables)]
8207            let offset = encoder.out_of_line_offset(bytes_len);
8208            let mut _prev_end_offset: usize = 0;
8209
8210            Ok(())
8211        }
8212    }
8213
8214    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for RingBufferStopRequest {
8215        #[inline(always)]
8216        fn new_empty() -> Self {
8217            Self::default()
8218        }
8219
8220        unsafe fn decode(
8221            &mut self,
8222            decoder: &mut fidl::encoding::Decoder<'_, D>,
8223            offset: usize,
8224            mut depth: fidl::encoding::Depth,
8225        ) -> fidl::Result<()> {
8226            decoder.debug_check_bounds::<Self>(offset);
8227            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
8228                None => return Err(fidl::Error::NotNullable),
8229                Some(len) => len,
8230            };
8231            // Calling decoder.out_of_line_offset(0) is not allowed.
8232            if len == 0 {
8233                return Ok(());
8234            };
8235            depth.increment()?;
8236            let envelope_size = 8;
8237            let bytes_len = len * envelope_size;
8238            let offset = decoder.out_of_line_offset(bytes_len)?;
8239            // Decode the envelope for each type.
8240            let mut _next_ordinal_to_read = 0;
8241            let mut next_offset = offset;
8242            let end_offset = offset + bytes_len;
8243
8244            // Decode the remaining unknown envelopes.
8245            while next_offset < end_offset {
8246                _next_ordinal_to_read += 1;
8247                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8248                next_offset += envelope_size;
8249            }
8250
8251            Ok(())
8252        }
8253    }
8254
8255    impl RingBufferSetActiveChannelsResponse {
8256        #[inline(always)]
8257        fn max_ordinal_present(&self) -> u64 {
8258            if let Some(_) = self.set_time {
8259                return 1;
8260            }
8261            0
8262        }
8263    }
8264
8265    impl fidl::encoding::ValueTypeMarker for RingBufferSetActiveChannelsResponse {
8266        type Borrowed<'a> = &'a Self;
8267        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
8268            value
8269        }
8270    }
8271
8272    unsafe impl fidl::encoding::TypeMarker for RingBufferSetActiveChannelsResponse {
8273        type Owned = Self;
8274
8275        #[inline(always)]
8276        fn inline_align(_context: fidl::encoding::Context) -> usize {
8277            8
8278        }
8279
8280        #[inline(always)]
8281        fn inline_size(_context: fidl::encoding::Context) -> usize {
8282            16
8283        }
8284    }
8285
8286    unsafe impl<D: fidl::encoding::ResourceDialect>
8287        fidl::encoding::Encode<RingBufferSetActiveChannelsResponse, D>
8288        for &RingBufferSetActiveChannelsResponse
8289    {
8290        unsafe fn encode(
8291            self,
8292            encoder: &mut fidl::encoding::Encoder<'_, D>,
8293            offset: usize,
8294            mut depth: fidl::encoding::Depth,
8295        ) -> fidl::Result<()> {
8296            encoder.debug_check_bounds::<RingBufferSetActiveChannelsResponse>(offset);
8297            // Vector header
8298            let max_ordinal: u64 = self.max_ordinal_present();
8299            encoder.write_num(max_ordinal, offset);
8300            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
8301            // Calling encoder.out_of_line_offset(0) is not allowed.
8302            if max_ordinal == 0 {
8303                return Ok(());
8304            }
8305            depth.increment()?;
8306            let envelope_size = 8;
8307            let bytes_len = max_ordinal as usize * envelope_size;
8308            #[allow(unused_variables)]
8309            let offset = encoder.out_of_line_offset(bytes_len);
8310            let mut _prev_end_offset: usize = 0;
8311            if 1 > max_ordinal {
8312                return Ok(());
8313            }
8314
8315            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
8316            // are envelope_size bytes.
8317            let cur_offset: usize = (1 - 1) * envelope_size;
8318
8319            // Zero reserved fields.
8320            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
8321
8322            // Safety:
8323            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
8324            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
8325            //   envelope_size bytes, there is always sufficient room.
8326            fidl::encoding::encode_in_envelope_optional::<i64, D>(
8327                self.set_time.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
8328                encoder,
8329                offset + cur_offset,
8330                depth,
8331            )?;
8332
8333            _prev_end_offset = cur_offset + envelope_size;
8334
8335            Ok(())
8336        }
8337    }
8338
8339    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
8340        for RingBufferSetActiveChannelsResponse
8341    {
8342        #[inline(always)]
8343        fn new_empty() -> Self {
8344            Self::default()
8345        }
8346
8347        unsafe fn decode(
8348            &mut self,
8349            decoder: &mut fidl::encoding::Decoder<'_, D>,
8350            offset: usize,
8351            mut depth: fidl::encoding::Depth,
8352        ) -> fidl::Result<()> {
8353            decoder.debug_check_bounds::<Self>(offset);
8354            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
8355                None => return Err(fidl::Error::NotNullable),
8356                Some(len) => len,
8357            };
8358            // Calling decoder.out_of_line_offset(0) is not allowed.
8359            if len == 0 {
8360                return Ok(());
8361            };
8362            depth.increment()?;
8363            let envelope_size = 8;
8364            let bytes_len = len * envelope_size;
8365            let offset = decoder.out_of_line_offset(bytes_len)?;
8366            // Decode the envelope for each type.
8367            let mut _next_ordinal_to_read = 0;
8368            let mut next_offset = offset;
8369            let end_offset = offset + bytes_len;
8370            _next_ordinal_to_read += 1;
8371            if next_offset >= end_offset {
8372                return Ok(());
8373            }
8374
8375            // Decode unknown envelopes for gaps in ordinals.
8376            while _next_ordinal_to_read < 1 {
8377                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8378                _next_ordinal_to_read += 1;
8379                next_offset += envelope_size;
8380            }
8381
8382            let next_out_of_line = decoder.next_out_of_line();
8383            let handles_before = decoder.remaining_handles();
8384            if let Some((inlined, num_bytes, num_handles)) =
8385                fidl::encoding::decode_envelope_header(decoder, next_offset)?
8386            {
8387                let member_inline_size =
8388                    <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
8389                if inlined != (member_inline_size <= 4) {
8390                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
8391                }
8392                let inner_offset;
8393                let mut inner_depth = depth.clone();
8394                if inlined {
8395                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8396                    inner_offset = next_offset;
8397                } else {
8398                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8399                    inner_depth.increment()?;
8400                }
8401                let val_ref = self.set_time.get_or_insert_with(|| fidl::new_empty!(i64, D));
8402                fidl::decode!(i64, D, val_ref, decoder, inner_offset, inner_depth)?;
8403                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8404                {
8405                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
8406                }
8407                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8408                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8409                }
8410            }
8411
8412            next_offset += envelope_size;
8413
8414            // Decode the remaining unknown envelopes.
8415            while next_offset < end_offset {
8416                _next_ordinal_to_read += 1;
8417                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8418                next_offset += envelope_size;
8419            }
8420
8421            Ok(())
8422        }
8423    }
8424
8425    impl RingBufferStartResponse {
8426        #[inline(always)]
8427        fn max_ordinal_present(&self) -> u64 {
8428            if let Some(_) = self.start_time {
8429                return 1;
8430            }
8431            0
8432        }
8433    }
8434
8435    impl fidl::encoding::ValueTypeMarker for RingBufferStartResponse {
8436        type Borrowed<'a> = &'a Self;
8437        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
8438            value
8439        }
8440    }
8441
8442    unsafe impl fidl::encoding::TypeMarker for RingBufferStartResponse {
8443        type Owned = Self;
8444
8445        #[inline(always)]
8446        fn inline_align(_context: fidl::encoding::Context) -> usize {
8447            8
8448        }
8449
8450        #[inline(always)]
8451        fn inline_size(_context: fidl::encoding::Context) -> usize {
8452            16
8453        }
8454    }
8455
8456    unsafe impl<D: fidl::encoding::ResourceDialect>
8457        fidl::encoding::Encode<RingBufferStartResponse, D> for &RingBufferStartResponse
8458    {
8459        unsafe fn encode(
8460            self,
8461            encoder: &mut fidl::encoding::Encoder<'_, D>,
8462            offset: usize,
8463            mut depth: fidl::encoding::Depth,
8464        ) -> fidl::Result<()> {
8465            encoder.debug_check_bounds::<RingBufferStartResponse>(offset);
8466            // Vector header
8467            let max_ordinal: u64 = self.max_ordinal_present();
8468            encoder.write_num(max_ordinal, offset);
8469            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
8470            // Calling encoder.out_of_line_offset(0) is not allowed.
8471            if max_ordinal == 0 {
8472                return Ok(());
8473            }
8474            depth.increment()?;
8475            let envelope_size = 8;
8476            let bytes_len = max_ordinal as usize * envelope_size;
8477            #[allow(unused_variables)]
8478            let offset = encoder.out_of_line_offset(bytes_len);
8479            let mut _prev_end_offset: usize = 0;
8480            if 1 > max_ordinal {
8481                return Ok(());
8482            }
8483
8484            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
8485            // are envelope_size bytes.
8486            let cur_offset: usize = (1 - 1) * envelope_size;
8487
8488            // Zero reserved fields.
8489            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
8490
8491            // Safety:
8492            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
8493            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
8494            //   envelope_size bytes, there is always sufficient room.
8495            fidl::encoding::encode_in_envelope_optional::<i64, D>(
8496                self.start_time.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
8497                encoder,
8498                offset + cur_offset,
8499                depth,
8500            )?;
8501
8502            _prev_end_offset = cur_offset + envelope_size;
8503
8504            Ok(())
8505        }
8506    }
8507
8508    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
8509        for RingBufferStartResponse
8510    {
8511        #[inline(always)]
8512        fn new_empty() -> Self {
8513            Self::default()
8514        }
8515
8516        unsafe fn decode(
8517            &mut self,
8518            decoder: &mut fidl::encoding::Decoder<'_, D>,
8519            offset: usize,
8520            mut depth: fidl::encoding::Depth,
8521        ) -> fidl::Result<()> {
8522            decoder.debug_check_bounds::<Self>(offset);
8523            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
8524                None => return Err(fidl::Error::NotNullable),
8525                Some(len) => len,
8526            };
8527            // Calling decoder.out_of_line_offset(0) is not allowed.
8528            if len == 0 {
8529                return Ok(());
8530            };
8531            depth.increment()?;
8532            let envelope_size = 8;
8533            let bytes_len = len * envelope_size;
8534            let offset = decoder.out_of_line_offset(bytes_len)?;
8535            // Decode the envelope for each type.
8536            let mut _next_ordinal_to_read = 0;
8537            let mut next_offset = offset;
8538            let end_offset = offset + bytes_len;
8539            _next_ordinal_to_read += 1;
8540            if next_offset >= end_offset {
8541                return Ok(());
8542            }
8543
8544            // Decode unknown envelopes for gaps in ordinals.
8545            while _next_ordinal_to_read < 1 {
8546                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8547                _next_ordinal_to_read += 1;
8548                next_offset += envelope_size;
8549            }
8550
8551            let next_out_of_line = decoder.next_out_of_line();
8552            let handles_before = decoder.remaining_handles();
8553            if let Some((inlined, num_bytes, num_handles)) =
8554                fidl::encoding::decode_envelope_header(decoder, next_offset)?
8555            {
8556                let member_inline_size =
8557                    <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
8558                if inlined != (member_inline_size <= 4) {
8559                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
8560                }
8561                let inner_offset;
8562                let mut inner_depth = depth.clone();
8563                if inlined {
8564                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8565                    inner_offset = next_offset;
8566                } else {
8567                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8568                    inner_depth.increment()?;
8569                }
8570                let val_ref = self.start_time.get_or_insert_with(|| fidl::new_empty!(i64, D));
8571                fidl::decode!(i64, D, val_ref, decoder, inner_offset, inner_depth)?;
8572                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8573                {
8574                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
8575                }
8576                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8577                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8578                }
8579            }
8580
8581            next_offset += envelope_size;
8582
8583            // Decode the remaining unknown envelopes.
8584            while next_offset < end_offset {
8585                _next_ordinal_to_read += 1;
8586                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8587                next_offset += envelope_size;
8588            }
8589
8590            Ok(())
8591        }
8592    }
8593
8594    impl RingBufferStopResponse {
8595        #[inline(always)]
8596        fn max_ordinal_present(&self) -> u64 {
8597            0
8598        }
8599    }
8600
8601    impl fidl::encoding::ValueTypeMarker for RingBufferStopResponse {
8602        type Borrowed<'a> = &'a Self;
8603        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
8604            value
8605        }
8606    }
8607
8608    unsafe impl fidl::encoding::TypeMarker for RingBufferStopResponse {
8609        type Owned = Self;
8610
8611        #[inline(always)]
8612        fn inline_align(_context: fidl::encoding::Context) -> usize {
8613            8
8614        }
8615
8616        #[inline(always)]
8617        fn inline_size(_context: fidl::encoding::Context) -> usize {
8618            16
8619        }
8620    }
8621
8622    unsafe impl<D: fidl::encoding::ResourceDialect>
8623        fidl::encoding::Encode<RingBufferStopResponse, D> for &RingBufferStopResponse
8624    {
8625        unsafe fn encode(
8626            self,
8627            encoder: &mut fidl::encoding::Encoder<'_, D>,
8628            offset: usize,
8629            mut depth: fidl::encoding::Depth,
8630        ) -> fidl::Result<()> {
8631            encoder.debug_check_bounds::<RingBufferStopResponse>(offset);
8632            // Vector header
8633            let max_ordinal: u64 = self.max_ordinal_present();
8634            encoder.write_num(max_ordinal, offset);
8635            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
8636            // Calling encoder.out_of_line_offset(0) is not allowed.
8637            if max_ordinal == 0 {
8638                return Ok(());
8639            }
8640            depth.increment()?;
8641            let envelope_size = 8;
8642            let bytes_len = max_ordinal as usize * envelope_size;
8643            #[allow(unused_variables)]
8644            let offset = encoder.out_of_line_offset(bytes_len);
8645            let mut _prev_end_offset: usize = 0;
8646
8647            Ok(())
8648        }
8649    }
8650
8651    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
8652        for RingBufferStopResponse
8653    {
8654        #[inline(always)]
8655        fn new_empty() -> Self {
8656            Self::default()
8657        }
8658
8659        unsafe fn decode(
8660            &mut self,
8661            decoder: &mut fidl::encoding::Decoder<'_, D>,
8662            offset: usize,
8663            mut depth: fidl::encoding::Depth,
8664        ) -> fidl::Result<()> {
8665            decoder.debug_check_bounds::<Self>(offset);
8666            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
8667                None => return Err(fidl::Error::NotNullable),
8668                Some(len) => len,
8669            };
8670            // Calling decoder.out_of_line_offset(0) is not allowed.
8671            if len == 0 {
8672                return Ok(());
8673            };
8674            depth.increment()?;
8675            let envelope_size = 8;
8676            let bytes_len = len * envelope_size;
8677            let offset = decoder.out_of_line_offset(bytes_len)?;
8678            // Decode the envelope for each type.
8679            let mut _next_ordinal_to_read = 0;
8680            let mut next_offset = offset;
8681            let end_offset = offset + bytes_len;
8682
8683            // Decode the remaining unknown envelopes.
8684            while next_offset < end_offset {
8685                _next_ordinal_to_read += 1;
8686                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8687                next_offset += envelope_size;
8688            }
8689
8690            Ok(())
8691        }
8692    }
8693
8694    impl RingBufferWatchDelayInfoResponse {
8695        #[inline(always)]
8696        fn max_ordinal_present(&self) -> u64 {
8697            if let Some(_) = self.delay_info {
8698                return 1;
8699            }
8700            0
8701        }
8702    }
8703
8704    impl fidl::encoding::ValueTypeMarker for RingBufferWatchDelayInfoResponse {
8705        type Borrowed<'a> = &'a Self;
8706        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
8707            value
8708        }
8709    }
8710
8711    unsafe impl fidl::encoding::TypeMarker for RingBufferWatchDelayInfoResponse {
8712        type Owned = Self;
8713
8714        #[inline(always)]
8715        fn inline_align(_context: fidl::encoding::Context) -> usize {
8716            8
8717        }
8718
8719        #[inline(always)]
8720        fn inline_size(_context: fidl::encoding::Context) -> usize {
8721            16
8722        }
8723    }
8724
8725    unsafe impl<D: fidl::encoding::ResourceDialect>
8726        fidl::encoding::Encode<RingBufferWatchDelayInfoResponse, D>
8727        for &RingBufferWatchDelayInfoResponse
8728    {
8729        unsafe fn encode(
8730            self,
8731            encoder: &mut fidl::encoding::Encoder<'_, D>,
8732            offset: usize,
8733            mut depth: fidl::encoding::Depth,
8734        ) -> fidl::Result<()> {
8735            encoder.debug_check_bounds::<RingBufferWatchDelayInfoResponse>(offset);
8736            // Vector header
8737            let max_ordinal: u64 = self.max_ordinal_present();
8738            encoder.write_num(max_ordinal, offset);
8739            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
8740            // Calling encoder.out_of_line_offset(0) is not allowed.
8741            if max_ordinal == 0 {
8742                return Ok(());
8743            }
8744            depth.increment()?;
8745            let envelope_size = 8;
8746            let bytes_len = max_ordinal as usize * envelope_size;
8747            #[allow(unused_variables)]
8748            let offset = encoder.out_of_line_offset(bytes_len);
8749            let mut _prev_end_offset: usize = 0;
8750            if 1 > 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 = (1 - 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::<DelayInfo, D>(
8766                self.delay_info
8767                    .as_ref()
8768                    .map(<DelayInfo as fidl::encoding::ValueTypeMarker>::borrow),
8769                encoder,
8770                offset + cur_offset,
8771                depth,
8772            )?;
8773
8774            _prev_end_offset = cur_offset + envelope_size;
8775
8776            Ok(())
8777        }
8778    }
8779
8780    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
8781        for RingBufferWatchDelayInfoResponse
8782    {
8783        #[inline(always)]
8784        fn new_empty() -> Self {
8785            Self::default()
8786        }
8787
8788        unsafe fn decode(
8789            &mut self,
8790            decoder: &mut fidl::encoding::Decoder<'_, D>,
8791            offset: usize,
8792            mut depth: fidl::encoding::Depth,
8793        ) -> fidl::Result<()> {
8794            decoder.debug_check_bounds::<Self>(offset);
8795            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
8796                None => return Err(fidl::Error::NotNullable),
8797                Some(len) => len,
8798            };
8799            // Calling decoder.out_of_line_offset(0) is not allowed.
8800            if len == 0 {
8801                return Ok(());
8802            };
8803            depth.increment()?;
8804            let envelope_size = 8;
8805            let bytes_len = len * envelope_size;
8806            let offset = decoder.out_of_line_offset(bytes_len)?;
8807            // Decode the envelope for each type.
8808            let mut _next_ordinal_to_read = 0;
8809            let mut next_offset = offset;
8810            let end_offset = offset + bytes_len;
8811            _next_ordinal_to_read += 1;
8812            if next_offset >= end_offset {
8813                return Ok(());
8814            }
8815
8816            // Decode unknown envelopes for gaps in ordinals.
8817            while _next_ordinal_to_read < 1 {
8818                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8819                _next_ordinal_to_read += 1;
8820                next_offset += envelope_size;
8821            }
8822
8823            let next_out_of_line = decoder.next_out_of_line();
8824            let handles_before = decoder.remaining_handles();
8825            if let Some((inlined, num_bytes, num_handles)) =
8826                fidl::encoding::decode_envelope_header(decoder, next_offset)?
8827            {
8828                let member_inline_size =
8829                    <DelayInfo as fidl::encoding::TypeMarker>::inline_size(decoder.context);
8830                if inlined != (member_inline_size <= 4) {
8831                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
8832                }
8833                let inner_offset;
8834                let mut inner_depth = depth.clone();
8835                if inlined {
8836                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8837                    inner_offset = next_offset;
8838                } else {
8839                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8840                    inner_depth.increment()?;
8841                }
8842                let val_ref = self.delay_info.get_or_insert_with(|| fidl::new_empty!(DelayInfo, D));
8843                fidl::decode!(DelayInfo, D, val_ref, decoder, inner_offset, inner_depth)?;
8844                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8845                {
8846                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
8847                }
8848                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8849                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8850                }
8851            }
8852
8853            next_offset += envelope_size;
8854
8855            // Decode the remaining unknown envelopes.
8856            while next_offset < end_offset {
8857                _next_ordinal_to_read += 1;
8858                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8859                next_offset += envelope_size;
8860            }
8861
8862            Ok(())
8863        }
8864    }
8865}