fidl_fuchsia_hardware_audio_signalprocessing_common/
fidl_fuchsia_hardware_audio_signalprocessing_common.rs

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