Skip to main content

fdomain_fuchsia_hardware_audio/
fdomain_fuchsia_hardware_audio.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 fdomain_client::fidl::{ControlHandle as _, FDomainFlexibleIntoResult as _, Responder as _};
8use fidl::encoding::{MessageBufFor, ProxyChannelBox, ResourceDialect};
9pub use fidl_fuchsia_hardware_audio_common::*;
10use futures::future::{self, MaybeDone, TryFutureExt};
11use zx_status;
12
13pub type VmoInfos = Vec<VmoInfo>;
14
15#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
16pub struct CodecConnectorConnectRequest {
17    pub codec_protocol: fdomain_client::fidl::ServerEnd<CodecMarker>,
18}
19
20impl fidl::Standalone<fdomain_client::fidl::FDomainResourceDialect>
21    for CodecConnectorConnectRequest
22{
23}
24
25#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
26pub struct CompositeConnectorConnectRequest {
27    pub composite_protocol: fdomain_client::fidl::ServerEnd<CompositeMarker>,
28}
29
30impl fidl::Standalone<fdomain_client::fidl::FDomainResourceDialect>
31    for CompositeConnectorConnectRequest
32{
33}
34
35#[derive(Debug, PartialEq)]
36pub struct CompositeCreatePacketStreamRequest {
37    pub processing_element_id: u64,
38    pub format: Format2,
39    pub packet_stream_control: fdomain_client::fidl::ServerEnd<PacketStreamControlMarker>,
40}
41
42impl fidl::Standalone<fdomain_client::fidl::FDomainResourceDialect>
43    for CompositeCreatePacketStreamRequest
44{
45}
46
47#[derive(Debug, PartialEq)]
48pub struct CompositeCreateRingBufferRequest {
49    pub processing_element_id: u64,
50    pub format: Format2,
51    pub ring_buffer: fdomain_client::fidl::ServerEnd<RingBufferMarker>,
52}
53
54impl fidl::Standalone<fdomain_client::fidl::FDomainResourceDialect>
55    for CompositeCreateRingBufferRequest
56{
57}
58
59#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
60pub struct DaiConnectorConnectRequest {
61    pub dai_protocol: fdomain_client::fidl::ServerEnd<DaiMarker>,
62}
63
64impl fidl::Standalone<fdomain_client::fidl::FDomainResourceDialect> for DaiConnectorConnectRequest {}
65
66#[derive(Debug, PartialEq)]
67pub struct DaiCreateRingBufferRequest {
68    pub dai_format: DaiFormat,
69    pub ring_buffer_format: Format,
70    pub ring_buffer: fdomain_client::fidl::ServerEnd<RingBufferMarker>,
71}
72
73impl fidl::Standalone<fdomain_client::fidl::FDomainResourceDialect> for DaiCreateRingBufferRequest {}
74
75#[derive(Debug, PartialEq)]
76pub struct PacketStreamControlAllocateVmosResponse {
77    pub vmos: Vec<VmoInfo>,
78}
79
80impl fidl::Standalone<fdomain_client::fidl::FDomainResourceDialect>
81    for PacketStreamControlAllocateVmosResponse
82{
83}
84
85#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
86pub struct RingBufferGetVmoResponse {
87    pub num_frames: u32,
88    pub ring_buffer: fdomain_client::Vmo,
89}
90
91impl fidl::Standalone<fdomain_client::fidl::FDomainResourceDialect> for RingBufferGetVmoResponse {}
92
93#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
94pub struct StreamConfigConnectorConnectRequest {
95    pub protocol: fdomain_client::fidl::ServerEnd<StreamConfigMarker>,
96}
97
98impl fidl::Standalone<fdomain_client::fidl::FDomainResourceDialect>
99    for StreamConfigConnectorConnectRequest
100{
101}
102
103#[derive(Debug, PartialEq)]
104pub struct StreamConfigCreateRingBufferRequest {
105    pub format: Format,
106    pub ring_buffer: fdomain_client::fidl::ServerEnd<RingBufferMarker>,
107}
108
109impl fidl::Standalone<fdomain_client::fidl::FDomainResourceDialect>
110    for StreamConfigCreateRingBufferRequest
111{
112}
113
114#[derive(Debug, Default, PartialEq)]
115pub struct PacketStreamControlSetPacketStreamSinkRequest {
116    pub stream: Option<fdomain_client::fidl::ClientEnd<PacketStreamSinkMarker>>,
117    #[doc(hidden)]
118    pub __source_breaking: fidl::marker::SourceBreaking,
119}
120
121impl fidl::Standalone<fdomain_client::fidl::FDomainResourceDialect>
122    for PacketStreamControlSetPacketStreamSinkRequest
123{
124}
125
126#[derive(Debug, Default, PartialEq)]
127pub struct PacketStreamControlGetPacketStreamSinkResponse {
128    pub stream: Option<fdomain_client::fidl::ClientEnd<PacketStreamSinkMarker>>,
129    #[doc(hidden)]
130    pub __source_breaking: fidl::marker::SourceBreaking,
131}
132
133impl fidl::Standalone<fdomain_client::fidl::FDomainResourceDialect>
134    for PacketStreamControlGetPacketStreamSinkResponse
135{
136}
137
138#[derive(Debug, Default, PartialEq)]
139pub struct PacketStreamSinkPutPacketRequest {
140    /// Location of the payload for this packet.
141    ///
142    /// Required.
143    pub payload: Option<DataTransfer>,
144    #[doc(hidden)]
145    pub __source_breaking: fidl::marker::SourceBreaking,
146}
147
148impl fidl::Standalone<fdomain_client::fidl::FDomainResourceDialect>
149    for PacketStreamSinkPutPacketRequest
150{
151}
152
153#[derive(Debug, Default, PartialEq)]
154pub struct RegisterVmosConfig {
155    /// The list of VMOs to register with the driver.
156    ///
157    /// Required.
158    pub vmo_infos: Option<Vec<VmoInfo>>,
159    #[doc(hidden)]
160    pub __source_breaking: fidl::marker::SourceBreaking,
161}
162
163impl fidl::Standalone<fdomain_client::fidl::FDomainResourceDialect> for RegisterVmosConfig {}
164
165/// VMO information for registering VMOs. Used in `RegisterVmos` and `AllocateVmos` to pair
166/// a VMO handle with a unique ID.
167#[derive(Debug, Default, PartialEq)]
168pub struct VmoInfo {
169    /// ID corresponding to the VMO.
170    ///
171    /// Required.
172    pub id: Option<u64>,
173    /// Handle to the VMO.
174    ///
175    /// Required.
176    pub vmo: Option<fdomain_client::Vmo>,
177    #[doc(hidden)]
178    pub __source_breaking: fidl::marker::SourceBreaking,
179}
180
181impl fidl::Standalone<fdomain_client::fidl::FDomainResourceDialect> for VmoInfo {}
182
183/// This describes a VMO section containing audio data.
184#[derive(Debug, Default, PartialEq)]
185pub struct VmoTransfer {
186    /// ID of a VMO that was previously registered or allocated.
187    ///
188    /// Required.
189    pub vmo_id: Option<u64>,
190    /// Offset into the VMO to start reading or writing.
191    /// This is relative to the start of that VMO.
192    ///
193    /// Required.
194    pub vmo_offset: Option<u64>,
195    /// Number of bytes to read/write from/to this VMO region.
196    ///
197    /// Required.
198    pub payload_size: Option<u64>,
199    #[doc(hidden)]
200    pub __source_breaking: fidl::marker::SourceBreaking,
201}
202
203impl fidl::Standalone<fdomain_client::fidl::FDomainResourceDialect> for VmoTransfer {}
204
205/// Data to be transferred. There are two supported ways data may be conveyed, corresponding to the
206/// two members of the DataTransfer union:
207///
208/// 1) vmo_transfer: A region within a VMO previously known to the driver. This VMO must have been
209///    established via `PacketStreamControl.RegisterVmos` (if client-allocated) or
210///    `PacketStreamControl.AllocateVmos` (if driver-allocated). Future requests refer to this
211///    buffer by the unique `vmo_id`. Because VMOs are reused across requests, the one-time
212///    cost of pinning/mapping is amortized.
213///
214/// 2) data: The payload is provided directly within the message. This mode is intended for
215///    small transfers or control information, not high-throughput streaming.
216#[derive(Debug)]
217pub enum DataTransfer {
218    /// Data is stored in a region of a registered VMO.
219    /// Requires `PacketStreamProperties.supported_buffer_types` to include `CLIENT_OWNED`
220    /// or `DRIVER_OWNED`.
221    VmoTransfer(VmoTransfer),
222    /// Embedded data buffer.
223    /// Requires `PacketStreamProperties.supported_buffer_types` to include `INLINE`.
224    InlineData(Vec<u8>),
225    #[doc(hidden)]
226    __SourceBreaking { unknown_ordinal: u64 },
227}
228
229/// Pattern that matches an unknown `DataTransfer` member.
230#[macro_export]
231macro_rules! DataTransferUnknown {
232    () => {
233        _
234    };
235}
236
237// Custom PartialEq so that unknown variants are not equal to themselves.
238impl PartialEq for DataTransfer {
239    fn eq(&self, other: &Self) -> bool {
240        match (self, other) {
241            (Self::VmoTransfer(x), Self::VmoTransfer(y)) => *x == *y,
242            (Self::InlineData(x), Self::InlineData(y)) => *x == *y,
243            _ => false,
244        }
245    }
246}
247
248impl DataTransfer {
249    #[inline]
250    pub fn ordinal(&self) -> u64 {
251        match *self {
252            Self::VmoTransfer(_) => 1,
253            Self::InlineData(_) => 2,
254            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
255        }
256    }
257
258    #[inline]
259    pub fn unknown_variant_for_testing() -> Self {
260        Self::__SourceBreaking { unknown_ordinal: 0 }
261    }
262
263    #[inline]
264    pub fn is_unknown(&self) -> bool {
265        match self {
266            Self::__SourceBreaking { .. } => true,
267            _ => false,
268        }
269    }
270}
271
272impl fidl::Standalone<fdomain_client::fidl::FDomainResourceDialect> for DataTransfer {}
273
274#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
275pub struct CodecMarker;
276
277impl fdomain_client::fidl::ProtocolMarker for CodecMarker {
278    type Proxy = CodecProxy;
279    type RequestStream = CodecRequestStream;
280
281    const DEBUG_NAME: &'static str = "(anonymous) Codec";
282}
283pub type CodecGetDaiFormatsResult = Result<Vec<DaiSupportedFormats>, i32>;
284pub type CodecSetDaiFormatResult = Result<CodecFormatInfo, i32>;
285
286pub trait CodecProxyInterface: Send + Sync {
287    type GetHealthStateResponseFut: std::future::Future<Output = Result<HealthState, fidl::Error>>
288        + Send;
289    fn r#get_health_state(&self) -> Self::GetHealthStateResponseFut;
290    fn r#signal_processing_connect(
291        &self,
292        protocol: fdomain_client::fidl::ServerEnd<
293            fdomain_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
294        >,
295    ) -> Result<(), fidl::Error>;
296    type ResetResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
297    fn r#reset(&self) -> Self::ResetResponseFut;
298    type GetPropertiesResponseFut: std::future::Future<Output = Result<CodecProperties, fidl::Error>>
299        + Send;
300    fn r#get_properties(&self) -> Self::GetPropertiesResponseFut;
301    type StopResponseFut: std::future::Future<Output = Result<i64, fidl::Error>> + Send;
302    fn r#stop(&self) -> Self::StopResponseFut;
303    type StartResponseFut: std::future::Future<Output = Result<i64, fidl::Error>> + Send;
304    fn r#start(&self) -> Self::StartResponseFut;
305    type GetDaiFormatsResponseFut: std::future::Future<Output = Result<CodecGetDaiFormatsResult, fidl::Error>>
306        + Send;
307    fn r#get_dai_formats(&self) -> Self::GetDaiFormatsResponseFut;
308    type SetDaiFormatResponseFut: std::future::Future<Output = Result<CodecSetDaiFormatResult, fidl::Error>>
309        + Send;
310    fn r#set_dai_format(&self, format: &DaiFormat) -> Self::SetDaiFormatResponseFut;
311    type WatchPlugStateResponseFut: std::future::Future<Output = Result<PlugState, fidl::Error>>
312        + Send;
313    fn r#watch_plug_state(&self) -> Self::WatchPlugStateResponseFut;
314}
315
316#[derive(Debug, Clone)]
317pub struct CodecProxy {
318    client: fidl::client::Client<fdomain_client::fidl::FDomainResourceDialect>,
319}
320
321impl fdomain_client::fidl::Proxy for CodecProxy {
322    type Protocol = CodecMarker;
323
324    fn from_channel(inner: fdomain_client::Channel) -> Self {
325        Self::new(inner)
326    }
327
328    fn into_channel(self) -> Result<fdomain_client::Channel, Self> {
329        self.client.into_channel().map_err(|client| Self { client })
330    }
331
332    fn as_channel(&self) -> &fdomain_client::Channel {
333        self.client.as_channel()
334    }
335}
336
337impl CodecProxy {
338    /// Create a new Proxy for fuchsia.hardware.audio/Codec.
339    pub fn new(channel: fdomain_client::Channel) -> Self {
340        let protocol_name = <CodecMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME;
341        Self { client: fidl::client::Client::new(channel, protocol_name) }
342    }
343
344    /// Get a Stream of events from the remote end of the protocol.
345    ///
346    /// # Panics
347    ///
348    /// Panics if the event stream was already taken.
349    pub fn take_event_stream(&self) -> CodecEventStream {
350        CodecEventStream { event_receiver: self.client.take_event_receiver() }
351    }
352
353    /// Retrieves top level health state.
354    /// A driver not responding promptly can be used as an indication of an unhealthy driver.
355    pub fn r#get_health_state(
356        &self,
357    ) -> fidl::client::QueryResponseFut<HealthState, fdomain_client::fidl::FDomainResourceDialect>
358    {
359        CodecProxyInterface::r#get_health_state(self)
360    }
361
362    /// Connect to a `SignalProcessing` protocol.
363    /// Multiple connections may be supported, if a new connection request is not supported, i.e.
364    /// the maximum number of connections have already been created, for instance one, then the
365    /// `protocol` channel (not the channel upon which `SignalProcessingConnect` is being called)
366    /// will be closed with a `ZX_ERR_ALREADY_BOUND` epitaph.
367    /// If signal processing is not supported at all, then the `protocol` channel (again, not the
368    /// channel upon which `SignalProcessingConnect` is being called) will be closed with a
369    /// `ZX_ERR_NOT_SUPPORTED` epitaph.
370    /// This method is named `SignalProcessingConnect` instead of `Connect` because this protocol
371    /// is intended to be composed, and hence the more verbose name allows differentiation and
372    /// improved clarity.
373    pub fn r#signal_processing_connect(
374        &self,
375        mut protocol: fdomain_client::fidl::ServerEnd<
376            fdomain_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
377        >,
378    ) -> Result<(), fidl::Error> {
379        CodecProxyInterface::r#signal_processing_connect(self, protocol)
380    }
381
382    /// Resets the codec.
383    /// `Reset` returns when the reset is completed. If the driver can't successfully reset the
384    /// codec it will close the codec protocol channel, in this case the client may obtain a new
385    /// codec protocol channel and retry.
386    pub fn r#reset(
387        &self,
388    ) -> fidl::client::QueryResponseFut<(), fdomain_client::fidl::FDomainResourceDialect> {
389        CodecProxyInterface::r#reset(self)
390    }
391
392    /// Retrieves top level static properties.
393    pub fn r#get_properties(
394        &self,
395    ) -> fidl::client::QueryResponseFut<CodecProperties, fdomain_client::fidl::FDomainResourceDialect>
396    {
397        CodecProxyInterface::r#get_properties(self)
398    }
399
400    /// Stops the codec operation.
401    /// `Stop` returns when configuring the codec to stop is completed. This method does not wait
402    /// for the hardware to actually stop playback/capture (i.e. `turn_off_delay` impact is not
403    /// taken into account), nor is any such delay reflected in the returned `stop_time`.
404    /// `stop_time` indicates when the driver finished configuring the codec to stop, as measured
405    /// in the CLOCK_MONOTONIC timeline.
406    /// If the driver cannot successfully configure the codec to stop, it will close the codec
407    /// protocol channel, in which case the client may obtain a new codec protocol channel and retry.
408    pub fn r#stop(
409        &self,
410    ) -> fidl::client::QueryResponseFut<i64, fdomain_client::fidl::FDomainResourceDialect> {
411        CodecProxyInterface::r#stop(self)
412    }
413
414    /// Start/Re-start the codec operation.
415    /// `Start` returns when configuring the codec to start is completed. This method does not wait
416    /// for the hardware to actually start playback/capture (i.e. `turn_on_delay` impact is not taken
417    /// into account), nor is any such delay reflected in the returned `start_time`.
418    /// `start_time` indicates when the driver finished configuring the codec to start, as measured
419    /// in the CLOCK_MONOTONIC timeline.
420    /// If the driver can't successfully start the codec, it will close the codec protocol channel,
421    /// in which case the client may obtain a new codec protocol channel and retry.
422    pub fn r#start(
423        &self,
424    ) -> fidl::client::QueryResponseFut<i64, fdomain_client::fidl::FDomainResourceDialect> {
425        CodecProxyInterface::r#start(self)
426    }
427
428    /// Retrieves the DAI formats supported by the codec, if not available at the time the codec
429    /// may reply with an error status and the controller may retry at a later time.
430    /// Retrieving multiple DaiSupportedFormats allows for cases where exclusive
431    /// combinations of the parameters in DaiSupportedFormats may be supported.
432    pub fn r#get_dai_formats(
433        &self,
434    ) -> fidl::client::QueryResponseFut<
435        CodecGetDaiFormatsResult,
436        fdomain_client::fidl::FDomainResourceDialect,
437    > {
438        CodecProxyInterface::r#get_dai_formats(self)
439    }
440
441    /// Sets the DAI format to be used in the interface between the controller and codec.
442    /// Returns an error if not supported at the time of the request (e.g. for removable hardware).
443    pub fn r#set_dai_format(
444        &self,
445        mut format: &DaiFormat,
446    ) -> fidl::client::QueryResponseFut<
447        CodecSetDaiFormatResult,
448        fdomain_client::fidl::FDomainResourceDialect,
449    > {
450        CodecProxyInterface::r#set_dai_format(self, format)
451    }
452
453    /// Get the plug detect state via a hanging get. The driver will reply to the first
454    /// `WatchPlugState` sent by the client. The driver will not respond to subsequent client
455    /// `WatchPlugState` calls until the plug state changes from what was most recently reported.
456    pub fn r#watch_plug_state(
457        &self,
458    ) -> fidl::client::QueryResponseFut<PlugState, fdomain_client::fidl::FDomainResourceDialect>
459    {
460        CodecProxyInterface::r#watch_plug_state(self)
461    }
462}
463
464impl CodecProxyInterface for CodecProxy {
465    type GetHealthStateResponseFut =
466        fidl::client::QueryResponseFut<HealthState, fdomain_client::fidl::FDomainResourceDialect>;
467    fn r#get_health_state(&self) -> Self::GetHealthStateResponseFut {
468        fn _decode(
469            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
470        ) -> Result<HealthState, fidl::Error> {
471            let _response = fidl::client::decode_transaction_body::<
472                HealthGetHealthStateResponse,
473                fdomain_client::fidl::FDomainResourceDialect,
474                0x4e146d6bca733a84,
475            >(_buf?)?;
476            Ok(_response.state)
477        }
478        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, HealthState>(
479            (),
480            0x4e146d6bca733a84,
481            fidl::encoding::DynamicFlags::empty(),
482            _decode,
483        )
484    }
485
486    fn r#signal_processing_connect(
487        &self,
488        mut protocol: fdomain_client::fidl::ServerEnd<
489            fdomain_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
490        >,
491    ) -> Result<(), fidl::Error> {
492        self.client.send::<fdomain_fuchsia_hardware_audio_signalprocessing::ConnectorSignalProcessingConnectRequest>(
493            (protocol,),
494            0xa81907ce6066295,
495            fidl::encoding::DynamicFlags::empty(),
496        )
497    }
498
499    type ResetResponseFut =
500        fidl::client::QueryResponseFut<(), fdomain_client::fidl::FDomainResourceDialect>;
501    fn r#reset(&self) -> Self::ResetResponseFut {
502        fn _decode(
503            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
504        ) -> Result<(), fidl::Error> {
505            let _response = fidl::client::decode_transaction_body::<
506                fidl::encoding::EmptyPayload,
507                fdomain_client::fidl::FDomainResourceDialect,
508                0x50757ae579a7bd6b,
509            >(_buf?)?;
510            Ok(_response)
511        }
512        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ()>(
513            (),
514            0x50757ae579a7bd6b,
515            fidl::encoding::DynamicFlags::empty(),
516            _decode,
517        )
518    }
519
520    type GetPropertiesResponseFut = fidl::client::QueryResponseFut<
521        CodecProperties,
522        fdomain_client::fidl::FDomainResourceDialect,
523    >;
524    fn r#get_properties(&self) -> Self::GetPropertiesResponseFut {
525        fn _decode(
526            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
527        ) -> Result<CodecProperties, fidl::Error> {
528            let _response = fidl::client::decode_transaction_body::<
529                CodecGetPropertiesResponse,
530                fdomain_client::fidl::FDomainResourceDialect,
531                0x7a0d138a6a1d9d90,
532            >(_buf?)?;
533            Ok(_response.properties)
534        }
535        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, CodecProperties>(
536            (),
537            0x7a0d138a6a1d9d90,
538            fidl::encoding::DynamicFlags::empty(),
539            _decode,
540        )
541    }
542
543    type StopResponseFut =
544        fidl::client::QueryResponseFut<i64, fdomain_client::fidl::FDomainResourceDialect>;
545    fn r#stop(&self) -> Self::StopResponseFut {
546        fn _decode(
547            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
548        ) -> Result<i64, fidl::Error> {
549            let _response = fidl::client::decode_transaction_body::<
550                CodecStopResponse,
551                fdomain_client::fidl::FDomainResourceDialect,
552                0x5c2e380df1332dbd,
553            >(_buf?)?;
554            Ok(_response.stop_time)
555        }
556        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, i64>(
557            (),
558            0x5c2e380df1332dbd,
559            fidl::encoding::DynamicFlags::empty(),
560            _decode,
561        )
562    }
563
564    type StartResponseFut =
565        fidl::client::QueryResponseFut<i64, fdomain_client::fidl::FDomainResourceDialect>;
566    fn r#start(&self) -> Self::StartResponseFut {
567        fn _decode(
568            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
569        ) -> Result<i64, fidl::Error> {
570            let _response = fidl::client::decode_transaction_body::<
571                CodecStartResponse,
572                fdomain_client::fidl::FDomainResourceDialect,
573                0x329cdacb286ab00,
574            >(_buf?)?;
575            Ok(_response.start_time)
576        }
577        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, i64>(
578            (),
579            0x329cdacb286ab00,
580            fidl::encoding::DynamicFlags::empty(),
581            _decode,
582        )
583    }
584
585    type GetDaiFormatsResponseFut = fidl::client::QueryResponseFut<
586        CodecGetDaiFormatsResult,
587        fdomain_client::fidl::FDomainResourceDialect,
588    >;
589    fn r#get_dai_formats(&self) -> Self::GetDaiFormatsResponseFut {
590        fn _decode(
591            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
592        ) -> Result<CodecGetDaiFormatsResult, fidl::Error> {
593            let _response = fidl::client::decode_transaction_body::<
594                fidl::encoding::ResultType<CodecGetDaiFormatsResponse, i32>,
595                fdomain_client::fidl::FDomainResourceDialect,
596                0xf8bbc46b4ba6a52,
597            >(_buf?)?;
598            Ok(_response.map(|x| x.formats))
599        }
600        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, CodecGetDaiFormatsResult>(
601            (),
602            0xf8bbc46b4ba6a52,
603            fidl::encoding::DynamicFlags::empty(),
604            _decode,
605        )
606    }
607
608    type SetDaiFormatResponseFut = fidl::client::QueryResponseFut<
609        CodecSetDaiFormatResult,
610        fdomain_client::fidl::FDomainResourceDialect,
611    >;
612    fn r#set_dai_format(&self, mut format: &DaiFormat) -> Self::SetDaiFormatResponseFut {
613        fn _decode(
614            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
615        ) -> Result<CodecSetDaiFormatResult, fidl::Error> {
616            let _response = fidl::client::decode_transaction_body::<
617                fidl::encoding::ResultType<CodecSetDaiFormatResponse, i32>,
618                fdomain_client::fidl::FDomainResourceDialect,
619                0x2f829df9e5a7a1ea,
620            >(_buf?)?;
621            Ok(_response.map(|x| x.state))
622        }
623        self.client.send_query_and_decode::<CodecSetDaiFormatRequest, CodecSetDaiFormatResult>(
624            (format,),
625            0x2f829df9e5a7a1ea,
626            fidl::encoding::DynamicFlags::empty(),
627            _decode,
628        )
629    }
630
631    type WatchPlugStateResponseFut =
632        fidl::client::QueryResponseFut<PlugState, fdomain_client::fidl::FDomainResourceDialect>;
633    fn r#watch_plug_state(&self) -> Self::WatchPlugStateResponseFut {
634        fn _decode(
635            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
636        ) -> Result<PlugState, fidl::Error> {
637            let _response = fidl::client::decode_transaction_body::<
638                CodecWatchPlugStateResponse,
639                fdomain_client::fidl::FDomainResourceDialect,
640                0x182b87f935ca7326,
641            >(_buf?)?;
642            Ok(_response.plug_state)
643        }
644        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, PlugState>(
645            (),
646            0x182b87f935ca7326,
647            fidl::encoding::DynamicFlags::empty(),
648            _decode,
649        )
650    }
651}
652
653pub struct CodecEventStream {
654    event_receiver: fidl::client::EventReceiver<fdomain_client::fidl::FDomainResourceDialect>,
655}
656
657impl std::marker::Unpin for CodecEventStream {}
658
659impl futures::stream::FusedStream for CodecEventStream {
660    fn is_terminated(&self) -> bool {
661        self.event_receiver.is_terminated()
662    }
663}
664
665impl futures::Stream for CodecEventStream {
666    type Item = Result<CodecEvent, fidl::Error>;
667
668    fn poll_next(
669        mut self: std::pin::Pin<&mut Self>,
670        cx: &mut std::task::Context<'_>,
671    ) -> std::task::Poll<Option<Self::Item>> {
672        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
673            &mut self.event_receiver,
674            cx
675        )?) {
676            Some(buf) => std::task::Poll::Ready(Some(CodecEvent::decode(buf))),
677            None => std::task::Poll::Ready(None),
678        }
679    }
680}
681
682#[derive(Debug)]
683pub enum CodecEvent {}
684
685impl CodecEvent {
686    /// Decodes a message buffer as a [`CodecEvent`].
687    fn decode(
688        mut buf: <fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
689    ) -> Result<CodecEvent, fidl::Error> {
690        let (bytes, _handles) = buf.split_mut();
691        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
692        debug_assert_eq!(tx_header.tx_id, 0);
693        match tx_header.ordinal {
694            _ => Err(fidl::Error::UnknownOrdinal {
695                ordinal: tx_header.ordinal,
696                protocol_name: <CodecMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
697            }),
698        }
699    }
700}
701
702/// A Stream of incoming requests for fuchsia.hardware.audio/Codec.
703pub struct CodecRequestStream {
704    inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
705    is_terminated: bool,
706}
707
708impl std::marker::Unpin for CodecRequestStream {}
709
710impl futures::stream::FusedStream for CodecRequestStream {
711    fn is_terminated(&self) -> bool {
712        self.is_terminated
713    }
714}
715
716impl fdomain_client::fidl::RequestStream for CodecRequestStream {
717    type Protocol = CodecMarker;
718    type ControlHandle = CodecControlHandle;
719
720    fn from_channel(channel: fdomain_client::Channel) -> Self {
721        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
722    }
723
724    fn control_handle(&self) -> Self::ControlHandle {
725        CodecControlHandle { inner: self.inner.clone() }
726    }
727
728    fn into_inner(
729        self,
730    ) -> (::std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>, bool)
731    {
732        (self.inner, self.is_terminated)
733    }
734
735    fn from_inner(
736        inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
737        is_terminated: bool,
738    ) -> Self {
739        Self { inner, is_terminated }
740    }
741}
742
743impl futures::Stream for CodecRequestStream {
744    type Item = Result<CodecRequest, fidl::Error>;
745
746    fn poll_next(
747        mut self: std::pin::Pin<&mut Self>,
748        cx: &mut std::task::Context<'_>,
749    ) -> std::task::Poll<Option<Self::Item>> {
750        let this = &mut *self;
751        if this.inner.check_shutdown(cx) {
752            this.is_terminated = true;
753            return std::task::Poll::Ready(None);
754        }
755        if this.is_terminated {
756            panic!("polled CodecRequestStream after completion");
757        }
758        fidl::encoding::with_tls_decode_buf::<_, fdomain_client::fidl::FDomainResourceDialect>(
759            |bytes, handles| {
760                match this.inner.channel().read_etc(cx, bytes, handles) {
761                    std::task::Poll::Ready(Ok(())) => {}
762                    std::task::Poll::Pending => return std::task::Poll::Pending,
763                    std::task::Poll::Ready(Err(None)) => {
764                        this.is_terminated = true;
765                        return std::task::Poll::Ready(None);
766                    }
767                    std::task::Poll::Ready(Err(Some(e))) => {
768                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
769                            e.into(),
770                        ))));
771                    }
772                }
773
774                // A message has been received from the channel
775                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
776
777                std::task::Poll::Ready(Some(match header.ordinal {
778                    0x4e146d6bca733a84 => {
779                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
780                        let mut req = fidl::new_empty!(
781                            fidl::encoding::EmptyPayload,
782                            fdomain_client::fidl::FDomainResourceDialect
783                        );
784                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
785                        let control_handle = CodecControlHandle { inner: this.inner.clone() };
786                        Ok(CodecRequest::GetHealthState {
787                            responder: CodecGetHealthStateResponder {
788                                control_handle: std::mem::ManuallyDrop::new(control_handle),
789                                tx_id: header.tx_id,
790                            },
791                        })
792                    }
793                    0xa81907ce6066295 => {
794                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
795                        let mut req = fidl::new_empty!(fdomain_fuchsia_hardware_audio_signalprocessing::ConnectorSignalProcessingConnectRequest, fdomain_client::fidl::FDomainResourceDialect);
796                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<fdomain_fuchsia_hardware_audio_signalprocessing::ConnectorSignalProcessingConnectRequest>(&header, _body_bytes, handles, &mut req)?;
797                        let control_handle = CodecControlHandle { inner: this.inner.clone() };
798                        Ok(CodecRequest::SignalProcessingConnect {
799                            protocol: req.protocol,
800
801                            control_handle,
802                        })
803                    }
804                    0x50757ae579a7bd6b => {
805                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
806                        let mut req = fidl::new_empty!(
807                            fidl::encoding::EmptyPayload,
808                            fdomain_client::fidl::FDomainResourceDialect
809                        );
810                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
811                        let control_handle = CodecControlHandle { inner: this.inner.clone() };
812                        Ok(CodecRequest::Reset {
813                            responder: CodecResetResponder {
814                                control_handle: std::mem::ManuallyDrop::new(control_handle),
815                                tx_id: header.tx_id,
816                            },
817                        })
818                    }
819                    0x7a0d138a6a1d9d90 => {
820                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
821                        let mut req = fidl::new_empty!(
822                            fidl::encoding::EmptyPayload,
823                            fdomain_client::fidl::FDomainResourceDialect
824                        );
825                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
826                        let control_handle = CodecControlHandle { inner: this.inner.clone() };
827                        Ok(CodecRequest::GetProperties {
828                            responder: CodecGetPropertiesResponder {
829                                control_handle: std::mem::ManuallyDrop::new(control_handle),
830                                tx_id: header.tx_id,
831                            },
832                        })
833                    }
834                    0x5c2e380df1332dbd => {
835                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
836                        let mut req = fidl::new_empty!(
837                            fidl::encoding::EmptyPayload,
838                            fdomain_client::fidl::FDomainResourceDialect
839                        );
840                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
841                        let control_handle = CodecControlHandle { inner: this.inner.clone() };
842                        Ok(CodecRequest::Stop {
843                            responder: CodecStopResponder {
844                                control_handle: std::mem::ManuallyDrop::new(control_handle),
845                                tx_id: header.tx_id,
846                            },
847                        })
848                    }
849                    0x329cdacb286ab00 => {
850                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
851                        let mut req = fidl::new_empty!(
852                            fidl::encoding::EmptyPayload,
853                            fdomain_client::fidl::FDomainResourceDialect
854                        );
855                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
856                        let control_handle = CodecControlHandle { inner: this.inner.clone() };
857                        Ok(CodecRequest::Start {
858                            responder: CodecStartResponder {
859                                control_handle: std::mem::ManuallyDrop::new(control_handle),
860                                tx_id: header.tx_id,
861                            },
862                        })
863                    }
864                    0xf8bbc46b4ba6a52 => {
865                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
866                        let mut req = fidl::new_empty!(
867                            fidl::encoding::EmptyPayload,
868                            fdomain_client::fidl::FDomainResourceDialect
869                        );
870                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
871                        let control_handle = CodecControlHandle { inner: this.inner.clone() };
872                        Ok(CodecRequest::GetDaiFormats {
873                            responder: CodecGetDaiFormatsResponder {
874                                control_handle: std::mem::ManuallyDrop::new(control_handle),
875                                tx_id: header.tx_id,
876                            },
877                        })
878                    }
879                    0x2f829df9e5a7a1ea => {
880                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
881                        let mut req = fidl::new_empty!(
882                            CodecSetDaiFormatRequest,
883                            fdomain_client::fidl::FDomainResourceDialect
884                        );
885                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<CodecSetDaiFormatRequest>(&header, _body_bytes, handles, &mut req)?;
886                        let control_handle = CodecControlHandle { inner: this.inner.clone() };
887                        Ok(CodecRequest::SetDaiFormat {
888                            format: req.format,
889
890                            responder: CodecSetDaiFormatResponder {
891                                control_handle: std::mem::ManuallyDrop::new(control_handle),
892                                tx_id: header.tx_id,
893                            },
894                        })
895                    }
896                    0x182b87f935ca7326 => {
897                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
898                        let mut req = fidl::new_empty!(
899                            fidl::encoding::EmptyPayload,
900                            fdomain_client::fidl::FDomainResourceDialect
901                        );
902                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
903                        let control_handle = CodecControlHandle { inner: this.inner.clone() };
904                        Ok(CodecRequest::WatchPlugState {
905                            responder: CodecWatchPlugStateResponder {
906                                control_handle: std::mem::ManuallyDrop::new(control_handle),
907                                tx_id: header.tx_id,
908                            },
909                        })
910                    }
911                    _ => Err(fidl::Error::UnknownOrdinal {
912                        ordinal: header.ordinal,
913                        protocol_name:
914                            <CodecMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
915                    }),
916                }))
917            },
918        )
919    }
920}
921
922/// For an overview see
923/// [[Audio Codec Interface]](https://fuchsia.dev/fuchsia-src/development/audio/drivers/codec).
924/// # Deprecation
925///
926/// Not supported anymore, instead use an
927/// [Audio Composite](https://fuchsia.dev/fuchsia-src/development/audio/drivers/composite)
928/// with one DAI and no Ring Buffer, see
929/// [Audio Drivers Architecture](https://fuchsia.dev/fuchsia-src/development/audio/drivers/architecture)
930#[derive(Debug)]
931pub enum CodecRequest {
932    /// Retrieves top level health state.
933    /// A driver not responding promptly can be used as an indication of an unhealthy driver.
934    GetHealthState { responder: CodecGetHealthStateResponder },
935    /// Connect to a `SignalProcessing` protocol.
936    /// Multiple connections may be supported, if a new connection request is not supported, i.e.
937    /// the maximum number of connections have already been created, for instance one, then the
938    /// `protocol` channel (not the channel upon which `SignalProcessingConnect` is being called)
939    /// will be closed with a `ZX_ERR_ALREADY_BOUND` epitaph.
940    /// If signal processing is not supported at all, then the `protocol` channel (again, not the
941    /// channel upon which `SignalProcessingConnect` is being called) will be closed with a
942    /// `ZX_ERR_NOT_SUPPORTED` epitaph.
943    /// This method is named `SignalProcessingConnect` instead of `Connect` because this protocol
944    /// is intended to be composed, and hence the more verbose name allows differentiation and
945    /// improved clarity.
946    SignalProcessingConnect {
947        protocol: fdomain_client::fidl::ServerEnd<
948            fdomain_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
949        >,
950        control_handle: CodecControlHandle,
951    },
952    /// Resets the codec.
953    /// `Reset` returns when the reset is completed. If the driver can't successfully reset the
954    /// codec it will close the codec protocol channel, in this case the client may obtain a new
955    /// codec protocol channel and retry.
956    Reset { responder: CodecResetResponder },
957    /// Retrieves top level static properties.
958    GetProperties { responder: CodecGetPropertiesResponder },
959    /// Stops the codec operation.
960    /// `Stop` returns when configuring the codec to stop is completed. This method does not wait
961    /// for the hardware to actually stop playback/capture (i.e. `turn_off_delay` impact is not
962    /// taken into account), nor is any such delay reflected in the returned `stop_time`.
963    /// `stop_time` indicates when the driver finished configuring the codec to stop, as measured
964    /// in the CLOCK_MONOTONIC timeline.
965    /// If the driver cannot successfully configure the codec to stop, it will close the codec
966    /// protocol channel, in which case the client may obtain a new codec protocol channel and retry.
967    Stop { responder: CodecStopResponder },
968    /// Start/Re-start the codec operation.
969    /// `Start` returns when configuring the codec to start is completed. This method does not wait
970    /// for the hardware to actually start playback/capture (i.e. `turn_on_delay` impact is not taken
971    /// into account), nor is any such delay reflected in the returned `start_time`.
972    /// `start_time` indicates when the driver finished configuring the codec to start, as measured
973    /// in the CLOCK_MONOTONIC timeline.
974    /// If the driver can't successfully start the codec, it will close the codec protocol channel,
975    /// in which case the client may obtain a new codec protocol channel and retry.
976    Start { responder: CodecStartResponder },
977    /// Retrieves the DAI formats supported by the codec, if not available at the time the codec
978    /// may reply with an error status and the controller may retry at a later time.
979    /// Retrieving multiple DaiSupportedFormats allows for cases where exclusive
980    /// combinations of the parameters in DaiSupportedFormats may be supported.
981    GetDaiFormats { responder: CodecGetDaiFormatsResponder },
982    /// Sets the DAI format to be used in the interface between the controller and codec.
983    /// Returns an error if not supported at the time of the request (e.g. for removable hardware).
984    SetDaiFormat { format: DaiFormat, responder: CodecSetDaiFormatResponder },
985    /// Get the plug detect state via a hanging get. The driver will reply to the first
986    /// `WatchPlugState` sent by the client. The driver will not respond to subsequent client
987    /// `WatchPlugState` calls until the plug state changes from what was most recently reported.
988    WatchPlugState { responder: CodecWatchPlugStateResponder },
989}
990
991impl CodecRequest {
992    #[allow(irrefutable_let_patterns)]
993    pub fn into_get_health_state(self) -> Option<(CodecGetHealthStateResponder)> {
994        if let CodecRequest::GetHealthState { responder } = self { Some((responder)) } else { None }
995    }
996
997    #[allow(irrefutable_let_patterns)]
998    pub fn into_signal_processing_connect(
999        self,
1000    ) -> Option<(
1001        fdomain_client::fidl::ServerEnd<
1002            fdomain_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
1003        >,
1004        CodecControlHandle,
1005    )> {
1006        if let CodecRequest::SignalProcessingConnect { protocol, control_handle } = self {
1007            Some((protocol, control_handle))
1008        } else {
1009            None
1010        }
1011    }
1012
1013    #[allow(irrefutable_let_patterns)]
1014    pub fn into_reset(self) -> Option<(CodecResetResponder)> {
1015        if let CodecRequest::Reset { responder } = self { Some((responder)) } else { None }
1016    }
1017
1018    #[allow(irrefutable_let_patterns)]
1019    pub fn into_get_properties(self) -> Option<(CodecGetPropertiesResponder)> {
1020        if let CodecRequest::GetProperties { responder } = self { Some((responder)) } else { None }
1021    }
1022
1023    #[allow(irrefutable_let_patterns)]
1024    pub fn into_stop(self) -> Option<(CodecStopResponder)> {
1025        if let CodecRequest::Stop { responder } = self { Some((responder)) } else { None }
1026    }
1027
1028    #[allow(irrefutable_let_patterns)]
1029    pub fn into_start(self) -> Option<(CodecStartResponder)> {
1030        if let CodecRequest::Start { responder } = self { Some((responder)) } else { None }
1031    }
1032
1033    #[allow(irrefutable_let_patterns)]
1034    pub fn into_get_dai_formats(self) -> Option<(CodecGetDaiFormatsResponder)> {
1035        if let CodecRequest::GetDaiFormats { responder } = self { Some((responder)) } else { None }
1036    }
1037
1038    #[allow(irrefutable_let_patterns)]
1039    pub fn into_set_dai_format(self) -> Option<(DaiFormat, CodecSetDaiFormatResponder)> {
1040        if let CodecRequest::SetDaiFormat { format, responder } = self {
1041            Some((format, responder))
1042        } else {
1043            None
1044        }
1045    }
1046
1047    #[allow(irrefutable_let_patterns)]
1048    pub fn into_watch_plug_state(self) -> Option<(CodecWatchPlugStateResponder)> {
1049        if let CodecRequest::WatchPlugState { responder } = self { Some((responder)) } else { None }
1050    }
1051
1052    /// Name of the method defined in FIDL
1053    pub fn method_name(&self) -> &'static str {
1054        match *self {
1055            CodecRequest::GetHealthState { .. } => "get_health_state",
1056            CodecRequest::SignalProcessingConnect { .. } => "signal_processing_connect",
1057            CodecRequest::Reset { .. } => "reset",
1058            CodecRequest::GetProperties { .. } => "get_properties",
1059            CodecRequest::Stop { .. } => "stop",
1060            CodecRequest::Start { .. } => "start",
1061            CodecRequest::GetDaiFormats { .. } => "get_dai_formats",
1062            CodecRequest::SetDaiFormat { .. } => "set_dai_format",
1063            CodecRequest::WatchPlugState { .. } => "watch_plug_state",
1064        }
1065    }
1066}
1067
1068#[derive(Debug, Clone)]
1069pub struct CodecControlHandle {
1070    inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
1071}
1072
1073impl CodecControlHandle {
1074    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
1075        self.inner.shutdown_with_epitaph(status.into())
1076    }
1077}
1078
1079impl fdomain_client::fidl::ControlHandle for CodecControlHandle {
1080    fn shutdown(&self) {
1081        self.inner.shutdown()
1082    }
1083
1084    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
1085        self.inner.shutdown_with_epitaph(status)
1086    }
1087
1088    fn is_closed(&self) -> bool {
1089        self.inner.channel().is_closed()
1090    }
1091    fn on_closed(&self) -> fdomain_client::OnFDomainSignals {
1092        self.inner.channel().on_closed()
1093    }
1094}
1095
1096impl CodecControlHandle {}
1097
1098#[must_use = "FIDL methods require a response to be sent"]
1099#[derive(Debug)]
1100pub struct CodecGetHealthStateResponder {
1101    control_handle: std::mem::ManuallyDrop<CodecControlHandle>,
1102    tx_id: u32,
1103}
1104
1105/// Set the the channel to be shutdown (see [`CodecControlHandle::shutdown`])
1106/// if the responder is dropped without sending a response, so that the client
1107/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1108impl std::ops::Drop for CodecGetHealthStateResponder {
1109    fn drop(&mut self) {
1110        self.control_handle.shutdown();
1111        // Safety: drops once, never accessed again
1112        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1113    }
1114}
1115
1116impl fdomain_client::fidl::Responder for CodecGetHealthStateResponder {
1117    type ControlHandle = CodecControlHandle;
1118
1119    fn control_handle(&self) -> &CodecControlHandle {
1120        &self.control_handle
1121    }
1122
1123    fn drop_without_shutdown(mut self) {
1124        // Safety: drops once, never accessed again due to mem::forget
1125        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1126        // Prevent Drop from running (which would shut down the channel)
1127        std::mem::forget(self);
1128    }
1129}
1130
1131impl CodecGetHealthStateResponder {
1132    /// Sends a response to the FIDL transaction.
1133    ///
1134    /// Sets the channel to shutdown if an error occurs.
1135    pub fn send(self, mut state: &HealthState) -> Result<(), fidl::Error> {
1136        let _result = self.send_raw(state);
1137        if _result.is_err() {
1138            self.control_handle.shutdown();
1139        }
1140        self.drop_without_shutdown();
1141        _result
1142    }
1143
1144    /// Similar to "send" but does not shutdown the channel if an error occurs.
1145    pub fn send_no_shutdown_on_err(self, mut state: &HealthState) -> Result<(), fidl::Error> {
1146        let _result = self.send_raw(state);
1147        self.drop_without_shutdown();
1148        _result
1149    }
1150
1151    fn send_raw(&self, mut state: &HealthState) -> Result<(), fidl::Error> {
1152        self.control_handle.inner.send::<HealthGetHealthStateResponse>(
1153            (state,),
1154            self.tx_id,
1155            0x4e146d6bca733a84,
1156            fidl::encoding::DynamicFlags::empty(),
1157        )
1158    }
1159}
1160
1161#[must_use = "FIDL methods require a response to be sent"]
1162#[derive(Debug)]
1163pub struct CodecResetResponder {
1164    control_handle: std::mem::ManuallyDrop<CodecControlHandle>,
1165    tx_id: u32,
1166}
1167
1168/// Set the the channel to be shutdown (see [`CodecControlHandle::shutdown`])
1169/// if the responder is dropped without sending a response, so that the client
1170/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1171impl std::ops::Drop for CodecResetResponder {
1172    fn drop(&mut self) {
1173        self.control_handle.shutdown();
1174        // Safety: drops once, never accessed again
1175        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1176    }
1177}
1178
1179impl fdomain_client::fidl::Responder for CodecResetResponder {
1180    type ControlHandle = CodecControlHandle;
1181
1182    fn control_handle(&self) -> &CodecControlHandle {
1183        &self.control_handle
1184    }
1185
1186    fn drop_without_shutdown(mut self) {
1187        // Safety: drops once, never accessed again due to mem::forget
1188        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1189        // Prevent Drop from running (which would shut down the channel)
1190        std::mem::forget(self);
1191    }
1192}
1193
1194impl CodecResetResponder {
1195    /// Sends a response to the FIDL transaction.
1196    ///
1197    /// Sets the channel to shutdown if an error occurs.
1198    pub fn send(self) -> Result<(), fidl::Error> {
1199        let _result = self.send_raw();
1200        if _result.is_err() {
1201            self.control_handle.shutdown();
1202        }
1203        self.drop_without_shutdown();
1204        _result
1205    }
1206
1207    /// Similar to "send" but does not shutdown the channel if an error occurs.
1208    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
1209        let _result = self.send_raw();
1210        self.drop_without_shutdown();
1211        _result
1212    }
1213
1214    fn send_raw(&self) -> Result<(), fidl::Error> {
1215        self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
1216            (),
1217            self.tx_id,
1218            0x50757ae579a7bd6b,
1219            fidl::encoding::DynamicFlags::empty(),
1220        )
1221    }
1222}
1223
1224#[must_use = "FIDL methods require a response to be sent"]
1225#[derive(Debug)]
1226pub struct CodecGetPropertiesResponder {
1227    control_handle: std::mem::ManuallyDrop<CodecControlHandle>,
1228    tx_id: u32,
1229}
1230
1231/// Set the the channel to be shutdown (see [`CodecControlHandle::shutdown`])
1232/// if the responder is dropped without sending a response, so that the client
1233/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1234impl std::ops::Drop for CodecGetPropertiesResponder {
1235    fn drop(&mut self) {
1236        self.control_handle.shutdown();
1237        // Safety: drops once, never accessed again
1238        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1239    }
1240}
1241
1242impl fdomain_client::fidl::Responder for CodecGetPropertiesResponder {
1243    type ControlHandle = CodecControlHandle;
1244
1245    fn control_handle(&self) -> &CodecControlHandle {
1246        &self.control_handle
1247    }
1248
1249    fn drop_without_shutdown(mut self) {
1250        // Safety: drops once, never accessed again due to mem::forget
1251        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1252        // Prevent Drop from running (which would shut down the channel)
1253        std::mem::forget(self);
1254    }
1255}
1256
1257impl CodecGetPropertiesResponder {
1258    /// Sends a response to the FIDL transaction.
1259    ///
1260    /// Sets the channel to shutdown if an error occurs.
1261    pub fn send(self, mut properties: &CodecProperties) -> Result<(), fidl::Error> {
1262        let _result = self.send_raw(properties);
1263        if _result.is_err() {
1264            self.control_handle.shutdown();
1265        }
1266        self.drop_without_shutdown();
1267        _result
1268    }
1269
1270    /// Similar to "send" but does not shutdown the channel if an error occurs.
1271    pub fn send_no_shutdown_on_err(
1272        self,
1273        mut properties: &CodecProperties,
1274    ) -> Result<(), fidl::Error> {
1275        let _result = self.send_raw(properties);
1276        self.drop_without_shutdown();
1277        _result
1278    }
1279
1280    fn send_raw(&self, mut properties: &CodecProperties) -> Result<(), fidl::Error> {
1281        self.control_handle.inner.send::<CodecGetPropertiesResponse>(
1282            (properties,),
1283            self.tx_id,
1284            0x7a0d138a6a1d9d90,
1285            fidl::encoding::DynamicFlags::empty(),
1286        )
1287    }
1288}
1289
1290#[must_use = "FIDL methods require a response to be sent"]
1291#[derive(Debug)]
1292pub struct CodecStopResponder {
1293    control_handle: std::mem::ManuallyDrop<CodecControlHandle>,
1294    tx_id: u32,
1295}
1296
1297/// Set the the channel to be shutdown (see [`CodecControlHandle::shutdown`])
1298/// if the responder is dropped without sending a response, so that the client
1299/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1300impl std::ops::Drop for CodecStopResponder {
1301    fn drop(&mut self) {
1302        self.control_handle.shutdown();
1303        // Safety: drops once, never accessed again
1304        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1305    }
1306}
1307
1308impl fdomain_client::fidl::Responder for CodecStopResponder {
1309    type ControlHandle = CodecControlHandle;
1310
1311    fn control_handle(&self) -> &CodecControlHandle {
1312        &self.control_handle
1313    }
1314
1315    fn drop_without_shutdown(mut self) {
1316        // Safety: drops once, never accessed again due to mem::forget
1317        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1318        // Prevent Drop from running (which would shut down the channel)
1319        std::mem::forget(self);
1320    }
1321}
1322
1323impl CodecStopResponder {
1324    /// Sends a response to the FIDL transaction.
1325    ///
1326    /// Sets the channel to shutdown if an error occurs.
1327    pub fn send(self, mut stop_time: i64) -> Result<(), fidl::Error> {
1328        let _result = self.send_raw(stop_time);
1329        if _result.is_err() {
1330            self.control_handle.shutdown();
1331        }
1332        self.drop_without_shutdown();
1333        _result
1334    }
1335
1336    /// Similar to "send" but does not shutdown the channel if an error occurs.
1337    pub fn send_no_shutdown_on_err(self, mut stop_time: i64) -> Result<(), fidl::Error> {
1338        let _result = self.send_raw(stop_time);
1339        self.drop_without_shutdown();
1340        _result
1341    }
1342
1343    fn send_raw(&self, mut stop_time: i64) -> Result<(), fidl::Error> {
1344        self.control_handle.inner.send::<CodecStopResponse>(
1345            (stop_time,),
1346            self.tx_id,
1347            0x5c2e380df1332dbd,
1348            fidl::encoding::DynamicFlags::empty(),
1349        )
1350    }
1351}
1352
1353#[must_use = "FIDL methods require a response to be sent"]
1354#[derive(Debug)]
1355pub struct CodecStartResponder {
1356    control_handle: std::mem::ManuallyDrop<CodecControlHandle>,
1357    tx_id: u32,
1358}
1359
1360/// Set the the channel to be shutdown (see [`CodecControlHandle::shutdown`])
1361/// if the responder is dropped without sending a response, so that the client
1362/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1363impl std::ops::Drop for CodecStartResponder {
1364    fn drop(&mut self) {
1365        self.control_handle.shutdown();
1366        // Safety: drops once, never accessed again
1367        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1368    }
1369}
1370
1371impl fdomain_client::fidl::Responder for CodecStartResponder {
1372    type ControlHandle = CodecControlHandle;
1373
1374    fn control_handle(&self) -> &CodecControlHandle {
1375        &self.control_handle
1376    }
1377
1378    fn drop_without_shutdown(mut self) {
1379        // Safety: drops once, never accessed again due to mem::forget
1380        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1381        // Prevent Drop from running (which would shut down the channel)
1382        std::mem::forget(self);
1383    }
1384}
1385
1386impl CodecStartResponder {
1387    /// Sends a response to the FIDL transaction.
1388    ///
1389    /// Sets the channel to shutdown if an error occurs.
1390    pub fn send(self, mut start_time: i64) -> Result<(), fidl::Error> {
1391        let _result = self.send_raw(start_time);
1392        if _result.is_err() {
1393            self.control_handle.shutdown();
1394        }
1395        self.drop_without_shutdown();
1396        _result
1397    }
1398
1399    /// Similar to "send" but does not shutdown the channel if an error occurs.
1400    pub fn send_no_shutdown_on_err(self, mut start_time: i64) -> Result<(), fidl::Error> {
1401        let _result = self.send_raw(start_time);
1402        self.drop_without_shutdown();
1403        _result
1404    }
1405
1406    fn send_raw(&self, mut start_time: i64) -> Result<(), fidl::Error> {
1407        self.control_handle.inner.send::<CodecStartResponse>(
1408            (start_time,),
1409            self.tx_id,
1410            0x329cdacb286ab00,
1411            fidl::encoding::DynamicFlags::empty(),
1412        )
1413    }
1414}
1415
1416#[must_use = "FIDL methods require a response to be sent"]
1417#[derive(Debug)]
1418pub struct CodecGetDaiFormatsResponder {
1419    control_handle: std::mem::ManuallyDrop<CodecControlHandle>,
1420    tx_id: u32,
1421}
1422
1423/// Set the the channel to be shutdown (see [`CodecControlHandle::shutdown`])
1424/// if the responder is dropped without sending a response, so that the client
1425/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1426impl std::ops::Drop for CodecGetDaiFormatsResponder {
1427    fn drop(&mut self) {
1428        self.control_handle.shutdown();
1429        // Safety: drops once, never accessed again
1430        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1431    }
1432}
1433
1434impl fdomain_client::fidl::Responder for CodecGetDaiFormatsResponder {
1435    type ControlHandle = CodecControlHandle;
1436
1437    fn control_handle(&self) -> &CodecControlHandle {
1438        &self.control_handle
1439    }
1440
1441    fn drop_without_shutdown(mut self) {
1442        // Safety: drops once, never accessed again due to mem::forget
1443        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1444        // Prevent Drop from running (which would shut down the channel)
1445        std::mem::forget(self);
1446    }
1447}
1448
1449impl CodecGetDaiFormatsResponder {
1450    /// Sends a response to the FIDL transaction.
1451    ///
1452    /// Sets the channel to shutdown if an error occurs.
1453    pub fn send(self, mut result: Result<&[DaiSupportedFormats], i32>) -> Result<(), fidl::Error> {
1454        let _result = self.send_raw(result);
1455        if _result.is_err() {
1456            self.control_handle.shutdown();
1457        }
1458        self.drop_without_shutdown();
1459        _result
1460    }
1461
1462    /// Similar to "send" but does not shutdown the channel if an error occurs.
1463    pub fn send_no_shutdown_on_err(
1464        self,
1465        mut result: Result<&[DaiSupportedFormats], i32>,
1466    ) -> Result<(), fidl::Error> {
1467        let _result = self.send_raw(result);
1468        self.drop_without_shutdown();
1469        _result
1470    }
1471
1472    fn send_raw(&self, mut result: Result<&[DaiSupportedFormats], i32>) -> Result<(), fidl::Error> {
1473        self.control_handle
1474            .inner
1475            .send::<fidl::encoding::ResultType<CodecGetDaiFormatsResponse, i32>>(
1476                result.map(|formats| (formats,)),
1477                self.tx_id,
1478                0xf8bbc46b4ba6a52,
1479                fidl::encoding::DynamicFlags::empty(),
1480            )
1481    }
1482}
1483
1484#[must_use = "FIDL methods require a response to be sent"]
1485#[derive(Debug)]
1486pub struct CodecSetDaiFormatResponder {
1487    control_handle: std::mem::ManuallyDrop<CodecControlHandle>,
1488    tx_id: u32,
1489}
1490
1491/// Set the the channel to be shutdown (see [`CodecControlHandle::shutdown`])
1492/// if the responder is dropped without sending a response, so that the client
1493/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1494impl std::ops::Drop for CodecSetDaiFormatResponder {
1495    fn drop(&mut self) {
1496        self.control_handle.shutdown();
1497        // Safety: drops once, never accessed again
1498        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1499    }
1500}
1501
1502impl fdomain_client::fidl::Responder for CodecSetDaiFormatResponder {
1503    type ControlHandle = CodecControlHandle;
1504
1505    fn control_handle(&self) -> &CodecControlHandle {
1506        &self.control_handle
1507    }
1508
1509    fn drop_without_shutdown(mut self) {
1510        // Safety: drops once, never accessed again due to mem::forget
1511        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1512        // Prevent Drop from running (which would shut down the channel)
1513        std::mem::forget(self);
1514    }
1515}
1516
1517impl CodecSetDaiFormatResponder {
1518    /// Sends a response to the FIDL transaction.
1519    ///
1520    /// Sets the channel to shutdown if an error occurs.
1521    pub fn send(self, mut result: Result<&CodecFormatInfo, i32>) -> Result<(), fidl::Error> {
1522        let _result = self.send_raw(result);
1523        if _result.is_err() {
1524            self.control_handle.shutdown();
1525        }
1526        self.drop_without_shutdown();
1527        _result
1528    }
1529
1530    /// Similar to "send" but does not shutdown the channel if an error occurs.
1531    pub fn send_no_shutdown_on_err(
1532        self,
1533        mut result: Result<&CodecFormatInfo, i32>,
1534    ) -> Result<(), fidl::Error> {
1535        let _result = self.send_raw(result);
1536        self.drop_without_shutdown();
1537        _result
1538    }
1539
1540    fn send_raw(&self, mut result: Result<&CodecFormatInfo, i32>) -> Result<(), fidl::Error> {
1541        self.control_handle
1542            .inner
1543            .send::<fidl::encoding::ResultType<CodecSetDaiFormatResponse, i32>>(
1544                result.map(|state| (state,)),
1545                self.tx_id,
1546                0x2f829df9e5a7a1ea,
1547                fidl::encoding::DynamicFlags::empty(),
1548            )
1549    }
1550}
1551
1552#[must_use = "FIDL methods require a response to be sent"]
1553#[derive(Debug)]
1554pub struct CodecWatchPlugStateResponder {
1555    control_handle: std::mem::ManuallyDrop<CodecControlHandle>,
1556    tx_id: u32,
1557}
1558
1559/// Set the the channel to be shutdown (see [`CodecControlHandle::shutdown`])
1560/// if the responder is dropped without sending a response, so that the client
1561/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1562impl std::ops::Drop for CodecWatchPlugStateResponder {
1563    fn drop(&mut self) {
1564        self.control_handle.shutdown();
1565        // Safety: drops once, never accessed again
1566        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1567    }
1568}
1569
1570impl fdomain_client::fidl::Responder for CodecWatchPlugStateResponder {
1571    type ControlHandle = CodecControlHandle;
1572
1573    fn control_handle(&self) -> &CodecControlHandle {
1574        &self.control_handle
1575    }
1576
1577    fn drop_without_shutdown(mut self) {
1578        // Safety: drops once, never accessed again due to mem::forget
1579        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1580        // Prevent Drop from running (which would shut down the channel)
1581        std::mem::forget(self);
1582    }
1583}
1584
1585impl CodecWatchPlugStateResponder {
1586    /// Sends a response to the FIDL transaction.
1587    ///
1588    /// Sets the channel to shutdown if an error occurs.
1589    pub fn send(self, mut plug_state: &PlugState) -> Result<(), fidl::Error> {
1590        let _result = self.send_raw(plug_state);
1591        if _result.is_err() {
1592            self.control_handle.shutdown();
1593        }
1594        self.drop_without_shutdown();
1595        _result
1596    }
1597
1598    /// Similar to "send" but does not shutdown the channel if an error occurs.
1599    pub fn send_no_shutdown_on_err(self, mut plug_state: &PlugState) -> Result<(), fidl::Error> {
1600        let _result = self.send_raw(plug_state);
1601        self.drop_without_shutdown();
1602        _result
1603    }
1604
1605    fn send_raw(&self, mut plug_state: &PlugState) -> Result<(), fidl::Error> {
1606        self.control_handle.inner.send::<CodecWatchPlugStateResponse>(
1607            (plug_state,),
1608            self.tx_id,
1609            0x182b87f935ca7326,
1610            fidl::encoding::DynamicFlags::empty(),
1611        )
1612    }
1613}
1614
1615#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1616pub struct CodecConnectorMarker;
1617
1618impl fdomain_client::fidl::ProtocolMarker for CodecConnectorMarker {
1619    type Proxy = CodecConnectorProxy;
1620    type RequestStream = CodecConnectorRequestStream;
1621
1622    const DEBUG_NAME: &'static str = "(anonymous) CodecConnector";
1623}
1624
1625pub trait CodecConnectorProxyInterface: Send + Sync {
1626    fn r#connect(
1627        &self,
1628        codec_protocol: fdomain_client::fidl::ServerEnd<CodecMarker>,
1629    ) -> Result<(), fidl::Error>;
1630}
1631
1632#[derive(Debug, Clone)]
1633pub struct CodecConnectorProxy {
1634    client: fidl::client::Client<fdomain_client::fidl::FDomainResourceDialect>,
1635}
1636
1637impl fdomain_client::fidl::Proxy for CodecConnectorProxy {
1638    type Protocol = CodecConnectorMarker;
1639
1640    fn from_channel(inner: fdomain_client::Channel) -> Self {
1641        Self::new(inner)
1642    }
1643
1644    fn into_channel(self) -> Result<fdomain_client::Channel, Self> {
1645        self.client.into_channel().map_err(|client| Self { client })
1646    }
1647
1648    fn as_channel(&self) -> &fdomain_client::Channel {
1649        self.client.as_channel()
1650    }
1651}
1652
1653impl CodecConnectorProxy {
1654    /// Create a new Proxy for fuchsia.hardware.audio/CodecConnector.
1655    pub fn new(channel: fdomain_client::Channel) -> Self {
1656        let protocol_name =
1657            <CodecConnectorMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME;
1658        Self { client: fidl::client::Client::new(channel, protocol_name) }
1659    }
1660
1661    /// Get a Stream of events from the remote end of the protocol.
1662    ///
1663    /// # Panics
1664    ///
1665    /// Panics if the event stream was already taken.
1666    pub fn take_event_stream(&self) -> CodecConnectorEventStream {
1667        CodecConnectorEventStream { event_receiver: self.client.take_event_receiver() }
1668    }
1669
1670    /// Connect to a Codec protocol server.
1671    /// This indirection into the Codec protocol allows us to support independent codec client
1672    /// connections.
1673    pub fn r#connect(
1674        &self,
1675        mut codec_protocol: fdomain_client::fidl::ServerEnd<CodecMarker>,
1676    ) -> Result<(), fidl::Error> {
1677        CodecConnectorProxyInterface::r#connect(self, codec_protocol)
1678    }
1679}
1680
1681impl CodecConnectorProxyInterface for CodecConnectorProxy {
1682    fn r#connect(
1683        &self,
1684        mut codec_protocol: fdomain_client::fidl::ServerEnd<CodecMarker>,
1685    ) -> Result<(), fidl::Error> {
1686        self.client.send::<CodecConnectorConnectRequest>(
1687            (codec_protocol,),
1688            0x1413f551544026c9,
1689            fidl::encoding::DynamicFlags::empty(),
1690        )
1691    }
1692}
1693
1694pub struct CodecConnectorEventStream {
1695    event_receiver: fidl::client::EventReceiver<fdomain_client::fidl::FDomainResourceDialect>,
1696}
1697
1698impl std::marker::Unpin for CodecConnectorEventStream {}
1699
1700impl futures::stream::FusedStream for CodecConnectorEventStream {
1701    fn is_terminated(&self) -> bool {
1702        self.event_receiver.is_terminated()
1703    }
1704}
1705
1706impl futures::Stream for CodecConnectorEventStream {
1707    type Item = Result<CodecConnectorEvent, fidl::Error>;
1708
1709    fn poll_next(
1710        mut self: std::pin::Pin<&mut Self>,
1711        cx: &mut std::task::Context<'_>,
1712    ) -> std::task::Poll<Option<Self::Item>> {
1713        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1714            &mut self.event_receiver,
1715            cx
1716        )?) {
1717            Some(buf) => std::task::Poll::Ready(Some(CodecConnectorEvent::decode(buf))),
1718            None => std::task::Poll::Ready(None),
1719        }
1720    }
1721}
1722
1723#[derive(Debug)]
1724pub enum CodecConnectorEvent {}
1725
1726impl CodecConnectorEvent {
1727    /// Decodes a message buffer as a [`CodecConnectorEvent`].
1728    fn decode(
1729        mut buf: <fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1730    ) -> Result<CodecConnectorEvent, fidl::Error> {
1731        let (bytes, _handles) = buf.split_mut();
1732        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1733        debug_assert_eq!(tx_header.tx_id, 0);
1734        match tx_header.ordinal {
1735            _ => Err(fidl::Error::UnknownOrdinal {
1736                ordinal: tx_header.ordinal,
1737                protocol_name:
1738                    <CodecConnectorMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
1739            }),
1740        }
1741    }
1742}
1743
1744/// A Stream of incoming requests for fuchsia.hardware.audio/CodecConnector.
1745pub struct CodecConnectorRequestStream {
1746    inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
1747    is_terminated: bool,
1748}
1749
1750impl std::marker::Unpin for CodecConnectorRequestStream {}
1751
1752impl futures::stream::FusedStream for CodecConnectorRequestStream {
1753    fn is_terminated(&self) -> bool {
1754        self.is_terminated
1755    }
1756}
1757
1758impl fdomain_client::fidl::RequestStream for CodecConnectorRequestStream {
1759    type Protocol = CodecConnectorMarker;
1760    type ControlHandle = CodecConnectorControlHandle;
1761
1762    fn from_channel(channel: fdomain_client::Channel) -> Self {
1763        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1764    }
1765
1766    fn control_handle(&self) -> Self::ControlHandle {
1767        CodecConnectorControlHandle { inner: self.inner.clone() }
1768    }
1769
1770    fn into_inner(
1771        self,
1772    ) -> (::std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>, bool)
1773    {
1774        (self.inner, self.is_terminated)
1775    }
1776
1777    fn from_inner(
1778        inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
1779        is_terminated: bool,
1780    ) -> Self {
1781        Self { inner, is_terminated }
1782    }
1783}
1784
1785impl futures::Stream for CodecConnectorRequestStream {
1786    type Item = Result<CodecConnectorRequest, fidl::Error>;
1787
1788    fn poll_next(
1789        mut self: std::pin::Pin<&mut Self>,
1790        cx: &mut std::task::Context<'_>,
1791    ) -> std::task::Poll<Option<Self::Item>> {
1792        let this = &mut *self;
1793        if this.inner.check_shutdown(cx) {
1794            this.is_terminated = true;
1795            return std::task::Poll::Ready(None);
1796        }
1797        if this.is_terminated {
1798            panic!("polled CodecConnectorRequestStream after completion");
1799        }
1800        fidl::encoding::with_tls_decode_buf::<_, fdomain_client::fidl::FDomainResourceDialect>(
1801            |bytes, handles| {
1802                match this.inner.channel().read_etc(cx, bytes, handles) {
1803                    std::task::Poll::Ready(Ok(())) => {}
1804                    std::task::Poll::Pending => return std::task::Poll::Pending,
1805                    std::task::Poll::Ready(Err(None)) => {
1806                        this.is_terminated = true;
1807                        return std::task::Poll::Ready(None);
1808                    }
1809                    std::task::Poll::Ready(Err(Some(e))) => {
1810                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1811                            e.into(),
1812                        ))));
1813                    }
1814                }
1815
1816                // A message has been received from the channel
1817                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1818
1819                std::task::Poll::Ready(Some(match header.ordinal {
1820                0x1413f551544026c9 => {
1821                    header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1822                    let mut req = fidl::new_empty!(CodecConnectorConnectRequest, fdomain_client::fidl::FDomainResourceDialect);
1823                    fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<CodecConnectorConnectRequest>(&header, _body_bytes, handles, &mut req)?;
1824                    let control_handle = CodecConnectorControlHandle {
1825                        inner: this.inner.clone(),
1826                    };
1827                    Ok(CodecConnectorRequest::Connect {codec_protocol: req.codec_protocol,
1828
1829                        control_handle,
1830                    })
1831                }
1832                _ => Err(fidl::Error::UnknownOrdinal {
1833                    ordinal: header.ordinal,
1834                    protocol_name: <CodecConnectorMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
1835                }),
1836            }))
1837            },
1838        )
1839    }
1840}
1841
1842/// For an overview of the Codec protocols see
1843/// [Codec Interface](//docs/concepts/drivers/driver_architectures/audio_drivers/audio_codec.md)
1844/// # Deprecation
1845///
1846/// Not supported anymore, instead use an
1847/// [Audio Composite](https://fuchsia.dev/fuchsia-src/development/audio/drivers/composite)
1848/// with one DAI and no Ring Buffer, see
1849/// [Audio Drivers Architecture](https://fuchsia.dev/fuchsia-src/development/audio/drivers/architecture)
1850#[derive(Debug)]
1851pub enum CodecConnectorRequest {
1852    /// Connect to a Codec protocol server.
1853    /// This indirection into the Codec protocol allows us to support independent codec client
1854    /// connections.
1855    Connect {
1856        codec_protocol: fdomain_client::fidl::ServerEnd<CodecMarker>,
1857        control_handle: CodecConnectorControlHandle,
1858    },
1859}
1860
1861impl CodecConnectorRequest {
1862    #[allow(irrefutable_let_patterns)]
1863    pub fn into_connect(
1864        self,
1865    ) -> Option<(fdomain_client::fidl::ServerEnd<CodecMarker>, CodecConnectorControlHandle)> {
1866        if let CodecConnectorRequest::Connect { codec_protocol, control_handle } = self {
1867            Some((codec_protocol, control_handle))
1868        } else {
1869            None
1870        }
1871    }
1872
1873    /// Name of the method defined in FIDL
1874    pub fn method_name(&self) -> &'static str {
1875        match *self {
1876            CodecConnectorRequest::Connect { .. } => "connect",
1877        }
1878    }
1879}
1880
1881#[derive(Debug, Clone)]
1882pub struct CodecConnectorControlHandle {
1883    inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
1884}
1885
1886impl CodecConnectorControlHandle {
1887    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
1888        self.inner.shutdown_with_epitaph(status.into())
1889    }
1890}
1891
1892impl fdomain_client::fidl::ControlHandle for CodecConnectorControlHandle {
1893    fn shutdown(&self) {
1894        self.inner.shutdown()
1895    }
1896
1897    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
1898        self.inner.shutdown_with_epitaph(status)
1899    }
1900
1901    fn is_closed(&self) -> bool {
1902        self.inner.channel().is_closed()
1903    }
1904    fn on_closed(&self) -> fdomain_client::OnFDomainSignals {
1905        self.inner.channel().on_closed()
1906    }
1907}
1908
1909impl CodecConnectorControlHandle {}
1910
1911#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1912pub struct CompositeMarker;
1913
1914impl fdomain_client::fidl::ProtocolMarker for CompositeMarker {
1915    type Proxy = CompositeProxy;
1916    type RequestStream = CompositeRequestStream;
1917
1918    const DEBUG_NAME: &'static str = "(anonymous) Composite";
1919}
1920pub type CompositeResetResult = Result<(), DriverError>;
1921pub type CompositeGetRingBufferFormatsResult = Result<Vec<SupportedFormats2>, DriverError>;
1922pub type CompositeCreateRingBufferResult = Result<(), DriverError>;
1923pub type CompositeGetDaiFormatsResult = Result<Vec<DaiSupportedFormats>, DriverError>;
1924pub type CompositeSetDaiFormatResult = Result<(), DriverError>;
1925pub type CompositeGetPacketStreamFormatsResult = Result<Vec<SupportedFormats2>, DriverError>;
1926pub type CompositeCreatePacketStreamResult = Result<(), DriverError>;
1927
1928pub trait CompositeProxyInterface: Send + Sync {
1929    type GetHealthStateResponseFut: std::future::Future<Output = Result<HealthState, fidl::Error>>
1930        + Send;
1931    fn r#get_health_state(&self) -> Self::GetHealthStateResponseFut;
1932    fn r#signal_processing_connect(
1933        &self,
1934        protocol: fdomain_client::fidl::ServerEnd<
1935            fdomain_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
1936        >,
1937    ) -> Result<(), fidl::Error>;
1938    type ResetResponseFut: std::future::Future<Output = Result<CompositeResetResult, fidl::Error>>
1939        + Send;
1940    fn r#reset(&self) -> Self::ResetResponseFut;
1941    type GetPropertiesResponseFut: std::future::Future<Output = Result<CompositeProperties, fidl::Error>>
1942        + Send;
1943    fn r#get_properties(&self) -> Self::GetPropertiesResponseFut;
1944    type GetRingBufferFormatsResponseFut: std::future::Future<Output = Result<CompositeGetRingBufferFormatsResult, fidl::Error>>
1945        + Send;
1946    fn r#get_ring_buffer_formats(
1947        &self,
1948        processing_element_id: u64,
1949    ) -> Self::GetRingBufferFormatsResponseFut;
1950    type CreateRingBufferResponseFut: std::future::Future<Output = Result<CompositeCreateRingBufferResult, fidl::Error>>
1951        + Send;
1952    fn r#create_ring_buffer(
1953        &self,
1954        processing_element_id: u64,
1955        format: &Format2,
1956        ring_buffer: fdomain_client::fidl::ServerEnd<RingBufferMarker>,
1957    ) -> Self::CreateRingBufferResponseFut;
1958    type GetDaiFormatsResponseFut: std::future::Future<Output = Result<CompositeGetDaiFormatsResult, fidl::Error>>
1959        + Send;
1960    fn r#get_dai_formats(&self, processing_element_id: u64) -> Self::GetDaiFormatsResponseFut;
1961    type SetDaiFormatResponseFut: std::future::Future<Output = Result<CompositeSetDaiFormatResult, fidl::Error>>
1962        + Send;
1963    fn r#set_dai_format(
1964        &self,
1965        processing_element_id: u64,
1966        format: &DaiFormat,
1967    ) -> Self::SetDaiFormatResponseFut;
1968    type GetPacketStreamFormatsResponseFut: std::future::Future<Output = Result<CompositeGetPacketStreamFormatsResult, fidl::Error>>
1969        + Send;
1970    fn r#get_packet_stream_formats(
1971        &self,
1972        processing_element_id: u64,
1973    ) -> Self::GetPacketStreamFormatsResponseFut;
1974    type CreatePacketStreamResponseFut: std::future::Future<Output = Result<CompositeCreatePacketStreamResult, fidl::Error>>
1975        + Send;
1976    fn r#create_packet_stream(
1977        &self,
1978        processing_element_id: u64,
1979        format: &Format2,
1980        packet_stream_control: fdomain_client::fidl::ServerEnd<PacketStreamControlMarker>,
1981    ) -> Self::CreatePacketStreamResponseFut;
1982}
1983
1984#[derive(Debug, Clone)]
1985pub struct CompositeProxy {
1986    client: fidl::client::Client<fdomain_client::fidl::FDomainResourceDialect>,
1987}
1988
1989impl fdomain_client::fidl::Proxy for CompositeProxy {
1990    type Protocol = CompositeMarker;
1991
1992    fn from_channel(inner: fdomain_client::Channel) -> Self {
1993        Self::new(inner)
1994    }
1995
1996    fn into_channel(self) -> Result<fdomain_client::Channel, Self> {
1997        self.client.into_channel().map_err(|client| Self { client })
1998    }
1999
2000    fn as_channel(&self) -> &fdomain_client::Channel {
2001        self.client.as_channel()
2002    }
2003}
2004
2005impl CompositeProxy {
2006    /// Create a new Proxy for fuchsia.hardware.audio/Composite.
2007    pub fn new(channel: fdomain_client::Channel) -> Self {
2008        let protocol_name = <CompositeMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME;
2009        Self { client: fidl::client::Client::new(channel, protocol_name) }
2010    }
2011
2012    /// Get a Stream of events from the remote end of the protocol.
2013    ///
2014    /// # Panics
2015    ///
2016    /// Panics if the event stream was already taken.
2017    pub fn take_event_stream(&self) -> CompositeEventStream {
2018        CompositeEventStream { event_receiver: self.client.take_event_receiver() }
2019    }
2020
2021    /// Retrieves top level health state.
2022    /// A driver not responding promptly can be used as an indication of an unhealthy driver.
2023    pub fn r#get_health_state(
2024        &self,
2025    ) -> fidl::client::QueryResponseFut<HealthState, fdomain_client::fidl::FDomainResourceDialect>
2026    {
2027        CompositeProxyInterface::r#get_health_state(self)
2028    }
2029
2030    /// Connect to a `SignalProcessing` protocol.
2031    /// Multiple connections may be supported, if a new connection request is not supported, i.e.
2032    /// the maximum number of connections have already been created, for instance one, then the
2033    /// `protocol` channel (not the channel upon which `SignalProcessingConnect` is being called)
2034    /// will be closed with a `ZX_ERR_ALREADY_BOUND` epitaph.
2035    /// If signal processing is not supported at all, then the `protocol` channel (again, not the
2036    /// channel upon which `SignalProcessingConnect` is being called) will be closed with a
2037    /// `ZX_ERR_NOT_SUPPORTED` epitaph.
2038    /// This method is named `SignalProcessingConnect` instead of `Connect` because this protocol
2039    /// is intended to be composed, and hence the more verbose name allows differentiation and
2040    /// improved clarity.
2041    pub fn r#signal_processing_connect(
2042        &self,
2043        mut protocol: fdomain_client::fidl::ServerEnd<
2044            fdomain_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
2045        >,
2046    ) -> Result<(), fidl::Error> {
2047        CompositeProxyInterface::r#signal_processing_connect(self, protocol)
2048    }
2049
2050    /// Resets the hardware including all DAI interconnects and signal processing.
2051    /// As a result, all channels obtained by `CreateRingBuffer` will be closed.
2052    ///
2053    /// `Reset` returns when the hardware is fully reset. At this point, a client would need to
2054    /// reconfigure any DAI interconnects, select a signal processing topology and reconfigure
2055    /// any processing elements, and reconstruct any ring buffers.
2056    ///
2057    /// If the driver can't successfully reset the hardware, it will return an error and then close
2058    /// the protocol channel, in this case the client may obtain a new protocol channel and retry.
2059    pub fn r#reset(
2060        &self,
2061    ) -> fidl::client::QueryResponseFut<
2062        CompositeResetResult,
2063        fdomain_client::fidl::FDomainResourceDialect,
2064    > {
2065        CompositeProxyInterface::r#reset(self)
2066    }
2067
2068    /// Retrieves top level static properties.
2069    pub fn r#get_properties(
2070        &self,
2071    ) -> fidl::client::QueryResponseFut<
2072        CompositeProperties,
2073        fdomain_client::fidl::FDomainResourceDialect,
2074    > {
2075        CompositeProxyInterface::r#get_properties(self)
2076    }
2077
2078    /// Retrieves the ring buffer formats supported by a `RING_BUFFER` processing element
2079    /// in the topology supported by this driver as returned by `GetElements` from
2080    /// fuchsia.hardware.audio.signalprocessing.
2081    /// Returns `SHOULD_WAIT` if the ring buffer formats are not available at the time, the
2082    /// client may retry at a later time.
2083    /// Returns `INVALID_ARGS` if the `processing_element_id` does not match an id returned
2084    /// by `GetElements`.
2085    /// Returns `WRONG_TYPE` if the `ElementType` of the element represented by the id is not
2086    /// `RING_BUFFER`.
2087    /// Retrieving multiple `SupportedFormats2` allows for cases where exclusive combinations of
2088    /// the parameters in `SupportedFormats2` may be supported.
2089    /// The vector returned to the caller must contain at least one entry.
2090    pub fn r#get_ring_buffer_formats(
2091        &self,
2092        mut processing_element_id: u64,
2093    ) -> fidl::client::QueryResponseFut<
2094        CompositeGetRingBufferFormatsResult,
2095        fdomain_client::fidl::FDomainResourceDialect,
2096    > {
2097        CompositeProxyInterface::r#get_ring_buffer_formats(self, processing_element_id)
2098    }
2099
2100    /// `CreateRingBuffer` is sent by clients to select a ring buffer format for the `RING_BUFFER`
2101    /// processing element specified by `processing_element_id`. The format is based on information
2102    /// that the driver provides in `GetRingBufferFormats`, what is supported by the client, and
2103    /// any other requirement. The returned `ring_buffer` channel is used to access and control the
2104    /// audio buffer provided by the driver.
2105    /// Returns `INVALID_ARGS` if the `processing_element_id` does not match an id returned
2106    /// by `GetElements`.
2107    /// Returns `WRONG_TYPE` if the `ElementType` of the element represented by the id is not
2108    /// `RING_BUFFER`.
2109    /// Returns `NOT_SUPPORTED` if the driver does not support ring buffers, or if the specified
2110    /// `format` is not supported.
2111    pub fn r#create_ring_buffer(
2112        &self,
2113        mut processing_element_id: u64,
2114        mut format: &Format2,
2115        mut ring_buffer: fdomain_client::fidl::ServerEnd<RingBufferMarker>,
2116    ) -> fidl::client::QueryResponseFut<
2117        CompositeCreateRingBufferResult,
2118        fdomain_client::fidl::FDomainResourceDialect,
2119    > {
2120        CompositeProxyInterface::r#create_ring_buffer(
2121            self,
2122            processing_element_id,
2123            format,
2124            ring_buffer,
2125        )
2126    }
2127
2128    /// Retrieves the DAI formats supported by a `DAI_INTERCONNECT` processing element
2129    /// in the topology supported by this driver as returned by `GetElements` from
2130    /// fuchsia.hardware.audio.signalprocessing.
2131    /// Returns `SHOULD_WAIT` if the DAI formats are not available at the time, the client
2132    /// may retry at a later time.
2133    /// Returns `INVALID_ARGS` if the `processing_element_id` does not match an id returned
2134    /// by `GetElements`.
2135    /// Returns `WRONG_TYPE` if the `ElementType` of the element represented by the id is not
2136    /// `DAI_INTERCONNECT`.
2137    /// Retrieving multiple `DaiSupportedFormats` allows for cases where exclusive combinations of
2138    /// the parameters in DaiSupportedFormats may be supported.
2139    /// The vector returned to the caller must contain at least one entry.
2140    pub fn r#get_dai_formats(
2141        &self,
2142        mut processing_element_id: u64,
2143    ) -> fidl::client::QueryResponseFut<
2144        CompositeGetDaiFormatsResult,
2145        fdomain_client::fidl::FDomainResourceDialect,
2146    > {
2147        CompositeProxyInterface::r#get_dai_formats(self, processing_element_id)
2148    }
2149
2150    /// `SetDaiFormat` is sent by clients to select a DAI format for the `DAI_INTERCONNECT`
2151    /// processing element specified by `processing_element_id`. The format is based on information
2152    /// that the driver provides in `GetDaiFormats`, what is supported by the client, and any other
2153    /// requirement.
2154    /// Returns `INVALID_ARGS` if the `processing_element_id` does not match an id returned
2155    /// by `GetElements`.
2156    /// Returns `WRONG_TYPE` if the `ElementType` of the element represented by the id is not
2157    /// `DAI_INTERCONNECT`.
2158    pub fn r#set_dai_format(
2159        &self,
2160        mut processing_element_id: u64,
2161        mut format: &DaiFormat,
2162    ) -> fidl::client::QueryResponseFut<
2163        CompositeSetDaiFormatResult,
2164        fdomain_client::fidl::FDomainResourceDialect,
2165    > {
2166        CompositeProxyInterface::r#set_dai_format(self, processing_element_id, format)
2167    }
2168
2169    /// Retrieves the packet-stream formats supported by a `PACKET_STREAM` processing element
2170    /// in the topologies supported by this driver, as returned by `GetElements` and `GetTopologies`
2171    /// from fuchsia.hardware.audio.signalprocessing.
2172    ///
2173    /// Returns `SHOULD_WAIT` if the packet-stream formats are not available at this time. The
2174    /// client may retry this request at a later time.
2175    /// Returns `INVALID_ARGS` if the `processing_element_id` does not match an id returned by
2176    /// `GetElements`.
2177    /// Returns `WRONG_TYPE` if the `ElementType` of the element represented by the id is not
2178    /// `PACKET_STREAM`.
2179    /// Returns `NOT_SUPPORTED` if the driver does not support packet streams.
2180    /// Returning a vector with multiple `SupportedFormats2` enables cases where exclusive
2181    /// combinations of the parameters in `SupportedFormats2` may be supported.
2182    /// The vector returned to the caller must contain at least one entry.
2183    pub fn r#get_packet_stream_formats(
2184        &self,
2185        mut processing_element_id: u64,
2186    ) -> fidl::client::QueryResponseFut<
2187        CompositeGetPacketStreamFormatsResult,
2188        fdomain_client::fidl::FDomainResourceDialect,
2189    > {
2190        CompositeProxyInterface::r#get_packet_stream_formats(self, processing_element_id)
2191    }
2192
2193    /// `CreatePacketStream` is sent by clients to select a packet-stream format for the
2194    /// `PACKET_STREAM` processing element specified by `processing_element_id`. The format is based
2195    /// on information that the driver provides in `GetPacketStreamFormats`, what is supported by
2196    /// the client, and any other requirement. The returned `packet_stream` channel is used to
2197    /// access and control the packet stream protocol served by the driver.
2198    ///
2199    /// Returns `INVALID_ARGS` if the `processing_element_id` does not match an id returned by
2200    /// `GetElements`.
2201    /// Returns `WRONG_TYPE` if the `ElementType` of the element represented by the id is not
2202    /// `PACKET_STREAM`.
2203    /// Returns `SHOULD_WAIT` if the server cannot create a packet stream for this element/format
2204    /// at this time, but it should be able to at some future time. This request can be retried.
2205    /// Returns `NOT_SUPPORTED` if the driver does not support packet streams, or if the specified
2206    ///`format` is not supported.
2207    pub fn r#create_packet_stream(
2208        &self,
2209        mut processing_element_id: u64,
2210        mut format: &Format2,
2211        mut packet_stream_control: fdomain_client::fidl::ServerEnd<PacketStreamControlMarker>,
2212    ) -> fidl::client::QueryResponseFut<
2213        CompositeCreatePacketStreamResult,
2214        fdomain_client::fidl::FDomainResourceDialect,
2215    > {
2216        CompositeProxyInterface::r#create_packet_stream(
2217            self,
2218            processing_element_id,
2219            format,
2220            packet_stream_control,
2221        )
2222    }
2223}
2224
2225impl CompositeProxyInterface for CompositeProxy {
2226    type GetHealthStateResponseFut =
2227        fidl::client::QueryResponseFut<HealthState, fdomain_client::fidl::FDomainResourceDialect>;
2228    fn r#get_health_state(&self) -> Self::GetHealthStateResponseFut {
2229        fn _decode(
2230            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2231        ) -> Result<HealthState, fidl::Error> {
2232            let _response = fidl::client::decode_transaction_body::<
2233                HealthGetHealthStateResponse,
2234                fdomain_client::fidl::FDomainResourceDialect,
2235                0x4e146d6bca733a84,
2236            >(_buf?)?;
2237            Ok(_response.state)
2238        }
2239        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, HealthState>(
2240            (),
2241            0x4e146d6bca733a84,
2242            fidl::encoding::DynamicFlags::empty(),
2243            _decode,
2244        )
2245    }
2246
2247    fn r#signal_processing_connect(
2248        &self,
2249        mut protocol: fdomain_client::fidl::ServerEnd<
2250            fdomain_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
2251        >,
2252    ) -> Result<(), fidl::Error> {
2253        self.client.send::<fdomain_fuchsia_hardware_audio_signalprocessing::ConnectorSignalProcessingConnectRequest>(
2254            (protocol,),
2255            0xa81907ce6066295,
2256            fidl::encoding::DynamicFlags::empty(),
2257        )
2258    }
2259
2260    type ResetResponseFut = fidl::client::QueryResponseFut<
2261        CompositeResetResult,
2262        fdomain_client::fidl::FDomainResourceDialect,
2263    >;
2264    fn r#reset(&self) -> Self::ResetResponseFut {
2265        fn _decode(
2266            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2267        ) -> Result<CompositeResetResult, fidl::Error> {
2268            let _response = fidl::client::decode_transaction_body::<
2269                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, DriverError>,
2270                fdomain_client::fidl::FDomainResourceDialect,
2271                0xac355fb98341996,
2272            >(_buf?)?
2273            .into_result_fdomain::<CompositeMarker>("reset")?;
2274            Ok(_response.map(|x| x))
2275        }
2276        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, CompositeResetResult>(
2277            (),
2278            0xac355fb98341996,
2279            fidl::encoding::DynamicFlags::FLEXIBLE,
2280            _decode,
2281        )
2282    }
2283
2284    type GetPropertiesResponseFut = fidl::client::QueryResponseFut<
2285        CompositeProperties,
2286        fdomain_client::fidl::FDomainResourceDialect,
2287    >;
2288    fn r#get_properties(&self) -> Self::GetPropertiesResponseFut {
2289        fn _decode(
2290            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2291        ) -> Result<CompositeProperties, fidl::Error> {
2292            let _response = fidl::client::decode_transaction_body::<
2293                fidl::encoding::FlexibleType<CompositeGetPropertiesResponse>,
2294                fdomain_client::fidl::FDomainResourceDialect,
2295                0x31846fa0a459942b,
2296            >(_buf?)?
2297            .into_result_fdomain::<CompositeMarker>("get_properties")?;
2298            Ok(_response.properties)
2299        }
2300        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, CompositeProperties>(
2301            (),
2302            0x31846fa0a459942b,
2303            fidl::encoding::DynamicFlags::FLEXIBLE,
2304            _decode,
2305        )
2306    }
2307
2308    type GetRingBufferFormatsResponseFut = fidl::client::QueryResponseFut<
2309        CompositeGetRingBufferFormatsResult,
2310        fdomain_client::fidl::FDomainResourceDialect,
2311    >;
2312    fn r#get_ring_buffer_formats(
2313        &self,
2314        mut processing_element_id: u64,
2315    ) -> Self::GetRingBufferFormatsResponseFut {
2316        fn _decode(
2317            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2318        ) -> Result<CompositeGetRingBufferFormatsResult, fidl::Error> {
2319            let _response = fidl::client::decode_transaction_body::<
2320                fidl::encoding::FlexibleResultType<
2321                    CompositeGetRingBufferFormatsResponse,
2322                    DriverError,
2323                >,
2324                fdomain_client::fidl::FDomainResourceDialect,
2325                0x1d89b701b6816ac4,
2326            >(_buf?)?
2327            .into_result_fdomain::<CompositeMarker>("get_ring_buffer_formats")?;
2328            Ok(_response.map(|x| x.ring_buffer_formats))
2329        }
2330        self.client.send_query_and_decode::<
2331            CompositeGetRingBufferFormatsRequest,
2332            CompositeGetRingBufferFormatsResult,
2333        >(
2334            (processing_element_id,),
2335            0x1d89b701b6816ac4,
2336            fidl::encoding::DynamicFlags::FLEXIBLE,
2337            _decode,
2338        )
2339    }
2340
2341    type CreateRingBufferResponseFut = fidl::client::QueryResponseFut<
2342        CompositeCreateRingBufferResult,
2343        fdomain_client::fidl::FDomainResourceDialect,
2344    >;
2345    fn r#create_ring_buffer(
2346        &self,
2347        mut processing_element_id: u64,
2348        mut format: &Format2,
2349        mut ring_buffer: fdomain_client::fidl::ServerEnd<RingBufferMarker>,
2350    ) -> Self::CreateRingBufferResponseFut {
2351        fn _decode(
2352            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2353        ) -> Result<CompositeCreateRingBufferResult, fidl::Error> {
2354            let _response = fidl::client::decode_transaction_body::<
2355                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, DriverError>,
2356                fdomain_client::fidl::FDomainResourceDialect,
2357                0x28c5685f85262033,
2358            >(_buf?)?
2359            .into_result_fdomain::<CompositeMarker>("create_ring_buffer")?;
2360            Ok(_response.map(|x| x))
2361        }
2362        self.client.send_query_and_decode::<
2363            CompositeCreateRingBufferRequest,
2364            CompositeCreateRingBufferResult,
2365        >(
2366            (processing_element_id, format, ring_buffer,),
2367            0x28c5685f85262033,
2368            fidl::encoding::DynamicFlags::FLEXIBLE,
2369            _decode,
2370        )
2371    }
2372
2373    type GetDaiFormatsResponseFut = fidl::client::QueryResponseFut<
2374        CompositeGetDaiFormatsResult,
2375        fdomain_client::fidl::FDomainResourceDialect,
2376    >;
2377    fn r#get_dai_formats(&self, mut processing_element_id: u64) -> Self::GetDaiFormatsResponseFut {
2378        fn _decode(
2379            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2380        ) -> Result<CompositeGetDaiFormatsResult, fidl::Error> {
2381            let _response = fidl::client::decode_transaction_body::<
2382                fidl::encoding::FlexibleResultType<CompositeGetDaiFormatsResponse, DriverError>,
2383                fdomain_client::fidl::FDomainResourceDialect,
2384                0x3cbeaed59c8f69b,
2385            >(_buf?)?
2386            .into_result_fdomain::<CompositeMarker>("get_dai_formats")?;
2387            Ok(_response.map(|x| x.dai_formats))
2388        }
2389        self.client
2390            .send_query_and_decode::<CompositeGetDaiFormatsRequest, CompositeGetDaiFormatsResult>(
2391                (processing_element_id,),
2392                0x3cbeaed59c8f69b,
2393                fidl::encoding::DynamicFlags::FLEXIBLE,
2394                _decode,
2395            )
2396    }
2397
2398    type SetDaiFormatResponseFut = fidl::client::QueryResponseFut<
2399        CompositeSetDaiFormatResult,
2400        fdomain_client::fidl::FDomainResourceDialect,
2401    >;
2402    fn r#set_dai_format(
2403        &self,
2404        mut processing_element_id: u64,
2405        mut format: &DaiFormat,
2406    ) -> Self::SetDaiFormatResponseFut {
2407        fn _decode(
2408            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2409        ) -> Result<CompositeSetDaiFormatResult, fidl::Error> {
2410            let _response = fidl::client::decode_transaction_body::<
2411                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, DriverError>,
2412                fdomain_client::fidl::FDomainResourceDialect,
2413                0x155acf5cc0dc8a84,
2414            >(_buf?)?
2415            .into_result_fdomain::<CompositeMarker>("set_dai_format")?;
2416            Ok(_response.map(|x| x))
2417        }
2418        self.client
2419            .send_query_and_decode::<CompositeSetDaiFormatRequest, CompositeSetDaiFormatResult>(
2420                (processing_element_id, format),
2421                0x155acf5cc0dc8a84,
2422                fidl::encoding::DynamicFlags::FLEXIBLE,
2423                _decode,
2424            )
2425    }
2426
2427    type GetPacketStreamFormatsResponseFut = fidl::client::QueryResponseFut<
2428        CompositeGetPacketStreamFormatsResult,
2429        fdomain_client::fidl::FDomainResourceDialect,
2430    >;
2431    fn r#get_packet_stream_formats(
2432        &self,
2433        mut processing_element_id: u64,
2434    ) -> Self::GetPacketStreamFormatsResponseFut {
2435        fn _decode(
2436            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2437        ) -> Result<CompositeGetPacketStreamFormatsResult, fidl::Error> {
2438            let _response = fidl::client::decode_transaction_body::<
2439                fidl::encoding::FlexibleResultType<
2440                    CompositeGetPacketStreamFormatsResponse,
2441                    DriverError,
2442                >,
2443                fdomain_client::fidl::FDomainResourceDialect,
2444                0x73cc47c6ad39bca7,
2445            >(_buf?)?
2446            .into_result_fdomain::<CompositeMarker>("get_packet_stream_formats")?;
2447            Ok(_response.map(|x| x.packet_stream_formats))
2448        }
2449        self.client.send_query_and_decode::<
2450            CompositeGetPacketStreamFormatsRequest,
2451            CompositeGetPacketStreamFormatsResult,
2452        >(
2453            (processing_element_id,),
2454            0x73cc47c6ad39bca7,
2455            fidl::encoding::DynamicFlags::FLEXIBLE,
2456            _decode,
2457        )
2458    }
2459
2460    type CreatePacketStreamResponseFut = fidl::client::QueryResponseFut<
2461        CompositeCreatePacketStreamResult,
2462        fdomain_client::fidl::FDomainResourceDialect,
2463    >;
2464    fn r#create_packet_stream(
2465        &self,
2466        mut processing_element_id: u64,
2467        mut format: &Format2,
2468        mut packet_stream_control: fdomain_client::fidl::ServerEnd<PacketStreamControlMarker>,
2469    ) -> Self::CreatePacketStreamResponseFut {
2470        fn _decode(
2471            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2472        ) -> Result<CompositeCreatePacketStreamResult, fidl::Error> {
2473            let _response = fidl::client::decode_transaction_body::<
2474                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, DriverError>,
2475                fdomain_client::fidl::FDomainResourceDialect,
2476                0x50e8902b756c707c,
2477            >(_buf?)?
2478            .into_result_fdomain::<CompositeMarker>("create_packet_stream")?;
2479            Ok(_response.map(|x| x))
2480        }
2481        self.client.send_query_and_decode::<
2482            CompositeCreatePacketStreamRequest,
2483            CompositeCreatePacketStreamResult,
2484        >(
2485            (processing_element_id, format, packet_stream_control,),
2486            0x50e8902b756c707c,
2487            fidl::encoding::DynamicFlags::FLEXIBLE,
2488            _decode,
2489        )
2490    }
2491}
2492
2493pub struct CompositeEventStream {
2494    event_receiver: fidl::client::EventReceiver<fdomain_client::fidl::FDomainResourceDialect>,
2495}
2496
2497impl std::marker::Unpin for CompositeEventStream {}
2498
2499impl futures::stream::FusedStream for CompositeEventStream {
2500    fn is_terminated(&self) -> bool {
2501        self.event_receiver.is_terminated()
2502    }
2503}
2504
2505impl futures::Stream for CompositeEventStream {
2506    type Item = Result<CompositeEvent, fidl::Error>;
2507
2508    fn poll_next(
2509        mut self: std::pin::Pin<&mut Self>,
2510        cx: &mut std::task::Context<'_>,
2511    ) -> std::task::Poll<Option<Self::Item>> {
2512        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2513            &mut self.event_receiver,
2514            cx
2515        )?) {
2516            Some(buf) => std::task::Poll::Ready(Some(CompositeEvent::decode(buf))),
2517            None => std::task::Poll::Ready(None),
2518        }
2519    }
2520}
2521
2522#[derive(Debug)]
2523pub enum CompositeEvent {
2524    #[non_exhaustive]
2525    _UnknownEvent {
2526        /// Ordinal of the event that was sent.
2527        ordinal: u64,
2528    },
2529}
2530
2531impl CompositeEvent {
2532    /// Decodes a message buffer as a [`CompositeEvent`].
2533    fn decode(
2534        mut buf: <fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2535    ) -> Result<CompositeEvent, fidl::Error> {
2536        let (bytes, _handles) = buf.split_mut();
2537        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2538        debug_assert_eq!(tx_header.tx_id, 0);
2539        match tx_header.ordinal {
2540            _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
2541                Ok(CompositeEvent::_UnknownEvent { ordinal: tx_header.ordinal })
2542            }
2543            _ => Err(fidl::Error::UnknownOrdinal {
2544                ordinal: tx_header.ordinal,
2545                protocol_name:
2546                    <CompositeMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
2547            }),
2548        }
2549    }
2550}
2551
2552/// A Stream of incoming requests for fuchsia.hardware.audio/Composite.
2553pub struct CompositeRequestStream {
2554    inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
2555    is_terminated: bool,
2556}
2557
2558impl std::marker::Unpin for CompositeRequestStream {}
2559
2560impl futures::stream::FusedStream for CompositeRequestStream {
2561    fn is_terminated(&self) -> bool {
2562        self.is_terminated
2563    }
2564}
2565
2566impl fdomain_client::fidl::RequestStream for CompositeRequestStream {
2567    type Protocol = CompositeMarker;
2568    type ControlHandle = CompositeControlHandle;
2569
2570    fn from_channel(channel: fdomain_client::Channel) -> Self {
2571        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2572    }
2573
2574    fn control_handle(&self) -> Self::ControlHandle {
2575        CompositeControlHandle { inner: self.inner.clone() }
2576    }
2577
2578    fn into_inner(
2579        self,
2580    ) -> (::std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>, bool)
2581    {
2582        (self.inner, self.is_terminated)
2583    }
2584
2585    fn from_inner(
2586        inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
2587        is_terminated: bool,
2588    ) -> Self {
2589        Self { inner, is_terminated }
2590    }
2591}
2592
2593impl futures::Stream for CompositeRequestStream {
2594    type Item = Result<CompositeRequest, fidl::Error>;
2595
2596    fn poll_next(
2597        mut self: std::pin::Pin<&mut Self>,
2598        cx: &mut std::task::Context<'_>,
2599    ) -> std::task::Poll<Option<Self::Item>> {
2600        let this = &mut *self;
2601        if this.inner.check_shutdown(cx) {
2602            this.is_terminated = true;
2603            return std::task::Poll::Ready(None);
2604        }
2605        if this.is_terminated {
2606            panic!("polled CompositeRequestStream after completion");
2607        }
2608        fidl::encoding::with_tls_decode_buf::<_, fdomain_client::fidl::FDomainResourceDialect>(
2609            |bytes, handles| {
2610                match this.inner.channel().read_etc(cx, bytes, handles) {
2611                    std::task::Poll::Ready(Ok(())) => {}
2612                    std::task::Poll::Pending => return std::task::Poll::Pending,
2613                    std::task::Poll::Ready(Err(None)) => {
2614                        this.is_terminated = true;
2615                        return std::task::Poll::Ready(None);
2616                    }
2617                    std::task::Poll::Ready(Err(Some(e))) => {
2618                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2619                            e.into(),
2620                        ))));
2621                    }
2622                }
2623
2624                // A message has been received from the channel
2625                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2626
2627                std::task::Poll::Ready(Some(match header.ordinal {
2628                    0x4e146d6bca733a84 => {
2629                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2630                        let mut req = fidl::new_empty!(
2631                            fidl::encoding::EmptyPayload,
2632                            fdomain_client::fidl::FDomainResourceDialect
2633                        );
2634                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2635                        let control_handle = CompositeControlHandle { inner: this.inner.clone() };
2636                        Ok(CompositeRequest::GetHealthState {
2637                            responder: CompositeGetHealthStateResponder {
2638                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2639                                tx_id: header.tx_id,
2640                            },
2641                        })
2642                    }
2643                    0xa81907ce6066295 => {
2644                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2645                        let mut req = fidl::new_empty!(fdomain_fuchsia_hardware_audio_signalprocessing::ConnectorSignalProcessingConnectRequest, fdomain_client::fidl::FDomainResourceDialect);
2646                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<fdomain_fuchsia_hardware_audio_signalprocessing::ConnectorSignalProcessingConnectRequest>(&header, _body_bytes, handles, &mut req)?;
2647                        let control_handle = CompositeControlHandle { inner: this.inner.clone() };
2648                        Ok(CompositeRequest::SignalProcessingConnect {
2649                            protocol: req.protocol,
2650
2651                            control_handle,
2652                        })
2653                    }
2654                    0xac355fb98341996 => {
2655                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2656                        let mut req = fidl::new_empty!(
2657                            fidl::encoding::EmptyPayload,
2658                            fdomain_client::fidl::FDomainResourceDialect
2659                        );
2660                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2661                        let control_handle = CompositeControlHandle { inner: this.inner.clone() };
2662                        Ok(CompositeRequest::Reset {
2663                            responder: CompositeResetResponder {
2664                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2665                                tx_id: header.tx_id,
2666                            },
2667                        })
2668                    }
2669                    0x31846fa0a459942b => {
2670                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2671                        let mut req = fidl::new_empty!(
2672                            fidl::encoding::EmptyPayload,
2673                            fdomain_client::fidl::FDomainResourceDialect
2674                        );
2675                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2676                        let control_handle = CompositeControlHandle { inner: this.inner.clone() };
2677                        Ok(CompositeRequest::GetProperties {
2678                            responder: CompositeGetPropertiesResponder {
2679                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2680                                tx_id: header.tx_id,
2681                            },
2682                        })
2683                    }
2684                    0x1d89b701b6816ac4 => {
2685                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2686                        let mut req = fidl::new_empty!(
2687                            CompositeGetRingBufferFormatsRequest,
2688                            fdomain_client::fidl::FDomainResourceDialect
2689                        );
2690                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<CompositeGetRingBufferFormatsRequest>(&header, _body_bytes, handles, &mut req)?;
2691                        let control_handle = CompositeControlHandle { inner: this.inner.clone() };
2692                        Ok(CompositeRequest::GetRingBufferFormats {
2693                            processing_element_id: req.processing_element_id,
2694
2695                            responder: CompositeGetRingBufferFormatsResponder {
2696                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2697                                tx_id: header.tx_id,
2698                            },
2699                        })
2700                    }
2701                    0x28c5685f85262033 => {
2702                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2703                        let mut req = fidl::new_empty!(
2704                            CompositeCreateRingBufferRequest,
2705                            fdomain_client::fidl::FDomainResourceDialect
2706                        );
2707                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<CompositeCreateRingBufferRequest>(&header, _body_bytes, handles, &mut req)?;
2708                        let control_handle = CompositeControlHandle { inner: this.inner.clone() };
2709                        Ok(CompositeRequest::CreateRingBuffer {
2710                            processing_element_id: req.processing_element_id,
2711                            format: req.format,
2712                            ring_buffer: req.ring_buffer,
2713
2714                            responder: CompositeCreateRingBufferResponder {
2715                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2716                                tx_id: header.tx_id,
2717                            },
2718                        })
2719                    }
2720                    0x3cbeaed59c8f69b => {
2721                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2722                        let mut req = fidl::new_empty!(
2723                            CompositeGetDaiFormatsRequest,
2724                            fdomain_client::fidl::FDomainResourceDialect
2725                        );
2726                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<CompositeGetDaiFormatsRequest>(&header, _body_bytes, handles, &mut req)?;
2727                        let control_handle = CompositeControlHandle { inner: this.inner.clone() };
2728                        Ok(CompositeRequest::GetDaiFormats {
2729                            processing_element_id: req.processing_element_id,
2730
2731                            responder: CompositeGetDaiFormatsResponder {
2732                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2733                                tx_id: header.tx_id,
2734                            },
2735                        })
2736                    }
2737                    0x155acf5cc0dc8a84 => {
2738                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2739                        let mut req = fidl::new_empty!(
2740                            CompositeSetDaiFormatRequest,
2741                            fdomain_client::fidl::FDomainResourceDialect
2742                        );
2743                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<CompositeSetDaiFormatRequest>(&header, _body_bytes, handles, &mut req)?;
2744                        let control_handle = CompositeControlHandle { inner: this.inner.clone() };
2745                        Ok(CompositeRequest::SetDaiFormat {
2746                            processing_element_id: req.processing_element_id,
2747                            format: req.format,
2748
2749                            responder: CompositeSetDaiFormatResponder {
2750                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2751                                tx_id: header.tx_id,
2752                            },
2753                        })
2754                    }
2755                    0x73cc47c6ad39bca7 => {
2756                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2757                        let mut req = fidl::new_empty!(
2758                            CompositeGetPacketStreamFormatsRequest,
2759                            fdomain_client::fidl::FDomainResourceDialect
2760                        );
2761                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<CompositeGetPacketStreamFormatsRequest>(&header, _body_bytes, handles, &mut req)?;
2762                        let control_handle = CompositeControlHandle { inner: this.inner.clone() };
2763                        Ok(CompositeRequest::GetPacketStreamFormats {
2764                            processing_element_id: req.processing_element_id,
2765
2766                            responder: CompositeGetPacketStreamFormatsResponder {
2767                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2768                                tx_id: header.tx_id,
2769                            },
2770                        })
2771                    }
2772                    0x50e8902b756c707c => {
2773                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2774                        let mut req = fidl::new_empty!(
2775                            CompositeCreatePacketStreamRequest,
2776                            fdomain_client::fidl::FDomainResourceDialect
2777                        );
2778                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<CompositeCreatePacketStreamRequest>(&header, _body_bytes, handles, &mut req)?;
2779                        let control_handle = CompositeControlHandle { inner: this.inner.clone() };
2780                        Ok(CompositeRequest::CreatePacketStream {
2781                            processing_element_id: req.processing_element_id,
2782                            format: req.format,
2783                            packet_stream_control: req.packet_stream_control,
2784
2785                            responder: CompositeCreatePacketStreamResponder {
2786                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2787                                tx_id: header.tx_id,
2788                            },
2789                        })
2790                    }
2791                    _ if header.tx_id == 0
2792                        && header
2793                            .dynamic_flags()
2794                            .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
2795                    {
2796                        Ok(CompositeRequest::_UnknownMethod {
2797                            ordinal: header.ordinal,
2798                            control_handle: CompositeControlHandle { inner: this.inner.clone() },
2799                            method_type: fidl::MethodType::OneWay,
2800                        })
2801                    }
2802                    _ if header
2803                        .dynamic_flags()
2804                        .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
2805                    {
2806                        this.inner.send_framework_err(
2807                            fidl::encoding::FrameworkErr::UnknownMethod,
2808                            header.tx_id,
2809                            header.ordinal,
2810                            header.dynamic_flags(),
2811                            (bytes, handles),
2812                        )?;
2813                        Ok(CompositeRequest::_UnknownMethod {
2814                            ordinal: header.ordinal,
2815                            control_handle: CompositeControlHandle { inner: this.inner.clone() },
2816                            method_type: fidl::MethodType::TwoWay,
2817                        })
2818                    }
2819                    _ => Err(fidl::Error::UnknownOrdinal {
2820                        ordinal: header.ordinal,
2821                        protocol_name:
2822                            <CompositeMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
2823                    }),
2824                }))
2825            },
2826        )
2827    }
2828}
2829
2830#[derive(Debug)]
2831pub enum CompositeRequest {
2832    /// Retrieves top level health state.
2833    /// A driver not responding promptly can be used as an indication of an unhealthy driver.
2834    GetHealthState { responder: CompositeGetHealthStateResponder },
2835    /// Connect to a `SignalProcessing` protocol.
2836    /// Multiple connections may be supported, if a new connection request is not supported, i.e.
2837    /// the maximum number of connections have already been created, for instance one, then the
2838    /// `protocol` channel (not the channel upon which `SignalProcessingConnect` is being called)
2839    /// will be closed with a `ZX_ERR_ALREADY_BOUND` epitaph.
2840    /// If signal processing is not supported at all, then the `protocol` channel (again, not the
2841    /// channel upon which `SignalProcessingConnect` is being called) will be closed with a
2842    /// `ZX_ERR_NOT_SUPPORTED` epitaph.
2843    /// This method is named `SignalProcessingConnect` instead of `Connect` because this protocol
2844    /// is intended to be composed, and hence the more verbose name allows differentiation and
2845    /// improved clarity.
2846    SignalProcessingConnect {
2847        protocol: fdomain_client::fidl::ServerEnd<
2848            fdomain_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
2849        >,
2850        control_handle: CompositeControlHandle,
2851    },
2852    /// Resets the hardware including all DAI interconnects and signal processing.
2853    /// As a result, all channels obtained by `CreateRingBuffer` will be closed.
2854    ///
2855    /// `Reset` returns when the hardware is fully reset. At this point, a client would need to
2856    /// reconfigure any DAI interconnects, select a signal processing topology and reconfigure
2857    /// any processing elements, and reconstruct any ring buffers.
2858    ///
2859    /// If the driver can't successfully reset the hardware, it will return an error and then close
2860    /// the protocol channel, in this case the client may obtain a new protocol channel and retry.
2861    Reset { responder: CompositeResetResponder },
2862    /// Retrieves top level static properties.
2863    GetProperties { responder: CompositeGetPropertiesResponder },
2864    /// Retrieves the ring buffer formats supported by a `RING_BUFFER` processing element
2865    /// in the topology supported by this driver as returned by `GetElements` from
2866    /// fuchsia.hardware.audio.signalprocessing.
2867    /// Returns `SHOULD_WAIT` if the ring buffer formats are not available at the time, the
2868    /// client may retry at a later time.
2869    /// Returns `INVALID_ARGS` if the `processing_element_id` does not match an id returned
2870    /// by `GetElements`.
2871    /// Returns `WRONG_TYPE` if the `ElementType` of the element represented by the id is not
2872    /// `RING_BUFFER`.
2873    /// Retrieving multiple `SupportedFormats2` allows for cases where exclusive combinations of
2874    /// the parameters in `SupportedFormats2` may be supported.
2875    /// The vector returned to the caller must contain at least one entry.
2876    GetRingBufferFormats {
2877        processing_element_id: u64,
2878        responder: CompositeGetRingBufferFormatsResponder,
2879    },
2880    /// `CreateRingBuffer` is sent by clients to select a ring buffer format for the `RING_BUFFER`
2881    /// processing element specified by `processing_element_id`. The format is based on information
2882    /// that the driver provides in `GetRingBufferFormats`, what is supported by the client, and
2883    /// any other requirement. The returned `ring_buffer` channel is used to access and control the
2884    /// audio buffer provided by the driver.
2885    /// Returns `INVALID_ARGS` if the `processing_element_id` does not match an id returned
2886    /// by `GetElements`.
2887    /// Returns `WRONG_TYPE` if the `ElementType` of the element represented by the id is not
2888    /// `RING_BUFFER`.
2889    /// Returns `NOT_SUPPORTED` if the driver does not support ring buffers, or if the specified
2890    /// `format` is not supported.
2891    CreateRingBuffer {
2892        processing_element_id: u64,
2893        format: Format2,
2894        ring_buffer: fdomain_client::fidl::ServerEnd<RingBufferMarker>,
2895        responder: CompositeCreateRingBufferResponder,
2896    },
2897    /// Retrieves the DAI formats supported by a `DAI_INTERCONNECT` processing element
2898    /// in the topology supported by this driver as returned by `GetElements` from
2899    /// fuchsia.hardware.audio.signalprocessing.
2900    /// Returns `SHOULD_WAIT` if the DAI formats are not available at the time, the client
2901    /// may retry at a later time.
2902    /// Returns `INVALID_ARGS` if the `processing_element_id` does not match an id returned
2903    /// by `GetElements`.
2904    /// Returns `WRONG_TYPE` if the `ElementType` of the element represented by the id is not
2905    /// `DAI_INTERCONNECT`.
2906    /// Retrieving multiple `DaiSupportedFormats` allows for cases where exclusive combinations of
2907    /// the parameters in DaiSupportedFormats may be supported.
2908    /// The vector returned to the caller must contain at least one entry.
2909    GetDaiFormats { processing_element_id: u64, responder: CompositeGetDaiFormatsResponder },
2910    /// `SetDaiFormat` is sent by clients to select a DAI format for the `DAI_INTERCONNECT`
2911    /// processing element specified by `processing_element_id`. The format is based on information
2912    /// that the driver provides in `GetDaiFormats`, what is supported by the client, and any other
2913    /// requirement.
2914    /// Returns `INVALID_ARGS` if the `processing_element_id` does not match an id returned
2915    /// by `GetElements`.
2916    /// Returns `WRONG_TYPE` if the `ElementType` of the element represented by the id is not
2917    /// `DAI_INTERCONNECT`.
2918    SetDaiFormat {
2919        processing_element_id: u64,
2920        format: DaiFormat,
2921        responder: CompositeSetDaiFormatResponder,
2922    },
2923    /// Retrieves the packet-stream formats supported by a `PACKET_STREAM` processing element
2924    /// in the topologies supported by this driver, as returned by `GetElements` and `GetTopologies`
2925    /// from fuchsia.hardware.audio.signalprocessing.
2926    ///
2927    /// Returns `SHOULD_WAIT` if the packet-stream formats are not available at this time. The
2928    /// client may retry this request at a later time.
2929    /// Returns `INVALID_ARGS` if the `processing_element_id` does not match an id returned by
2930    /// `GetElements`.
2931    /// Returns `WRONG_TYPE` if the `ElementType` of the element represented by the id is not
2932    /// `PACKET_STREAM`.
2933    /// Returns `NOT_SUPPORTED` if the driver does not support packet streams.
2934    /// Returning a vector with multiple `SupportedFormats2` enables cases where exclusive
2935    /// combinations of the parameters in `SupportedFormats2` may be supported.
2936    /// The vector returned to the caller must contain at least one entry.
2937    GetPacketStreamFormats {
2938        processing_element_id: u64,
2939        responder: CompositeGetPacketStreamFormatsResponder,
2940    },
2941    /// `CreatePacketStream` is sent by clients to select a packet-stream format for the
2942    /// `PACKET_STREAM` processing element specified by `processing_element_id`. The format is based
2943    /// on information that the driver provides in `GetPacketStreamFormats`, what is supported by
2944    /// the client, and any other requirement. The returned `packet_stream` channel is used to
2945    /// access and control the packet stream protocol served by the driver.
2946    ///
2947    /// Returns `INVALID_ARGS` if the `processing_element_id` does not match an id returned by
2948    /// `GetElements`.
2949    /// Returns `WRONG_TYPE` if the `ElementType` of the element represented by the id is not
2950    /// `PACKET_STREAM`.
2951    /// Returns `SHOULD_WAIT` if the server cannot create a packet stream for this element/format
2952    /// at this time, but it should be able to at some future time. This request can be retried.
2953    /// Returns `NOT_SUPPORTED` if the driver does not support packet streams, or if the specified
2954    ///`format` is not supported.
2955    CreatePacketStream {
2956        processing_element_id: u64,
2957        format: Format2,
2958        packet_stream_control: fdomain_client::fidl::ServerEnd<PacketStreamControlMarker>,
2959        responder: CompositeCreatePacketStreamResponder,
2960    },
2961    /// An interaction was received which does not match any known method.
2962    #[non_exhaustive]
2963    _UnknownMethod {
2964        /// Ordinal of the method that was called.
2965        ordinal: u64,
2966        control_handle: CompositeControlHandle,
2967        method_type: fidl::MethodType,
2968    },
2969}
2970
2971impl CompositeRequest {
2972    #[allow(irrefutable_let_patterns)]
2973    pub fn into_get_health_state(self) -> Option<(CompositeGetHealthStateResponder)> {
2974        if let CompositeRequest::GetHealthState { responder } = self {
2975            Some((responder))
2976        } else {
2977            None
2978        }
2979    }
2980
2981    #[allow(irrefutable_let_patterns)]
2982    pub fn into_signal_processing_connect(
2983        self,
2984    ) -> Option<(
2985        fdomain_client::fidl::ServerEnd<
2986            fdomain_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
2987        >,
2988        CompositeControlHandle,
2989    )> {
2990        if let CompositeRequest::SignalProcessingConnect { protocol, control_handle } = self {
2991            Some((protocol, control_handle))
2992        } else {
2993            None
2994        }
2995    }
2996
2997    #[allow(irrefutable_let_patterns)]
2998    pub fn into_reset(self) -> Option<(CompositeResetResponder)> {
2999        if let CompositeRequest::Reset { responder } = self { Some((responder)) } else { None }
3000    }
3001
3002    #[allow(irrefutable_let_patterns)]
3003    pub fn into_get_properties(self) -> Option<(CompositeGetPropertiesResponder)> {
3004        if let CompositeRequest::GetProperties { responder } = self {
3005            Some((responder))
3006        } else {
3007            None
3008        }
3009    }
3010
3011    #[allow(irrefutable_let_patterns)]
3012    pub fn into_get_ring_buffer_formats(
3013        self,
3014    ) -> Option<(u64, CompositeGetRingBufferFormatsResponder)> {
3015        if let CompositeRequest::GetRingBufferFormats { processing_element_id, responder } = self {
3016            Some((processing_element_id, responder))
3017        } else {
3018            None
3019        }
3020    }
3021
3022    #[allow(irrefutable_let_patterns)]
3023    pub fn into_create_ring_buffer(
3024        self,
3025    ) -> Option<(
3026        u64,
3027        Format2,
3028        fdomain_client::fidl::ServerEnd<RingBufferMarker>,
3029        CompositeCreateRingBufferResponder,
3030    )> {
3031        if let CompositeRequest::CreateRingBuffer {
3032            processing_element_id,
3033            format,
3034            ring_buffer,
3035            responder,
3036        } = self
3037        {
3038            Some((processing_element_id, format, ring_buffer, responder))
3039        } else {
3040            None
3041        }
3042    }
3043
3044    #[allow(irrefutable_let_patterns)]
3045    pub fn into_get_dai_formats(self) -> Option<(u64, CompositeGetDaiFormatsResponder)> {
3046        if let CompositeRequest::GetDaiFormats { processing_element_id, responder } = self {
3047            Some((processing_element_id, responder))
3048        } else {
3049            None
3050        }
3051    }
3052
3053    #[allow(irrefutable_let_patterns)]
3054    pub fn into_set_dai_format(self) -> Option<(u64, DaiFormat, CompositeSetDaiFormatResponder)> {
3055        if let CompositeRequest::SetDaiFormat { processing_element_id, format, responder } = self {
3056            Some((processing_element_id, format, responder))
3057        } else {
3058            None
3059        }
3060    }
3061
3062    #[allow(irrefutable_let_patterns)]
3063    pub fn into_get_packet_stream_formats(
3064        self,
3065    ) -> Option<(u64, CompositeGetPacketStreamFormatsResponder)> {
3066        if let CompositeRequest::GetPacketStreamFormats { processing_element_id, responder } = self
3067        {
3068            Some((processing_element_id, responder))
3069        } else {
3070            None
3071        }
3072    }
3073
3074    #[allow(irrefutable_let_patterns)]
3075    pub fn into_create_packet_stream(
3076        self,
3077    ) -> Option<(
3078        u64,
3079        Format2,
3080        fdomain_client::fidl::ServerEnd<PacketStreamControlMarker>,
3081        CompositeCreatePacketStreamResponder,
3082    )> {
3083        if let CompositeRequest::CreatePacketStream {
3084            processing_element_id,
3085            format,
3086            packet_stream_control,
3087            responder,
3088        } = self
3089        {
3090            Some((processing_element_id, format, packet_stream_control, responder))
3091        } else {
3092            None
3093        }
3094    }
3095
3096    /// Name of the method defined in FIDL
3097    pub fn method_name(&self) -> &'static str {
3098        match *self {
3099            CompositeRequest::GetHealthState { .. } => "get_health_state",
3100            CompositeRequest::SignalProcessingConnect { .. } => "signal_processing_connect",
3101            CompositeRequest::Reset { .. } => "reset",
3102            CompositeRequest::GetProperties { .. } => "get_properties",
3103            CompositeRequest::GetRingBufferFormats { .. } => "get_ring_buffer_formats",
3104            CompositeRequest::CreateRingBuffer { .. } => "create_ring_buffer",
3105            CompositeRequest::GetDaiFormats { .. } => "get_dai_formats",
3106            CompositeRequest::SetDaiFormat { .. } => "set_dai_format",
3107            CompositeRequest::GetPacketStreamFormats { .. } => "get_packet_stream_formats",
3108            CompositeRequest::CreatePacketStream { .. } => "create_packet_stream",
3109            CompositeRequest::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
3110                "unknown one-way method"
3111            }
3112            CompositeRequest::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
3113                "unknown two-way method"
3114            }
3115        }
3116    }
3117}
3118
3119#[derive(Debug, Clone)]
3120pub struct CompositeControlHandle {
3121    inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
3122}
3123
3124impl CompositeControlHandle {
3125    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
3126        self.inner.shutdown_with_epitaph(status.into())
3127    }
3128}
3129
3130impl fdomain_client::fidl::ControlHandle for CompositeControlHandle {
3131    fn shutdown(&self) {
3132        self.inner.shutdown()
3133    }
3134
3135    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
3136        self.inner.shutdown_with_epitaph(status)
3137    }
3138
3139    fn is_closed(&self) -> bool {
3140        self.inner.channel().is_closed()
3141    }
3142    fn on_closed(&self) -> fdomain_client::OnFDomainSignals {
3143        self.inner.channel().on_closed()
3144    }
3145}
3146
3147impl CompositeControlHandle {}
3148
3149#[must_use = "FIDL methods require a response to be sent"]
3150#[derive(Debug)]
3151pub struct CompositeGetHealthStateResponder {
3152    control_handle: std::mem::ManuallyDrop<CompositeControlHandle>,
3153    tx_id: u32,
3154}
3155
3156/// Set the the channel to be shutdown (see [`CompositeControlHandle::shutdown`])
3157/// if the responder is dropped without sending a response, so that the client
3158/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3159impl std::ops::Drop for CompositeGetHealthStateResponder {
3160    fn drop(&mut self) {
3161        self.control_handle.shutdown();
3162        // Safety: drops once, never accessed again
3163        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3164    }
3165}
3166
3167impl fdomain_client::fidl::Responder for CompositeGetHealthStateResponder {
3168    type ControlHandle = CompositeControlHandle;
3169
3170    fn control_handle(&self) -> &CompositeControlHandle {
3171        &self.control_handle
3172    }
3173
3174    fn drop_without_shutdown(mut self) {
3175        // Safety: drops once, never accessed again due to mem::forget
3176        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3177        // Prevent Drop from running (which would shut down the channel)
3178        std::mem::forget(self);
3179    }
3180}
3181
3182impl CompositeGetHealthStateResponder {
3183    /// Sends a response to the FIDL transaction.
3184    ///
3185    /// Sets the channel to shutdown if an error occurs.
3186    pub fn send(self, mut state: &HealthState) -> Result<(), fidl::Error> {
3187        let _result = self.send_raw(state);
3188        if _result.is_err() {
3189            self.control_handle.shutdown();
3190        }
3191        self.drop_without_shutdown();
3192        _result
3193    }
3194
3195    /// Similar to "send" but does not shutdown the channel if an error occurs.
3196    pub fn send_no_shutdown_on_err(self, mut state: &HealthState) -> Result<(), fidl::Error> {
3197        let _result = self.send_raw(state);
3198        self.drop_without_shutdown();
3199        _result
3200    }
3201
3202    fn send_raw(&self, mut state: &HealthState) -> Result<(), fidl::Error> {
3203        self.control_handle.inner.send::<HealthGetHealthStateResponse>(
3204            (state,),
3205            self.tx_id,
3206            0x4e146d6bca733a84,
3207            fidl::encoding::DynamicFlags::empty(),
3208        )
3209    }
3210}
3211
3212#[must_use = "FIDL methods require a response to be sent"]
3213#[derive(Debug)]
3214pub struct CompositeResetResponder {
3215    control_handle: std::mem::ManuallyDrop<CompositeControlHandle>,
3216    tx_id: u32,
3217}
3218
3219/// Set the the channel to be shutdown (see [`CompositeControlHandle::shutdown`])
3220/// if the responder is dropped without sending a response, so that the client
3221/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3222impl std::ops::Drop for CompositeResetResponder {
3223    fn drop(&mut self) {
3224        self.control_handle.shutdown();
3225        // Safety: drops once, never accessed again
3226        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3227    }
3228}
3229
3230impl fdomain_client::fidl::Responder for CompositeResetResponder {
3231    type ControlHandle = CompositeControlHandle;
3232
3233    fn control_handle(&self) -> &CompositeControlHandle {
3234        &self.control_handle
3235    }
3236
3237    fn drop_without_shutdown(mut self) {
3238        // Safety: drops once, never accessed again due to mem::forget
3239        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3240        // Prevent Drop from running (which would shut down the channel)
3241        std::mem::forget(self);
3242    }
3243}
3244
3245impl CompositeResetResponder {
3246    /// Sends a response to the FIDL transaction.
3247    ///
3248    /// Sets the channel to shutdown if an error occurs.
3249    pub fn send(self, mut result: Result<(), DriverError>) -> Result<(), fidl::Error> {
3250        let _result = self.send_raw(result);
3251        if _result.is_err() {
3252            self.control_handle.shutdown();
3253        }
3254        self.drop_without_shutdown();
3255        _result
3256    }
3257
3258    /// Similar to "send" but does not shutdown the channel if an error occurs.
3259    pub fn send_no_shutdown_on_err(
3260        self,
3261        mut result: Result<(), DriverError>,
3262    ) -> Result<(), fidl::Error> {
3263        let _result = self.send_raw(result);
3264        self.drop_without_shutdown();
3265        _result
3266    }
3267
3268    fn send_raw(&self, mut result: Result<(), DriverError>) -> Result<(), fidl::Error> {
3269        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
3270            fidl::encoding::EmptyStruct,
3271            DriverError,
3272        >>(
3273            fidl::encoding::FlexibleResult::new(result),
3274            self.tx_id,
3275            0xac355fb98341996,
3276            fidl::encoding::DynamicFlags::FLEXIBLE,
3277        )
3278    }
3279}
3280
3281#[must_use = "FIDL methods require a response to be sent"]
3282#[derive(Debug)]
3283pub struct CompositeGetPropertiesResponder {
3284    control_handle: std::mem::ManuallyDrop<CompositeControlHandle>,
3285    tx_id: u32,
3286}
3287
3288/// Set the the channel to be shutdown (see [`CompositeControlHandle::shutdown`])
3289/// if the responder is dropped without sending a response, so that the client
3290/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3291impl std::ops::Drop for CompositeGetPropertiesResponder {
3292    fn drop(&mut self) {
3293        self.control_handle.shutdown();
3294        // Safety: drops once, never accessed again
3295        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3296    }
3297}
3298
3299impl fdomain_client::fidl::Responder for CompositeGetPropertiesResponder {
3300    type ControlHandle = CompositeControlHandle;
3301
3302    fn control_handle(&self) -> &CompositeControlHandle {
3303        &self.control_handle
3304    }
3305
3306    fn drop_without_shutdown(mut self) {
3307        // Safety: drops once, never accessed again due to mem::forget
3308        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3309        // Prevent Drop from running (which would shut down the channel)
3310        std::mem::forget(self);
3311    }
3312}
3313
3314impl CompositeGetPropertiesResponder {
3315    /// Sends a response to the FIDL transaction.
3316    ///
3317    /// Sets the channel to shutdown if an error occurs.
3318    pub fn send(self, mut properties: &CompositeProperties) -> Result<(), fidl::Error> {
3319        let _result = self.send_raw(properties);
3320        if _result.is_err() {
3321            self.control_handle.shutdown();
3322        }
3323        self.drop_without_shutdown();
3324        _result
3325    }
3326
3327    /// Similar to "send" but does not shutdown the channel if an error occurs.
3328    pub fn send_no_shutdown_on_err(
3329        self,
3330        mut properties: &CompositeProperties,
3331    ) -> Result<(), fidl::Error> {
3332        let _result = self.send_raw(properties);
3333        self.drop_without_shutdown();
3334        _result
3335    }
3336
3337    fn send_raw(&self, mut properties: &CompositeProperties) -> Result<(), fidl::Error> {
3338        self.control_handle
3339            .inner
3340            .send::<fidl::encoding::FlexibleType<CompositeGetPropertiesResponse>>(
3341                fidl::encoding::Flexible::new((properties,)),
3342                self.tx_id,
3343                0x31846fa0a459942b,
3344                fidl::encoding::DynamicFlags::FLEXIBLE,
3345            )
3346    }
3347}
3348
3349#[must_use = "FIDL methods require a response to be sent"]
3350#[derive(Debug)]
3351pub struct CompositeGetRingBufferFormatsResponder {
3352    control_handle: std::mem::ManuallyDrop<CompositeControlHandle>,
3353    tx_id: u32,
3354}
3355
3356/// Set the the channel to be shutdown (see [`CompositeControlHandle::shutdown`])
3357/// if the responder is dropped without sending a response, so that the client
3358/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3359impl std::ops::Drop for CompositeGetRingBufferFormatsResponder {
3360    fn drop(&mut self) {
3361        self.control_handle.shutdown();
3362        // Safety: drops once, never accessed again
3363        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3364    }
3365}
3366
3367impl fdomain_client::fidl::Responder for CompositeGetRingBufferFormatsResponder {
3368    type ControlHandle = CompositeControlHandle;
3369
3370    fn control_handle(&self) -> &CompositeControlHandle {
3371        &self.control_handle
3372    }
3373
3374    fn drop_without_shutdown(mut self) {
3375        // Safety: drops once, never accessed again due to mem::forget
3376        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3377        // Prevent Drop from running (which would shut down the channel)
3378        std::mem::forget(self);
3379    }
3380}
3381
3382impl CompositeGetRingBufferFormatsResponder {
3383    /// Sends a response to the FIDL transaction.
3384    ///
3385    /// Sets the channel to shutdown if an error occurs.
3386    pub fn send(
3387        self,
3388        mut result: Result<&[SupportedFormats2], DriverError>,
3389    ) -> Result<(), fidl::Error> {
3390        let _result = self.send_raw(result);
3391        if _result.is_err() {
3392            self.control_handle.shutdown();
3393        }
3394        self.drop_without_shutdown();
3395        _result
3396    }
3397
3398    /// Similar to "send" but does not shutdown the channel if an error occurs.
3399    pub fn send_no_shutdown_on_err(
3400        self,
3401        mut result: Result<&[SupportedFormats2], DriverError>,
3402    ) -> Result<(), fidl::Error> {
3403        let _result = self.send_raw(result);
3404        self.drop_without_shutdown();
3405        _result
3406    }
3407
3408    fn send_raw(
3409        &self,
3410        mut result: Result<&[SupportedFormats2], DriverError>,
3411    ) -> Result<(), fidl::Error> {
3412        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
3413            CompositeGetRingBufferFormatsResponse,
3414            DriverError,
3415        >>(
3416            fidl::encoding::FlexibleResult::new(
3417                result.map(|ring_buffer_formats| (ring_buffer_formats,)),
3418            ),
3419            self.tx_id,
3420            0x1d89b701b6816ac4,
3421            fidl::encoding::DynamicFlags::FLEXIBLE,
3422        )
3423    }
3424}
3425
3426#[must_use = "FIDL methods require a response to be sent"]
3427#[derive(Debug)]
3428pub struct CompositeCreateRingBufferResponder {
3429    control_handle: std::mem::ManuallyDrop<CompositeControlHandle>,
3430    tx_id: u32,
3431}
3432
3433/// Set the the channel to be shutdown (see [`CompositeControlHandle::shutdown`])
3434/// if the responder is dropped without sending a response, so that the client
3435/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3436impl std::ops::Drop for CompositeCreateRingBufferResponder {
3437    fn drop(&mut self) {
3438        self.control_handle.shutdown();
3439        // Safety: drops once, never accessed again
3440        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3441    }
3442}
3443
3444impl fdomain_client::fidl::Responder for CompositeCreateRingBufferResponder {
3445    type ControlHandle = CompositeControlHandle;
3446
3447    fn control_handle(&self) -> &CompositeControlHandle {
3448        &self.control_handle
3449    }
3450
3451    fn drop_without_shutdown(mut self) {
3452        // Safety: drops once, never accessed again due to mem::forget
3453        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3454        // Prevent Drop from running (which would shut down the channel)
3455        std::mem::forget(self);
3456    }
3457}
3458
3459impl CompositeCreateRingBufferResponder {
3460    /// Sends a response to the FIDL transaction.
3461    ///
3462    /// Sets the channel to shutdown if an error occurs.
3463    pub fn send(self, mut result: Result<(), DriverError>) -> Result<(), fidl::Error> {
3464        let _result = self.send_raw(result);
3465        if _result.is_err() {
3466            self.control_handle.shutdown();
3467        }
3468        self.drop_without_shutdown();
3469        _result
3470    }
3471
3472    /// Similar to "send" but does not shutdown the channel if an error occurs.
3473    pub fn send_no_shutdown_on_err(
3474        self,
3475        mut result: Result<(), DriverError>,
3476    ) -> Result<(), fidl::Error> {
3477        let _result = self.send_raw(result);
3478        self.drop_without_shutdown();
3479        _result
3480    }
3481
3482    fn send_raw(&self, mut result: Result<(), DriverError>) -> Result<(), fidl::Error> {
3483        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
3484            fidl::encoding::EmptyStruct,
3485            DriverError,
3486        >>(
3487            fidl::encoding::FlexibleResult::new(result),
3488            self.tx_id,
3489            0x28c5685f85262033,
3490            fidl::encoding::DynamicFlags::FLEXIBLE,
3491        )
3492    }
3493}
3494
3495#[must_use = "FIDL methods require a response to be sent"]
3496#[derive(Debug)]
3497pub struct CompositeGetDaiFormatsResponder {
3498    control_handle: std::mem::ManuallyDrop<CompositeControlHandle>,
3499    tx_id: u32,
3500}
3501
3502/// Set the the channel to be shutdown (see [`CompositeControlHandle::shutdown`])
3503/// if the responder is dropped without sending a response, so that the client
3504/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3505impl std::ops::Drop for CompositeGetDaiFormatsResponder {
3506    fn drop(&mut self) {
3507        self.control_handle.shutdown();
3508        // Safety: drops once, never accessed again
3509        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3510    }
3511}
3512
3513impl fdomain_client::fidl::Responder for CompositeGetDaiFormatsResponder {
3514    type ControlHandle = CompositeControlHandle;
3515
3516    fn control_handle(&self) -> &CompositeControlHandle {
3517        &self.control_handle
3518    }
3519
3520    fn drop_without_shutdown(mut self) {
3521        // Safety: drops once, never accessed again due to mem::forget
3522        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3523        // Prevent Drop from running (which would shut down the channel)
3524        std::mem::forget(self);
3525    }
3526}
3527
3528impl CompositeGetDaiFormatsResponder {
3529    /// Sends a response to the FIDL transaction.
3530    ///
3531    /// Sets the channel to shutdown if an error occurs.
3532    pub fn send(
3533        self,
3534        mut result: Result<&[DaiSupportedFormats], DriverError>,
3535    ) -> Result<(), fidl::Error> {
3536        let _result = self.send_raw(result);
3537        if _result.is_err() {
3538            self.control_handle.shutdown();
3539        }
3540        self.drop_without_shutdown();
3541        _result
3542    }
3543
3544    /// Similar to "send" but does not shutdown the channel if an error occurs.
3545    pub fn send_no_shutdown_on_err(
3546        self,
3547        mut result: Result<&[DaiSupportedFormats], DriverError>,
3548    ) -> Result<(), fidl::Error> {
3549        let _result = self.send_raw(result);
3550        self.drop_without_shutdown();
3551        _result
3552    }
3553
3554    fn send_raw(
3555        &self,
3556        mut result: Result<&[DaiSupportedFormats], DriverError>,
3557    ) -> Result<(), fidl::Error> {
3558        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
3559            CompositeGetDaiFormatsResponse,
3560            DriverError,
3561        >>(
3562            fidl::encoding::FlexibleResult::new(result.map(|dai_formats| (dai_formats,))),
3563            self.tx_id,
3564            0x3cbeaed59c8f69b,
3565            fidl::encoding::DynamicFlags::FLEXIBLE,
3566        )
3567    }
3568}
3569
3570#[must_use = "FIDL methods require a response to be sent"]
3571#[derive(Debug)]
3572pub struct CompositeSetDaiFormatResponder {
3573    control_handle: std::mem::ManuallyDrop<CompositeControlHandle>,
3574    tx_id: u32,
3575}
3576
3577/// Set the the channel to be shutdown (see [`CompositeControlHandle::shutdown`])
3578/// if the responder is dropped without sending a response, so that the client
3579/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3580impl std::ops::Drop for CompositeSetDaiFormatResponder {
3581    fn drop(&mut self) {
3582        self.control_handle.shutdown();
3583        // Safety: drops once, never accessed again
3584        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3585    }
3586}
3587
3588impl fdomain_client::fidl::Responder for CompositeSetDaiFormatResponder {
3589    type ControlHandle = CompositeControlHandle;
3590
3591    fn control_handle(&self) -> &CompositeControlHandle {
3592        &self.control_handle
3593    }
3594
3595    fn drop_without_shutdown(mut self) {
3596        // Safety: drops once, never accessed again due to mem::forget
3597        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3598        // Prevent Drop from running (which would shut down the channel)
3599        std::mem::forget(self);
3600    }
3601}
3602
3603impl CompositeSetDaiFormatResponder {
3604    /// Sends a response to the FIDL transaction.
3605    ///
3606    /// Sets the channel to shutdown if an error occurs.
3607    pub fn send(self, mut result: Result<(), DriverError>) -> Result<(), fidl::Error> {
3608        let _result = self.send_raw(result);
3609        if _result.is_err() {
3610            self.control_handle.shutdown();
3611        }
3612        self.drop_without_shutdown();
3613        _result
3614    }
3615
3616    /// Similar to "send" but does not shutdown the channel if an error occurs.
3617    pub fn send_no_shutdown_on_err(
3618        self,
3619        mut result: Result<(), DriverError>,
3620    ) -> Result<(), fidl::Error> {
3621        let _result = self.send_raw(result);
3622        self.drop_without_shutdown();
3623        _result
3624    }
3625
3626    fn send_raw(&self, mut result: Result<(), DriverError>) -> Result<(), fidl::Error> {
3627        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
3628            fidl::encoding::EmptyStruct,
3629            DriverError,
3630        >>(
3631            fidl::encoding::FlexibleResult::new(result),
3632            self.tx_id,
3633            0x155acf5cc0dc8a84,
3634            fidl::encoding::DynamicFlags::FLEXIBLE,
3635        )
3636    }
3637}
3638
3639#[must_use = "FIDL methods require a response to be sent"]
3640#[derive(Debug)]
3641pub struct CompositeGetPacketStreamFormatsResponder {
3642    control_handle: std::mem::ManuallyDrop<CompositeControlHandle>,
3643    tx_id: u32,
3644}
3645
3646/// Set the the channel to be shutdown (see [`CompositeControlHandle::shutdown`])
3647/// if the responder is dropped without sending a response, so that the client
3648/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3649impl std::ops::Drop for CompositeGetPacketStreamFormatsResponder {
3650    fn drop(&mut self) {
3651        self.control_handle.shutdown();
3652        // Safety: drops once, never accessed again
3653        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3654    }
3655}
3656
3657impl fdomain_client::fidl::Responder for CompositeGetPacketStreamFormatsResponder {
3658    type ControlHandle = CompositeControlHandle;
3659
3660    fn control_handle(&self) -> &CompositeControlHandle {
3661        &self.control_handle
3662    }
3663
3664    fn drop_without_shutdown(mut self) {
3665        // Safety: drops once, never accessed again due to mem::forget
3666        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3667        // Prevent Drop from running (which would shut down the channel)
3668        std::mem::forget(self);
3669    }
3670}
3671
3672impl CompositeGetPacketStreamFormatsResponder {
3673    /// Sends a response to the FIDL transaction.
3674    ///
3675    /// Sets the channel to shutdown if an error occurs.
3676    pub fn send(
3677        self,
3678        mut result: Result<&[SupportedFormats2], DriverError>,
3679    ) -> Result<(), fidl::Error> {
3680        let _result = self.send_raw(result);
3681        if _result.is_err() {
3682            self.control_handle.shutdown();
3683        }
3684        self.drop_without_shutdown();
3685        _result
3686    }
3687
3688    /// Similar to "send" but does not shutdown the channel if an error occurs.
3689    pub fn send_no_shutdown_on_err(
3690        self,
3691        mut result: Result<&[SupportedFormats2], DriverError>,
3692    ) -> Result<(), fidl::Error> {
3693        let _result = self.send_raw(result);
3694        self.drop_without_shutdown();
3695        _result
3696    }
3697
3698    fn send_raw(
3699        &self,
3700        mut result: Result<&[SupportedFormats2], DriverError>,
3701    ) -> Result<(), fidl::Error> {
3702        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
3703            CompositeGetPacketStreamFormatsResponse,
3704            DriverError,
3705        >>(
3706            fidl::encoding::FlexibleResult::new(
3707                result.map(|packet_stream_formats| (packet_stream_formats,)),
3708            ),
3709            self.tx_id,
3710            0x73cc47c6ad39bca7,
3711            fidl::encoding::DynamicFlags::FLEXIBLE,
3712        )
3713    }
3714}
3715
3716#[must_use = "FIDL methods require a response to be sent"]
3717#[derive(Debug)]
3718pub struct CompositeCreatePacketStreamResponder {
3719    control_handle: std::mem::ManuallyDrop<CompositeControlHandle>,
3720    tx_id: u32,
3721}
3722
3723/// Set the the channel to be shutdown (see [`CompositeControlHandle::shutdown`])
3724/// if the responder is dropped without sending a response, so that the client
3725/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3726impl std::ops::Drop for CompositeCreatePacketStreamResponder {
3727    fn drop(&mut self) {
3728        self.control_handle.shutdown();
3729        // Safety: drops once, never accessed again
3730        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3731    }
3732}
3733
3734impl fdomain_client::fidl::Responder for CompositeCreatePacketStreamResponder {
3735    type ControlHandle = CompositeControlHandle;
3736
3737    fn control_handle(&self) -> &CompositeControlHandle {
3738        &self.control_handle
3739    }
3740
3741    fn drop_without_shutdown(mut self) {
3742        // Safety: drops once, never accessed again due to mem::forget
3743        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3744        // Prevent Drop from running (which would shut down the channel)
3745        std::mem::forget(self);
3746    }
3747}
3748
3749impl CompositeCreatePacketStreamResponder {
3750    /// Sends a response to the FIDL transaction.
3751    ///
3752    /// Sets the channel to shutdown if an error occurs.
3753    pub fn send(self, mut result: Result<(), DriverError>) -> Result<(), fidl::Error> {
3754        let _result = self.send_raw(result);
3755        if _result.is_err() {
3756            self.control_handle.shutdown();
3757        }
3758        self.drop_without_shutdown();
3759        _result
3760    }
3761
3762    /// Similar to "send" but does not shutdown the channel if an error occurs.
3763    pub fn send_no_shutdown_on_err(
3764        self,
3765        mut result: Result<(), DriverError>,
3766    ) -> Result<(), fidl::Error> {
3767        let _result = self.send_raw(result);
3768        self.drop_without_shutdown();
3769        _result
3770    }
3771
3772    fn send_raw(&self, mut result: Result<(), DriverError>) -> Result<(), fidl::Error> {
3773        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
3774            fidl::encoding::EmptyStruct,
3775            DriverError,
3776        >>(
3777            fidl::encoding::FlexibleResult::new(result),
3778            self.tx_id,
3779            0x50e8902b756c707c,
3780            fidl::encoding::DynamicFlags::FLEXIBLE,
3781        )
3782    }
3783}
3784
3785#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
3786pub struct CompositeConnectorMarker;
3787
3788impl fdomain_client::fidl::ProtocolMarker for CompositeConnectorMarker {
3789    type Proxy = CompositeConnectorProxy;
3790    type RequestStream = CompositeConnectorRequestStream;
3791
3792    const DEBUG_NAME: &'static str = "(anonymous) CompositeConnector";
3793}
3794
3795pub trait CompositeConnectorProxyInterface: Send + Sync {
3796    fn r#connect(
3797        &self,
3798        composite_protocol: fdomain_client::fidl::ServerEnd<CompositeMarker>,
3799    ) -> Result<(), fidl::Error>;
3800}
3801
3802#[derive(Debug, Clone)]
3803pub struct CompositeConnectorProxy {
3804    client: fidl::client::Client<fdomain_client::fidl::FDomainResourceDialect>,
3805}
3806
3807impl fdomain_client::fidl::Proxy for CompositeConnectorProxy {
3808    type Protocol = CompositeConnectorMarker;
3809
3810    fn from_channel(inner: fdomain_client::Channel) -> Self {
3811        Self::new(inner)
3812    }
3813
3814    fn into_channel(self) -> Result<fdomain_client::Channel, Self> {
3815        self.client.into_channel().map_err(|client| Self { client })
3816    }
3817
3818    fn as_channel(&self) -> &fdomain_client::Channel {
3819        self.client.as_channel()
3820    }
3821}
3822
3823impl CompositeConnectorProxy {
3824    /// Create a new Proxy for fuchsia.hardware.audio/CompositeConnector.
3825    pub fn new(channel: fdomain_client::Channel) -> Self {
3826        let protocol_name =
3827            <CompositeConnectorMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME;
3828        Self { client: fidl::client::Client::new(channel, protocol_name) }
3829    }
3830
3831    /// Get a Stream of events from the remote end of the protocol.
3832    ///
3833    /// # Panics
3834    ///
3835    /// Panics if the event stream was already taken.
3836    pub fn take_event_stream(&self) -> CompositeConnectorEventStream {
3837        CompositeConnectorEventStream { event_receiver: self.client.take_event_receiver() }
3838    }
3839
3840    /// Connect to a `Device` protocol.
3841    /// This method allows a component to serve FIDL outside the devhost's control.
3842    pub fn r#connect(
3843        &self,
3844        mut composite_protocol: fdomain_client::fidl::ServerEnd<CompositeMarker>,
3845    ) -> Result<(), fidl::Error> {
3846        CompositeConnectorProxyInterface::r#connect(self, composite_protocol)
3847    }
3848}
3849
3850impl CompositeConnectorProxyInterface for CompositeConnectorProxy {
3851    fn r#connect(
3852        &self,
3853        mut composite_protocol: fdomain_client::fidl::ServerEnd<CompositeMarker>,
3854    ) -> Result<(), fidl::Error> {
3855        self.client.send::<CompositeConnectorConnectRequest>(
3856            (composite_protocol,),
3857            0x7ee557529079e466,
3858            fidl::encoding::DynamicFlags::empty(),
3859        )
3860    }
3861}
3862
3863pub struct CompositeConnectorEventStream {
3864    event_receiver: fidl::client::EventReceiver<fdomain_client::fidl::FDomainResourceDialect>,
3865}
3866
3867impl std::marker::Unpin for CompositeConnectorEventStream {}
3868
3869impl futures::stream::FusedStream for CompositeConnectorEventStream {
3870    fn is_terminated(&self) -> bool {
3871        self.event_receiver.is_terminated()
3872    }
3873}
3874
3875impl futures::Stream for CompositeConnectorEventStream {
3876    type Item = Result<CompositeConnectorEvent, fidl::Error>;
3877
3878    fn poll_next(
3879        mut self: std::pin::Pin<&mut Self>,
3880        cx: &mut std::task::Context<'_>,
3881    ) -> std::task::Poll<Option<Self::Item>> {
3882        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
3883            &mut self.event_receiver,
3884            cx
3885        )?) {
3886            Some(buf) => std::task::Poll::Ready(Some(CompositeConnectorEvent::decode(buf))),
3887            None => std::task::Poll::Ready(None),
3888        }
3889    }
3890}
3891
3892#[derive(Debug)]
3893pub enum CompositeConnectorEvent {}
3894
3895impl CompositeConnectorEvent {
3896    /// Decodes a message buffer as a [`CompositeConnectorEvent`].
3897    fn decode(
3898        mut buf: <fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
3899    ) -> Result<CompositeConnectorEvent, fidl::Error> {
3900        let (bytes, _handles) = buf.split_mut();
3901        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3902        debug_assert_eq!(tx_header.tx_id, 0);
3903        match tx_header.ordinal {
3904            _ => Err(fidl::Error::UnknownOrdinal {
3905                ordinal: tx_header.ordinal,
3906                protocol_name:
3907                    <CompositeConnectorMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
3908            }),
3909        }
3910    }
3911}
3912
3913/// A Stream of incoming requests for fuchsia.hardware.audio/CompositeConnector.
3914pub struct CompositeConnectorRequestStream {
3915    inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
3916    is_terminated: bool,
3917}
3918
3919impl std::marker::Unpin for CompositeConnectorRequestStream {}
3920
3921impl futures::stream::FusedStream for CompositeConnectorRequestStream {
3922    fn is_terminated(&self) -> bool {
3923        self.is_terminated
3924    }
3925}
3926
3927impl fdomain_client::fidl::RequestStream for CompositeConnectorRequestStream {
3928    type Protocol = CompositeConnectorMarker;
3929    type ControlHandle = CompositeConnectorControlHandle;
3930
3931    fn from_channel(channel: fdomain_client::Channel) -> Self {
3932        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
3933    }
3934
3935    fn control_handle(&self) -> Self::ControlHandle {
3936        CompositeConnectorControlHandle { inner: self.inner.clone() }
3937    }
3938
3939    fn into_inner(
3940        self,
3941    ) -> (::std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>, bool)
3942    {
3943        (self.inner, self.is_terminated)
3944    }
3945
3946    fn from_inner(
3947        inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
3948        is_terminated: bool,
3949    ) -> Self {
3950        Self { inner, is_terminated }
3951    }
3952}
3953
3954impl futures::Stream for CompositeConnectorRequestStream {
3955    type Item = Result<CompositeConnectorRequest, fidl::Error>;
3956
3957    fn poll_next(
3958        mut self: std::pin::Pin<&mut Self>,
3959        cx: &mut std::task::Context<'_>,
3960    ) -> std::task::Poll<Option<Self::Item>> {
3961        let this = &mut *self;
3962        if this.inner.check_shutdown(cx) {
3963            this.is_terminated = true;
3964            return std::task::Poll::Ready(None);
3965        }
3966        if this.is_terminated {
3967            panic!("polled CompositeConnectorRequestStream after completion");
3968        }
3969        fidl::encoding::with_tls_decode_buf::<_, fdomain_client::fidl::FDomainResourceDialect>(
3970            |bytes, handles| {
3971                match this.inner.channel().read_etc(cx, bytes, handles) {
3972                    std::task::Poll::Ready(Ok(())) => {}
3973                    std::task::Poll::Pending => return std::task::Poll::Pending,
3974                    std::task::Poll::Ready(Err(None)) => {
3975                        this.is_terminated = true;
3976                        return std::task::Poll::Ready(None);
3977                    }
3978                    std::task::Poll::Ready(Err(Some(e))) => {
3979                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
3980                            e.into(),
3981                        ))));
3982                    }
3983                }
3984
3985                // A message has been received from the channel
3986                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3987
3988                std::task::Poll::Ready(Some(match header.ordinal {
3989                0x7ee557529079e466 => {
3990                    header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3991                    let mut req = fidl::new_empty!(CompositeConnectorConnectRequest, fdomain_client::fidl::FDomainResourceDialect);
3992                    fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<CompositeConnectorConnectRequest>(&header, _body_bytes, handles, &mut req)?;
3993                    let control_handle = CompositeConnectorControlHandle {
3994                        inner: this.inner.clone(),
3995                    };
3996                    Ok(CompositeConnectorRequest::Connect {composite_protocol: req.composite_protocol,
3997
3998                        control_handle,
3999                    })
4000                }
4001                _ => Err(fidl::Error::UnknownOrdinal {
4002                    ordinal: header.ordinal,
4003                    protocol_name: <CompositeConnectorMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
4004                }),
4005            }))
4006            },
4007        )
4008    }
4009}
4010
4011/// For an overview see
4012/// [Audio Composite Devices](https://fuchsia.dev/fuchsia-src/development/audio/drivers/composite.md).
4013#[derive(Debug)]
4014pub enum CompositeConnectorRequest {
4015    /// Connect to a `Device` protocol.
4016    /// This method allows a component to serve FIDL outside the devhost's control.
4017    Connect {
4018        composite_protocol: fdomain_client::fidl::ServerEnd<CompositeMarker>,
4019        control_handle: CompositeConnectorControlHandle,
4020    },
4021}
4022
4023impl CompositeConnectorRequest {
4024    #[allow(irrefutable_let_patterns)]
4025    pub fn into_connect(
4026        self,
4027    ) -> Option<(fdomain_client::fidl::ServerEnd<CompositeMarker>, CompositeConnectorControlHandle)>
4028    {
4029        if let CompositeConnectorRequest::Connect { composite_protocol, control_handle } = self {
4030            Some((composite_protocol, control_handle))
4031        } else {
4032            None
4033        }
4034    }
4035
4036    /// Name of the method defined in FIDL
4037    pub fn method_name(&self) -> &'static str {
4038        match *self {
4039            CompositeConnectorRequest::Connect { .. } => "connect",
4040        }
4041    }
4042}
4043
4044#[derive(Debug, Clone)]
4045pub struct CompositeConnectorControlHandle {
4046    inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
4047}
4048
4049impl CompositeConnectorControlHandle {
4050    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
4051        self.inner.shutdown_with_epitaph(status.into())
4052    }
4053}
4054
4055impl fdomain_client::fidl::ControlHandle for CompositeConnectorControlHandle {
4056    fn shutdown(&self) {
4057        self.inner.shutdown()
4058    }
4059
4060    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
4061        self.inner.shutdown_with_epitaph(status)
4062    }
4063
4064    fn is_closed(&self) -> bool {
4065        self.inner.channel().is_closed()
4066    }
4067    fn on_closed(&self) -> fdomain_client::OnFDomainSignals {
4068        self.inner.channel().on_closed()
4069    }
4070}
4071
4072impl CompositeConnectorControlHandle {}
4073
4074#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
4075pub struct DaiMarker;
4076
4077impl fdomain_client::fidl::ProtocolMarker for DaiMarker {
4078    type Proxy = DaiProxy;
4079    type RequestStream = DaiRequestStream;
4080
4081    const DEBUG_NAME: &'static str = "(anonymous) Dai";
4082}
4083pub type DaiGetDaiFormatsResult = Result<Vec<DaiSupportedFormats>, i32>;
4084pub type DaiGetRingBufferFormatsResult = Result<Vec<SupportedFormats>, i32>;
4085
4086pub trait DaiProxyInterface: Send + Sync {
4087    type GetHealthStateResponseFut: std::future::Future<Output = Result<HealthState, fidl::Error>>
4088        + Send;
4089    fn r#get_health_state(&self) -> Self::GetHealthStateResponseFut;
4090    fn r#signal_processing_connect(
4091        &self,
4092        protocol: fdomain_client::fidl::ServerEnd<
4093            fdomain_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
4094        >,
4095    ) -> Result<(), fidl::Error>;
4096    type ResetResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
4097    fn r#reset(&self) -> Self::ResetResponseFut;
4098    type GetPropertiesResponseFut: std::future::Future<Output = Result<DaiProperties, fidl::Error>>
4099        + Send;
4100    fn r#get_properties(&self) -> Self::GetPropertiesResponseFut;
4101    type GetDaiFormatsResponseFut: std::future::Future<Output = Result<DaiGetDaiFormatsResult, fidl::Error>>
4102        + Send;
4103    fn r#get_dai_formats(&self) -> Self::GetDaiFormatsResponseFut;
4104    type GetRingBufferFormatsResponseFut: std::future::Future<Output = Result<DaiGetRingBufferFormatsResult, fidl::Error>>
4105        + Send;
4106    fn r#get_ring_buffer_formats(&self) -> Self::GetRingBufferFormatsResponseFut;
4107    fn r#create_ring_buffer(
4108        &self,
4109        dai_format: &DaiFormat,
4110        ring_buffer_format: &Format,
4111        ring_buffer: fdomain_client::fidl::ServerEnd<RingBufferMarker>,
4112    ) -> Result<(), fidl::Error>;
4113}
4114
4115#[derive(Debug, Clone)]
4116pub struct DaiProxy {
4117    client: fidl::client::Client<fdomain_client::fidl::FDomainResourceDialect>,
4118}
4119
4120impl fdomain_client::fidl::Proxy for DaiProxy {
4121    type Protocol = DaiMarker;
4122
4123    fn from_channel(inner: fdomain_client::Channel) -> Self {
4124        Self::new(inner)
4125    }
4126
4127    fn into_channel(self) -> Result<fdomain_client::Channel, Self> {
4128        self.client.into_channel().map_err(|client| Self { client })
4129    }
4130
4131    fn as_channel(&self) -> &fdomain_client::Channel {
4132        self.client.as_channel()
4133    }
4134}
4135
4136impl DaiProxy {
4137    /// Create a new Proxy for fuchsia.hardware.audio/Dai.
4138    pub fn new(channel: fdomain_client::Channel) -> Self {
4139        let protocol_name = <DaiMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME;
4140        Self { client: fidl::client::Client::new(channel, protocol_name) }
4141    }
4142
4143    /// Get a Stream of events from the remote end of the protocol.
4144    ///
4145    /// # Panics
4146    ///
4147    /// Panics if the event stream was already taken.
4148    pub fn take_event_stream(&self) -> DaiEventStream {
4149        DaiEventStream { event_receiver: self.client.take_event_receiver() }
4150    }
4151
4152    /// Retrieves top level health state.
4153    /// A driver not responding promptly can be used as an indication of an unhealthy driver.
4154    pub fn r#get_health_state(
4155        &self,
4156    ) -> fidl::client::QueryResponseFut<HealthState, fdomain_client::fidl::FDomainResourceDialect>
4157    {
4158        DaiProxyInterface::r#get_health_state(self)
4159    }
4160
4161    /// Connect to a `SignalProcessing` protocol.
4162    /// Multiple connections may be supported, if a new connection request is not supported, i.e.
4163    /// the maximum number of connections have already been created, for instance one, then the
4164    /// `protocol` channel (not the channel upon which `SignalProcessingConnect` is being called)
4165    /// will be closed with a `ZX_ERR_ALREADY_BOUND` epitaph.
4166    /// If signal processing is not supported at all, then the `protocol` channel (again, not the
4167    /// channel upon which `SignalProcessingConnect` is being called) will be closed with a
4168    /// `ZX_ERR_NOT_SUPPORTED` epitaph.
4169    /// This method is named `SignalProcessingConnect` instead of `Connect` because this protocol
4170    /// is intended to be composed, and hence the more verbose name allows differentiation and
4171    /// improved clarity.
4172    pub fn r#signal_processing_connect(
4173        &self,
4174        mut protocol: fdomain_client::fidl::ServerEnd<
4175            fdomain_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
4176        >,
4177    ) -> Result<(), fidl::Error> {
4178        DaiProxyInterface::r#signal_processing_connect(self, protocol)
4179    }
4180
4181    /// Resets the DAI HW. The `ring_buffer` channel obtained via `CreateRingBuffer` may be closed
4182    /// by the driver, in this case the client needs to obtain a new `ring_buffer`.
4183    /// `Reset` returns when the reset is completed. If the driver can't successfully reset the HW,
4184    /// it will close the DAI protocol channel, in this case the client may obtain a new DAI
4185    /// protocol channel and retry.
4186    pub fn r#reset(
4187        &self,
4188    ) -> fidl::client::QueryResponseFut<(), fdomain_client::fidl::FDomainResourceDialect> {
4189        DaiProxyInterface::r#reset(self)
4190    }
4191
4192    /// Retrieves top level static properties.
4193    pub fn r#get_properties(
4194        &self,
4195    ) -> fidl::client::QueryResponseFut<DaiProperties, fdomain_client::fidl::FDomainResourceDialect>
4196    {
4197        DaiProxyInterface::r#get_properties(self)
4198    }
4199
4200    /// Retrieves the DAI formats supported by the DAI, if not available at the time the DAI
4201    /// may reply with an error status and the client may retry at a later time.
4202    /// Retrieving multiple `DaiSupportedFormats` allows for cases where exclusive combinations of
4203    /// the parameters in SupportedFormats may be supported.
4204    pub fn r#get_dai_formats(
4205        &self,
4206    ) -> fidl::client::QueryResponseFut<
4207        DaiGetDaiFormatsResult,
4208        fdomain_client::fidl::FDomainResourceDialect,
4209    > {
4210        DaiProxyInterface::r#get_dai_formats(self)
4211    }
4212
4213    /// Retrieves the ring buffer formats supported by the DAI, if not available at the time the DAI
4214    /// may reply with an error status and the client may retry at a later time.
4215    /// Retrieving multiple `SupportedFormats` allows for cases where exclusive combinations of
4216    /// the parameters in `SupportedFormats` may be supported.
4217    pub fn r#get_ring_buffer_formats(
4218        &self,
4219    ) -> fidl::client::QueryResponseFut<
4220        DaiGetRingBufferFormatsResult,
4221        fdomain_client::fidl::FDomainResourceDialect,
4222    > {
4223        DaiProxyInterface::r#get_ring_buffer_formats(self)
4224    }
4225
4226    /// `CreateRingBuffer` is sent by clients to select both a DAI format and a ring buffer format
4227    /// based on information that the driver provides in `GetDaiFormats` and `GetRingBufferFormats`,
4228    /// what is supported by the client, and any other requirement. The `ring_buffer` channel is
4229    /// used to control the audio buffer, if a previous ring buffer channel had been established and
4230    /// was still active, the driver must close that (ring buffer) channel and make every attempt to
4231    /// gracefully quiesce any on-going streaming operations in the process.
4232    pub fn r#create_ring_buffer(
4233        &self,
4234        mut dai_format: &DaiFormat,
4235        mut ring_buffer_format: &Format,
4236        mut ring_buffer: fdomain_client::fidl::ServerEnd<RingBufferMarker>,
4237    ) -> Result<(), fidl::Error> {
4238        DaiProxyInterface::r#create_ring_buffer(self, dai_format, ring_buffer_format, ring_buffer)
4239    }
4240}
4241
4242impl DaiProxyInterface for DaiProxy {
4243    type GetHealthStateResponseFut =
4244        fidl::client::QueryResponseFut<HealthState, fdomain_client::fidl::FDomainResourceDialect>;
4245    fn r#get_health_state(&self) -> Self::GetHealthStateResponseFut {
4246        fn _decode(
4247            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4248        ) -> Result<HealthState, fidl::Error> {
4249            let _response = fidl::client::decode_transaction_body::<
4250                HealthGetHealthStateResponse,
4251                fdomain_client::fidl::FDomainResourceDialect,
4252                0x4e146d6bca733a84,
4253            >(_buf?)?;
4254            Ok(_response.state)
4255        }
4256        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, HealthState>(
4257            (),
4258            0x4e146d6bca733a84,
4259            fidl::encoding::DynamicFlags::empty(),
4260            _decode,
4261        )
4262    }
4263
4264    fn r#signal_processing_connect(
4265        &self,
4266        mut protocol: fdomain_client::fidl::ServerEnd<
4267            fdomain_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
4268        >,
4269    ) -> Result<(), fidl::Error> {
4270        self.client.send::<fdomain_fuchsia_hardware_audio_signalprocessing::ConnectorSignalProcessingConnectRequest>(
4271            (protocol,),
4272            0xa81907ce6066295,
4273            fidl::encoding::DynamicFlags::empty(),
4274        )
4275    }
4276
4277    type ResetResponseFut =
4278        fidl::client::QueryResponseFut<(), fdomain_client::fidl::FDomainResourceDialect>;
4279    fn r#reset(&self) -> Self::ResetResponseFut {
4280        fn _decode(
4281            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4282        ) -> Result<(), fidl::Error> {
4283            let _response = fidl::client::decode_transaction_body::<
4284                fidl::encoding::EmptyPayload,
4285                fdomain_client::fidl::FDomainResourceDialect,
4286                0x69e5fa9fa2f78c14,
4287            >(_buf?)?;
4288            Ok(_response)
4289        }
4290        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ()>(
4291            (),
4292            0x69e5fa9fa2f78c14,
4293            fidl::encoding::DynamicFlags::empty(),
4294            _decode,
4295        )
4296    }
4297
4298    type GetPropertiesResponseFut =
4299        fidl::client::QueryResponseFut<DaiProperties, fdomain_client::fidl::FDomainResourceDialect>;
4300    fn r#get_properties(&self) -> Self::GetPropertiesResponseFut {
4301        fn _decode(
4302            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4303        ) -> Result<DaiProperties, fidl::Error> {
4304            let _response = fidl::client::decode_transaction_body::<
4305                DaiGetPropertiesResponse,
4306                fdomain_client::fidl::FDomainResourceDialect,
4307                0x2c25a1a66149510b,
4308            >(_buf?)?;
4309            Ok(_response.properties)
4310        }
4311        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, DaiProperties>(
4312            (),
4313            0x2c25a1a66149510b,
4314            fidl::encoding::DynamicFlags::empty(),
4315            _decode,
4316        )
4317    }
4318
4319    type GetDaiFormatsResponseFut = fidl::client::QueryResponseFut<
4320        DaiGetDaiFormatsResult,
4321        fdomain_client::fidl::FDomainResourceDialect,
4322    >;
4323    fn r#get_dai_formats(&self) -> Self::GetDaiFormatsResponseFut {
4324        fn _decode(
4325            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4326        ) -> Result<DaiGetDaiFormatsResult, fidl::Error> {
4327            let _response = fidl::client::decode_transaction_body::<
4328                fidl::encoding::ResultType<DaiGetDaiFormatsResponse, i32>,
4329                fdomain_client::fidl::FDomainResourceDialect,
4330                0x1eb37b0cddf79d69,
4331            >(_buf?)?;
4332            Ok(_response.map(|x| x.dai_formats))
4333        }
4334        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, DaiGetDaiFormatsResult>(
4335            (),
4336            0x1eb37b0cddf79d69,
4337            fidl::encoding::DynamicFlags::empty(),
4338            _decode,
4339        )
4340    }
4341
4342    type GetRingBufferFormatsResponseFut = fidl::client::QueryResponseFut<
4343        DaiGetRingBufferFormatsResult,
4344        fdomain_client::fidl::FDomainResourceDialect,
4345    >;
4346    fn r#get_ring_buffer_formats(&self) -> Self::GetRingBufferFormatsResponseFut {
4347        fn _decode(
4348            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4349        ) -> Result<DaiGetRingBufferFormatsResult, fidl::Error> {
4350            let _response = fidl::client::decode_transaction_body::<
4351                fidl::encoding::ResultType<DaiGetRingBufferFormatsResponse, i32>,
4352                fdomain_client::fidl::FDomainResourceDialect,
4353                0x760371081d8c92e4,
4354            >(_buf?)?;
4355            Ok(_response.map(|x| x.ring_buffer_formats))
4356        }
4357        self.client
4358            .send_query_and_decode::<fidl::encoding::EmptyPayload, DaiGetRingBufferFormatsResult>(
4359                (),
4360                0x760371081d8c92e4,
4361                fidl::encoding::DynamicFlags::empty(),
4362                _decode,
4363            )
4364    }
4365
4366    fn r#create_ring_buffer(
4367        &self,
4368        mut dai_format: &DaiFormat,
4369        mut ring_buffer_format: &Format,
4370        mut ring_buffer: fdomain_client::fidl::ServerEnd<RingBufferMarker>,
4371    ) -> Result<(), fidl::Error> {
4372        self.client.send::<DaiCreateRingBufferRequest>(
4373            (dai_format, ring_buffer_format, ring_buffer),
4374            0x5af9760589a75257,
4375            fidl::encoding::DynamicFlags::empty(),
4376        )
4377    }
4378}
4379
4380pub struct DaiEventStream {
4381    event_receiver: fidl::client::EventReceiver<fdomain_client::fidl::FDomainResourceDialect>,
4382}
4383
4384impl std::marker::Unpin for DaiEventStream {}
4385
4386impl futures::stream::FusedStream for DaiEventStream {
4387    fn is_terminated(&self) -> bool {
4388        self.event_receiver.is_terminated()
4389    }
4390}
4391
4392impl futures::Stream for DaiEventStream {
4393    type Item = Result<DaiEvent, fidl::Error>;
4394
4395    fn poll_next(
4396        mut self: std::pin::Pin<&mut Self>,
4397        cx: &mut std::task::Context<'_>,
4398    ) -> std::task::Poll<Option<Self::Item>> {
4399        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
4400            &mut self.event_receiver,
4401            cx
4402        )?) {
4403            Some(buf) => std::task::Poll::Ready(Some(DaiEvent::decode(buf))),
4404            None => std::task::Poll::Ready(None),
4405        }
4406    }
4407}
4408
4409#[derive(Debug)]
4410pub enum DaiEvent {}
4411
4412impl DaiEvent {
4413    /// Decodes a message buffer as a [`DaiEvent`].
4414    fn decode(
4415        mut buf: <fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
4416    ) -> Result<DaiEvent, fidl::Error> {
4417        let (bytes, _handles) = buf.split_mut();
4418        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4419        debug_assert_eq!(tx_header.tx_id, 0);
4420        match tx_header.ordinal {
4421            _ => Err(fidl::Error::UnknownOrdinal {
4422                ordinal: tx_header.ordinal,
4423                protocol_name: <DaiMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
4424            }),
4425        }
4426    }
4427}
4428
4429/// A Stream of incoming requests for fuchsia.hardware.audio/Dai.
4430pub struct DaiRequestStream {
4431    inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
4432    is_terminated: bool,
4433}
4434
4435impl std::marker::Unpin for DaiRequestStream {}
4436
4437impl futures::stream::FusedStream for DaiRequestStream {
4438    fn is_terminated(&self) -> bool {
4439        self.is_terminated
4440    }
4441}
4442
4443impl fdomain_client::fidl::RequestStream for DaiRequestStream {
4444    type Protocol = DaiMarker;
4445    type ControlHandle = DaiControlHandle;
4446
4447    fn from_channel(channel: fdomain_client::Channel) -> Self {
4448        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
4449    }
4450
4451    fn control_handle(&self) -> Self::ControlHandle {
4452        DaiControlHandle { inner: self.inner.clone() }
4453    }
4454
4455    fn into_inner(
4456        self,
4457    ) -> (::std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>, bool)
4458    {
4459        (self.inner, self.is_terminated)
4460    }
4461
4462    fn from_inner(
4463        inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
4464        is_terminated: bool,
4465    ) -> Self {
4466        Self { inner, is_terminated }
4467    }
4468}
4469
4470impl futures::Stream for DaiRequestStream {
4471    type Item = Result<DaiRequest, fidl::Error>;
4472
4473    fn poll_next(
4474        mut self: std::pin::Pin<&mut Self>,
4475        cx: &mut std::task::Context<'_>,
4476    ) -> std::task::Poll<Option<Self::Item>> {
4477        let this = &mut *self;
4478        if this.inner.check_shutdown(cx) {
4479            this.is_terminated = true;
4480            return std::task::Poll::Ready(None);
4481        }
4482        if this.is_terminated {
4483            panic!("polled DaiRequestStream after completion");
4484        }
4485        fidl::encoding::with_tls_decode_buf::<_, fdomain_client::fidl::FDomainResourceDialect>(
4486            |bytes, handles| {
4487                match this.inner.channel().read_etc(cx, bytes, handles) {
4488                    std::task::Poll::Ready(Ok(())) => {}
4489                    std::task::Poll::Pending => return std::task::Poll::Pending,
4490                    std::task::Poll::Ready(Err(None)) => {
4491                        this.is_terminated = true;
4492                        return std::task::Poll::Ready(None);
4493                    }
4494                    std::task::Poll::Ready(Err(Some(e))) => {
4495                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
4496                            e.into(),
4497                        ))));
4498                    }
4499                }
4500
4501                // A message has been received from the channel
4502                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4503
4504                std::task::Poll::Ready(Some(match header.ordinal {
4505                    0x4e146d6bca733a84 => {
4506                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4507                        let mut req = fidl::new_empty!(
4508                            fidl::encoding::EmptyPayload,
4509                            fdomain_client::fidl::FDomainResourceDialect
4510                        );
4511                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
4512                        let control_handle = DaiControlHandle { inner: this.inner.clone() };
4513                        Ok(DaiRequest::GetHealthState {
4514                            responder: DaiGetHealthStateResponder {
4515                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4516                                tx_id: header.tx_id,
4517                            },
4518                        })
4519                    }
4520                    0xa81907ce6066295 => {
4521                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4522                        let mut req = fidl::new_empty!(fdomain_fuchsia_hardware_audio_signalprocessing::ConnectorSignalProcessingConnectRequest, fdomain_client::fidl::FDomainResourceDialect);
4523                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<fdomain_fuchsia_hardware_audio_signalprocessing::ConnectorSignalProcessingConnectRequest>(&header, _body_bytes, handles, &mut req)?;
4524                        let control_handle = DaiControlHandle { inner: this.inner.clone() };
4525                        Ok(DaiRequest::SignalProcessingConnect {
4526                            protocol: req.protocol,
4527
4528                            control_handle,
4529                        })
4530                    }
4531                    0x69e5fa9fa2f78c14 => {
4532                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4533                        let mut req = fidl::new_empty!(
4534                            fidl::encoding::EmptyPayload,
4535                            fdomain_client::fidl::FDomainResourceDialect
4536                        );
4537                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
4538                        let control_handle = DaiControlHandle { inner: this.inner.clone() };
4539                        Ok(DaiRequest::Reset {
4540                            responder: DaiResetResponder {
4541                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4542                                tx_id: header.tx_id,
4543                            },
4544                        })
4545                    }
4546                    0x2c25a1a66149510b => {
4547                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4548                        let mut req = fidl::new_empty!(
4549                            fidl::encoding::EmptyPayload,
4550                            fdomain_client::fidl::FDomainResourceDialect
4551                        );
4552                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
4553                        let control_handle = DaiControlHandle { inner: this.inner.clone() };
4554                        Ok(DaiRequest::GetProperties {
4555                            responder: DaiGetPropertiesResponder {
4556                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4557                                tx_id: header.tx_id,
4558                            },
4559                        })
4560                    }
4561                    0x1eb37b0cddf79d69 => {
4562                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4563                        let mut req = fidl::new_empty!(
4564                            fidl::encoding::EmptyPayload,
4565                            fdomain_client::fidl::FDomainResourceDialect
4566                        );
4567                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
4568                        let control_handle = DaiControlHandle { inner: this.inner.clone() };
4569                        Ok(DaiRequest::GetDaiFormats {
4570                            responder: DaiGetDaiFormatsResponder {
4571                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4572                                tx_id: header.tx_id,
4573                            },
4574                        })
4575                    }
4576                    0x760371081d8c92e4 => {
4577                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4578                        let mut req = fidl::new_empty!(
4579                            fidl::encoding::EmptyPayload,
4580                            fdomain_client::fidl::FDomainResourceDialect
4581                        );
4582                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
4583                        let control_handle = DaiControlHandle { inner: this.inner.clone() };
4584                        Ok(DaiRequest::GetRingBufferFormats {
4585                            responder: DaiGetRingBufferFormatsResponder {
4586                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4587                                tx_id: header.tx_id,
4588                            },
4589                        })
4590                    }
4591                    0x5af9760589a75257 => {
4592                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4593                        let mut req = fidl::new_empty!(
4594                            DaiCreateRingBufferRequest,
4595                            fdomain_client::fidl::FDomainResourceDialect
4596                        );
4597                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<DaiCreateRingBufferRequest>(&header, _body_bytes, handles, &mut req)?;
4598                        let control_handle = DaiControlHandle { inner: this.inner.clone() };
4599                        Ok(DaiRequest::CreateRingBuffer {
4600                            dai_format: req.dai_format,
4601                            ring_buffer_format: req.ring_buffer_format,
4602                            ring_buffer: req.ring_buffer,
4603
4604                            control_handle,
4605                        })
4606                    }
4607                    _ => Err(fidl::Error::UnknownOrdinal {
4608                        ordinal: header.ordinal,
4609                        protocol_name:
4610                            <DaiMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
4611                    }),
4612                }))
4613            },
4614        )
4615    }
4616}
4617
4618/// For an overview see
4619/// [Digital Audio Interface](https://fuchsia.dev/fuchsia-src/concepts/drivers/driver_architectures/audio_drivers/audio_dai).
4620/// # Deprecation
4621///
4622/// Not supported anymore, instead use an
4623/// [Audio Composite](https://fuchsia.dev/fuchsia-src/development/audio/drivers/composite)
4624/// with one DAI and one Ring Buffer, see
4625/// [Audio Drivers Architecture](https://fuchsia.dev/fuchsia-src/development/audio/drivers/architecture)
4626#[derive(Debug)]
4627pub enum DaiRequest {
4628    /// Retrieves top level health state.
4629    /// A driver not responding promptly can be used as an indication of an unhealthy driver.
4630    GetHealthState { responder: DaiGetHealthStateResponder },
4631    /// Connect to a `SignalProcessing` protocol.
4632    /// Multiple connections may be supported, if a new connection request is not supported, i.e.
4633    /// the maximum number of connections have already been created, for instance one, then the
4634    /// `protocol` channel (not the channel upon which `SignalProcessingConnect` is being called)
4635    /// will be closed with a `ZX_ERR_ALREADY_BOUND` epitaph.
4636    /// If signal processing is not supported at all, then the `protocol` channel (again, not the
4637    /// channel upon which `SignalProcessingConnect` is being called) will be closed with a
4638    /// `ZX_ERR_NOT_SUPPORTED` epitaph.
4639    /// This method is named `SignalProcessingConnect` instead of `Connect` because this protocol
4640    /// is intended to be composed, and hence the more verbose name allows differentiation and
4641    /// improved clarity.
4642    SignalProcessingConnect {
4643        protocol: fdomain_client::fidl::ServerEnd<
4644            fdomain_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
4645        >,
4646        control_handle: DaiControlHandle,
4647    },
4648    /// Resets the DAI HW. The `ring_buffer` channel obtained via `CreateRingBuffer` may be closed
4649    /// by the driver, in this case the client needs to obtain a new `ring_buffer`.
4650    /// `Reset` returns when the reset is completed. If the driver can't successfully reset the HW,
4651    /// it will close the DAI protocol channel, in this case the client may obtain a new DAI
4652    /// protocol channel and retry.
4653    Reset { responder: DaiResetResponder },
4654    /// Retrieves top level static properties.
4655    GetProperties { responder: DaiGetPropertiesResponder },
4656    /// Retrieves the DAI formats supported by the DAI, if not available at the time the DAI
4657    /// may reply with an error status and the client may retry at a later time.
4658    /// Retrieving multiple `DaiSupportedFormats` allows for cases where exclusive combinations of
4659    /// the parameters in SupportedFormats may be supported.
4660    GetDaiFormats { responder: DaiGetDaiFormatsResponder },
4661    /// Retrieves the ring buffer formats supported by the DAI, if not available at the time the DAI
4662    /// may reply with an error status and the client may retry at a later time.
4663    /// Retrieving multiple `SupportedFormats` allows for cases where exclusive combinations of
4664    /// the parameters in `SupportedFormats` may be supported.
4665    GetRingBufferFormats { responder: DaiGetRingBufferFormatsResponder },
4666    /// `CreateRingBuffer` is sent by clients to select both a DAI format and a ring buffer format
4667    /// based on information that the driver provides in `GetDaiFormats` and `GetRingBufferFormats`,
4668    /// what is supported by the client, and any other requirement. The `ring_buffer` channel is
4669    /// used to control the audio buffer, if a previous ring buffer channel had been established and
4670    /// was still active, the driver must close that (ring buffer) channel and make every attempt to
4671    /// gracefully quiesce any on-going streaming operations in the process.
4672    CreateRingBuffer {
4673        dai_format: DaiFormat,
4674        ring_buffer_format: Format,
4675        ring_buffer: fdomain_client::fidl::ServerEnd<RingBufferMarker>,
4676        control_handle: DaiControlHandle,
4677    },
4678}
4679
4680impl DaiRequest {
4681    #[allow(irrefutable_let_patterns)]
4682    pub fn into_get_health_state(self) -> Option<(DaiGetHealthStateResponder)> {
4683        if let DaiRequest::GetHealthState { responder } = self { Some((responder)) } else { None }
4684    }
4685
4686    #[allow(irrefutable_let_patterns)]
4687    pub fn into_signal_processing_connect(
4688        self,
4689    ) -> Option<(
4690        fdomain_client::fidl::ServerEnd<
4691            fdomain_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
4692        >,
4693        DaiControlHandle,
4694    )> {
4695        if let DaiRequest::SignalProcessingConnect { protocol, control_handle } = self {
4696            Some((protocol, control_handle))
4697        } else {
4698            None
4699        }
4700    }
4701
4702    #[allow(irrefutable_let_patterns)]
4703    pub fn into_reset(self) -> Option<(DaiResetResponder)> {
4704        if let DaiRequest::Reset { responder } = self { Some((responder)) } else { None }
4705    }
4706
4707    #[allow(irrefutable_let_patterns)]
4708    pub fn into_get_properties(self) -> Option<(DaiGetPropertiesResponder)> {
4709        if let DaiRequest::GetProperties { responder } = self { Some((responder)) } else { None }
4710    }
4711
4712    #[allow(irrefutable_let_patterns)]
4713    pub fn into_get_dai_formats(self) -> Option<(DaiGetDaiFormatsResponder)> {
4714        if let DaiRequest::GetDaiFormats { responder } = self { Some((responder)) } else { None }
4715    }
4716
4717    #[allow(irrefutable_let_patterns)]
4718    pub fn into_get_ring_buffer_formats(self) -> Option<(DaiGetRingBufferFormatsResponder)> {
4719        if let DaiRequest::GetRingBufferFormats { responder } = self {
4720            Some((responder))
4721        } else {
4722            None
4723        }
4724    }
4725
4726    #[allow(irrefutable_let_patterns)]
4727    pub fn into_create_ring_buffer(
4728        self,
4729    ) -> Option<(
4730        DaiFormat,
4731        Format,
4732        fdomain_client::fidl::ServerEnd<RingBufferMarker>,
4733        DaiControlHandle,
4734    )> {
4735        if let DaiRequest::CreateRingBuffer {
4736            dai_format,
4737            ring_buffer_format,
4738            ring_buffer,
4739            control_handle,
4740        } = self
4741        {
4742            Some((dai_format, ring_buffer_format, ring_buffer, control_handle))
4743        } else {
4744            None
4745        }
4746    }
4747
4748    /// Name of the method defined in FIDL
4749    pub fn method_name(&self) -> &'static str {
4750        match *self {
4751            DaiRequest::GetHealthState { .. } => "get_health_state",
4752            DaiRequest::SignalProcessingConnect { .. } => "signal_processing_connect",
4753            DaiRequest::Reset { .. } => "reset",
4754            DaiRequest::GetProperties { .. } => "get_properties",
4755            DaiRequest::GetDaiFormats { .. } => "get_dai_formats",
4756            DaiRequest::GetRingBufferFormats { .. } => "get_ring_buffer_formats",
4757            DaiRequest::CreateRingBuffer { .. } => "create_ring_buffer",
4758        }
4759    }
4760}
4761
4762#[derive(Debug, Clone)]
4763pub struct DaiControlHandle {
4764    inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
4765}
4766
4767impl DaiControlHandle {
4768    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
4769        self.inner.shutdown_with_epitaph(status.into())
4770    }
4771}
4772
4773impl fdomain_client::fidl::ControlHandle for DaiControlHandle {
4774    fn shutdown(&self) {
4775        self.inner.shutdown()
4776    }
4777
4778    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
4779        self.inner.shutdown_with_epitaph(status)
4780    }
4781
4782    fn is_closed(&self) -> bool {
4783        self.inner.channel().is_closed()
4784    }
4785    fn on_closed(&self) -> fdomain_client::OnFDomainSignals {
4786        self.inner.channel().on_closed()
4787    }
4788}
4789
4790impl DaiControlHandle {}
4791
4792#[must_use = "FIDL methods require a response to be sent"]
4793#[derive(Debug)]
4794pub struct DaiGetHealthStateResponder {
4795    control_handle: std::mem::ManuallyDrop<DaiControlHandle>,
4796    tx_id: u32,
4797}
4798
4799/// Set the the channel to be shutdown (see [`DaiControlHandle::shutdown`])
4800/// if the responder is dropped without sending a response, so that the client
4801/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
4802impl std::ops::Drop for DaiGetHealthStateResponder {
4803    fn drop(&mut self) {
4804        self.control_handle.shutdown();
4805        // Safety: drops once, never accessed again
4806        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4807    }
4808}
4809
4810impl fdomain_client::fidl::Responder for DaiGetHealthStateResponder {
4811    type ControlHandle = DaiControlHandle;
4812
4813    fn control_handle(&self) -> &DaiControlHandle {
4814        &self.control_handle
4815    }
4816
4817    fn drop_without_shutdown(mut self) {
4818        // Safety: drops once, never accessed again due to mem::forget
4819        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4820        // Prevent Drop from running (which would shut down the channel)
4821        std::mem::forget(self);
4822    }
4823}
4824
4825impl DaiGetHealthStateResponder {
4826    /// Sends a response to the FIDL transaction.
4827    ///
4828    /// Sets the channel to shutdown if an error occurs.
4829    pub fn send(self, mut state: &HealthState) -> Result<(), fidl::Error> {
4830        let _result = self.send_raw(state);
4831        if _result.is_err() {
4832            self.control_handle.shutdown();
4833        }
4834        self.drop_without_shutdown();
4835        _result
4836    }
4837
4838    /// Similar to "send" but does not shutdown the channel if an error occurs.
4839    pub fn send_no_shutdown_on_err(self, mut state: &HealthState) -> Result<(), fidl::Error> {
4840        let _result = self.send_raw(state);
4841        self.drop_without_shutdown();
4842        _result
4843    }
4844
4845    fn send_raw(&self, mut state: &HealthState) -> Result<(), fidl::Error> {
4846        self.control_handle.inner.send::<HealthGetHealthStateResponse>(
4847            (state,),
4848            self.tx_id,
4849            0x4e146d6bca733a84,
4850            fidl::encoding::DynamicFlags::empty(),
4851        )
4852    }
4853}
4854
4855#[must_use = "FIDL methods require a response to be sent"]
4856#[derive(Debug)]
4857pub struct DaiResetResponder {
4858    control_handle: std::mem::ManuallyDrop<DaiControlHandle>,
4859    tx_id: u32,
4860}
4861
4862/// Set the the channel to be shutdown (see [`DaiControlHandle::shutdown`])
4863/// if the responder is dropped without sending a response, so that the client
4864/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
4865impl std::ops::Drop for DaiResetResponder {
4866    fn drop(&mut self) {
4867        self.control_handle.shutdown();
4868        // Safety: drops once, never accessed again
4869        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4870    }
4871}
4872
4873impl fdomain_client::fidl::Responder for DaiResetResponder {
4874    type ControlHandle = DaiControlHandle;
4875
4876    fn control_handle(&self) -> &DaiControlHandle {
4877        &self.control_handle
4878    }
4879
4880    fn drop_without_shutdown(mut self) {
4881        // Safety: drops once, never accessed again due to mem::forget
4882        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4883        // Prevent Drop from running (which would shut down the channel)
4884        std::mem::forget(self);
4885    }
4886}
4887
4888impl DaiResetResponder {
4889    /// Sends a response to the FIDL transaction.
4890    ///
4891    /// Sets the channel to shutdown if an error occurs.
4892    pub fn send(self) -> Result<(), fidl::Error> {
4893        let _result = self.send_raw();
4894        if _result.is_err() {
4895            self.control_handle.shutdown();
4896        }
4897        self.drop_without_shutdown();
4898        _result
4899    }
4900
4901    /// Similar to "send" but does not shutdown the channel if an error occurs.
4902    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
4903        let _result = self.send_raw();
4904        self.drop_without_shutdown();
4905        _result
4906    }
4907
4908    fn send_raw(&self) -> Result<(), fidl::Error> {
4909        self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
4910            (),
4911            self.tx_id,
4912            0x69e5fa9fa2f78c14,
4913            fidl::encoding::DynamicFlags::empty(),
4914        )
4915    }
4916}
4917
4918#[must_use = "FIDL methods require a response to be sent"]
4919#[derive(Debug)]
4920pub struct DaiGetPropertiesResponder {
4921    control_handle: std::mem::ManuallyDrop<DaiControlHandle>,
4922    tx_id: u32,
4923}
4924
4925/// Set the the channel to be shutdown (see [`DaiControlHandle::shutdown`])
4926/// if the responder is dropped without sending a response, so that the client
4927/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
4928impl std::ops::Drop for DaiGetPropertiesResponder {
4929    fn drop(&mut self) {
4930        self.control_handle.shutdown();
4931        // Safety: drops once, never accessed again
4932        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4933    }
4934}
4935
4936impl fdomain_client::fidl::Responder for DaiGetPropertiesResponder {
4937    type ControlHandle = DaiControlHandle;
4938
4939    fn control_handle(&self) -> &DaiControlHandle {
4940        &self.control_handle
4941    }
4942
4943    fn drop_without_shutdown(mut self) {
4944        // Safety: drops once, never accessed again due to mem::forget
4945        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4946        // Prevent Drop from running (which would shut down the channel)
4947        std::mem::forget(self);
4948    }
4949}
4950
4951impl DaiGetPropertiesResponder {
4952    /// Sends a response to the FIDL transaction.
4953    ///
4954    /// Sets the channel to shutdown if an error occurs.
4955    pub fn send(self, mut properties: &DaiProperties) -> Result<(), fidl::Error> {
4956        let _result = self.send_raw(properties);
4957        if _result.is_err() {
4958            self.control_handle.shutdown();
4959        }
4960        self.drop_without_shutdown();
4961        _result
4962    }
4963
4964    /// Similar to "send" but does not shutdown the channel if an error occurs.
4965    pub fn send_no_shutdown_on_err(
4966        self,
4967        mut properties: &DaiProperties,
4968    ) -> Result<(), fidl::Error> {
4969        let _result = self.send_raw(properties);
4970        self.drop_without_shutdown();
4971        _result
4972    }
4973
4974    fn send_raw(&self, mut properties: &DaiProperties) -> Result<(), fidl::Error> {
4975        self.control_handle.inner.send::<DaiGetPropertiesResponse>(
4976            (properties,),
4977            self.tx_id,
4978            0x2c25a1a66149510b,
4979            fidl::encoding::DynamicFlags::empty(),
4980        )
4981    }
4982}
4983
4984#[must_use = "FIDL methods require a response to be sent"]
4985#[derive(Debug)]
4986pub struct DaiGetDaiFormatsResponder {
4987    control_handle: std::mem::ManuallyDrop<DaiControlHandle>,
4988    tx_id: u32,
4989}
4990
4991/// Set the the channel to be shutdown (see [`DaiControlHandle::shutdown`])
4992/// if the responder is dropped without sending a response, so that the client
4993/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
4994impl std::ops::Drop for DaiGetDaiFormatsResponder {
4995    fn drop(&mut self) {
4996        self.control_handle.shutdown();
4997        // Safety: drops once, never accessed again
4998        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4999    }
5000}
5001
5002impl fdomain_client::fidl::Responder for DaiGetDaiFormatsResponder {
5003    type ControlHandle = DaiControlHandle;
5004
5005    fn control_handle(&self) -> &DaiControlHandle {
5006        &self.control_handle
5007    }
5008
5009    fn drop_without_shutdown(mut self) {
5010        // Safety: drops once, never accessed again due to mem::forget
5011        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5012        // Prevent Drop from running (which would shut down the channel)
5013        std::mem::forget(self);
5014    }
5015}
5016
5017impl DaiGetDaiFormatsResponder {
5018    /// Sends a response to the FIDL transaction.
5019    ///
5020    /// Sets the channel to shutdown if an error occurs.
5021    pub fn send(self, mut result: Result<&[DaiSupportedFormats], i32>) -> Result<(), fidl::Error> {
5022        let _result = self.send_raw(result);
5023        if _result.is_err() {
5024            self.control_handle.shutdown();
5025        }
5026        self.drop_without_shutdown();
5027        _result
5028    }
5029
5030    /// Similar to "send" but does not shutdown the channel if an error occurs.
5031    pub fn send_no_shutdown_on_err(
5032        self,
5033        mut result: Result<&[DaiSupportedFormats], i32>,
5034    ) -> Result<(), fidl::Error> {
5035        let _result = self.send_raw(result);
5036        self.drop_without_shutdown();
5037        _result
5038    }
5039
5040    fn send_raw(&self, mut result: Result<&[DaiSupportedFormats], i32>) -> Result<(), fidl::Error> {
5041        self.control_handle.inner.send::<fidl::encoding::ResultType<DaiGetDaiFormatsResponse, i32>>(
5042            result.map(|dai_formats| (dai_formats,)),
5043            self.tx_id,
5044            0x1eb37b0cddf79d69,
5045            fidl::encoding::DynamicFlags::empty(),
5046        )
5047    }
5048}
5049
5050#[must_use = "FIDL methods require a response to be sent"]
5051#[derive(Debug)]
5052pub struct DaiGetRingBufferFormatsResponder {
5053    control_handle: std::mem::ManuallyDrop<DaiControlHandle>,
5054    tx_id: u32,
5055}
5056
5057/// Set the the channel to be shutdown (see [`DaiControlHandle::shutdown`])
5058/// if the responder is dropped without sending a response, so that the client
5059/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5060impl std::ops::Drop for DaiGetRingBufferFormatsResponder {
5061    fn drop(&mut self) {
5062        self.control_handle.shutdown();
5063        // Safety: drops once, never accessed again
5064        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5065    }
5066}
5067
5068impl fdomain_client::fidl::Responder for DaiGetRingBufferFormatsResponder {
5069    type ControlHandle = DaiControlHandle;
5070
5071    fn control_handle(&self) -> &DaiControlHandle {
5072        &self.control_handle
5073    }
5074
5075    fn drop_without_shutdown(mut self) {
5076        // Safety: drops once, never accessed again due to mem::forget
5077        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5078        // Prevent Drop from running (which would shut down the channel)
5079        std::mem::forget(self);
5080    }
5081}
5082
5083impl DaiGetRingBufferFormatsResponder {
5084    /// Sends a response to the FIDL transaction.
5085    ///
5086    /// Sets the channel to shutdown if an error occurs.
5087    pub fn send(self, mut result: Result<&[SupportedFormats], i32>) -> Result<(), fidl::Error> {
5088        let _result = self.send_raw(result);
5089        if _result.is_err() {
5090            self.control_handle.shutdown();
5091        }
5092        self.drop_without_shutdown();
5093        _result
5094    }
5095
5096    /// Similar to "send" but does not shutdown the channel if an error occurs.
5097    pub fn send_no_shutdown_on_err(
5098        self,
5099        mut result: Result<&[SupportedFormats], i32>,
5100    ) -> Result<(), fidl::Error> {
5101        let _result = self.send_raw(result);
5102        self.drop_without_shutdown();
5103        _result
5104    }
5105
5106    fn send_raw(&self, mut result: Result<&[SupportedFormats], i32>) -> Result<(), fidl::Error> {
5107        self.control_handle
5108            .inner
5109            .send::<fidl::encoding::ResultType<DaiGetRingBufferFormatsResponse, i32>>(
5110                result.map(|ring_buffer_formats| (ring_buffer_formats,)),
5111                self.tx_id,
5112                0x760371081d8c92e4,
5113                fidl::encoding::DynamicFlags::empty(),
5114            )
5115    }
5116}
5117
5118#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
5119pub struct DaiConnectorMarker;
5120
5121impl fdomain_client::fidl::ProtocolMarker for DaiConnectorMarker {
5122    type Proxy = DaiConnectorProxy;
5123    type RequestStream = DaiConnectorRequestStream;
5124
5125    const DEBUG_NAME: &'static str = "(anonymous) DaiConnector";
5126}
5127
5128pub trait DaiConnectorProxyInterface: Send + Sync {
5129    fn r#connect(
5130        &self,
5131        dai_protocol: fdomain_client::fidl::ServerEnd<DaiMarker>,
5132    ) -> Result<(), fidl::Error>;
5133}
5134
5135#[derive(Debug, Clone)]
5136pub struct DaiConnectorProxy {
5137    client: fidl::client::Client<fdomain_client::fidl::FDomainResourceDialect>,
5138}
5139
5140impl fdomain_client::fidl::Proxy for DaiConnectorProxy {
5141    type Protocol = DaiConnectorMarker;
5142
5143    fn from_channel(inner: fdomain_client::Channel) -> Self {
5144        Self::new(inner)
5145    }
5146
5147    fn into_channel(self) -> Result<fdomain_client::Channel, Self> {
5148        self.client.into_channel().map_err(|client| Self { client })
5149    }
5150
5151    fn as_channel(&self) -> &fdomain_client::Channel {
5152        self.client.as_channel()
5153    }
5154}
5155
5156impl DaiConnectorProxy {
5157    /// Create a new Proxy for fuchsia.hardware.audio/DaiConnector.
5158    pub fn new(channel: fdomain_client::Channel) -> Self {
5159        let protocol_name =
5160            <DaiConnectorMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME;
5161        Self { client: fidl::client::Client::new(channel, protocol_name) }
5162    }
5163
5164    /// Get a Stream of events from the remote end of the protocol.
5165    ///
5166    /// # Panics
5167    ///
5168    /// Panics if the event stream was already taken.
5169    pub fn take_event_stream(&self) -> DaiConnectorEventStream {
5170        DaiConnectorEventStream { event_receiver: self.client.take_event_receiver() }
5171    }
5172
5173    /// This connects to a DAI protocol server.
5174    pub fn r#connect(
5175        &self,
5176        mut dai_protocol: fdomain_client::fidl::ServerEnd<DaiMarker>,
5177    ) -> Result<(), fidl::Error> {
5178        DaiConnectorProxyInterface::r#connect(self, dai_protocol)
5179    }
5180}
5181
5182impl DaiConnectorProxyInterface for DaiConnectorProxy {
5183    fn r#connect(
5184        &self,
5185        mut dai_protocol: fdomain_client::fidl::ServerEnd<DaiMarker>,
5186    ) -> Result<(), fidl::Error> {
5187        self.client.send::<DaiConnectorConnectRequest>(
5188            (dai_protocol,),
5189            0x4e4db05c2eca1450,
5190            fidl::encoding::DynamicFlags::empty(),
5191        )
5192    }
5193}
5194
5195pub struct DaiConnectorEventStream {
5196    event_receiver: fidl::client::EventReceiver<fdomain_client::fidl::FDomainResourceDialect>,
5197}
5198
5199impl std::marker::Unpin for DaiConnectorEventStream {}
5200
5201impl futures::stream::FusedStream for DaiConnectorEventStream {
5202    fn is_terminated(&self) -> bool {
5203        self.event_receiver.is_terminated()
5204    }
5205}
5206
5207impl futures::Stream for DaiConnectorEventStream {
5208    type Item = Result<DaiConnectorEvent, fidl::Error>;
5209
5210    fn poll_next(
5211        mut self: std::pin::Pin<&mut Self>,
5212        cx: &mut std::task::Context<'_>,
5213    ) -> std::task::Poll<Option<Self::Item>> {
5214        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
5215            &mut self.event_receiver,
5216            cx
5217        )?) {
5218            Some(buf) => std::task::Poll::Ready(Some(DaiConnectorEvent::decode(buf))),
5219            None => std::task::Poll::Ready(None),
5220        }
5221    }
5222}
5223
5224#[derive(Debug)]
5225pub enum DaiConnectorEvent {}
5226
5227impl DaiConnectorEvent {
5228    /// Decodes a message buffer as a [`DaiConnectorEvent`].
5229    fn decode(
5230        mut buf: <fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
5231    ) -> Result<DaiConnectorEvent, fidl::Error> {
5232        let (bytes, _handles) = buf.split_mut();
5233        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5234        debug_assert_eq!(tx_header.tx_id, 0);
5235        match tx_header.ordinal {
5236            _ => Err(fidl::Error::UnknownOrdinal {
5237                ordinal: tx_header.ordinal,
5238                protocol_name:
5239                    <DaiConnectorMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
5240            }),
5241        }
5242    }
5243}
5244
5245/// A Stream of incoming requests for fuchsia.hardware.audio/DaiConnector.
5246pub struct DaiConnectorRequestStream {
5247    inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
5248    is_terminated: bool,
5249}
5250
5251impl std::marker::Unpin for DaiConnectorRequestStream {}
5252
5253impl futures::stream::FusedStream for DaiConnectorRequestStream {
5254    fn is_terminated(&self) -> bool {
5255        self.is_terminated
5256    }
5257}
5258
5259impl fdomain_client::fidl::RequestStream for DaiConnectorRequestStream {
5260    type Protocol = DaiConnectorMarker;
5261    type ControlHandle = DaiConnectorControlHandle;
5262
5263    fn from_channel(channel: fdomain_client::Channel) -> Self {
5264        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
5265    }
5266
5267    fn control_handle(&self) -> Self::ControlHandle {
5268        DaiConnectorControlHandle { inner: self.inner.clone() }
5269    }
5270
5271    fn into_inner(
5272        self,
5273    ) -> (::std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>, bool)
5274    {
5275        (self.inner, self.is_terminated)
5276    }
5277
5278    fn from_inner(
5279        inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
5280        is_terminated: bool,
5281    ) -> Self {
5282        Self { inner, is_terminated }
5283    }
5284}
5285
5286impl futures::Stream for DaiConnectorRequestStream {
5287    type Item = Result<DaiConnectorRequest, fidl::Error>;
5288
5289    fn poll_next(
5290        mut self: std::pin::Pin<&mut Self>,
5291        cx: &mut std::task::Context<'_>,
5292    ) -> std::task::Poll<Option<Self::Item>> {
5293        let this = &mut *self;
5294        if this.inner.check_shutdown(cx) {
5295            this.is_terminated = true;
5296            return std::task::Poll::Ready(None);
5297        }
5298        if this.is_terminated {
5299            panic!("polled DaiConnectorRequestStream after completion");
5300        }
5301        fidl::encoding::with_tls_decode_buf::<_, fdomain_client::fidl::FDomainResourceDialect>(
5302            |bytes, handles| {
5303                match this.inner.channel().read_etc(cx, bytes, handles) {
5304                    std::task::Poll::Ready(Ok(())) => {}
5305                    std::task::Poll::Pending => return std::task::Poll::Pending,
5306                    std::task::Poll::Ready(Err(None)) => {
5307                        this.is_terminated = true;
5308                        return std::task::Poll::Ready(None);
5309                    }
5310                    std::task::Poll::Ready(Err(Some(e))) => {
5311                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
5312                            e.into(),
5313                        ))));
5314                    }
5315                }
5316
5317                // A message has been received from the channel
5318                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5319
5320                std::task::Poll::Ready(Some(match header.ordinal {
5321                    0x4e4db05c2eca1450 => {
5322                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5323                        let mut req = fidl::new_empty!(
5324                            DaiConnectorConnectRequest,
5325                            fdomain_client::fidl::FDomainResourceDialect
5326                        );
5327                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<DaiConnectorConnectRequest>(&header, _body_bytes, handles, &mut req)?;
5328                        let control_handle =
5329                            DaiConnectorControlHandle { inner: this.inner.clone() };
5330                        Ok(DaiConnectorRequest::Connect {
5331                            dai_protocol: req.dai_protocol,
5332
5333                            control_handle,
5334                        })
5335                    }
5336                    _ => Err(fidl::Error::UnknownOrdinal {
5337                        ordinal: header.ordinal,
5338                        protocol_name:
5339                            <DaiConnectorMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
5340                    }),
5341                }))
5342            },
5343        )
5344    }
5345}
5346
5347/// For an overview of the DAI protocols see
5348/// [Digital Audio Interface](//docs/concepts/drivers/driver_architectures/audio_drivers/audio_dai.md)
5349/// # Deprecation
5350///
5351/// Not supported anymore, instead use an
5352/// [Audio Composite](https://fuchsia.dev/fuchsia-src/development/audio/drivers/composite)
5353/// with one DAI and one Ring Buffer, see
5354/// [Audio Drivers Architecture](https://fuchsia.dev/fuchsia-src/development/audio/drivers/architecture)
5355#[derive(Debug)]
5356pub enum DaiConnectorRequest {
5357    /// This connects to a DAI protocol server.
5358    Connect {
5359        dai_protocol: fdomain_client::fidl::ServerEnd<DaiMarker>,
5360        control_handle: DaiConnectorControlHandle,
5361    },
5362}
5363
5364impl DaiConnectorRequest {
5365    #[allow(irrefutable_let_patterns)]
5366    pub fn into_connect(
5367        self,
5368    ) -> Option<(fdomain_client::fidl::ServerEnd<DaiMarker>, DaiConnectorControlHandle)> {
5369        if let DaiConnectorRequest::Connect { dai_protocol, control_handle } = self {
5370            Some((dai_protocol, control_handle))
5371        } else {
5372            None
5373        }
5374    }
5375
5376    /// Name of the method defined in FIDL
5377    pub fn method_name(&self) -> &'static str {
5378        match *self {
5379            DaiConnectorRequest::Connect { .. } => "connect",
5380        }
5381    }
5382}
5383
5384#[derive(Debug, Clone)]
5385pub struct DaiConnectorControlHandle {
5386    inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
5387}
5388
5389impl DaiConnectorControlHandle {
5390    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
5391        self.inner.shutdown_with_epitaph(status.into())
5392    }
5393}
5394
5395impl fdomain_client::fidl::ControlHandle for DaiConnectorControlHandle {
5396    fn shutdown(&self) {
5397        self.inner.shutdown()
5398    }
5399
5400    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
5401        self.inner.shutdown_with_epitaph(status)
5402    }
5403
5404    fn is_closed(&self) -> bool {
5405        self.inner.channel().is_closed()
5406    }
5407    fn on_closed(&self) -> fdomain_client::OnFDomainSignals {
5408        self.inner.channel().on_closed()
5409    }
5410}
5411
5412impl DaiConnectorControlHandle {}
5413
5414#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
5415pub struct HealthMarker;
5416
5417impl fdomain_client::fidl::ProtocolMarker for HealthMarker {
5418    type Proxy = HealthProxy;
5419    type RequestStream = HealthRequestStream;
5420
5421    const DEBUG_NAME: &'static str = "(anonymous) Health";
5422}
5423
5424pub trait HealthProxyInterface: Send + Sync {
5425    type GetHealthStateResponseFut: std::future::Future<Output = Result<HealthState, fidl::Error>>
5426        + Send;
5427    fn r#get_health_state(&self) -> Self::GetHealthStateResponseFut;
5428}
5429
5430#[derive(Debug, Clone)]
5431pub struct HealthProxy {
5432    client: fidl::client::Client<fdomain_client::fidl::FDomainResourceDialect>,
5433}
5434
5435impl fdomain_client::fidl::Proxy for HealthProxy {
5436    type Protocol = HealthMarker;
5437
5438    fn from_channel(inner: fdomain_client::Channel) -> Self {
5439        Self::new(inner)
5440    }
5441
5442    fn into_channel(self) -> Result<fdomain_client::Channel, Self> {
5443        self.client.into_channel().map_err(|client| Self { client })
5444    }
5445
5446    fn as_channel(&self) -> &fdomain_client::Channel {
5447        self.client.as_channel()
5448    }
5449}
5450
5451impl HealthProxy {
5452    /// Create a new Proxy for fuchsia.hardware.audio/Health.
5453    pub fn new(channel: fdomain_client::Channel) -> Self {
5454        let protocol_name = <HealthMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME;
5455        Self { client: fidl::client::Client::new(channel, protocol_name) }
5456    }
5457
5458    /// Get a Stream of events from the remote end of the protocol.
5459    ///
5460    /// # Panics
5461    ///
5462    /// Panics if the event stream was already taken.
5463    pub fn take_event_stream(&self) -> HealthEventStream {
5464        HealthEventStream { event_receiver: self.client.take_event_receiver() }
5465    }
5466
5467    /// Retrieves top level health state.
5468    /// A driver not responding promptly can be used as an indication of an unhealthy driver.
5469    pub fn r#get_health_state(
5470        &self,
5471    ) -> fidl::client::QueryResponseFut<HealthState, fdomain_client::fidl::FDomainResourceDialect>
5472    {
5473        HealthProxyInterface::r#get_health_state(self)
5474    }
5475}
5476
5477impl HealthProxyInterface for HealthProxy {
5478    type GetHealthStateResponseFut =
5479        fidl::client::QueryResponseFut<HealthState, fdomain_client::fidl::FDomainResourceDialect>;
5480    fn r#get_health_state(&self) -> Self::GetHealthStateResponseFut {
5481        fn _decode(
5482            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5483        ) -> Result<HealthState, fidl::Error> {
5484            let _response = fidl::client::decode_transaction_body::<
5485                HealthGetHealthStateResponse,
5486                fdomain_client::fidl::FDomainResourceDialect,
5487                0x4e146d6bca733a84,
5488            >(_buf?)?;
5489            Ok(_response.state)
5490        }
5491        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, HealthState>(
5492            (),
5493            0x4e146d6bca733a84,
5494            fidl::encoding::DynamicFlags::empty(),
5495            _decode,
5496        )
5497    }
5498}
5499
5500pub struct HealthEventStream {
5501    event_receiver: fidl::client::EventReceiver<fdomain_client::fidl::FDomainResourceDialect>,
5502}
5503
5504impl std::marker::Unpin for HealthEventStream {}
5505
5506impl futures::stream::FusedStream for HealthEventStream {
5507    fn is_terminated(&self) -> bool {
5508        self.event_receiver.is_terminated()
5509    }
5510}
5511
5512impl futures::Stream for HealthEventStream {
5513    type Item = Result<HealthEvent, fidl::Error>;
5514
5515    fn poll_next(
5516        mut self: std::pin::Pin<&mut Self>,
5517        cx: &mut std::task::Context<'_>,
5518    ) -> std::task::Poll<Option<Self::Item>> {
5519        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
5520            &mut self.event_receiver,
5521            cx
5522        )?) {
5523            Some(buf) => std::task::Poll::Ready(Some(HealthEvent::decode(buf))),
5524            None => std::task::Poll::Ready(None),
5525        }
5526    }
5527}
5528
5529#[derive(Debug)]
5530pub enum HealthEvent {}
5531
5532impl HealthEvent {
5533    /// Decodes a message buffer as a [`HealthEvent`].
5534    fn decode(
5535        mut buf: <fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
5536    ) -> Result<HealthEvent, fidl::Error> {
5537        let (bytes, _handles) = buf.split_mut();
5538        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5539        debug_assert_eq!(tx_header.tx_id, 0);
5540        match tx_header.ordinal {
5541            _ => Err(fidl::Error::UnknownOrdinal {
5542                ordinal: tx_header.ordinal,
5543                protocol_name: <HealthMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
5544            }),
5545        }
5546    }
5547}
5548
5549/// A Stream of incoming requests for fuchsia.hardware.audio/Health.
5550pub struct HealthRequestStream {
5551    inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
5552    is_terminated: bool,
5553}
5554
5555impl std::marker::Unpin for HealthRequestStream {}
5556
5557impl futures::stream::FusedStream for HealthRequestStream {
5558    fn is_terminated(&self) -> bool {
5559        self.is_terminated
5560    }
5561}
5562
5563impl fdomain_client::fidl::RequestStream for HealthRequestStream {
5564    type Protocol = HealthMarker;
5565    type ControlHandle = HealthControlHandle;
5566
5567    fn from_channel(channel: fdomain_client::Channel) -> Self {
5568        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
5569    }
5570
5571    fn control_handle(&self) -> Self::ControlHandle {
5572        HealthControlHandle { inner: self.inner.clone() }
5573    }
5574
5575    fn into_inner(
5576        self,
5577    ) -> (::std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>, bool)
5578    {
5579        (self.inner, self.is_terminated)
5580    }
5581
5582    fn from_inner(
5583        inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
5584        is_terminated: bool,
5585    ) -> Self {
5586        Self { inner, is_terminated }
5587    }
5588}
5589
5590impl futures::Stream for HealthRequestStream {
5591    type Item = Result<HealthRequest, fidl::Error>;
5592
5593    fn poll_next(
5594        mut self: std::pin::Pin<&mut Self>,
5595        cx: &mut std::task::Context<'_>,
5596    ) -> std::task::Poll<Option<Self::Item>> {
5597        let this = &mut *self;
5598        if this.inner.check_shutdown(cx) {
5599            this.is_terminated = true;
5600            return std::task::Poll::Ready(None);
5601        }
5602        if this.is_terminated {
5603            panic!("polled HealthRequestStream after completion");
5604        }
5605        fidl::encoding::with_tls_decode_buf::<_, fdomain_client::fidl::FDomainResourceDialect>(
5606            |bytes, handles| {
5607                match this.inner.channel().read_etc(cx, bytes, handles) {
5608                    std::task::Poll::Ready(Ok(())) => {}
5609                    std::task::Poll::Pending => return std::task::Poll::Pending,
5610                    std::task::Poll::Ready(Err(None)) => {
5611                        this.is_terminated = true;
5612                        return std::task::Poll::Ready(None);
5613                    }
5614                    std::task::Poll::Ready(Err(Some(e))) => {
5615                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
5616                            e.into(),
5617                        ))));
5618                    }
5619                }
5620
5621                // A message has been received from the channel
5622                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5623
5624                std::task::Poll::Ready(Some(match header.ordinal {
5625                    0x4e146d6bca733a84 => {
5626                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5627                        let mut req = fidl::new_empty!(
5628                            fidl::encoding::EmptyPayload,
5629                            fdomain_client::fidl::FDomainResourceDialect
5630                        );
5631                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
5632                        let control_handle = HealthControlHandle { inner: this.inner.clone() };
5633                        Ok(HealthRequest::GetHealthState {
5634                            responder: HealthGetHealthStateResponder {
5635                                control_handle: std::mem::ManuallyDrop::new(control_handle),
5636                                tx_id: header.tx_id,
5637                            },
5638                        })
5639                    }
5640                    _ => Err(fidl::Error::UnknownOrdinal {
5641                        ordinal: header.ordinal,
5642                        protocol_name:
5643                            <HealthMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
5644                    }),
5645                }))
5646            },
5647        )
5648    }
5649}
5650
5651#[derive(Debug)]
5652pub enum HealthRequest {
5653    /// Retrieves top level health state.
5654    /// A driver not responding promptly can be used as an indication of an unhealthy driver.
5655    GetHealthState { responder: HealthGetHealthStateResponder },
5656}
5657
5658impl HealthRequest {
5659    #[allow(irrefutable_let_patterns)]
5660    pub fn into_get_health_state(self) -> Option<(HealthGetHealthStateResponder)> {
5661        if let HealthRequest::GetHealthState { responder } = self {
5662            Some((responder))
5663        } else {
5664            None
5665        }
5666    }
5667
5668    /// Name of the method defined in FIDL
5669    pub fn method_name(&self) -> &'static str {
5670        match *self {
5671            HealthRequest::GetHealthState { .. } => "get_health_state",
5672        }
5673    }
5674}
5675
5676#[derive(Debug, Clone)]
5677pub struct HealthControlHandle {
5678    inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
5679}
5680
5681impl HealthControlHandle {
5682    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
5683        self.inner.shutdown_with_epitaph(status.into())
5684    }
5685}
5686
5687impl fdomain_client::fidl::ControlHandle for HealthControlHandle {
5688    fn shutdown(&self) {
5689        self.inner.shutdown()
5690    }
5691
5692    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
5693        self.inner.shutdown_with_epitaph(status)
5694    }
5695
5696    fn is_closed(&self) -> bool {
5697        self.inner.channel().is_closed()
5698    }
5699    fn on_closed(&self) -> fdomain_client::OnFDomainSignals {
5700        self.inner.channel().on_closed()
5701    }
5702}
5703
5704impl HealthControlHandle {}
5705
5706#[must_use = "FIDL methods require a response to be sent"]
5707#[derive(Debug)]
5708pub struct HealthGetHealthStateResponder {
5709    control_handle: std::mem::ManuallyDrop<HealthControlHandle>,
5710    tx_id: u32,
5711}
5712
5713/// Set the the channel to be shutdown (see [`HealthControlHandle::shutdown`])
5714/// if the responder is dropped without sending a response, so that the client
5715/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5716impl std::ops::Drop for HealthGetHealthStateResponder {
5717    fn drop(&mut self) {
5718        self.control_handle.shutdown();
5719        // Safety: drops once, never accessed again
5720        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5721    }
5722}
5723
5724impl fdomain_client::fidl::Responder for HealthGetHealthStateResponder {
5725    type ControlHandle = HealthControlHandle;
5726
5727    fn control_handle(&self) -> &HealthControlHandle {
5728        &self.control_handle
5729    }
5730
5731    fn drop_without_shutdown(mut self) {
5732        // Safety: drops once, never accessed again due to mem::forget
5733        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5734        // Prevent Drop from running (which would shut down the channel)
5735        std::mem::forget(self);
5736    }
5737}
5738
5739impl HealthGetHealthStateResponder {
5740    /// Sends a response to the FIDL transaction.
5741    ///
5742    /// Sets the channel to shutdown if an error occurs.
5743    pub fn send(self, mut state: &HealthState) -> Result<(), fidl::Error> {
5744        let _result = self.send_raw(state);
5745        if _result.is_err() {
5746            self.control_handle.shutdown();
5747        }
5748        self.drop_without_shutdown();
5749        _result
5750    }
5751
5752    /// Similar to "send" but does not shutdown the channel if an error occurs.
5753    pub fn send_no_shutdown_on_err(self, mut state: &HealthState) -> Result<(), fidl::Error> {
5754        let _result = self.send_raw(state);
5755        self.drop_without_shutdown();
5756        _result
5757    }
5758
5759    fn send_raw(&self, mut state: &HealthState) -> Result<(), fidl::Error> {
5760        self.control_handle.inner.send::<HealthGetHealthStateResponse>(
5761            (state,),
5762            self.tx_id,
5763            0x4e146d6bca733a84,
5764            fidl::encoding::DynamicFlags::empty(),
5765        )
5766    }
5767}
5768
5769#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
5770pub struct PacketStreamControlMarker;
5771
5772impl fdomain_client::fidl::ProtocolMarker for PacketStreamControlMarker {
5773    type Proxy = PacketStreamControlProxy;
5774    type RequestStream = PacketStreamControlRequestStream;
5775
5776    const DEBUG_NAME: &'static str = "(anonymous) PacketStreamControl";
5777}
5778pub type PacketStreamControlAllocateVmosResult = Result<Vec<VmoInfo>, i32>;
5779pub type PacketStreamControlDeallocateVmosResult = Result<(), i32>;
5780pub type PacketStreamControlRegisterVmosResult = Result<(), i32>;
5781pub type PacketStreamControlUnregisterVmosResult = Result<(), i32>;
5782pub type PacketStreamControlGetPacketStreamSinkResult =
5783    Result<PacketStreamControlGetPacketStreamSinkResponse, i32>;
5784pub type PacketStreamControlSetPacketStreamSinkResult = Result<(), i32>;
5785pub type PacketStreamControlStartResult = Result<(), i32>;
5786pub type PacketStreamControlStopResult = Result<(), i32>;
5787
5788pub trait PacketStreamControlProxyInterface: Send + Sync {
5789    type GetPropertiesResponseFut: std::future::Future<Output = Result<PacketStreamProperties, fidl::Error>>
5790        + Send;
5791    fn r#get_properties(&self) -> Self::GetPropertiesResponseFut;
5792    type AllocateVmosResponseFut: std::future::Future<Output = Result<PacketStreamControlAllocateVmosResult, fidl::Error>>
5793        + Send;
5794    fn r#allocate_vmos(&self, payload: &AllocateVmosConfig) -> Self::AllocateVmosResponseFut;
5795    type DeallocateVmosResponseFut: std::future::Future<Output = Result<PacketStreamControlDeallocateVmosResult, fidl::Error>>
5796        + Send;
5797    fn r#deallocate_vmos(&self) -> Self::DeallocateVmosResponseFut;
5798    type RegisterVmosResponseFut: std::future::Future<Output = Result<PacketStreamControlRegisterVmosResult, fidl::Error>>
5799        + Send;
5800    fn r#register_vmos(&self, payload: RegisterVmosConfig) -> Self::RegisterVmosResponseFut;
5801    type UnregisterVmosResponseFut: std::future::Future<Output = Result<PacketStreamControlUnregisterVmosResult, fidl::Error>>
5802        + Send;
5803    fn r#unregister_vmos(&self) -> Self::UnregisterVmosResponseFut;
5804    type GetPacketStreamSinkResponseFut: std::future::Future<
5805            Output = Result<PacketStreamControlGetPacketStreamSinkResult, fidl::Error>,
5806        > + Send;
5807    fn r#get_packet_stream_sink(&self) -> Self::GetPacketStreamSinkResponseFut;
5808    type SetPacketStreamSinkResponseFut: std::future::Future<
5809            Output = Result<PacketStreamControlSetPacketStreamSinkResult, fidl::Error>,
5810        > + Send;
5811    fn r#set_packet_stream_sink(
5812        &self,
5813        payload: PacketStreamControlSetPacketStreamSinkRequest,
5814    ) -> Self::SetPacketStreamSinkResponseFut;
5815    type StartResponseFut: std::future::Future<Output = Result<PacketStreamControlStartResult, fidl::Error>>
5816        + Send;
5817    fn r#start(&self) -> Self::StartResponseFut;
5818    type StopResponseFut: std::future::Future<Output = Result<PacketStreamControlStopResult, fidl::Error>>
5819        + Send;
5820    fn r#stop(&self) -> Self::StopResponseFut;
5821}
5822
5823#[derive(Debug, Clone)]
5824pub struct PacketStreamControlProxy {
5825    client: fidl::client::Client<fdomain_client::fidl::FDomainResourceDialect>,
5826}
5827
5828impl fdomain_client::fidl::Proxy for PacketStreamControlProxy {
5829    type Protocol = PacketStreamControlMarker;
5830
5831    fn from_channel(inner: fdomain_client::Channel) -> Self {
5832        Self::new(inner)
5833    }
5834
5835    fn into_channel(self) -> Result<fdomain_client::Channel, Self> {
5836        self.client.into_channel().map_err(|client| Self { client })
5837    }
5838
5839    fn as_channel(&self) -> &fdomain_client::Channel {
5840        self.client.as_channel()
5841    }
5842}
5843
5844impl PacketStreamControlProxy {
5845    /// Create a new Proxy for fuchsia.hardware.audio/PacketStreamControl.
5846    pub fn new(channel: fdomain_client::Channel) -> Self {
5847        let protocol_name =
5848            <PacketStreamControlMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME;
5849        Self { client: fidl::client::Client::new(channel, protocol_name) }
5850    }
5851
5852    /// Get a Stream of events from the remote end of the protocol.
5853    ///
5854    /// # Panics
5855    ///
5856    /// Panics if the event stream was already taken.
5857    pub fn take_event_stream(&self) -> PacketStreamControlEventStream {
5858        PacketStreamControlEventStream { event_receiver: self.client.take_event_receiver() }
5859    }
5860
5861    /// Accessor for top level static properties.
5862    pub fn r#get_properties(
5863        &self,
5864    ) -> fidl::client::QueryResponseFut<
5865        PacketStreamProperties,
5866        fdomain_client::fidl::FDomainResourceDialect,
5867    > {
5868        PacketStreamControlProxyInterface::r#get_properties(self)
5869    }
5870
5871    /// Request the driver to allocate VMOs for data transfer.
5872    /// Returns the allocated VMOs and their assigned IDs.
5873    ///
5874    /// The returned VMO handle must include ZX_RIGHT_TRANSFER, ZX_RIGHT_READ and ZX_RIGHT_MAP.
5875    /// If the packet stream is an output stream, then the handle must also include
5876    /// ZX_RIGHT_WRITE.
5877    ///
5878    /// Returns `ZX_ERR_INVALID_ARGS` if `min_vmo_size` is zero or `vmo_count` is zero.
5879    /// Returns `ZX_ERR_NO_MEMORY` if the driver cannot allocate the requested VMOs.
5880    /// Returns `ZX_ERR_BAD_STATE` if VMOs are already allocated or registered, or if the
5881    /// stream is already started. Call `DeallocateVmos` or `UnregisterVmos` first to
5882    /// reconfigure.
5883    pub fn r#allocate_vmos(
5884        &self,
5885        mut payload: &AllocateVmosConfig,
5886    ) -> fidl::client::QueryResponseFut<
5887        PacketStreamControlAllocateVmosResult,
5888        fdomain_client::fidl::FDomainResourceDialect,
5889    > {
5890        PacketStreamControlProxyInterface::r#allocate_vmos(self, payload)
5891    }
5892
5893    /// Releases all VMOs previously allocated via `AllocateVmos`.
5894    /// This also occurs automatically when the `PacketStreamControl` channel is closed.
5895    ///
5896    /// Returns `ZX_ERR_BAD_STATE` if VMOs are not currently allocated, or if the stream is
5897    /// not stopped.
5898    pub fn r#deallocate_vmos(
5899        &self,
5900    ) -> fidl::client::QueryResponseFut<
5901        PacketStreamControlDeallocateVmosResult,
5902        fdomain_client::fidl::FDomainResourceDialect,
5903    > {
5904        PacketStreamControlProxyInterface::r#deallocate_vmos(self)
5905    }
5906
5907    /// Registers client-allocated VMOs with the driver.
5908    ///
5909    /// The registered VMO handle must include ZX_RIGHT_TRANSFER, ZX_RIGHT_READ and ZX_RIGHT_MAP.
5910    /// If the packet stream is an input stream, then the handle must also include
5911    /// ZX_RIGHT_WRITE.
5912    ///
5913    /// Returns `ZX_ERR_INVALID_ARGS` if `vmo_infos` is empty, or if any VMO handle is invalid,
5914    /// or if duplicate `vmo_id`s are found.
5915    /// Returns `ZX_ERR_ACCESS_DENIED` if any VMO does not have the required rights.
5916    /// Returns `ZX_ERR_BAD_STATE` if VMOs are already registered or allocated, or if the
5917    /// stream is already started. Call `UnregisterVmos` or `DeallocateVmos` first to
5918    /// reconfigure.
5919    pub fn r#register_vmos(
5920        &self,
5921        mut payload: RegisterVmosConfig,
5922    ) -> fidl::client::QueryResponseFut<
5923        PacketStreamControlRegisterVmosResult,
5924        fdomain_client::fidl::FDomainResourceDialect,
5925    > {
5926        PacketStreamControlProxyInterface::r#register_vmos(self, payload)
5927    }
5928
5929    /// Unregisters all VMOs previously registered via `RegisterVmos`.
5930    /// This also occurs automatically when the `PacketStreamControl` channel is closed.
5931    ///
5932    /// Returns `ZX_ERR_BAD_STATE` if VMOs are not currently registered, or if the stream is
5933    /// not stopped.
5934    pub fn r#unregister_vmos(
5935        &self,
5936    ) -> fidl::client::QueryResponseFut<
5937        PacketStreamControlUnregisterVmosResult,
5938        fdomain_client::fidl::FDomainResourceDialect,
5939    > {
5940        PacketStreamControlProxyInterface::r#unregister_vmos(self)
5941    }
5942
5943    /// Connects to the data sink implemented by the driver.
5944    /// This is used for audio **Output** where the driver consumes data.
5945    ///
5946    /// Flow:
5947    /// 1. App writes audio data to a registered VMO.
5948    /// 2. App flushes the cache for the written region (if `needs_cache_flush_or_invalidate` is
5949    ///    true).
5950    /// 3. App calls `PacketStreamSink.PutPacket` with the location of the data.
5951    /// 4. Driver consumes the data.
5952    ///
5953    /// If this method is called multiple times, the previous `PacketStreamSink` channel is closed,
5954    /// and any pending requests on that channel are discarded. The new channel replaces the old
5955    /// one.
5956    ///
5957    /// Returns `ZX_ERR_NOT_SUPPORTED` if the stream is an input stream, or if the driver does
5958    /// not support this method.
5959    pub fn r#get_packet_stream_sink(
5960        &self,
5961    ) -> fidl::client::QueryResponseFut<
5962        PacketStreamControlGetPacketStreamSinkResult,
5963        fdomain_client::fidl::FDomainResourceDialect,
5964    > {
5965        PacketStreamControlProxyInterface::r#get_packet_stream_sink(self)
5966    }
5967
5968    /// Provides a data sink to the driver.
5969    /// This is used for audio **Input** where the driver produces data.
5970    ///
5971    /// Flow:
5972    /// 1. Driver writes audio data to a registered VMO.
5973    /// 2. Driver calls `PacketStreamSink.PutPacket` with the location of the data.
5974    /// 3. App receives `PutPacket`.
5975    /// 4. App invalidates the cache for the region (if `needs_cache_flush_or_invalidate` is
5976    ///    true).
5977    /// 5. App reads the data.
5978    ///
5979    /// If this method is called multiple times, the driver closes the previous `PacketStreamSink`
5980    /// channel. The new channel replaces the old one.
5981    ///
5982    /// Returns `ZX_ERR_NOT_SUPPORTED` if the stream is an output stream, or if the driver does
5983    /// not support this method.
5984    pub fn r#set_packet_stream_sink(
5985        &self,
5986        mut payload: PacketStreamControlSetPacketStreamSinkRequest,
5987    ) -> fidl::client::QueryResponseFut<
5988        PacketStreamControlSetPacketStreamSinkResult,
5989        fdomain_client::fidl::FDomainResourceDialect,
5990    > {
5991        PacketStreamControlProxyInterface::r#set_packet_stream_sink(self, payload)
5992    }
5993
5994    /// Start the packet-stream.
5995    ///
5996    /// Returns `ZX_ERR_BAD_STATE` if:
5997    /// * Buffers have not been allocated (if `DRIVER_OWNED` was specified)
5998    ///   and/or registered (if `CLIENT_OWNED` was specified). This is not applicable if
5999    ///   `INLINE` is supported.
6000    /// * The stream is already started.
6001    pub fn r#start(
6002        &self,
6003    ) -> fidl::client::QueryResponseFut<
6004        PacketStreamControlStartResult,
6005        fdomain_client::fidl::FDomainResourceDialect,
6006    > {
6007        PacketStreamControlProxyInterface::r#start(self)
6008    }
6009
6010    /// Stop the packet-stream.
6011    ///
6012    /// Once the response is received, the stream is halted.
6013    ///
6014    /// Behavior depends on the stream direction:
6015    /// * **Output**: The driver stops consuming packets. Any pending `PacketStreamSink.PutPacket`
6016    ///   requests will remain pending until `Start` is called again. Clients may call
6017    ///   `PacketStreamSink.FlushPackets` after `Stop` to discard these pending packets.
6018    /// * **Input**: The driver stops producing packets. No further `PacketStreamSink.PutPacket`
6019    ///   calls will be made by the driver until `Start` is called again.
6020    ///
6021    /// Note that since `PacketStreamSink` uses a separate channel, there is no strict ordering
6022    /// guarantee between `Stop` and `PacketStreamSink.PutPacket`:
6023    /// * For **Output**, some in-flight `PacketStreamSink.PutPacket` calls may
6024    ///   complete successfully after `Stop` has returned.
6025    /// * For **Input**, some in-flight `PacketStreamSink.PutPacket` calls may
6026    ///   arrive at the client after `Stop` has returned.
6027    ///
6028    /// Returns `ZX_ERR_BAD_STATE` if the stream is not started.
6029    pub fn r#stop(
6030        &self,
6031    ) -> fidl::client::QueryResponseFut<
6032        PacketStreamControlStopResult,
6033        fdomain_client::fidl::FDomainResourceDialect,
6034    > {
6035        PacketStreamControlProxyInterface::r#stop(self)
6036    }
6037}
6038
6039impl PacketStreamControlProxyInterface for PacketStreamControlProxy {
6040    type GetPropertiesResponseFut = fidl::client::QueryResponseFut<
6041        PacketStreamProperties,
6042        fdomain_client::fidl::FDomainResourceDialect,
6043    >;
6044    fn r#get_properties(&self) -> Self::GetPropertiesResponseFut {
6045        fn _decode(
6046            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6047        ) -> Result<PacketStreamProperties, fidl::Error> {
6048            let _response = fidl::client::decode_transaction_body::<
6049                fidl::encoding::FlexibleType<PacketStreamControlGetPropertiesResponse>,
6050                fdomain_client::fidl::FDomainResourceDialect,
6051                0x586cf4f0f8d2771f,
6052            >(_buf?)?
6053            .into_result_fdomain::<PacketStreamControlMarker>("get_properties")?;
6054            Ok(_response.properties)
6055        }
6056        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, PacketStreamProperties>(
6057            (),
6058            0x586cf4f0f8d2771f,
6059            fidl::encoding::DynamicFlags::FLEXIBLE,
6060            _decode,
6061        )
6062    }
6063
6064    type AllocateVmosResponseFut = fidl::client::QueryResponseFut<
6065        PacketStreamControlAllocateVmosResult,
6066        fdomain_client::fidl::FDomainResourceDialect,
6067    >;
6068    fn r#allocate_vmos(&self, mut payload: &AllocateVmosConfig) -> Self::AllocateVmosResponseFut {
6069        fn _decode(
6070            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6071        ) -> Result<PacketStreamControlAllocateVmosResult, fidl::Error> {
6072            let _response = fidl::client::decode_transaction_body::<
6073                fidl::encoding::FlexibleResultType<PacketStreamControlAllocateVmosResponse, i32>,
6074                fdomain_client::fidl::FDomainResourceDialect,
6075                0x7ff1473165ed344b,
6076            >(_buf?)?
6077            .into_result_fdomain::<PacketStreamControlMarker>("allocate_vmos")?;
6078            Ok(_response.map(|x| x.vmos))
6079        }
6080        self.client
6081            .send_query_and_decode::<AllocateVmosConfig, PacketStreamControlAllocateVmosResult>(
6082                payload,
6083                0x7ff1473165ed344b,
6084                fidl::encoding::DynamicFlags::FLEXIBLE,
6085                _decode,
6086            )
6087    }
6088
6089    type DeallocateVmosResponseFut = fidl::client::QueryResponseFut<
6090        PacketStreamControlDeallocateVmosResult,
6091        fdomain_client::fidl::FDomainResourceDialect,
6092    >;
6093    fn r#deallocate_vmos(&self) -> Self::DeallocateVmosResponseFut {
6094        fn _decode(
6095            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6096        ) -> Result<PacketStreamControlDeallocateVmosResult, fidl::Error> {
6097            let _response = fidl::client::decode_transaction_body::<
6098                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
6099                fdomain_client::fidl::FDomainResourceDialect,
6100                0x4db5cc85a7b8405b,
6101            >(_buf?)?
6102            .into_result_fdomain::<PacketStreamControlMarker>("deallocate_vmos")?;
6103            Ok(_response.map(|x| x))
6104        }
6105        self.client.send_query_and_decode::<
6106            fidl::encoding::EmptyPayload,
6107            PacketStreamControlDeallocateVmosResult,
6108        >(
6109            (),
6110            0x4db5cc85a7b8405b,
6111            fidl::encoding::DynamicFlags::FLEXIBLE,
6112            _decode,
6113        )
6114    }
6115
6116    type RegisterVmosResponseFut = fidl::client::QueryResponseFut<
6117        PacketStreamControlRegisterVmosResult,
6118        fdomain_client::fidl::FDomainResourceDialect,
6119    >;
6120    fn r#register_vmos(&self, mut payload: RegisterVmosConfig) -> Self::RegisterVmosResponseFut {
6121        fn _decode(
6122            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6123        ) -> Result<PacketStreamControlRegisterVmosResult, fidl::Error> {
6124            let _response = fidl::client::decode_transaction_body::<
6125                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
6126                fdomain_client::fidl::FDomainResourceDialect,
6127                0x29c3b656a1020bfd,
6128            >(_buf?)?
6129            .into_result_fdomain::<PacketStreamControlMarker>("register_vmos")?;
6130            Ok(_response.map(|x| x))
6131        }
6132        self.client
6133            .send_query_and_decode::<RegisterVmosConfig, PacketStreamControlRegisterVmosResult>(
6134                &mut payload,
6135                0x29c3b656a1020bfd,
6136                fidl::encoding::DynamicFlags::FLEXIBLE,
6137                _decode,
6138            )
6139    }
6140
6141    type UnregisterVmosResponseFut = fidl::client::QueryResponseFut<
6142        PacketStreamControlUnregisterVmosResult,
6143        fdomain_client::fidl::FDomainResourceDialect,
6144    >;
6145    fn r#unregister_vmos(&self) -> Self::UnregisterVmosResponseFut {
6146        fn _decode(
6147            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6148        ) -> Result<PacketStreamControlUnregisterVmosResult, fidl::Error> {
6149            let _response = fidl::client::decode_transaction_body::<
6150                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
6151                fdomain_client::fidl::FDomainResourceDialect,
6152                0x3e3b4dbfe26b6094,
6153            >(_buf?)?
6154            .into_result_fdomain::<PacketStreamControlMarker>("unregister_vmos")?;
6155            Ok(_response.map(|x| x))
6156        }
6157        self.client.send_query_and_decode::<
6158            fidl::encoding::EmptyPayload,
6159            PacketStreamControlUnregisterVmosResult,
6160        >(
6161            (),
6162            0x3e3b4dbfe26b6094,
6163            fidl::encoding::DynamicFlags::FLEXIBLE,
6164            _decode,
6165        )
6166    }
6167
6168    type GetPacketStreamSinkResponseFut = fidl::client::QueryResponseFut<
6169        PacketStreamControlGetPacketStreamSinkResult,
6170        fdomain_client::fidl::FDomainResourceDialect,
6171    >;
6172    fn r#get_packet_stream_sink(&self) -> Self::GetPacketStreamSinkResponseFut {
6173        fn _decode(
6174            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6175        ) -> Result<PacketStreamControlGetPacketStreamSinkResult, fidl::Error> {
6176            let _response = fidl::client::decode_transaction_body::<
6177                fidl::encoding::FlexibleResultType<
6178                    PacketStreamControlGetPacketStreamSinkResponse,
6179                    i32,
6180                >,
6181                fdomain_client::fidl::FDomainResourceDialect,
6182                0x7394726463ebbc6a,
6183            >(_buf?)?
6184            .into_result_fdomain::<PacketStreamControlMarker>("get_packet_stream_sink")?;
6185            Ok(_response.map(|x| x))
6186        }
6187        self.client.send_query_and_decode::<
6188            fidl::encoding::EmptyPayload,
6189            PacketStreamControlGetPacketStreamSinkResult,
6190        >(
6191            (),
6192            0x7394726463ebbc6a,
6193            fidl::encoding::DynamicFlags::FLEXIBLE,
6194            _decode,
6195        )
6196    }
6197
6198    type SetPacketStreamSinkResponseFut = fidl::client::QueryResponseFut<
6199        PacketStreamControlSetPacketStreamSinkResult,
6200        fdomain_client::fidl::FDomainResourceDialect,
6201    >;
6202    fn r#set_packet_stream_sink(
6203        &self,
6204        mut payload: PacketStreamControlSetPacketStreamSinkRequest,
6205    ) -> Self::SetPacketStreamSinkResponseFut {
6206        fn _decode(
6207            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6208        ) -> Result<PacketStreamControlSetPacketStreamSinkResult, fidl::Error> {
6209            let _response = fidl::client::decode_transaction_body::<
6210                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
6211                fdomain_client::fidl::FDomainResourceDialect,
6212                0xab88800e31dc0e4,
6213            >(_buf?)?
6214            .into_result_fdomain::<PacketStreamControlMarker>("set_packet_stream_sink")?;
6215            Ok(_response.map(|x| x))
6216        }
6217        self.client.send_query_and_decode::<
6218            PacketStreamControlSetPacketStreamSinkRequest,
6219            PacketStreamControlSetPacketStreamSinkResult,
6220        >(
6221            &mut payload,
6222            0xab88800e31dc0e4,
6223            fidl::encoding::DynamicFlags::FLEXIBLE,
6224            _decode,
6225        )
6226    }
6227
6228    type StartResponseFut = fidl::client::QueryResponseFut<
6229        PacketStreamControlStartResult,
6230        fdomain_client::fidl::FDomainResourceDialect,
6231    >;
6232    fn r#start(&self) -> Self::StartResponseFut {
6233        fn _decode(
6234            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6235        ) -> Result<PacketStreamControlStartResult, fidl::Error> {
6236            let _response = fidl::client::decode_transaction_body::<
6237                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
6238                fdomain_client::fidl::FDomainResourceDialect,
6239                0x3a584b94d8a6bfd0,
6240            >(_buf?)?
6241            .into_result_fdomain::<PacketStreamControlMarker>("start")?;
6242            Ok(_response.map(|x| x))
6243        }
6244        self.client
6245            .send_query_and_decode::<fidl::encoding::EmptyPayload, PacketStreamControlStartResult>(
6246                (),
6247                0x3a584b94d8a6bfd0,
6248                fidl::encoding::DynamicFlags::FLEXIBLE,
6249                _decode,
6250            )
6251    }
6252
6253    type StopResponseFut = fidl::client::QueryResponseFut<
6254        PacketStreamControlStopResult,
6255        fdomain_client::fidl::FDomainResourceDialect,
6256    >;
6257    fn r#stop(&self) -> Self::StopResponseFut {
6258        fn _decode(
6259            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6260        ) -> Result<PacketStreamControlStopResult, fidl::Error> {
6261            let _response = fidl::client::decode_transaction_body::<
6262                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
6263                fdomain_client::fidl::FDomainResourceDialect,
6264                0x703e4fafcdd7ef32,
6265            >(_buf?)?
6266            .into_result_fdomain::<PacketStreamControlMarker>("stop")?;
6267            Ok(_response.map(|x| x))
6268        }
6269        self.client
6270            .send_query_and_decode::<fidl::encoding::EmptyPayload, PacketStreamControlStopResult>(
6271                (),
6272                0x703e4fafcdd7ef32,
6273                fidl::encoding::DynamicFlags::FLEXIBLE,
6274                _decode,
6275            )
6276    }
6277}
6278
6279pub struct PacketStreamControlEventStream {
6280    event_receiver: fidl::client::EventReceiver<fdomain_client::fidl::FDomainResourceDialect>,
6281}
6282
6283impl std::marker::Unpin for PacketStreamControlEventStream {}
6284
6285impl futures::stream::FusedStream for PacketStreamControlEventStream {
6286    fn is_terminated(&self) -> bool {
6287        self.event_receiver.is_terminated()
6288    }
6289}
6290
6291impl futures::Stream for PacketStreamControlEventStream {
6292    type Item = Result<PacketStreamControlEvent, fidl::Error>;
6293
6294    fn poll_next(
6295        mut self: std::pin::Pin<&mut Self>,
6296        cx: &mut std::task::Context<'_>,
6297    ) -> std::task::Poll<Option<Self::Item>> {
6298        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
6299            &mut self.event_receiver,
6300            cx
6301        )?) {
6302            Some(buf) => std::task::Poll::Ready(Some(PacketStreamControlEvent::decode(buf))),
6303            None => std::task::Poll::Ready(None),
6304        }
6305    }
6306}
6307
6308#[derive(Debug)]
6309pub enum PacketStreamControlEvent {
6310    #[non_exhaustive]
6311    _UnknownEvent {
6312        /// Ordinal of the event that was sent.
6313        ordinal: u64,
6314    },
6315}
6316
6317impl PacketStreamControlEvent {
6318    /// Decodes a message buffer as a [`PacketStreamControlEvent`].
6319    fn decode(
6320        mut buf: <fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
6321    ) -> Result<PacketStreamControlEvent, fidl::Error> {
6322        let (bytes, _handles) = buf.split_mut();
6323        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
6324        debug_assert_eq!(tx_header.tx_id, 0);
6325        match tx_header.ordinal {
6326            _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
6327                Ok(PacketStreamControlEvent::_UnknownEvent { ordinal: tx_header.ordinal })
6328            }
6329            _ => Err(fidl::Error::UnknownOrdinal {
6330                ordinal: tx_header.ordinal,
6331                protocol_name:
6332                    <PacketStreamControlMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
6333            }),
6334        }
6335    }
6336}
6337
6338/// A Stream of incoming requests for fuchsia.hardware.audio/PacketStreamControl.
6339pub struct PacketStreamControlRequestStream {
6340    inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
6341    is_terminated: bool,
6342}
6343
6344impl std::marker::Unpin for PacketStreamControlRequestStream {}
6345
6346impl futures::stream::FusedStream for PacketStreamControlRequestStream {
6347    fn is_terminated(&self) -> bool {
6348        self.is_terminated
6349    }
6350}
6351
6352impl fdomain_client::fidl::RequestStream for PacketStreamControlRequestStream {
6353    type Protocol = PacketStreamControlMarker;
6354    type ControlHandle = PacketStreamControlControlHandle;
6355
6356    fn from_channel(channel: fdomain_client::Channel) -> Self {
6357        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
6358    }
6359
6360    fn control_handle(&self) -> Self::ControlHandle {
6361        PacketStreamControlControlHandle { inner: self.inner.clone() }
6362    }
6363
6364    fn into_inner(
6365        self,
6366    ) -> (::std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>, bool)
6367    {
6368        (self.inner, self.is_terminated)
6369    }
6370
6371    fn from_inner(
6372        inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
6373        is_terminated: bool,
6374    ) -> Self {
6375        Self { inner, is_terminated }
6376    }
6377}
6378
6379impl futures::Stream for PacketStreamControlRequestStream {
6380    type Item = Result<PacketStreamControlRequest, fidl::Error>;
6381
6382    fn poll_next(
6383        mut self: std::pin::Pin<&mut Self>,
6384        cx: &mut std::task::Context<'_>,
6385    ) -> std::task::Poll<Option<Self::Item>> {
6386        let this = &mut *self;
6387        if this.inner.check_shutdown(cx) {
6388            this.is_terminated = true;
6389            return std::task::Poll::Ready(None);
6390        }
6391        if this.is_terminated {
6392            panic!("polled PacketStreamControlRequestStream after completion");
6393        }
6394        fidl::encoding::with_tls_decode_buf::<_, fdomain_client::fidl::FDomainResourceDialect>(
6395            |bytes, handles| {
6396                match this.inner.channel().read_etc(cx, bytes, handles) {
6397                    std::task::Poll::Ready(Ok(())) => {}
6398                    std::task::Poll::Pending => return std::task::Poll::Pending,
6399                    std::task::Poll::Ready(Err(None)) => {
6400                        this.is_terminated = true;
6401                        return std::task::Poll::Ready(None);
6402                    }
6403                    std::task::Poll::Ready(Err(Some(e))) => {
6404                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
6405                            e.into(),
6406                        ))));
6407                    }
6408                }
6409
6410                // A message has been received from the channel
6411                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
6412
6413                std::task::Poll::Ready(Some(match header.ordinal {
6414                0x586cf4f0f8d2771f => {
6415                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6416                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fdomain_client::fidl::FDomainResourceDialect);
6417                    fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
6418                    let control_handle = PacketStreamControlControlHandle {
6419                        inner: this.inner.clone(),
6420                    };
6421                    Ok(PacketStreamControlRequest::GetProperties {
6422                        responder: PacketStreamControlGetPropertiesResponder {
6423                            control_handle: std::mem::ManuallyDrop::new(control_handle),
6424                            tx_id: header.tx_id,
6425                        },
6426                    })
6427                }
6428                0x7ff1473165ed344b => {
6429                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6430                    let mut req = fidl::new_empty!(AllocateVmosConfig, fdomain_client::fidl::FDomainResourceDialect);
6431                    fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<AllocateVmosConfig>(&header, _body_bytes, handles, &mut req)?;
6432                    let control_handle = PacketStreamControlControlHandle {
6433                        inner: this.inner.clone(),
6434                    };
6435                    Ok(PacketStreamControlRequest::AllocateVmos {payload: req,
6436                        responder: PacketStreamControlAllocateVmosResponder {
6437                            control_handle: std::mem::ManuallyDrop::new(control_handle),
6438                            tx_id: header.tx_id,
6439                        },
6440                    })
6441                }
6442                0x4db5cc85a7b8405b => {
6443                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6444                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fdomain_client::fidl::FDomainResourceDialect);
6445                    fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
6446                    let control_handle = PacketStreamControlControlHandle {
6447                        inner: this.inner.clone(),
6448                    };
6449                    Ok(PacketStreamControlRequest::DeallocateVmos {
6450                        responder: PacketStreamControlDeallocateVmosResponder {
6451                            control_handle: std::mem::ManuallyDrop::new(control_handle),
6452                            tx_id: header.tx_id,
6453                        },
6454                    })
6455                }
6456                0x29c3b656a1020bfd => {
6457                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6458                    let mut req = fidl::new_empty!(RegisterVmosConfig, fdomain_client::fidl::FDomainResourceDialect);
6459                    fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<RegisterVmosConfig>(&header, _body_bytes, handles, &mut req)?;
6460                    let control_handle = PacketStreamControlControlHandle {
6461                        inner: this.inner.clone(),
6462                    };
6463                    Ok(PacketStreamControlRequest::RegisterVmos {payload: req,
6464                        responder: PacketStreamControlRegisterVmosResponder {
6465                            control_handle: std::mem::ManuallyDrop::new(control_handle),
6466                            tx_id: header.tx_id,
6467                        },
6468                    })
6469                }
6470                0x3e3b4dbfe26b6094 => {
6471                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6472                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fdomain_client::fidl::FDomainResourceDialect);
6473                    fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
6474                    let control_handle = PacketStreamControlControlHandle {
6475                        inner: this.inner.clone(),
6476                    };
6477                    Ok(PacketStreamControlRequest::UnregisterVmos {
6478                        responder: PacketStreamControlUnregisterVmosResponder {
6479                            control_handle: std::mem::ManuallyDrop::new(control_handle),
6480                            tx_id: header.tx_id,
6481                        },
6482                    })
6483                }
6484                0x7394726463ebbc6a => {
6485                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6486                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fdomain_client::fidl::FDomainResourceDialect);
6487                    fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
6488                    let control_handle = PacketStreamControlControlHandle {
6489                        inner: this.inner.clone(),
6490                    };
6491                    Ok(PacketStreamControlRequest::GetPacketStreamSink {
6492                        responder: PacketStreamControlGetPacketStreamSinkResponder {
6493                            control_handle: std::mem::ManuallyDrop::new(control_handle),
6494                            tx_id: header.tx_id,
6495                        },
6496                    })
6497                }
6498                0xab88800e31dc0e4 => {
6499                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6500                    let mut req = fidl::new_empty!(PacketStreamControlSetPacketStreamSinkRequest, fdomain_client::fidl::FDomainResourceDialect);
6501                    fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<PacketStreamControlSetPacketStreamSinkRequest>(&header, _body_bytes, handles, &mut req)?;
6502                    let control_handle = PacketStreamControlControlHandle {
6503                        inner: this.inner.clone(),
6504                    };
6505                    Ok(PacketStreamControlRequest::SetPacketStreamSink {payload: req,
6506                        responder: PacketStreamControlSetPacketStreamSinkResponder {
6507                            control_handle: std::mem::ManuallyDrop::new(control_handle),
6508                            tx_id: header.tx_id,
6509                        },
6510                    })
6511                }
6512                0x3a584b94d8a6bfd0 => {
6513                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6514                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fdomain_client::fidl::FDomainResourceDialect);
6515                    fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
6516                    let control_handle = PacketStreamControlControlHandle {
6517                        inner: this.inner.clone(),
6518                    };
6519                    Ok(PacketStreamControlRequest::Start {
6520                        responder: PacketStreamControlStartResponder {
6521                            control_handle: std::mem::ManuallyDrop::new(control_handle),
6522                            tx_id: header.tx_id,
6523                        },
6524                    })
6525                }
6526                0x703e4fafcdd7ef32 => {
6527                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6528                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fdomain_client::fidl::FDomainResourceDialect);
6529                    fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
6530                    let control_handle = PacketStreamControlControlHandle {
6531                        inner: this.inner.clone(),
6532                    };
6533                    Ok(PacketStreamControlRequest::Stop {
6534                        responder: PacketStreamControlStopResponder {
6535                            control_handle: std::mem::ManuallyDrop::new(control_handle),
6536                            tx_id: header.tx_id,
6537                        },
6538                    })
6539                }
6540                _ if header.tx_id == 0 && header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
6541                    Ok(PacketStreamControlRequest::_UnknownMethod {
6542                        ordinal: header.ordinal,
6543                        control_handle: PacketStreamControlControlHandle { inner: this.inner.clone() },
6544                        method_type: fidl::MethodType::OneWay,
6545                    })
6546                }
6547                _ if header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
6548                    this.inner.send_framework_err(
6549                        fidl::encoding::FrameworkErr::UnknownMethod,
6550                        header.tx_id,
6551                        header.ordinal,
6552                        header.dynamic_flags(),
6553                        (bytes, handles),
6554                    )?;
6555                    Ok(PacketStreamControlRequest::_UnknownMethod {
6556                        ordinal: header.ordinal,
6557                        control_handle: PacketStreamControlControlHandle { inner: this.inner.clone() },
6558                        method_type: fidl::MethodType::TwoWay,
6559                    })
6560                }
6561                _ => Err(fidl::Error::UnknownOrdinal {
6562                    ordinal: header.ordinal,
6563                    protocol_name: <PacketStreamControlMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
6564                }),
6565            }))
6566            },
6567        )
6568    }
6569}
6570
6571/// Control protocol for establishing and managing the packet stream.
6572#[derive(Debug)]
6573pub enum PacketStreamControlRequest {
6574    /// Accessor for top level static properties.
6575    GetProperties { responder: PacketStreamControlGetPropertiesResponder },
6576    /// Request the driver to allocate VMOs for data transfer.
6577    /// Returns the allocated VMOs and their assigned IDs.
6578    ///
6579    /// The returned VMO handle must include ZX_RIGHT_TRANSFER, ZX_RIGHT_READ and ZX_RIGHT_MAP.
6580    /// If the packet stream is an output stream, then the handle must also include
6581    /// ZX_RIGHT_WRITE.
6582    ///
6583    /// Returns `ZX_ERR_INVALID_ARGS` if `min_vmo_size` is zero or `vmo_count` is zero.
6584    /// Returns `ZX_ERR_NO_MEMORY` if the driver cannot allocate the requested VMOs.
6585    /// Returns `ZX_ERR_BAD_STATE` if VMOs are already allocated or registered, or if the
6586    /// stream is already started. Call `DeallocateVmos` or `UnregisterVmos` first to
6587    /// reconfigure.
6588    AllocateVmos {
6589        payload: AllocateVmosConfig,
6590        responder: PacketStreamControlAllocateVmosResponder,
6591    },
6592    /// Releases all VMOs previously allocated via `AllocateVmos`.
6593    /// This also occurs automatically when the `PacketStreamControl` channel is closed.
6594    ///
6595    /// Returns `ZX_ERR_BAD_STATE` if VMOs are not currently allocated, or if the stream is
6596    /// not stopped.
6597    DeallocateVmos { responder: PacketStreamControlDeallocateVmosResponder },
6598    /// Registers client-allocated VMOs with the driver.
6599    ///
6600    /// The registered VMO handle must include ZX_RIGHT_TRANSFER, ZX_RIGHT_READ and ZX_RIGHT_MAP.
6601    /// If the packet stream is an input stream, then the handle must also include
6602    /// ZX_RIGHT_WRITE.
6603    ///
6604    /// Returns `ZX_ERR_INVALID_ARGS` if `vmo_infos` is empty, or if any VMO handle is invalid,
6605    /// or if duplicate `vmo_id`s are found.
6606    /// Returns `ZX_ERR_ACCESS_DENIED` if any VMO does not have the required rights.
6607    /// Returns `ZX_ERR_BAD_STATE` if VMOs are already registered or allocated, or if the
6608    /// stream is already started. Call `UnregisterVmos` or `DeallocateVmos` first to
6609    /// reconfigure.
6610    RegisterVmos {
6611        payload: RegisterVmosConfig,
6612        responder: PacketStreamControlRegisterVmosResponder,
6613    },
6614    /// Unregisters all VMOs previously registered via `RegisterVmos`.
6615    /// This also occurs automatically when the `PacketStreamControl` channel is closed.
6616    ///
6617    /// Returns `ZX_ERR_BAD_STATE` if VMOs are not currently registered, or if the stream is
6618    /// not stopped.
6619    UnregisterVmos { responder: PacketStreamControlUnregisterVmosResponder },
6620    /// Connects to the data sink implemented by the driver.
6621    /// This is used for audio **Output** where the driver consumes data.
6622    ///
6623    /// Flow:
6624    /// 1. App writes audio data to a registered VMO.
6625    /// 2. App flushes the cache for the written region (if `needs_cache_flush_or_invalidate` is
6626    ///    true).
6627    /// 3. App calls `PacketStreamSink.PutPacket` with the location of the data.
6628    /// 4. Driver consumes the data.
6629    ///
6630    /// If this method is called multiple times, the previous `PacketStreamSink` channel is closed,
6631    /// and any pending requests on that channel are discarded. The new channel replaces the old
6632    /// one.
6633    ///
6634    /// Returns `ZX_ERR_NOT_SUPPORTED` if the stream is an input stream, or if the driver does
6635    /// not support this method.
6636    GetPacketStreamSink { responder: PacketStreamControlGetPacketStreamSinkResponder },
6637    /// Provides a data sink to the driver.
6638    /// This is used for audio **Input** where the driver produces data.
6639    ///
6640    /// Flow:
6641    /// 1. Driver writes audio data to a registered VMO.
6642    /// 2. Driver calls `PacketStreamSink.PutPacket` with the location of the data.
6643    /// 3. App receives `PutPacket`.
6644    /// 4. App invalidates the cache for the region (if `needs_cache_flush_or_invalidate` is
6645    ///    true).
6646    /// 5. App reads the data.
6647    ///
6648    /// If this method is called multiple times, the driver closes the previous `PacketStreamSink`
6649    /// channel. The new channel replaces the old one.
6650    ///
6651    /// Returns `ZX_ERR_NOT_SUPPORTED` if the stream is an output stream, or if the driver does
6652    /// not support this method.
6653    SetPacketStreamSink {
6654        payload: PacketStreamControlSetPacketStreamSinkRequest,
6655        responder: PacketStreamControlSetPacketStreamSinkResponder,
6656    },
6657    /// Start the packet-stream.
6658    ///
6659    /// Returns `ZX_ERR_BAD_STATE` if:
6660    /// * Buffers have not been allocated (if `DRIVER_OWNED` was specified)
6661    ///   and/or registered (if `CLIENT_OWNED` was specified). This is not applicable if
6662    ///   `INLINE` is supported.
6663    /// * The stream is already started.
6664    Start { responder: PacketStreamControlStartResponder },
6665    /// Stop the packet-stream.
6666    ///
6667    /// Once the response is received, the stream is halted.
6668    ///
6669    /// Behavior depends on the stream direction:
6670    /// * **Output**: The driver stops consuming packets. Any pending `PacketStreamSink.PutPacket`
6671    ///   requests will remain pending until `Start` is called again. Clients may call
6672    ///   `PacketStreamSink.FlushPackets` after `Stop` to discard these pending packets.
6673    /// * **Input**: The driver stops producing packets. No further `PacketStreamSink.PutPacket`
6674    ///   calls will be made by the driver until `Start` is called again.
6675    ///
6676    /// Note that since `PacketStreamSink` uses a separate channel, there is no strict ordering
6677    /// guarantee between `Stop` and `PacketStreamSink.PutPacket`:
6678    /// * For **Output**, some in-flight `PacketStreamSink.PutPacket` calls may
6679    ///   complete successfully after `Stop` has returned.
6680    /// * For **Input**, some in-flight `PacketStreamSink.PutPacket` calls may
6681    ///   arrive at the client after `Stop` has returned.
6682    ///
6683    /// Returns `ZX_ERR_BAD_STATE` if the stream is not started.
6684    Stop { responder: PacketStreamControlStopResponder },
6685    /// An interaction was received which does not match any known method.
6686    #[non_exhaustive]
6687    _UnknownMethod {
6688        /// Ordinal of the method that was called.
6689        ordinal: u64,
6690        control_handle: PacketStreamControlControlHandle,
6691        method_type: fidl::MethodType,
6692    },
6693}
6694
6695impl PacketStreamControlRequest {
6696    #[allow(irrefutable_let_patterns)]
6697    pub fn into_get_properties(self) -> Option<(PacketStreamControlGetPropertiesResponder)> {
6698        if let PacketStreamControlRequest::GetProperties { responder } = self {
6699            Some((responder))
6700        } else {
6701            None
6702        }
6703    }
6704
6705    #[allow(irrefutable_let_patterns)]
6706    pub fn into_allocate_vmos(
6707        self,
6708    ) -> Option<(AllocateVmosConfig, PacketStreamControlAllocateVmosResponder)> {
6709        if let PacketStreamControlRequest::AllocateVmos { payload, responder } = self {
6710            Some((payload, responder))
6711        } else {
6712            None
6713        }
6714    }
6715
6716    #[allow(irrefutable_let_patterns)]
6717    pub fn into_deallocate_vmos(self) -> Option<(PacketStreamControlDeallocateVmosResponder)> {
6718        if let PacketStreamControlRequest::DeallocateVmos { responder } = self {
6719            Some((responder))
6720        } else {
6721            None
6722        }
6723    }
6724
6725    #[allow(irrefutable_let_patterns)]
6726    pub fn into_register_vmos(
6727        self,
6728    ) -> Option<(RegisterVmosConfig, PacketStreamControlRegisterVmosResponder)> {
6729        if let PacketStreamControlRequest::RegisterVmos { payload, responder } = self {
6730            Some((payload, responder))
6731        } else {
6732            None
6733        }
6734    }
6735
6736    #[allow(irrefutable_let_patterns)]
6737    pub fn into_unregister_vmos(self) -> Option<(PacketStreamControlUnregisterVmosResponder)> {
6738        if let PacketStreamControlRequest::UnregisterVmos { responder } = self {
6739            Some((responder))
6740        } else {
6741            None
6742        }
6743    }
6744
6745    #[allow(irrefutable_let_patterns)]
6746    pub fn into_get_packet_stream_sink(
6747        self,
6748    ) -> Option<(PacketStreamControlGetPacketStreamSinkResponder)> {
6749        if let PacketStreamControlRequest::GetPacketStreamSink { responder } = self {
6750            Some((responder))
6751        } else {
6752            None
6753        }
6754    }
6755
6756    #[allow(irrefutable_let_patterns)]
6757    pub fn into_set_packet_stream_sink(
6758        self,
6759    ) -> Option<(
6760        PacketStreamControlSetPacketStreamSinkRequest,
6761        PacketStreamControlSetPacketStreamSinkResponder,
6762    )> {
6763        if let PacketStreamControlRequest::SetPacketStreamSink { payload, responder } = self {
6764            Some((payload, responder))
6765        } else {
6766            None
6767        }
6768    }
6769
6770    #[allow(irrefutable_let_patterns)]
6771    pub fn into_start(self) -> Option<(PacketStreamControlStartResponder)> {
6772        if let PacketStreamControlRequest::Start { responder } = self {
6773            Some((responder))
6774        } else {
6775            None
6776        }
6777    }
6778
6779    #[allow(irrefutable_let_patterns)]
6780    pub fn into_stop(self) -> Option<(PacketStreamControlStopResponder)> {
6781        if let PacketStreamControlRequest::Stop { responder } = self {
6782            Some((responder))
6783        } else {
6784            None
6785        }
6786    }
6787
6788    /// Name of the method defined in FIDL
6789    pub fn method_name(&self) -> &'static str {
6790        match *self {
6791            PacketStreamControlRequest::GetProperties { .. } => "get_properties",
6792            PacketStreamControlRequest::AllocateVmos { .. } => "allocate_vmos",
6793            PacketStreamControlRequest::DeallocateVmos { .. } => "deallocate_vmos",
6794            PacketStreamControlRequest::RegisterVmos { .. } => "register_vmos",
6795            PacketStreamControlRequest::UnregisterVmos { .. } => "unregister_vmos",
6796            PacketStreamControlRequest::GetPacketStreamSink { .. } => "get_packet_stream_sink",
6797            PacketStreamControlRequest::SetPacketStreamSink { .. } => "set_packet_stream_sink",
6798            PacketStreamControlRequest::Start { .. } => "start",
6799            PacketStreamControlRequest::Stop { .. } => "stop",
6800            PacketStreamControlRequest::_UnknownMethod {
6801                method_type: fidl::MethodType::OneWay,
6802                ..
6803            } => "unknown one-way method",
6804            PacketStreamControlRequest::_UnknownMethod {
6805                method_type: fidl::MethodType::TwoWay,
6806                ..
6807            } => "unknown two-way method",
6808        }
6809    }
6810}
6811
6812#[derive(Debug, Clone)]
6813pub struct PacketStreamControlControlHandle {
6814    inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
6815}
6816
6817impl PacketStreamControlControlHandle {
6818    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
6819        self.inner.shutdown_with_epitaph(status.into())
6820    }
6821}
6822
6823impl fdomain_client::fidl::ControlHandle for PacketStreamControlControlHandle {
6824    fn shutdown(&self) {
6825        self.inner.shutdown()
6826    }
6827
6828    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
6829        self.inner.shutdown_with_epitaph(status)
6830    }
6831
6832    fn is_closed(&self) -> bool {
6833        self.inner.channel().is_closed()
6834    }
6835    fn on_closed(&self) -> fdomain_client::OnFDomainSignals {
6836        self.inner.channel().on_closed()
6837    }
6838}
6839
6840impl PacketStreamControlControlHandle {}
6841
6842#[must_use = "FIDL methods require a response to be sent"]
6843#[derive(Debug)]
6844pub struct PacketStreamControlGetPropertiesResponder {
6845    control_handle: std::mem::ManuallyDrop<PacketStreamControlControlHandle>,
6846    tx_id: u32,
6847}
6848
6849/// Set the the channel to be shutdown (see [`PacketStreamControlControlHandle::shutdown`])
6850/// if the responder is dropped without sending a response, so that the client
6851/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6852impl std::ops::Drop for PacketStreamControlGetPropertiesResponder {
6853    fn drop(&mut self) {
6854        self.control_handle.shutdown();
6855        // Safety: drops once, never accessed again
6856        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6857    }
6858}
6859
6860impl fdomain_client::fidl::Responder for PacketStreamControlGetPropertiesResponder {
6861    type ControlHandle = PacketStreamControlControlHandle;
6862
6863    fn control_handle(&self) -> &PacketStreamControlControlHandle {
6864        &self.control_handle
6865    }
6866
6867    fn drop_without_shutdown(mut self) {
6868        // Safety: drops once, never accessed again due to mem::forget
6869        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6870        // Prevent Drop from running (which would shut down the channel)
6871        std::mem::forget(self);
6872    }
6873}
6874
6875impl PacketStreamControlGetPropertiesResponder {
6876    /// Sends a response to the FIDL transaction.
6877    ///
6878    /// Sets the channel to shutdown if an error occurs.
6879    pub fn send(self, mut properties: &PacketStreamProperties) -> Result<(), fidl::Error> {
6880        let _result = self.send_raw(properties);
6881        if _result.is_err() {
6882            self.control_handle.shutdown();
6883        }
6884        self.drop_without_shutdown();
6885        _result
6886    }
6887
6888    /// Similar to "send" but does not shutdown the channel if an error occurs.
6889    pub fn send_no_shutdown_on_err(
6890        self,
6891        mut properties: &PacketStreamProperties,
6892    ) -> Result<(), fidl::Error> {
6893        let _result = self.send_raw(properties);
6894        self.drop_without_shutdown();
6895        _result
6896    }
6897
6898    fn send_raw(&self, mut properties: &PacketStreamProperties) -> Result<(), fidl::Error> {
6899        self.control_handle.inner.send::<fidl::encoding::FlexibleType<
6900            PacketStreamControlGetPropertiesResponse,
6901        >>(
6902            fidl::encoding::Flexible::new((properties,)),
6903            self.tx_id,
6904            0x586cf4f0f8d2771f,
6905            fidl::encoding::DynamicFlags::FLEXIBLE,
6906        )
6907    }
6908}
6909
6910#[must_use = "FIDL methods require a response to be sent"]
6911#[derive(Debug)]
6912pub struct PacketStreamControlAllocateVmosResponder {
6913    control_handle: std::mem::ManuallyDrop<PacketStreamControlControlHandle>,
6914    tx_id: u32,
6915}
6916
6917/// Set the the channel to be shutdown (see [`PacketStreamControlControlHandle::shutdown`])
6918/// if the responder is dropped without sending a response, so that the client
6919/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6920impl std::ops::Drop for PacketStreamControlAllocateVmosResponder {
6921    fn drop(&mut self) {
6922        self.control_handle.shutdown();
6923        // Safety: drops once, never accessed again
6924        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6925    }
6926}
6927
6928impl fdomain_client::fidl::Responder for PacketStreamControlAllocateVmosResponder {
6929    type ControlHandle = PacketStreamControlControlHandle;
6930
6931    fn control_handle(&self) -> &PacketStreamControlControlHandle {
6932        &self.control_handle
6933    }
6934
6935    fn drop_without_shutdown(mut self) {
6936        // Safety: drops once, never accessed again due to mem::forget
6937        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6938        // Prevent Drop from running (which would shut down the channel)
6939        std::mem::forget(self);
6940    }
6941}
6942
6943impl PacketStreamControlAllocateVmosResponder {
6944    /// Sends a response to the FIDL transaction.
6945    ///
6946    /// Sets the channel to shutdown if an error occurs.
6947    pub fn send(self, mut result: Result<Vec<VmoInfo>, i32>) -> Result<(), fidl::Error> {
6948        let _result = self.send_raw(result);
6949        if _result.is_err() {
6950            self.control_handle.shutdown();
6951        }
6952        self.drop_without_shutdown();
6953        _result
6954    }
6955
6956    /// Similar to "send" but does not shutdown the channel if an error occurs.
6957    pub fn send_no_shutdown_on_err(
6958        self,
6959        mut result: Result<Vec<VmoInfo>, i32>,
6960    ) -> Result<(), fidl::Error> {
6961        let _result = self.send_raw(result);
6962        self.drop_without_shutdown();
6963        _result
6964    }
6965
6966    fn send_raw(&self, mut result: Result<Vec<VmoInfo>, i32>) -> Result<(), fidl::Error> {
6967        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
6968            PacketStreamControlAllocateVmosResponse,
6969            i32,
6970        >>(
6971            fidl::encoding::FlexibleResult::new(
6972                result.as_mut().map_err(|e| *e).map(|vmos| (vmos.as_mut_slice(),)),
6973            ),
6974            self.tx_id,
6975            0x7ff1473165ed344b,
6976            fidl::encoding::DynamicFlags::FLEXIBLE,
6977        )
6978    }
6979}
6980
6981#[must_use = "FIDL methods require a response to be sent"]
6982#[derive(Debug)]
6983pub struct PacketStreamControlDeallocateVmosResponder {
6984    control_handle: std::mem::ManuallyDrop<PacketStreamControlControlHandle>,
6985    tx_id: u32,
6986}
6987
6988/// Set the the channel to be shutdown (see [`PacketStreamControlControlHandle::shutdown`])
6989/// if the responder is dropped without sending a response, so that the client
6990/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6991impl std::ops::Drop for PacketStreamControlDeallocateVmosResponder {
6992    fn drop(&mut self) {
6993        self.control_handle.shutdown();
6994        // Safety: drops once, never accessed again
6995        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6996    }
6997}
6998
6999impl fdomain_client::fidl::Responder for PacketStreamControlDeallocateVmosResponder {
7000    type ControlHandle = PacketStreamControlControlHandle;
7001
7002    fn control_handle(&self) -> &PacketStreamControlControlHandle {
7003        &self.control_handle
7004    }
7005
7006    fn drop_without_shutdown(mut self) {
7007        // Safety: drops once, never accessed again due to mem::forget
7008        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7009        // Prevent Drop from running (which would shut down the channel)
7010        std::mem::forget(self);
7011    }
7012}
7013
7014impl PacketStreamControlDeallocateVmosResponder {
7015    /// Sends a response to the FIDL transaction.
7016    ///
7017    /// Sets the channel to shutdown if an error occurs.
7018    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
7019        let _result = self.send_raw(result);
7020        if _result.is_err() {
7021            self.control_handle.shutdown();
7022        }
7023        self.drop_without_shutdown();
7024        _result
7025    }
7026
7027    /// Similar to "send" but does not shutdown the channel if an error occurs.
7028    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
7029        let _result = self.send_raw(result);
7030        self.drop_without_shutdown();
7031        _result
7032    }
7033
7034    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
7035        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
7036            fidl::encoding::EmptyStruct,
7037            i32,
7038        >>(
7039            fidl::encoding::FlexibleResult::new(result),
7040            self.tx_id,
7041            0x4db5cc85a7b8405b,
7042            fidl::encoding::DynamicFlags::FLEXIBLE,
7043        )
7044    }
7045}
7046
7047#[must_use = "FIDL methods require a response to be sent"]
7048#[derive(Debug)]
7049pub struct PacketStreamControlRegisterVmosResponder {
7050    control_handle: std::mem::ManuallyDrop<PacketStreamControlControlHandle>,
7051    tx_id: u32,
7052}
7053
7054/// Set the the channel to be shutdown (see [`PacketStreamControlControlHandle::shutdown`])
7055/// if the responder is dropped without sending a response, so that the client
7056/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7057impl std::ops::Drop for PacketStreamControlRegisterVmosResponder {
7058    fn drop(&mut self) {
7059        self.control_handle.shutdown();
7060        // Safety: drops once, never accessed again
7061        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7062    }
7063}
7064
7065impl fdomain_client::fidl::Responder for PacketStreamControlRegisterVmosResponder {
7066    type ControlHandle = PacketStreamControlControlHandle;
7067
7068    fn control_handle(&self) -> &PacketStreamControlControlHandle {
7069        &self.control_handle
7070    }
7071
7072    fn drop_without_shutdown(mut self) {
7073        // Safety: drops once, never accessed again due to mem::forget
7074        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7075        // Prevent Drop from running (which would shut down the channel)
7076        std::mem::forget(self);
7077    }
7078}
7079
7080impl PacketStreamControlRegisterVmosResponder {
7081    /// Sends a response to the FIDL transaction.
7082    ///
7083    /// Sets the channel to shutdown if an error occurs.
7084    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
7085        let _result = self.send_raw(result);
7086        if _result.is_err() {
7087            self.control_handle.shutdown();
7088        }
7089        self.drop_without_shutdown();
7090        _result
7091    }
7092
7093    /// Similar to "send" but does not shutdown the channel if an error occurs.
7094    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
7095        let _result = self.send_raw(result);
7096        self.drop_without_shutdown();
7097        _result
7098    }
7099
7100    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
7101        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
7102            fidl::encoding::EmptyStruct,
7103            i32,
7104        >>(
7105            fidl::encoding::FlexibleResult::new(result),
7106            self.tx_id,
7107            0x29c3b656a1020bfd,
7108            fidl::encoding::DynamicFlags::FLEXIBLE,
7109        )
7110    }
7111}
7112
7113#[must_use = "FIDL methods require a response to be sent"]
7114#[derive(Debug)]
7115pub struct PacketStreamControlUnregisterVmosResponder {
7116    control_handle: std::mem::ManuallyDrop<PacketStreamControlControlHandle>,
7117    tx_id: u32,
7118}
7119
7120/// Set the the channel to be shutdown (see [`PacketStreamControlControlHandle::shutdown`])
7121/// if the responder is dropped without sending a response, so that the client
7122/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7123impl std::ops::Drop for PacketStreamControlUnregisterVmosResponder {
7124    fn drop(&mut self) {
7125        self.control_handle.shutdown();
7126        // Safety: drops once, never accessed again
7127        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7128    }
7129}
7130
7131impl fdomain_client::fidl::Responder for PacketStreamControlUnregisterVmosResponder {
7132    type ControlHandle = PacketStreamControlControlHandle;
7133
7134    fn control_handle(&self) -> &PacketStreamControlControlHandle {
7135        &self.control_handle
7136    }
7137
7138    fn drop_without_shutdown(mut self) {
7139        // Safety: drops once, never accessed again due to mem::forget
7140        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7141        // Prevent Drop from running (which would shut down the channel)
7142        std::mem::forget(self);
7143    }
7144}
7145
7146impl PacketStreamControlUnregisterVmosResponder {
7147    /// Sends a response to the FIDL transaction.
7148    ///
7149    /// Sets the channel to shutdown if an error occurs.
7150    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
7151        let _result = self.send_raw(result);
7152        if _result.is_err() {
7153            self.control_handle.shutdown();
7154        }
7155        self.drop_without_shutdown();
7156        _result
7157    }
7158
7159    /// Similar to "send" but does not shutdown the channel if an error occurs.
7160    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
7161        let _result = self.send_raw(result);
7162        self.drop_without_shutdown();
7163        _result
7164    }
7165
7166    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
7167        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
7168            fidl::encoding::EmptyStruct,
7169            i32,
7170        >>(
7171            fidl::encoding::FlexibleResult::new(result),
7172            self.tx_id,
7173            0x3e3b4dbfe26b6094,
7174            fidl::encoding::DynamicFlags::FLEXIBLE,
7175        )
7176    }
7177}
7178
7179#[must_use = "FIDL methods require a response to be sent"]
7180#[derive(Debug)]
7181pub struct PacketStreamControlGetPacketStreamSinkResponder {
7182    control_handle: std::mem::ManuallyDrop<PacketStreamControlControlHandle>,
7183    tx_id: u32,
7184}
7185
7186/// Set the the channel to be shutdown (see [`PacketStreamControlControlHandle::shutdown`])
7187/// if the responder is dropped without sending a response, so that the client
7188/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7189impl std::ops::Drop for PacketStreamControlGetPacketStreamSinkResponder {
7190    fn drop(&mut self) {
7191        self.control_handle.shutdown();
7192        // Safety: drops once, never accessed again
7193        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7194    }
7195}
7196
7197impl fdomain_client::fidl::Responder for PacketStreamControlGetPacketStreamSinkResponder {
7198    type ControlHandle = PacketStreamControlControlHandle;
7199
7200    fn control_handle(&self) -> &PacketStreamControlControlHandle {
7201        &self.control_handle
7202    }
7203
7204    fn drop_without_shutdown(mut self) {
7205        // Safety: drops once, never accessed again due to mem::forget
7206        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7207        // Prevent Drop from running (which would shut down the channel)
7208        std::mem::forget(self);
7209    }
7210}
7211
7212impl PacketStreamControlGetPacketStreamSinkResponder {
7213    /// Sends a response to the FIDL transaction.
7214    ///
7215    /// Sets the channel to shutdown if an error occurs.
7216    pub fn send(
7217        self,
7218        mut result: Result<PacketStreamControlGetPacketStreamSinkResponse, i32>,
7219    ) -> Result<(), fidl::Error> {
7220        let _result = self.send_raw(result);
7221        if _result.is_err() {
7222            self.control_handle.shutdown();
7223        }
7224        self.drop_without_shutdown();
7225        _result
7226    }
7227
7228    /// Similar to "send" but does not shutdown the channel if an error occurs.
7229    pub fn send_no_shutdown_on_err(
7230        self,
7231        mut result: Result<PacketStreamControlGetPacketStreamSinkResponse, i32>,
7232    ) -> Result<(), fidl::Error> {
7233        let _result = self.send_raw(result);
7234        self.drop_without_shutdown();
7235        _result
7236    }
7237
7238    fn send_raw(
7239        &self,
7240        mut result: Result<PacketStreamControlGetPacketStreamSinkResponse, i32>,
7241    ) -> Result<(), fidl::Error> {
7242        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
7243            PacketStreamControlGetPacketStreamSinkResponse,
7244            i32,
7245        >>(
7246            fidl::encoding::FlexibleResult::new(result.as_mut().map_err(|e| *e)),
7247            self.tx_id,
7248            0x7394726463ebbc6a,
7249            fidl::encoding::DynamicFlags::FLEXIBLE,
7250        )
7251    }
7252}
7253
7254#[must_use = "FIDL methods require a response to be sent"]
7255#[derive(Debug)]
7256pub struct PacketStreamControlSetPacketStreamSinkResponder {
7257    control_handle: std::mem::ManuallyDrop<PacketStreamControlControlHandle>,
7258    tx_id: u32,
7259}
7260
7261/// Set the the channel to be shutdown (see [`PacketStreamControlControlHandle::shutdown`])
7262/// if the responder is dropped without sending a response, so that the client
7263/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7264impl std::ops::Drop for PacketStreamControlSetPacketStreamSinkResponder {
7265    fn drop(&mut self) {
7266        self.control_handle.shutdown();
7267        // Safety: drops once, never accessed again
7268        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7269    }
7270}
7271
7272impl fdomain_client::fidl::Responder for PacketStreamControlSetPacketStreamSinkResponder {
7273    type ControlHandle = PacketStreamControlControlHandle;
7274
7275    fn control_handle(&self) -> &PacketStreamControlControlHandle {
7276        &self.control_handle
7277    }
7278
7279    fn drop_without_shutdown(mut self) {
7280        // Safety: drops once, never accessed again due to mem::forget
7281        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7282        // Prevent Drop from running (which would shut down the channel)
7283        std::mem::forget(self);
7284    }
7285}
7286
7287impl PacketStreamControlSetPacketStreamSinkResponder {
7288    /// Sends a response to the FIDL transaction.
7289    ///
7290    /// Sets the channel to shutdown if an error occurs.
7291    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
7292        let _result = self.send_raw(result);
7293        if _result.is_err() {
7294            self.control_handle.shutdown();
7295        }
7296        self.drop_without_shutdown();
7297        _result
7298    }
7299
7300    /// Similar to "send" but does not shutdown the channel if an error occurs.
7301    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
7302        let _result = self.send_raw(result);
7303        self.drop_without_shutdown();
7304        _result
7305    }
7306
7307    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
7308        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
7309            fidl::encoding::EmptyStruct,
7310            i32,
7311        >>(
7312            fidl::encoding::FlexibleResult::new(result),
7313            self.tx_id,
7314            0xab88800e31dc0e4,
7315            fidl::encoding::DynamicFlags::FLEXIBLE,
7316        )
7317    }
7318}
7319
7320#[must_use = "FIDL methods require a response to be sent"]
7321#[derive(Debug)]
7322pub struct PacketStreamControlStartResponder {
7323    control_handle: std::mem::ManuallyDrop<PacketStreamControlControlHandle>,
7324    tx_id: u32,
7325}
7326
7327/// Set the the channel to be shutdown (see [`PacketStreamControlControlHandle::shutdown`])
7328/// if the responder is dropped without sending a response, so that the client
7329/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7330impl std::ops::Drop for PacketStreamControlStartResponder {
7331    fn drop(&mut self) {
7332        self.control_handle.shutdown();
7333        // Safety: drops once, never accessed again
7334        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7335    }
7336}
7337
7338impl fdomain_client::fidl::Responder for PacketStreamControlStartResponder {
7339    type ControlHandle = PacketStreamControlControlHandle;
7340
7341    fn control_handle(&self) -> &PacketStreamControlControlHandle {
7342        &self.control_handle
7343    }
7344
7345    fn drop_without_shutdown(mut self) {
7346        // Safety: drops once, never accessed again due to mem::forget
7347        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7348        // Prevent Drop from running (which would shut down the channel)
7349        std::mem::forget(self);
7350    }
7351}
7352
7353impl PacketStreamControlStartResponder {
7354    /// Sends a response to the FIDL transaction.
7355    ///
7356    /// Sets the channel to shutdown if an error occurs.
7357    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
7358        let _result = self.send_raw(result);
7359        if _result.is_err() {
7360            self.control_handle.shutdown();
7361        }
7362        self.drop_without_shutdown();
7363        _result
7364    }
7365
7366    /// Similar to "send" but does not shutdown the channel if an error occurs.
7367    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
7368        let _result = self.send_raw(result);
7369        self.drop_without_shutdown();
7370        _result
7371    }
7372
7373    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
7374        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
7375            fidl::encoding::EmptyStruct,
7376            i32,
7377        >>(
7378            fidl::encoding::FlexibleResult::new(result),
7379            self.tx_id,
7380            0x3a584b94d8a6bfd0,
7381            fidl::encoding::DynamicFlags::FLEXIBLE,
7382        )
7383    }
7384}
7385
7386#[must_use = "FIDL methods require a response to be sent"]
7387#[derive(Debug)]
7388pub struct PacketStreamControlStopResponder {
7389    control_handle: std::mem::ManuallyDrop<PacketStreamControlControlHandle>,
7390    tx_id: u32,
7391}
7392
7393/// Set the the channel to be shutdown (see [`PacketStreamControlControlHandle::shutdown`])
7394/// if the responder is dropped without sending a response, so that the client
7395/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7396impl std::ops::Drop for PacketStreamControlStopResponder {
7397    fn drop(&mut self) {
7398        self.control_handle.shutdown();
7399        // Safety: drops once, never accessed again
7400        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7401    }
7402}
7403
7404impl fdomain_client::fidl::Responder for PacketStreamControlStopResponder {
7405    type ControlHandle = PacketStreamControlControlHandle;
7406
7407    fn control_handle(&self) -> &PacketStreamControlControlHandle {
7408        &self.control_handle
7409    }
7410
7411    fn drop_without_shutdown(mut self) {
7412        // Safety: drops once, never accessed again due to mem::forget
7413        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7414        // Prevent Drop from running (which would shut down the channel)
7415        std::mem::forget(self);
7416    }
7417}
7418
7419impl PacketStreamControlStopResponder {
7420    /// Sends a response to the FIDL transaction.
7421    ///
7422    /// Sets the channel to shutdown if an error occurs.
7423    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
7424        let _result = self.send_raw(result);
7425        if _result.is_err() {
7426            self.control_handle.shutdown();
7427        }
7428        self.drop_without_shutdown();
7429        _result
7430    }
7431
7432    /// Similar to "send" but does not shutdown the channel if an error occurs.
7433    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
7434        let _result = self.send_raw(result);
7435        self.drop_without_shutdown();
7436        _result
7437    }
7438
7439    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
7440        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
7441            fidl::encoding::EmptyStruct,
7442            i32,
7443        >>(
7444            fidl::encoding::FlexibleResult::new(result),
7445            self.tx_id,
7446            0x703e4fafcdd7ef32,
7447            fidl::encoding::DynamicFlags::FLEXIBLE,
7448        )
7449    }
7450}
7451
7452#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
7453pub struct PacketStreamSinkMarker;
7454
7455impl fdomain_client::fidl::ProtocolMarker for PacketStreamSinkMarker {
7456    type Proxy = PacketStreamSinkProxy;
7457    type RequestStream = PacketStreamSinkRequestStream;
7458
7459    const DEBUG_NAME: &'static str = "(anonymous) PacketStreamSink";
7460}
7461pub type PacketStreamSinkPutPacketResult = Result<PacketStreamSinkPutPacketResponse, i32>;
7462pub type PacketStreamSinkFlushPacketsResult = Result<(), i32>;
7463
7464pub trait PacketStreamSinkProxyInterface: Send + Sync {
7465    type PutPacketResponseFut: std::future::Future<Output = Result<PacketStreamSinkPutPacketResult, fidl::Error>>
7466        + Send;
7467    fn r#put_packet(&self, payload: PacketStreamSinkPutPacketRequest)
7468    -> Self::PutPacketResponseFut;
7469    type FlushPacketsResponseFut: std::future::Future<Output = Result<PacketStreamSinkFlushPacketsResult, fidl::Error>>
7470        + Send;
7471    fn r#flush_packets(&self) -> Self::FlushPacketsResponseFut;
7472}
7473
7474#[derive(Debug, Clone)]
7475pub struct PacketStreamSinkProxy {
7476    client: fidl::client::Client<fdomain_client::fidl::FDomainResourceDialect>,
7477}
7478
7479impl fdomain_client::fidl::Proxy for PacketStreamSinkProxy {
7480    type Protocol = PacketStreamSinkMarker;
7481
7482    fn from_channel(inner: fdomain_client::Channel) -> Self {
7483        Self::new(inner)
7484    }
7485
7486    fn into_channel(self) -> Result<fdomain_client::Channel, Self> {
7487        self.client.into_channel().map_err(|client| Self { client })
7488    }
7489
7490    fn as_channel(&self) -> &fdomain_client::Channel {
7491        self.client.as_channel()
7492    }
7493}
7494
7495impl PacketStreamSinkProxy {
7496    /// Create a new Proxy for fuchsia.hardware.audio/PacketStreamSink.
7497    pub fn new(channel: fdomain_client::Channel) -> Self {
7498        let protocol_name =
7499            <PacketStreamSinkMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME;
7500        Self { client: fidl::client::Client::new(channel, protocol_name) }
7501    }
7502
7503    /// Get a Stream of events from the remote end of the protocol.
7504    ///
7505    /// # Panics
7506    ///
7507    /// Panics if the event stream was already taken.
7508    pub fn take_event_stream(&self) -> PacketStreamSinkEventStream {
7509        PacketStreamSinkEventStream { event_receiver: self.client.take_event_receiver() }
7510    }
7511
7512    /// Submits a packet to be processed by the server.
7513    ///
7514    /// The client may queue multiple packets by calling `PutPacket` repeatedly.
7515    /// Packets are processed in the order they were submitted. This call
7516    /// blocks until the payload is processed. When this call returns, the
7517    /// buffer region is guaranteed to be available for reuse.
7518    ///
7519    /// Returns `ZX_ERR_BAD_STATE` if the stream is not started or configured.
7520    /// Returns `ZX_ERR_CANCELED` if `FlushPackets` was called.
7521    /// Returns `ZX_ERR_INVALID_ARGS` if the packet is invalid. This includes:
7522    /// * The payload is missing.
7523    /// * `inline_data` is used but `supported_buffer_types` does not include `INLINE`.
7524    /// * `vmo_transfer` is used but `supported_buffer_types` does not include `CLIENT_OWNED` or
7525    ///   `DRIVER_OWNED`.
7526    /// * `vmo_id` is unrecognized, or `vmo_offset` + `payload_size` exceeds the VMO size.
7527    ///
7528    /// Note: The server is not required to detect if a VMO region is currently in use by a
7529    /// previous pending packet. Clients are responsible for managing buffer usage.
7530    pub fn r#put_packet(
7531        &self,
7532        mut payload: PacketStreamSinkPutPacketRequest,
7533    ) -> fidl::client::QueryResponseFut<
7534        PacketStreamSinkPutPacketResult,
7535        fdomain_client::fidl::FDomainResourceDialect,
7536    > {
7537        PacketStreamSinkProxyInterface::r#put_packet(self, payload)
7538    }
7539
7540    /// Flushes all packets currently pending without processing them.
7541    /// This call waits until all pending packets are completed or canceled.
7542    ///
7543    /// Note: A packet may be partially processed (e.g. if it contains multiple
7544    /// audio frames, or if the data does not align with encoded frame boundaries)
7545    /// before it is canceled.
7546    pub fn r#flush_packets(
7547        &self,
7548    ) -> fidl::client::QueryResponseFut<
7549        PacketStreamSinkFlushPacketsResult,
7550        fdomain_client::fidl::FDomainResourceDialect,
7551    > {
7552        PacketStreamSinkProxyInterface::r#flush_packets(self)
7553    }
7554}
7555
7556impl PacketStreamSinkProxyInterface for PacketStreamSinkProxy {
7557    type PutPacketResponseFut = fidl::client::QueryResponseFut<
7558        PacketStreamSinkPutPacketResult,
7559        fdomain_client::fidl::FDomainResourceDialect,
7560    >;
7561    fn r#put_packet(
7562        &self,
7563        mut payload: PacketStreamSinkPutPacketRequest,
7564    ) -> Self::PutPacketResponseFut {
7565        fn _decode(
7566            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
7567        ) -> Result<PacketStreamSinkPutPacketResult, fidl::Error> {
7568            let _response = fidl::client::decode_transaction_body::<
7569                fidl::encoding::FlexibleResultType<PacketStreamSinkPutPacketResponse, i32>,
7570                fdomain_client::fidl::FDomainResourceDialect,
7571                0x25a8e35efba81f2b,
7572            >(_buf?)?
7573            .into_result_fdomain::<PacketStreamSinkMarker>("put_packet")?;
7574            Ok(_response.map(|x| x))
7575        }
7576        self.client.send_query_and_decode::<
7577            PacketStreamSinkPutPacketRequest,
7578            PacketStreamSinkPutPacketResult,
7579        >(
7580            &mut payload,
7581            0x25a8e35efba81f2b,
7582            fidl::encoding::DynamicFlags::FLEXIBLE,
7583            _decode,
7584        )
7585    }
7586
7587    type FlushPacketsResponseFut = fidl::client::QueryResponseFut<
7588        PacketStreamSinkFlushPacketsResult,
7589        fdomain_client::fidl::FDomainResourceDialect,
7590    >;
7591    fn r#flush_packets(&self) -> Self::FlushPacketsResponseFut {
7592        fn _decode(
7593            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
7594        ) -> Result<PacketStreamSinkFlushPacketsResult, fidl::Error> {
7595            let _response = fidl::client::decode_transaction_body::<
7596                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
7597                fdomain_client::fidl::FDomainResourceDialect,
7598                0x13f16ca37ede8a4,
7599            >(_buf?)?
7600            .into_result_fdomain::<PacketStreamSinkMarker>("flush_packets")?;
7601            Ok(_response.map(|x| x))
7602        }
7603        self.client.send_query_and_decode::<
7604            fidl::encoding::EmptyPayload,
7605            PacketStreamSinkFlushPacketsResult,
7606        >(
7607            (),
7608            0x13f16ca37ede8a4,
7609            fidl::encoding::DynamicFlags::FLEXIBLE,
7610            _decode,
7611        )
7612    }
7613}
7614
7615pub struct PacketStreamSinkEventStream {
7616    event_receiver: fidl::client::EventReceiver<fdomain_client::fidl::FDomainResourceDialect>,
7617}
7618
7619impl std::marker::Unpin for PacketStreamSinkEventStream {}
7620
7621impl futures::stream::FusedStream for PacketStreamSinkEventStream {
7622    fn is_terminated(&self) -> bool {
7623        self.event_receiver.is_terminated()
7624    }
7625}
7626
7627impl futures::Stream for PacketStreamSinkEventStream {
7628    type Item = Result<PacketStreamSinkEvent, fidl::Error>;
7629
7630    fn poll_next(
7631        mut self: std::pin::Pin<&mut Self>,
7632        cx: &mut std::task::Context<'_>,
7633    ) -> std::task::Poll<Option<Self::Item>> {
7634        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
7635            &mut self.event_receiver,
7636            cx
7637        )?) {
7638            Some(buf) => std::task::Poll::Ready(Some(PacketStreamSinkEvent::decode(buf))),
7639            None => std::task::Poll::Ready(None),
7640        }
7641    }
7642}
7643
7644#[derive(Debug)]
7645pub enum PacketStreamSinkEvent {
7646    #[non_exhaustive]
7647    _UnknownEvent {
7648        /// Ordinal of the event that was sent.
7649        ordinal: u64,
7650    },
7651}
7652
7653impl PacketStreamSinkEvent {
7654    /// Decodes a message buffer as a [`PacketStreamSinkEvent`].
7655    fn decode(
7656        mut buf: <fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
7657    ) -> Result<PacketStreamSinkEvent, fidl::Error> {
7658        let (bytes, _handles) = buf.split_mut();
7659        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
7660        debug_assert_eq!(tx_header.tx_id, 0);
7661        match tx_header.ordinal {
7662            _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
7663                Ok(PacketStreamSinkEvent::_UnknownEvent { ordinal: tx_header.ordinal })
7664            }
7665            _ => Err(fidl::Error::UnknownOrdinal {
7666                ordinal: tx_header.ordinal,
7667                protocol_name:
7668                    <PacketStreamSinkMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
7669            }),
7670        }
7671    }
7672}
7673
7674/// A Stream of incoming requests for fuchsia.hardware.audio/PacketStreamSink.
7675pub struct PacketStreamSinkRequestStream {
7676    inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
7677    is_terminated: bool,
7678}
7679
7680impl std::marker::Unpin for PacketStreamSinkRequestStream {}
7681
7682impl futures::stream::FusedStream for PacketStreamSinkRequestStream {
7683    fn is_terminated(&self) -> bool {
7684        self.is_terminated
7685    }
7686}
7687
7688impl fdomain_client::fidl::RequestStream for PacketStreamSinkRequestStream {
7689    type Protocol = PacketStreamSinkMarker;
7690    type ControlHandle = PacketStreamSinkControlHandle;
7691
7692    fn from_channel(channel: fdomain_client::Channel) -> Self {
7693        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
7694    }
7695
7696    fn control_handle(&self) -> Self::ControlHandle {
7697        PacketStreamSinkControlHandle { inner: self.inner.clone() }
7698    }
7699
7700    fn into_inner(
7701        self,
7702    ) -> (::std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>, bool)
7703    {
7704        (self.inner, self.is_terminated)
7705    }
7706
7707    fn from_inner(
7708        inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
7709        is_terminated: bool,
7710    ) -> Self {
7711        Self { inner, is_terminated }
7712    }
7713}
7714
7715impl futures::Stream for PacketStreamSinkRequestStream {
7716    type Item = Result<PacketStreamSinkRequest, fidl::Error>;
7717
7718    fn poll_next(
7719        mut self: std::pin::Pin<&mut Self>,
7720        cx: &mut std::task::Context<'_>,
7721    ) -> std::task::Poll<Option<Self::Item>> {
7722        let this = &mut *self;
7723        if this.inner.check_shutdown(cx) {
7724            this.is_terminated = true;
7725            return std::task::Poll::Ready(None);
7726        }
7727        if this.is_terminated {
7728            panic!("polled PacketStreamSinkRequestStream after completion");
7729        }
7730        fidl::encoding::with_tls_decode_buf::<_, fdomain_client::fidl::FDomainResourceDialect>(
7731            |bytes, handles| {
7732                match this.inner.channel().read_etc(cx, bytes, handles) {
7733                    std::task::Poll::Ready(Ok(())) => {}
7734                    std::task::Poll::Pending => return std::task::Poll::Pending,
7735                    std::task::Poll::Ready(Err(None)) => {
7736                        this.is_terminated = true;
7737                        return std::task::Poll::Ready(None);
7738                    }
7739                    std::task::Poll::Ready(Err(Some(e))) => {
7740                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
7741                            e.into(),
7742                        ))));
7743                    }
7744                }
7745
7746                // A message has been received from the channel
7747                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
7748
7749                std::task::Poll::Ready(Some(match header.ordinal {
7750                0x25a8e35efba81f2b => {
7751                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7752                    let mut req = fidl::new_empty!(PacketStreamSinkPutPacketRequest, fdomain_client::fidl::FDomainResourceDialect);
7753                    fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<PacketStreamSinkPutPacketRequest>(&header, _body_bytes, handles, &mut req)?;
7754                    let control_handle = PacketStreamSinkControlHandle {
7755                        inner: this.inner.clone(),
7756                    };
7757                    Ok(PacketStreamSinkRequest::PutPacket {payload: req,
7758                        responder: PacketStreamSinkPutPacketResponder {
7759                            control_handle: std::mem::ManuallyDrop::new(control_handle),
7760                            tx_id: header.tx_id,
7761                        },
7762                    })
7763                }
7764                0x13f16ca37ede8a4 => {
7765                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7766                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fdomain_client::fidl::FDomainResourceDialect);
7767                    fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
7768                    let control_handle = PacketStreamSinkControlHandle {
7769                        inner: this.inner.clone(),
7770                    };
7771                    Ok(PacketStreamSinkRequest::FlushPackets {
7772                        responder: PacketStreamSinkFlushPacketsResponder {
7773                            control_handle: std::mem::ManuallyDrop::new(control_handle),
7774                            tx_id: header.tx_id,
7775                        },
7776                    })
7777                }
7778                _ if header.tx_id == 0 && header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
7779                    Ok(PacketStreamSinkRequest::_UnknownMethod {
7780                        ordinal: header.ordinal,
7781                        control_handle: PacketStreamSinkControlHandle { inner: this.inner.clone() },
7782                        method_type: fidl::MethodType::OneWay,
7783                    })
7784                }
7785                _ if header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
7786                    this.inner.send_framework_err(
7787                        fidl::encoding::FrameworkErr::UnknownMethod,
7788                        header.tx_id,
7789                        header.ordinal,
7790                        header.dynamic_flags(),
7791                        (bytes, handles),
7792                    )?;
7793                    Ok(PacketStreamSinkRequest::_UnknownMethod {
7794                        ordinal: header.ordinal,
7795                        control_handle: PacketStreamSinkControlHandle { inner: this.inner.clone() },
7796                        method_type: fidl::MethodType::TwoWay,
7797                    })
7798                }
7799                _ => Err(fidl::Error::UnknownOrdinal {
7800                    ordinal: header.ordinal,
7801                    protocol_name: <PacketStreamSinkMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
7802                }),
7803            }))
7804            },
7805        )
7806    }
7807}
7808
7809/// The protocol for streaming packet-based audio data.
7810/// This protocol functions as a data sink. The "server" of this protocol consumes packets,
7811/// and the "client" produces packets.
7812///
7813/// This protocol can be used in two directions:
7814/// 1. **Output (Client -> Driver)**: The Driver implements `PacketStreamSink`. The Client (App)
7815///    calls `PutPacket`.
7816/// 2. **Input (Driver -> Client)**: The Client (App) implements `PacketStreamSink`. The Driver
7817///    calls `PutPacket`.
7818#[derive(Debug)]
7819pub enum PacketStreamSinkRequest {
7820    /// Submits a packet to be processed by the server.
7821    ///
7822    /// The client may queue multiple packets by calling `PutPacket` repeatedly.
7823    /// Packets are processed in the order they were submitted. This call
7824    /// blocks until the payload is processed. When this call returns, the
7825    /// buffer region is guaranteed to be available for reuse.
7826    ///
7827    /// Returns `ZX_ERR_BAD_STATE` if the stream is not started or configured.
7828    /// Returns `ZX_ERR_CANCELED` if `FlushPackets` was called.
7829    /// Returns `ZX_ERR_INVALID_ARGS` if the packet is invalid. This includes:
7830    /// * The payload is missing.
7831    /// * `inline_data` is used but `supported_buffer_types` does not include `INLINE`.
7832    /// * `vmo_transfer` is used but `supported_buffer_types` does not include `CLIENT_OWNED` or
7833    ///   `DRIVER_OWNED`.
7834    /// * `vmo_id` is unrecognized, or `vmo_offset` + `payload_size` exceeds the VMO size.
7835    ///
7836    /// Note: The server is not required to detect if a VMO region is currently in use by a
7837    /// previous pending packet. Clients are responsible for managing buffer usage.
7838    PutPacket {
7839        payload: PacketStreamSinkPutPacketRequest,
7840        responder: PacketStreamSinkPutPacketResponder,
7841    },
7842    /// Flushes all packets currently pending without processing them.
7843    /// This call waits until all pending packets are completed or canceled.
7844    ///
7845    /// Note: A packet may be partially processed (e.g. if it contains multiple
7846    /// audio frames, or if the data does not align with encoded frame boundaries)
7847    /// before it is canceled.
7848    FlushPackets { responder: PacketStreamSinkFlushPacketsResponder },
7849    /// An interaction was received which does not match any known method.
7850    #[non_exhaustive]
7851    _UnknownMethod {
7852        /// Ordinal of the method that was called.
7853        ordinal: u64,
7854        control_handle: PacketStreamSinkControlHandle,
7855        method_type: fidl::MethodType,
7856    },
7857}
7858
7859impl PacketStreamSinkRequest {
7860    #[allow(irrefutable_let_patterns)]
7861    pub fn into_put_packet(
7862        self,
7863    ) -> Option<(PacketStreamSinkPutPacketRequest, PacketStreamSinkPutPacketResponder)> {
7864        if let PacketStreamSinkRequest::PutPacket { payload, responder } = self {
7865            Some((payload, responder))
7866        } else {
7867            None
7868        }
7869    }
7870
7871    #[allow(irrefutable_let_patterns)]
7872    pub fn into_flush_packets(self) -> Option<(PacketStreamSinkFlushPacketsResponder)> {
7873        if let PacketStreamSinkRequest::FlushPackets { responder } = self {
7874            Some((responder))
7875        } else {
7876            None
7877        }
7878    }
7879
7880    /// Name of the method defined in FIDL
7881    pub fn method_name(&self) -> &'static str {
7882        match *self {
7883            PacketStreamSinkRequest::PutPacket { .. } => "put_packet",
7884            PacketStreamSinkRequest::FlushPackets { .. } => "flush_packets",
7885            PacketStreamSinkRequest::_UnknownMethod {
7886                method_type: fidl::MethodType::OneWay,
7887                ..
7888            } => "unknown one-way method",
7889            PacketStreamSinkRequest::_UnknownMethod {
7890                method_type: fidl::MethodType::TwoWay,
7891                ..
7892            } => "unknown two-way method",
7893        }
7894    }
7895}
7896
7897#[derive(Debug, Clone)]
7898pub struct PacketStreamSinkControlHandle {
7899    inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
7900}
7901
7902impl PacketStreamSinkControlHandle {
7903    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
7904        self.inner.shutdown_with_epitaph(status.into())
7905    }
7906}
7907
7908impl fdomain_client::fidl::ControlHandle for PacketStreamSinkControlHandle {
7909    fn shutdown(&self) {
7910        self.inner.shutdown()
7911    }
7912
7913    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
7914        self.inner.shutdown_with_epitaph(status)
7915    }
7916
7917    fn is_closed(&self) -> bool {
7918        self.inner.channel().is_closed()
7919    }
7920    fn on_closed(&self) -> fdomain_client::OnFDomainSignals {
7921        self.inner.channel().on_closed()
7922    }
7923}
7924
7925impl PacketStreamSinkControlHandle {}
7926
7927#[must_use = "FIDL methods require a response to be sent"]
7928#[derive(Debug)]
7929pub struct PacketStreamSinkPutPacketResponder {
7930    control_handle: std::mem::ManuallyDrop<PacketStreamSinkControlHandle>,
7931    tx_id: u32,
7932}
7933
7934/// Set the the channel to be shutdown (see [`PacketStreamSinkControlHandle::shutdown`])
7935/// if the responder is dropped without sending a response, so that the client
7936/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7937impl std::ops::Drop for PacketStreamSinkPutPacketResponder {
7938    fn drop(&mut self) {
7939        self.control_handle.shutdown();
7940        // Safety: drops once, never accessed again
7941        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7942    }
7943}
7944
7945impl fdomain_client::fidl::Responder for PacketStreamSinkPutPacketResponder {
7946    type ControlHandle = PacketStreamSinkControlHandle;
7947
7948    fn control_handle(&self) -> &PacketStreamSinkControlHandle {
7949        &self.control_handle
7950    }
7951
7952    fn drop_without_shutdown(mut self) {
7953        // Safety: drops once, never accessed again due to mem::forget
7954        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7955        // Prevent Drop from running (which would shut down the channel)
7956        std::mem::forget(self);
7957    }
7958}
7959
7960impl PacketStreamSinkPutPacketResponder {
7961    /// Sends a response to the FIDL transaction.
7962    ///
7963    /// Sets the channel to shutdown if an error occurs.
7964    pub fn send(
7965        self,
7966        mut result: Result<&PacketStreamSinkPutPacketResponse, i32>,
7967    ) -> Result<(), fidl::Error> {
7968        let _result = self.send_raw(result);
7969        if _result.is_err() {
7970            self.control_handle.shutdown();
7971        }
7972        self.drop_without_shutdown();
7973        _result
7974    }
7975
7976    /// Similar to "send" but does not shutdown the channel if an error occurs.
7977    pub fn send_no_shutdown_on_err(
7978        self,
7979        mut result: Result<&PacketStreamSinkPutPacketResponse, i32>,
7980    ) -> Result<(), fidl::Error> {
7981        let _result = self.send_raw(result);
7982        self.drop_without_shutdown();
7983        _result
7984    }
7985
7986    fn send_raw(
7987        &self,
7988        mut result: Result<&PacketStreamSinkPutPacketResponse, i32>,
7989    ) -> Result<(), fidl::Error> {
7990        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
7991            PacketStreamSinkPutPacketResponse,
7992            i32,
7993        >>(
7994            fidl::encoding::FlexibleResult::new(result),
7995            self.tx_id,
7996            0x25a8e35efba81f2b,
7997            fidl::encoding::DynamicFlags::FLEXIBLE,
7998        )
7999    }
8000}
8001
8002#[must_use = "FIDL methods require a response to be sent"]
8003#[derive(Debug)]
8004pub struct PacketStreamSinkFlushPacketsResponder {
8005    control_handle: std::mem::ManuallyDrop<PacketStreamSinkControlHandle>,
8006    tx_id: u32,
8007}
8008
8009/// Set the the channel to be shutdown (see [`PacketStreamSinkControlHandle::shutdown`])
8010/// if the responder is dropped without sending a response, so that the client
8011/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
8012impl std::ops::Drop for PacketStreamSinkFlushPacketsResponder {
8013    fn drop(&mut self) {
8014        self.control_handle.shutdown();
8015        // Safety: drops once, never accessed again
8016        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8017    }
8018}
8019
8020impl fdomain_client::fidl::Responder for PacketStreamSinkFlushPacketsResponder {
8021    type ControlHandle = PacketStreamSinkControlHandle;
8022
8023    fn control_handle(&self) -> &PacketStreamSinkControlHandle {
8024        &self.control_handle
8025    }
8026
8027    fn drop_without_shutdown(mut self) {
8028        // Safety: drops once, never accessed again due to mem::forget
8029        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8030        // Prevent Drop from running (which would shut down the channel)
8031        std::mem::forget(self);
8032    }
8033}
8034
8035impl PacketStreamSinkFlushPacketsResponder {
8036    /// Sends a response to the FIDL transaction.
8037    ///
8038    /// Sets the channel to shutdown if an error occurs.
8039    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
8040        let _result = self.send_raw(result);
8041        if _result.is_err() {
8042            self.control_handle.shutdown();
8043        }
8044        self.drop_without_shutdown();
8045        _result
8046    }
8047
8048    /// Similar to "send" but does not shutdown the channel if an error occurs.
8049    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
8050        let _result = self.send_raw(result);
8051        self.drop_without_shutdown();
8052        _result
8053    }
8054
8055    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
8056        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
8057            fidl::encoding::EmptyStruct,
8058            i32,
8059        >>(
8060            fidl::encoding::FlexibleResult::new(result),
8061            self.tx_id,
8062            0x13f16ca37ede8a4,
8063            fidl::encoding::DynamicFlags::FLEXIBLE,
8064        )
8065    }
8066}
8067
8068#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
8069pub struct RingBufferMarker;
8070
8071impl fdomain_client::fidl::ProtocolMarker for RingBufferMarker {
8072    type Proxy = RingBufferProxy;
8073    type RequestStream = RingBufferRequestStream;
8074
8075    const DEBUG_NAME: &'static str = "(anonymous) RingBuffer";
8076}
8077pub type RingBufferGetVmoResult = Result<(u32, fdomain_client::Vmo), GetVmoError>;
8078pub type RingBufferSetActiveChannelsResult = Result<i64, i32>;
8079
8080pub trait RingBufferProxyInterface: Send + Sync {
8081    type GetPropertiesResponseFut: std::future::Future<Output = Result<RingBufferProperties, fidl::Error>>
8082        + Send;
8083    fn r#get_properties(&self) -> Self::GetPropertiesResponseFut;
8084    type WatchClockRecoveryPositionInfoResponseFut: std::future::Future<Output = Result<RingBufferPositionInfo, fidl::Error>>
8085        + Send;
8086    fn r#watch_clock_recovery_position_info(
8087        &self,
8088    ) -> Self::WatchClockRecoveryPositionInfoResponseFut;
8089    type GetVmoResponseFut: std::future::Future<Output = Result<RingBufferGetVmoResult, fidl::Error>>
8090        + Send;
8091    fn r#get_vmo(
8092        &self,
8093        min_frames: u32,
8094        clock_recovery_notifications_per_ring: u32,
8095    ) -> Self::GetVmoResponseFut;
8096    type StartResponseFut: std::future::Future<Output = Result<i64, fidl::Error>> + Send;
8097    fn r#start(&self) -> Self::StartResponseFut;
8098    type StopResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
8099    fn r#stop(&self) -> Self::StopResponseFut;
8100    type SetActiveChannelsResponseFut: std::future::Future<Output = Result<RingBufferSetActiveChannelsResult, fidl::Error>>
8101        + Send;
8102    fn r#set_active_channels(
8103        &self,
8104        active_channels_bitmask: u64,
8105    ) -> Self::SetActiveChannelsResponseFut;
8106    type WatchDelayInfoResponseFut: std::future::Future<Output = Result<DelayInfo, fidl::Error>>
8107        + Send;
8108    fn r#watch_delay_info(&self) -> Self::WatchDelayInfoResponseFut;
8109}
8110
8111#[derive(Debug, Clone)]
8112pub struct RingBufferProxy {
8113    client: fidl::client::Client<fdomain_client::fidl::FDomainResourceDialect>,
8114}
8115
8116impl fdomain_client::fidl::Proxy for RingBufferProxy {
8117    type Protocol = RingBufferMarker;
8118
8119    fn from_channel(inner: fdomain_client::Channel) -> Self {
8120        Self::new(inner)
8121    }
8122
8123    fn into_channel(self) -> Result<fdomain_client::Channel, Self> {
8124        self.client.into_channel().map_err(|client| Self { client })
8125    }
8126
8127    fn as_channel(&self) -> &fdomain_client::Channel {
8128        self.client.as_channel()
8129    }
8130}
8131
8132impl RingBufferProxy {
8133    /// Create a new Proxy for fuchsia.hardware.audio/RingBuffer.
8134    pub fn new(channel: fdomain_client::Channel) -> Self {
8135        let protocol_name = <RingBufferMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME;
8136        Self { client: fidl::client::Client::new(channel, protocol_name) }
8137    }
8138
8139    /// Get a Stream of events from the remote end of the protocol.
8140    ///
8141    /// # Panics
8142    ///
8143    /// Panics if the event stream was already taken.
8144    pub fn take_event_stream(&self) -> RingBufferEventStream {
8145        RingBufferEventStream { event_receiver: self.client.take_event_receiver() }
8146    }
8147
8148    /// Accessor for top level static properties.
8149    pub fn r#get_properties(
8150        &self,
8151    ) -> fidl::client::QueryResponseFut<
8152        RingBufferProperties,
8153        fdomain_client::fidl::FDomainResourceDialect,
8154    > {
8155        RingBufferProxyInterface::r#get_properties(self)
8156    }
8157
8158    /// Gets the ring buffer current position via a hanging get.
8159    ///
8160    /// `WatchClockRecoveryPositionInfo` may only be called after `GetVmo` was called, where a
8161    /// `clock_recovery_notifications_per_ring` was specified.
8162    ///
8163    /// The driver must respond to a client's first `WatchClockRecoveryPositionInfo` call, but will
8164    /// not respond to subsequent client calls until the position information has changed from what
8165    /// was most recently provided to that client.
8166    ///
8167    /// The driver must not respond to a `WatchClockRecoveryPositionInfo` until after it has replied
8168    /// to the `Start` command.
8169    ///
8170    /// At the `start_time` returned by `Start`, position is always 0. From there, it
8171    /// progresses at the rate specified by the rate, sample format (and clock domain,
8172    /// if the device is not in the same clock domain as`CLOCK_MONOTONIC`).
8173    ///
8174    /// If `clock_recovery_notifications_per_ring` is not zero, the driver will reply with its
8175    /// estimated position to be used for clock recovery at most at
8176    /// `clock_recovery_notifications_per_ring` frequency.
8177    ///
8178    /// The `RingBufferPositionInfo` return values must include timestamps that are monotonically
8179    /// increasing.
8180    ///
8181    /// The driver will close the protocol channel with an error of `ZX_ERR_BAD_STATE`, if there is
8182    /// already a pending `WatchClockRecoveryPositionInfo` for this client.
8183    pub fn r#watch_clock_recovery_position_info(
8184        &self,
8185    ) -> fidl::client::QueryResponseFut<
8186        RingBufferPositionInfo,
8187        fdomain_client::fidl::FDomainResourceDialect,
8188    > {
8189        RingBufferProxyInterface::r#watch_clock_recovery_position_info(self)
8190    }
8191
8192    /// Requests a shared buffer to be used for moving bulk audio data between client and driver.
8193    ///
8194    /// The client requests `min_frames` as the size for part of the ring buffer it needs.
8195    /// The driver returns the actual size of allocated ring buffer space in `num_frames`.
8196    ///
8197    /// `num_frames` must be at least `min_frames` plus `driver_transfer_bytes` (in frames) such
8198    /// that ring buffer contents can be transfered in and out, or else the call must be failed
8199    /// with GetVmoError.INVALID_ARGS.
8200    ///
8201    /// The driver may increase the ring buffer size beyond `min_frames` plus
8202    /// `driver_transfer_bytes` (in frames) due to any internal requirements, for instance
8203    /// alignment.
8204    ///
8205    /// Clients can treat the entire returned ring buffer as safe to access, except for the
8206    /// `driver_transfer_bytes` immediately adjacent to the current position, see the
8207    /// `driver_transfer_bytes` parameter specification in `RingBufferProperties` for more details.
8208    ///
8209    /// The returned VMO handle must include ZX_RIGHT_TRANSFER, ZX_RIGHT_READ and ZX_RIGHT_MAP.
8210    /// If the ring buffer is "outgoing" (conveys audio data from client to device), then the
8211    /// handle must also include ZX_RIGHT_WRITE.
8212    ///
8213    /// If `clock_recovery_notifications_per_ring` is non-zero, the driver will send replies to
8214    /// `WatchClockRecoveryPositionInfo` client requests at most at
8215    /// `clock_recovery_notifications_per_ring` frequency. These notifications are meant to be used
8216    /// for clock recovery.
8217    pub fn r#get_vmo(
8218        &self,
8219        mut min_frames: u32,
8220        mut clock_recovery_notifications_per_ring: u32,
8221    ) -> fidl::client::QueryResponseFut<
8222        RingBufferGetVmoResult,
8223        fdomain_client::fidl::FDomainResourceDialect,
8224    > {
8225        RingBufferProxyInterface::r#get_vmo(self, min_frames, clock_recovery_notifications_per_ring)
8226    }
8227
8228    /// Start the ring buffer.
8229    ///
8230    /// The `start_time` value (in the CLOCK_MONOTONIC timeline) indicates when position began
8231    /// moving, starting at the beginning of the ring buffer, i.e. the driver has started to read or
8232    /// write from or to the ring buffer position 0, subject to the overall position and buffering
8233    /// behavior described in 'Ring buffer behavior' below.
8234    ///
8235    /// If `Start` is called before `GetVmo`, the channel must be closed with `ZX_ERR_BAD_STATE`.
8236    /// If `Start` is called while this RingBuffer is already started, or if `Start` is called for
8237    /// a second time before the first call has completed, then the channel must be closed with an
8238    /// error `ZX_ERR_BAD_STATE` returned.
8239    /// If `Start` is called before `SetActiveChannels`, then by default all channels are active.
8240    pub fn r#start(
8241        &self,
8242    ) -> fidl::client::QueryResponseFut<i64, fdomain_client::fidl::FDomainResourceDialect> {
8243        RingBufferProxyInterface::r#start(self)
8244    }
8245
8246    /// Stop the ring buffer.
8247    ///
8248    /// Once this call's response is received, no further position notifications will be sent until
8249    /// `Start` is called again.
8250    ///
8251    /// If `Stop` is called before `GetVmo`, the channel must be closed with `ZX_ERR_BAD_STATE`.
8252    pub fn r#stop(
8253        &self,
8254    ) -> fidl::client::QueryResponseFut<(), fdomain_client::fidl::FDomainResourceDialect> {
8255        RingBufferProxyInterface::r#stop(self)
8256    }
8257
8258    /// Sets which channels are active via a bitmask.
8259    ///
8260    /// The total number of channels is the `number_of_channels` in `Format`, specifically in
8261    /// `PcmFormat`, i.e. this bitmask has up to `number_of_channels` bits set (maximum 64).
8262    /// The least significant bit corresponds to channel index 0. Channels not set (bits are 0) in
8263    /// the bitmask are inactive. By default all channels are active. Hence creating a RingBuffer
8264    /// turns on the hardware associated for all channels.
8265    ///
8266    /// Inactive channels indicate to the driver that it may turn off hardware associated with the
8267    /// inactive channels. A subsequent `SetActiveChannels` setting an inactive channel to active
8268    /// may incur in a `turn_on_delay` to actually restart playback/capture of the channels.
8269    ///
8270    /// Deactivating one, several, or all channels does not `Stop` the ring buffer, nor does it
8271    /// change the ring buffer's behavior with regard to position. Once `Start` is called, a ring
8272    /// buffer's position advances (and position notifications sent as needed) regardless of the
8273    /// number of active channels, including if no channels are active. This means that the format
8274    /// in the ring buffer is not changed.
8275    ///
8276    /// If the driver does not support deactivating channels, it must return `ZX_ERR_NOT_SUPPORTED`.
8277    /// If the mask is incorrect, i.e. enables channels outside the number of bits to use for a
8278    /// given `number_of_channels`, then the driver must return `ZX_ERR_INVALID_ARGS`.
8279    ///
8280    /// The `set_time` value (in the CLOCK_MONOTONIC timeline) indicates when configuring
8281    /// the hardware to activate or deactivate channels is completed. `set_time` does not include
8282    /// the potential `turn_on_delay`, the driver does not delay the reply waiting for the
8283    /// hardware to actually turn on, the driver replies with a `set_time` indicating when the
8284    /// hardware configuration was completed. If the requested channel configuration is already
8285    /// active, the returned `set_time` can be before `SetActiveChannels` was called but must be
8286    /// before the reply is sent. If called again with the same configuration, the reply must
8287    /// include the same `set_time` value as was previously returned.
8288    ///
8289    /// For input channels, it is not required that the driver zero-out inactive channels.
8290    ///
8291    /// If `SetActiveChannels` is called for a second time before the first call has completed,
8292    /// the channel must be closed with an error `ZX_ERR_BAD_STATE` returned.
8293    pub fn r#set_active_channels(
8294        &self,
8295        mut active_channels_bitmask: u64,
8296    ) -> fidl::client::QueryResponseFut<
8297        RingBufferSetActiveChannelsResult,
8298        fdomain_client::fidl::FDomainResourceDialect,
8299    > {
8300        RingBufferProxyInterface::r#set_active_channels(self, active_channels_bitmask)
8301    }
8302
8303    /// Get information about delays via a hanging get.
8304    ///
8305    /// The driver will immediately reply to the first `WatchDelayInfo` sent by the client.
8306    /// The driver will not respond to subsequent client `WatchDelayInfo` calls until the delay info
8307    /// changes from what was most recently reported.
8308    ///
8309    /// If `WatchDelayInfo` is called for a second time before the first call has completed, the
8310    /// channel must be closed with an error `ZX_ERR_BAD_STATE` returned.
8311    pub fn r#watch_delay_info(
8312        &self,
8313    ) -> fidl::client::QueryResponseFut<DelayInfo, fdomain_client::fidl::FDomainResourceDialect>
8314    {
8315        RingBufferProxyInterface::r#watch_delay_info(self)
8316    }
8317}
8318
8319impl RingBufferProxyInterface for RingBufferProxy {
8320    type GetPropertiesResponseFut = fidl::client::QueryResponseFut<
8321        RingBufferProperties,
8322        fdomain_client::fidl::FDomainResourceDialect,
8323    >;
8324    fn r#get_properties(&self) -> Self::GetPropertiesResponseFut {
8325        fn _decode(
8326            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
8327        ) -> Result<RingBufferProperties, fidl::Error> {
8328            let _response = fidl::client::decode_transaction_body::<
8329                RingBufferGetPropertiesResponse,
8330                fdomain_client::fidl::FDomainResourceDialect,
8331                0x12947f061a8fe1,
8332            >(_buf?)?;
8333            Ok(_response.properties)
8334        }
8335        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, RingBufferProperties>(
8336            (),
8337            0x12947f061a8fe1,
8338            fidl::encoding::DynamicFlags::empty(),
8339            _decode,
8340        )
8341    }
8342
8343    type WatchClockRecoveryPositionInfoResponseFut = fidl::client::QueryResponseFut<
8344        RingBufferPositionInfo,
8345        fdomain_client::fidl::FDomainResourceDialect,
8346    >;
8347    fn r#watch_clock_recovery_position_info(
8348        &self,
8349    ) -> Self::WatchClockRecoveryPositionInfoResponseFut {
8350        fn _decode(
8351            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
8352        ) -> Result<RingBufferPositionInfo, fidl::Error> {
8353            let _response = fidl::client::decode_transaction_body::<
8354                RingBufferWatchClockRecoveryPositionInfoResponse,
8355                fdomain_client::fidl::FDomainResourceDialect,
8356                0x694d5b898a4167e5,
8357            >(_buf?)?;
8358            Ok(_response.position_info)
8359        }
8360        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, RingBufferPositionInfo>(
8361            (),
8362            0x694d5b898a4167e5,
8363            fidl::encoding::DynamicFlags::empty(),
8364            _decode,
8365        )
8366    }
8367
8368    type GetVmoResponseFut = fidl::client::QueryResponseFut<
8369        RingBufferGetVmoResult,
8370        fdomain_client::fidl::FDomainResourceDialect,
8371    >;
8372    fn r#get_vmo(
8373        &self,
8374        mut min_frames: u32,
8375        mut clock_recovery_notifications_per_ring: u32,
8376    ) -> Self::GetVmoResponseFut {
8377        fn _decode(
8378            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
8379        ) -> Result<RingBufferGetVmoResult, fidl::Error> {
8380            let _response = fidl::client::decode_transaction_body::<
8381                fidl::encoding::ResultType<RingBufferGetVmoResponse, GetVmoError>,
8382                fdomain_client::fidl::FDomainResourceDialect,
8383                0x44c8f4f5680e853a,
8384            >(_buf?)?;
8385            Ok(_response.map(|x| (x.num_frames, x.ring_buffer)))
8386        }
8387        self.client.send_query_and_decode::<RingBufferGetVmoRequest, RingBufferGetVmoResult>(
8388            (min_frames, clock_recovery_notifications_per_ring),
8389            0x44c8f4f5680e853a,
8390            fidl::encoding::DynamicFlags::empty(),
8391            _decode,
8392        )
8393    }
8394
8395    type StartResponseFut =
8396        fidl::client::QueryResponseFut<i64, fdomain_client::fidl::FDomainResourceDialect>;
8397    fn r#start(&self) -> Self::StartResponseFut {
8398        fn _decode(
8399            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
8400        ) -> Result<i64, fidl::Error> {
8401            let _response = fidl::client::decode_transaction_body::<
8402                RingBufferStartResponse,
8403                fdomain_client::fidl::FDomainResourceDialect,
8404                0x5dd780a769a8892d,
8405            >(_buf?)?;
8406            Ok(_response.start_time)
8407        }
8408        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, i64>(
8409            (),
8410            0x5dd780a769a8892d,
8411            fidl::encoding::DynamicFlags::empty(),
8412            _decode,
8413        )
8414    }
8415
8416    type StopResponseFut =
8417        fidl::client::QueryResponseFut<(), fdomain_client::fidl::FDomainResourceDialect>;
8418    fn r#stop(&self) -> Self::StopResponseFut {
8419        fn _decode(
8420            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
8421        ) -> Result<(), fidl::Error> {
8422            let _response = fidl::client::decode_transaction_body::<
8423                fidl::encoding::EmptyPayload,
8424                fdomain_client::fidl::FDomainResourceDialect,
8425                0x49a73d9cf1d4e110,
8426            >(_buf?)?;
8427            Ok(_response)
8428        }
8429        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ()>(
8430            (),
8431            0x49a73d9cf1d4e110,
8432            fidl::encoding::DynamicFlags::empty(),
8433            _decode,
8434        )
8435    }
8436
8437    type SetActiveChannelsResponseFut = fidl::client::QueryResponseFut<
8438        RingBufferSetActiveChannelsResult,
8439        fdomain_client::fidl::FDomainResourceDialect,
8440    >;
8441    fn r#set_active_channels(
8442        &self,
8443        mut active_channels_bitmask: u64,
8444    ) -> Self::SetActiveChannelsResponseFut {
8445        fn _decode(
8446            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
8447        ) -> Result<RingBufferSetActiveChannelsResult, fidl::Error> {
8448            let _response = fidl::client::decode_transaction_body::<
8449                fidl::encoding::ResultType<RingBufferSetActiveChannelsResponse, i32>,
8450                fdomain_client::fidl::FDomainResourceDialect,
8451                0x605464c1d384f309,
8452            >(_buf?)?;
8453            Ok(_response.map(|x| x.set_time))
8454        }
8455        self.client.send_query_and_decode::<
8456            RingBufferSetActiveChannelsRequest,
8457            RingBufferSetActiveChannelsResult,
8458        >(
8459            (active_channels_bitmask,),
8460            0x605464c1d384f309,
8461            fidl::encoding::DynamicFlags::empty(),
8462            _decode,
8463        )
8464    }
8465
8466    type WatchDelayInfoResponseFut =
8467        fidl::client::QueryResponseFut<DelayInfo, fdomain_client::fidl::FDomainResourceDialect>;
8468    fn r#watch_delay_info(&self) -> Self::WatchDelayInfoResponseFut {
8469        fn _decode(
8470            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
8471        ) -> Result<DelayInfo, fidl::Error> {
8472            let _response = fidl::client::decode_transaction_body::<
8473                fidl::encoding::FlexibleType<RingBufferWatchDelayInfoResponse>,
8474                fdomain_client::fidl::FDomainResourceDialect,
8475                0x6c1248db213fcf9f,
8476            >(_buf?)?
8477            .into_result_fdomain::<RingBufferMarker>("watch_delay_info")?;
8478            Ok(_response.delay_info)
8479        }
8480        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, DelayInfo>(
8481            (),
8482            0x6c1248db213fcf9f,
8483            fidl::encoding::DynamicFlags::FLEXIBLE,
8484            _decode,
8485        )
8486    }
8487}
8488
8489pub struct RingBufferEventStream {
8490    event_receiver: fidl::client::EventReceiver<fdomain_client::fidl::FDomainResourceDialect>,
8491}
8492
8493impl std::marker::Unpin for RingBufferEventStream {}
8494
8495impl futures::stream::FusedStream for RingBufferEventStream {
8496    fn is_terminated(&self) -> bool {
8497        self.event_receiver.is_terminated()
8498    }
8499}
8500
8501impl futures::Stream for RingBufferEventStream {
8502    type Item = Result<RingBufferEvent, fidl::Error>;
8503
8504    fn poll_next(
8505        mut self: std::pin::Pin<&mut Self>,
8506        cx: &mut std::task::Context<'_>,
8507    ) -> std::task::Poll<Option<Self::Item>> {
8508        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
8509            &mut self.event_receiver,
8510            cx
8511        )?) {
8512            Some(buf) => std::task::Poll::Ready(Some(RingBufferEvent::decode(buf))),
8513            None => std::task::Poll::Ready(None),
8514        }
8515    }
8516}
8517
8518#[derive(Debug)]
8519pub enum RingBufferEvent {
8520    #[non_exhaustive]
8521    _UnknownEvent {
8522        /// Ordinal of the event that was sent.
8523        ordinal: u64,
8524    },
8525}
8526
8527impl RingBufferEvent {
8528    /// Decodes a message buffer as a [`RingBufferEvent`].
8529    fn decode(
8530        mut buf: <fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
8531    ) -> Result<RingBufferEvent, fidl::Error> {
8532        let (bytes, _handles) = buf.split_mut();
8533        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
8534        debug_assert_eq!(tx_header.tx_id, 0);
8535        match tx_header.ordinal {
8536            _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
8537                Ok(RingBufferEvent::_UnknownEvent { ordinal: tx_header.ordinal })
8538            }
8539            _ => Err(fidl::Error::UnknownOrdinal {
8540                ordinal: tx_header.ordinal,
8541                protocol_name:
8542                    <RingBufferMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
8543            }),
8544        }
8545    }
8546}
8547
8548/// A Stream of incoming requests for fuchsia.hardware.audio/RingBuffer.
8549pub struct RingBufferRequestStream {
8550    inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
8551    is_terminated: bool,
8552}
8553
8554impl std::marker::Unpin for RingBufferRequestStream {}
8555
8556impl futures::stream::FusedStream for RingBufferRequestStream {
8557    fn is_terminated(&self) -> bool {
8558        self.is_terminated
8559    }
8560}
8561
8562impl fdomain_client::fidl::RequestStream for RingBufferRequestStream {
8563    type Protocol = RingBufferMarker;
8564    type ControlHandle = RingBufferControlHandle;
8565
8566    fn from_channel(channel: fdomain_client::Channel) -> Self {
8567        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
8568    }
8569
8570    fn control_handle(&self) -> Self::ControlHandle {
8571        RingBufferControlHandle { inner: self.inner.clone() }
8572    }
8573
8574    fn into_inner(
8575        self,
8576    ) -> (::std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>, bool)
8577    {
8578        (self.inner, self.is_terminated)
8579    }
8580
8581    fn from_inner(
8582        inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
8583        is_terminated: bool,
8584    ) -> Self {
8585        Self { inner, is_terminated }
8586    }
8587}
8588
8589impl futures::Stream for RingBufferRequestStream {
8590    type Item = Result<RingBufferRequest, fidl::Error>;
8591
8592    fn poll_next(
8593        mut self: std::pin::Pin<&mut Self>,
8594        cx: &mut std::task::Context<'_>,
8595    ) -> std::task::Poll<Option<Self::Item>> {
8596        let this = &mut *self;
8597        if this.inner.check_shutdown(cx) {
8598            this.is_terminated = true;
8599            return std::task::Poll::Ready(None);
8600        }
8601        if this.is_terminated {
8602            panic!("polled RingBufferRequestStream after completion");
8603        }
8604        fidl::encoding::with_tls_decode_buf::<_, fdomain_client::fidl::FDomainResourceDialect>(
8605            |bytes, handles| {
8606                match this.inner.channel().read_etc(cx, bytes, handles) {
8607                    std::task::Poll::Ready(Ok(())) => {}
8608                    std::task::Poll::Pending => return std::task::Poll::Pending,
8609                    std::task::Poll::Ready(Err(None)) => {
8610                        this.is_terminated = true;
8611                        return std::task::Poll::Ready(None);
8612                    }
8613                    std::task::Poll::Ready(Err(Some(e))) => {
8614                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
8615                            e.into(),
8616                        ))));
8617                    }
8618                }
8619
8620                // A message has been received from the channel
8621                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
8622
8623                std::task::Poll::Ready(Some(match header.ordinal {
8624                    0x12947f061a8fe1 => {
8625                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
8626                        let mut req = fidl::new_empty!(
8627                            fidl::encoding::EmptyPayload,
8628                            fdomain_client::fidl::FDomainResourceDialect
8629                        );
8630                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
8631                        let control_handle = RingBufferControlHandle { inner: this.inner.clone() };
8632                        Ok(RingBufferRequest::GetProperties {
8633                            responder: RingBufferGetPropertiesResponder {
8634                                control_handle: std::mem::ManuallyDrop::new(control_handle),
8635                                tx_id: header.tx_id,
8636                            },
8637                        })
8638                    }
8639                    0x694d5b898a4167e5 => {
8640                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
8641                        let mut req = fidl::new_empty!(
8642                            fidl::encoding::EmptyPayload,
8643                            fdomain_client::fidl::FDomainResourceDialect
8644                        );
8645                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
8646                        let control_handle = RingBufferControlHandle { inner: this.inner.clone() };
8647                        Ok(RingBufferRequest::WatchClockRecoveryPositionInfo {
8648                            responder: RingBufferWatchClockRecoveryPositionInfoResponder {
8649                                control_handle: std::mem::ManuallyDrop::new(control_handle),
8650                                tx_id: header.tx_id,
8651                            },
8652                        })
8653                    }
8654                    0x44c8f4f5680e853a => {
8655                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
8656                        let mut req = fidl::new_empty!(
8657                            RingBufferGetVmoRequest,
8658                            fdomain_client::fidl::FDomainResourceDialect
8659                        );
8660                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<RingBufferGetVmoRequest>(&header, _body_bytes, handles, &mut req)?;
8661                        let control_handle = RingBufferControlHandle { inner: this.inner.clone() };
8662                        Ok(RingBufferRequest::GetVmo {
8663                            min_frames: req.min_frames,
8664                            clock_recovery_notifications_per_ring: req
8665                                .clock_recovery_notifications_per_ring,
8666
8667                            responder: RingBufferGetVmoResponder {
8668                                control_handle: std::mem::ManuallyDrop::new(control_handle),
8669                                tx_id: header.tx_id,
8670                            },
8671                        })
8672                    }
8673                    0x5dd780a769a8892d => {
8674                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
8675                        let mut req = fidl::new_empty!(
8676                            fidl::encoding::EmptyPayload,
8677                            fdomain_client::fidl::FDomainResourceDialect
8678                        );
8679                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
8680                        let control_handle = RingBufferControlHandle { inner: this.inner.clone() };
8681                        Ok(RingBufferRequest::Start {
8682                            responder: RingBufferStartResponder {
8683                                control_handle: std::mem::ManuallyDrop::new(control_handle),
8684                                tx_id: header.tx_id,
8685                            },
8686                        })
8687                    }
8688                    0x49a73d9cf1d4e110 => {
8689                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
8690                        let mut req = fidl::new_empty!(
8691                            fidl::encoding::EmptyPayload,
8692                            fdomain_client::fidl::FDomainResourceDialect
8693                        );
8694                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
8695                        let control_handle = RingBufferControlHandle { inner: this.inner.clone() };
8696                        Ok(RingBufferRequest::Stop {
8697                            responder: RingBufferStopResponder {
8698                                control_handle: std::mem::ManuallyDrop::new(control_handle),
8699                                tx_id: header.tx_id,
8700                            },
8701                        })
8702                    }
8703                    0x605464c1d384f309 => {
8704                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
8705                        let mut req = fidl::new_empty!(
8706                            RingBufferSetActiveChannelsRequest,
8707                            fdomain_client::fidl::FDomainResourceDialect
8708                        );
8709                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<RingBufferSetActiveChannelsRequest>(&header, _body_bytes, handles, &mut req)?;
8710                        let control_handle = RingBufferControlHandle { inner: this.inner.clone() };
8711                        Ok(RingBufferRequest::SetActiveChannels {
8712                            active_channels_bitmask: req.active_channels_bitmask,
8713
8714                            responder: RingBufferSetActiveChannelsResponder {
8715                                control_handle: std::mem::ManuallyDrop::new(control_handle),
8716                                tx_id: header.tx_id,
8717                            },
8718                        })
8719                    }
8720                    0x6c1248db213fcf9f => {
8721                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
8722                        let mut req = fidl::new_empty!(
8723                            fidl::encoding::EmptyPayload,
8724                            fdomain_client::fidl::FDomainResourceDialect
8725                        );
8726                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
8727                        let control_handle = RingBufferControlHandle { inner: this.inner.clone() };
8728                        Ok(RingBufferRequest::WatchDelayInfo {
8729                            responder: RingBufferWatchDelayInfoResponder {
8730                                control_handle: std::mem::ManuallyDrop::new(control_handle),
8731                                tx_id: header.tx_id,
8732                            },
8733                        })
8734                    }
8735                    _ if header.tx_id == 0
8736                        && header
8737                            .dynamic_flags()
8738                            .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
8739                    {
8740                        Ok(RingBufferRequest::_UnknownMethod {
8741                            ordinal: header.ordinal,
8742                            control_handle: RingBufferControlHandle { inner: this.inner.clone() },
8743                            method_type: fidl::MethodType::OneWay,
8744                        })
8745                    }
8746                    _ if header
8747                        .dynamic_flags()
8748                        .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
8749                    {
8750                        this.inner.send_framework_err(
8751                            fidl::encoding::FrameworkErr::UnknownMethod,
8752                            header.tx_id,
8753                            header.ordinal,
8754                            header.dynamic_flags(),
8755                            (bytes, handles),
8756                        )?;
8757                        Ok(RingBufferRequest::_UnknownMethod {
8758                            ordinal: header.ordinal,
8759                            control_handle: RingBufferControlHandle { inner: this.inner.clone() },
8760                            method_type: fidl::MethodType::TwoWay,
8761                        })
8762                    }
8763                    _ => Err(fidl::Error::UnknownOrdinal {
8764                        ordinal: header.ordinal,
8765                        protocol_name:
8766                            <RingBufferMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
8767                    }),
8768                }))
8769            },
8770        )
8771    }
8772}
8773
8774/// Ring buffers are used to convey audio between parties (usually in different processes), allowing
8775/// concurrent, asynchronous data access without requiring locks. This pattern works because both
8776/// parties share an understanding of which buffer areas are safe to access, and how those areas
8777/// change over time.
8778///
8779/// For in-depth description of the responsibilities for both _producers_ and _consumers_,
8780/// before the ring buffer is started as well as while it is active, please see
8781/// [Ring Buffer Behavior](https://fuchsia.dev/fuchsia-src/development/audio/ring_buffer.md).
8782#[derive(Debug)]
8783pub enum RingBufferRequest {
8784    /// Accessor for top level static properties.
8785    GetProperties { responder: RingBufferGetPropertiesResponder },
8786    /// Gets the ring buffer current position via a hanging get.
8787    ///
8788    /// `WatchClockRecoveryPositionInfo` may only be called after `GetVmo` was called, where a
8789    /// `clock_recovery_notifications_per_ring` was specified.
8790    ///
8791    /// The driver must respond to a client's first `WatchClockRecoveryPositionInfo` call, but will
8792    /// not respond to subsequent client calls until the position information has changed from what
8793    /// was most recently provided to that client.
8794    ///
8795    /// The driver must not respond to a `WatchClockRecoveryPositionInfo` until after it has replied
8796    /// to the `Start` command.
8797    ///
8798    /// At the `start_time` returned by `Start`, position is always 0. From there, it
8799    /// progresses at the rate specified by the rate, sample format (and clock domain,
8800    /// if the device is not in the same clock domain as`CLOCK_MONOTONIC`).
8801    ///
8802    /// If `clock_recovery_notifications_per_ring` is not zero, the driver will reply with its
8803    /// estimated position to be used for clock recovery at most at
8804    /// `clock_recovery_notifications_per_ring` frequency.
8805    ///
8806    /// The `RingBufferPositionInfo` return values must include timestamps that are monotonically
8807    /// increasing.
8808    ///
8809    /// The driver will close the protocol channel with an error of `ZX_ERR_BAD_STATE`, if there is
8810    /// already a pending `WatchClockRecoveryPositionInfo` for this client.
8811    WatchClockRecoveryPositionInfo { responder: RingBufferWatchClockRecoveryPositionInfoResponder },
8812    /// Requests a shared buffer to be used for moving bulk audio data between client and driver.
8813    ///
8814    /// The client requests `min_frames` as the size for part of the ring buffer it needs.
8815    /// The driver returns the actual size of allocated ring buffer space in `num_frames`.
8816    ///
8817    /// `num_frames` must be at least `min_frames` plus `driver_transfer_bytes` (in frames) such
8818    /// that ring buffer contents can be transfered in and out, or else the call must be failed
8819    /// with GetVmoError.INVALID_ARGS.
8820    ///
8821    /// The driver may increase the ring buffer size beyond `min_frames` plus
8822    /// `driver_transfer_bytes` (in frames) due to any internal requirements, for instance
8823    /// alignment.
8824    ///
8825    /// Clients can treat the entire returned ring buffer as safe to access, except for the
8826    /// `driver_transfer_bytes` immediately adjacent to the current position, see the
8827    /// `driver_transfer_bytes` parameter specification in `RingBufferProperties` for more details.
8828    ///
8829    /// The returned VMO handle must include ZX_RIGHT_TRANSFER, ZX_RIGHT_READ and ZX_RIGHT_MAP.
8830    /// If the ring buffer is "outgoing" (conveys audio data from client to device), then the
8831    /// handle must also include ZX_RIGHT_WRITE.
8832    ///
8833    /// If `clock_recovery_notifications_per_ring` is non-zero, the driver will send replies to
8834    /// `WatchClockRecoveryPositionInfo` client requests at most at
8835    /// `clock_recovery_notifications_per_ring` frequency. These notifications are meant to be used
8836    /// for clock recovery.
8837    GetVmo {
8838        min_frames: u32,
8839        clock_recovery_notifications_per_ring: u32,
8840        responder: RingBufferGetVmoResponder,
8841    },
8842    /// Start the ring buffer.
8843    ///
8844    /// The `start_time` value (in the CLOCK_MONOTONIC timeline) indicates when position began
8845    /// moving, starting at the beginning of the ring buffer, i.e. the driver has started to read or
8846    /// write from or to the ring buffer position 0, subject to the overall position and buffering
8847    /// behavior described in 'Ring buffer behavior' below.
8848    ///
8849    /// If `Start` is called before `GetVmo`, the channel must be closed with `ZX_ERR_BAD_STATE`.
8850    /// If `Start` is called while this RingBuffer is already started, or if `Start` is called for
8851    /// a second time before the first call has completed, then the channel must be closed with an
8852    /// error `ZX_ERR_BAD_STATE` returned.
8853    /// If `Start` is called before `SetActiveChannels`, then by default all channels are active.
8854    Start { responder: RingBufferStartResponder },
8855    /// Stop the ring buffer.
8856    ///
8857    /// Once this call's response is received, no further position notifications will be sent until
8858    /// `Start` is called again.
8859    ///
8860    /// If `Stop` is called before `GetVmo`, the channel must be closed with `ZX_ERR_BAD_STATE`.
8861    Stop { responder: RingBufferStopResponder },
8862    /// Sets which channels are active via a bitmask.
8863    ///
8864    /// The total number of channels is the `number_of_channels` in `Format`, specifically in
8865    /// `PcmFormat`, i.e. this bitmask has up to `number_of_channels` bits set (maximum 64).
8866    /// The least significant bit corresponds to channel index 0. Channels not set (bits are 0) in
8867    /// the bitmask are inactive. By default all channels are active. Hence creating a RingBuffer
8868    /// turns on the hardware associated for all channels.
8869    ///
8870    /// Inactive channels indicate to the driver that it may turn off hardware associated with the
8871    /// inactive channels. A subsequent `SetActiveChannels` setting an inactive channel to active
8872    /// may incur in a `turn_on_delay` to actually restart playback/capture of the channels.
8873    ///
8874    /// Deactivating one, several, or all channels does not `Stop` the ring buffer, nor does it
8875    /// change the ring buffer's behavior with regard to position. Once `Start` is called, a ring
8876    /// buffer's position advances (and position notifications sent as needed) regardless of the
8877    /// number of active channels, including if no channels are active. This means that the format
8878    /// in the ring buffer is not changed.
8879    ///
8880    /// If the driver does not support deactivating channels, it must return `ZX_ERR_NOT_SUPPORTED`.
8881    /// If the mask is incorrect, i.e. enables channels outside the number of bits to use for a
8882    /// given `number_of_channels`, then the driver must return `ZX_ERR_INVALID_ARGS`.
8883    ///
8884    /// The `set_time` value (in the CLOCK_MONOTONIC timeline) indicates when configuring
8885    /// the hardware to activate or deactivate channels is completed. `set_time` does not include
8886    /// the potential `turn_on_delay`, the driver does not delay the reply waiting for the
8887    /// hardware to actually turn on, the driver replies with a `set_time` indicating when the
8888    /// hardware configuration was completed. If the requested channel configuration is already
8889    /// active, the returned `set_time` can be before `SetActiveChannels` was called but must be
8890    /// before the reply is sent. If called again with the same configuration, the reply must
8891    /// include the same `set_time` value as was previously returned.
8892    ///
8893    /// For input channels, it is not required that the driver zero-out inactive channels.
8894    ///
8895    /// If `SetActiveChannels` is called for a second time before the first call has completed,
8896    /// the channel must be closed with an error `ZX_ERR_BAD_STATE` returned.
8897    SetActiveChannels {
8898        active_channels_bitmask: u64,
8899        responder: RingBufferSetActiveChannelsResponder,
8900    },
8901    /// Get information about delays via a hanging get.
8902    ///
8903    /// The driver will immediately reply to the first `WatchDelayInfo` sent by the client.
8904    /// The driver will not respond to subsequent client `WatchDelayInfo` calls until the delay info
8905    /// changes from what was most recently reported.
8906    ///
8907    /// If `WatchDelayInfo` is called for a second time before the first call has completed, the
8908    /// channel must be closed with an error `ZX_ERR_BAD_STATE` returned.
8909    WatchDelayInfo { responder: RingBufferWatchDelayInfoResponder },
8910    /// An interaction was received which does not match any known method.
8911    #[non_exhaustive]
8912    _UnknownMethod {
8913        /// Ordinal of the method that was called.
8914        ordinal: u64,
8915        control_handle: RingBufferControlHandle,
8916        method_type: fidl::MethodType,
8917    },
8918}
8919
8920impl RingBufferRequest {
8921    #[allow(irrefutable_let_patterns)]
8922    pub fn into_get_properties(self) -> Option<(RingBufferGetPropertiesResponder)> {
8923        if let RingBufferRequest::GetProperties { responder } = self {
8924            Some((responder))
8925        } else {
8926            None
8927        }
8928    }
8929
8930    #[allow(irrefutable_let_patterns)]
8931    pub fn into_watch_clock_recovery_position_info(
8932        self,
8933    ) -> Option<(RingBufferWatchClockRecoveryPositionInfoResponder)> {
8934        if let RingBufferRequest::WatchClockRecoveryPositionInfo { responder } = self {
8935            Some((responder))
8936        } else {
8937            None
8938        }
8939    }
8940
8941    #[allow(irrefutable_let_patterns)]
8942    pub fn into_get_vmo(self) -> Option<(u32, u32, RingBufferGetVmoResponder)> {
8943        if let RingBufferRequest::GetVmo {
8944            min_frames,
8945            clock_recovery_notifications_per_ring,
8946            responder,
8947        } = self
8948        {
8949            Some((min_frames, clock_recovery_notifications_per_ring, responder))
8950        } else {
8951            None
8952        }
8953    }
8954
8955    #[allow(irrefutable_let_patterns)]
8956    pub fn into_start(self) -> Option<(RingBufferStartResponder)> {
8957        if let RingBufferRequest::Start { responder } = self { Some((responder)) } else { None }
8958    }
8959
8960    #[allow(irrefutable_let_patterns)]
8961    pub fn into_stop(self) -> Option<(RingBufferStopResponder)> {
8962        if let RingBufferRequest::Stop { responder } = self { Some((responder)) } else { None }
8963    }
8964
8965    #[allow(irrefutable_let_patterns)]
8966    pub fn into_set_active_channels(self) -> Option<(u64, RingBufferSetActiveChannelsResponder)> {
8967        if let RingBufferRequest::SetActiveChannels { active_channels_bitmask, responder } = self {
8968            Some((active_channels_bitmask, responder))
8969        } else {
8970            None
8971        }
8972    }
8973
8974    #[allow(irrefutable_let_patterns)]
8975    pub fn into_watch_delay_info(self) -> Option<(RingBufferWatchDelayInfoResponder)> {
8976        if let RingBufferRequest::WatchDelayInfo { responder } = self {
8977            Some((responder))
8978        } else {
8979            None
8980        }
8981    }
8982
8983    /// Name of the method defined in FIDL
8984    pub fn method_name(&self) -> &'static str {
8985        match *self {
8986            RingBufferRequest::GetProperties { .. } => "get_properties",
8987            RingBufferRequest::WatchClockRecoveryPositionInfo { .. } => {
8988                "watch_clock_recovery_position_info"
8989            }
8990            RingBufferRequest::GetVmo { .. } => "get_vmo",
8991            RingBufferRequest::Start { .. } => "start",
8992            RingBufferRequest::Stop { .. } => "stop",
8993            RingBufferRequest::SetActiveChannels { .. } => "set_active_channels",
8994            RingBufferRequest::WatchDelayInfo { .. } => "watch_delay_info",
8995            RingBufferRequest::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
8996                "unknown one-way method"
8997            }
8998            RingBufferRequest::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
8999                "unknown two-way method"
9000            }
9001        }
9002    }
9003}
9004
9005#[derive(Debug, Clone)]
9006pub struct RingBufferControlHandle {
9007    inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
9008}
9009
9010impl RingBufferControlHandle {
9011    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
9012        self.inner.shutdown_with_epitaph(status.into())
9013    }
9014}
9015
9016impl fdomain_client::fidl::ControlHandle for RingBufferControlHandle {
9017    fn shutdown(&self) {
9018        self.inner.shutdown()
9019    }
9020
9021    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
9022        self.inner.shutdown_with_epitaph(status)
9023    }
9024
9025    fn is_closed(&self) -> bool {
9026        self.inner.channel().is_closed()
9027    }
9028    fn on_closed(&self) -> fdomain_client::OnFDomainSignals {
9029        self.inner.channel().on_closed()
9030    }
9031}
9032
9033impl RingBufferControlHandle {}
9034
9035#[must_use = "FIDL methods require a response to be sent"]
9036#[derive(Debug)]
9037pub struct RingBufferGetPropertiesResponder {
9038    control_handle: std::mem::ManuallyDrop<RingBufferControlHandle>,
9039    tx_id: u32,
9040}
9041
9042/// Set the the channel to be shutdown (see [`RingBufferControlHandle::shutdown`])
9043/// if the responder is dropped without sending a response, so that the client
9044/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
9045impl std::ops::Drop for RingBufferGetPropertiesResponder {
9046    fn drop(&mut self) {
9047        self.control_handle.shutdown();
9048        // Safety: drops once, never accessed again
9049        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9050    }
9051}
9052
9053impl fdomain_client::fidl::Responder for RingBufferGetPropertiesResponder {
9054    type ControlHandle = RingBufferControlHandle;
9055
9056    fn control_handle(&self) -> &RingBufferControlHandle {
9057        &self.control_handle
9058    }
9059
9060    fn drop_without_shutdown(mut self) {
9061        // Safety: drops once, never accessed again due to mem::forget
9062        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9063        // Prevent Drop from running (which would shut down the channel)
9064        std::mem::forget(self);
9065    }
9066}
9067
9068impl RingBufferGetPropertiesResponder {
9069    /// Sends a response to the FIDL transaction.
9070    ///
9071    /// Sets the channel to shutdown if an error occurs.
9072    pub fn send(self, mut properties: &RingBufferProperties) -> Result<(), fidl::Error> {
9073        let _result = self.send_raw(properties);
9074        if _result.is_err() {
9075            self.control_handle.shutdown();
9076        }
9077        self.drop_without_shutdown();
9078        _result
9079    }
9080
9081    /// Similar to "send" but does not shutdown the channel if an error occurs.
9082    pub fn send_no_shutdown_on_err(
9083        self,
9084        mut properties: &RingBufferProperties,
9085    ) -> Result<(), fidl::Error> {
9086        let _result = self.send_raw(properties);
9087        self.drop_without_shutdown();
9088        _result
9089    }
9090
9091    fn send_raw(&self, mut properties: &RingBufferProperties) -> Result<(), fidl::Error> {
9092        self.control_handle.inner.send::<RingBufferGetPropertiesResponse>(
9093            (properties,),
9094            self.tx_id,
9095            0x12947f061a8fe1,
9096            fidl::encoding::DynamicFlags::empty(),
9097        )
9098    }
9099}
9100
9101#[must_use = "FIDL methods require a response to be sent"]
9102#[derive(Debug)]
9103pub struct RingBufferWatchClockRecoveryPositionInfoResponder {
9104    control_handle: std::mem::ManuallyDrop<RingBufferControlHandle>,
9105    tx_id: u32,
9106}
9107
9108/// Set the the channel to be shutdown (see [`RingBufferControlHandle::shutdown`])
9109/// if the responder is dropped without sending a response, so that the client
9110/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
9111impl std::ops::Drop for RingBufferWatchClockRecoveryPositionInfoResponder {
9112    fn drop(&mut self) {
9113        self.control_handle.shutdown();
9114        // Safety: drops once, never accessed again
9115        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9116    }
9117}
9118
9119impl fdomain_client::fidl::Responder for RingBufferWatchClockRecoveryPositionInfoResponder {
9120    type ControlHandle = RingBufferControlHandle;
9121
9122    fn control_handle(&self) -> &RingBufferControlHandle {
9123        &self.control_handle
9124    }
9125
9126    fn drop_without_shutdown(mut self) {
9127        // Safety: drops once, never accessed again due to mem::forget
9128        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9129        // Prevent Drop from running (which would shut down the channel)
9130        std::mem::forget(self);
9131    }
9132}
9133
9134impl RingBufferWatchClockRecoveryPositionInfoResponder {
9135    /// Sends a response to the FIDL transaction.
9136    ///
9137    /// Sets the channel to shutdown if an error occurs.
9138    pub fn send(self, mut position_info: &RingBufferPositionInfo) -> Result<(), fidl::Error> {
9139        let _result = self.send_raw(position_info);
9140        if _result.is_err() {
9141            self.control_handle.shutdown();
9142        }
9143        self.drop_without_shutdown();
9144        _result
9145    }
9146
9147    /// Similar to "send" but does not shutdown the channel if an error occurs.
9148    pub fn send_no_shutdown_on_err(
9149        self,
9150        mut position_info: &RingBufferPositionInfo,
9151    ) -> Result<(), fidl::Error> {
9152        let _result = self.send_raw(position_info);
9153        self.drop_without_shutdown();
9154        _result
9155    }
9156
9157    fn send_raw(&self, mut position_info: &RingBufferPositionInfo) -> Result<(), fidl::Error> {
9158        self.control_handle.inner.send::<RingBufferWatchClockRecoveryPositionInfoResponse>(
9159            (position_info,),
9160            self.tx_id,
9161            0x694d5b898a4167e5,
9162            fidl::encoding::DynamicFlags::empty(),
9163        )
9164    }
9165}
9166
9167#[must_use = "FIDL methods require a response to be sent"]
9168#[derive(Debug)]
9169pub struct RingBufferGetVmoResponder {
9170    control_handle: std::mem::ManuallyDrop<RingBufferControlHandle>,
9171    tx_id: u32,
9172}
9173
9174/// Set the the channel to be shutdown (see [`RingBufferControlHandle::shutdown`])
9175/// if the responder is dropped without sending a response, so that the client
9176/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
9177impl std::ops::Drop for RingBufferGetVmoResponder {
9178    fn drop(&mut self) {
9179        self.control_handle.shutdown();
9180        // Safety: drops once, never accessed again
9181        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9182    }
9183}
9184
9185impl fdomain_client::fidl::Responder for RingBufferGetVmoResponder {
9186    type ControlHandle = RingBufferControlHandle;
9187
9188    fn control_handle(&self) -> &RingBufferControlHandle {
9189        &self.control_handle
9190    }
9191
9192    fn drop_without_shutdown(mut self) {
9193        // Safety: drops once, never accessed again due to mem::forget
9194        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9195        // Prevent Drop from running (which would shut down the channel)
9196        std::mem::forget(self);
9197    }
9198}
9199
9200impl RingBufferGetVmoResponder {
9201    /// Sends a response to the FIDL transaction.
9202    ///
9203    /// Sets the channel to shutdown if an error occurs.
9204    pub fn send(
9205        self,
9206        mut result: Result<(u32, fdomain_client::Vmo), GetVmoError>,
9207    ) -> Result<(), fidl::Error> {
9208        let _result = self.send_raw(result);
9209        if _result.is_err() {
9210            self.control_handle.shutdown();
9211        }
9212        self.drop_without_shutdown();
9213        _result
9214    }
9215
9216    /// Similar to "send" but does not shutdown the channel if an error occurs.
9217    pub fn send_no_shutdown_on_err(
9218        self,
9219        mut result: Result<(u32, fdomain_client::Vmo), GetVmoError>,
9220    ) -> Result<(), fidl::Error> {
9221        let _result = self.send_raw(result);
9222        self.drop_without_shutdown();
9223        _result
9224    }
9225
9226    fn send_raw(
9227        &self,
9228        mut result: Result<(u32, fdomain_client::Vmo), GetVmoError>,
9229    ) -> Result<(), fidl::Error> {
9230        self.control_handle
9231            .inner
9232            .send::<fidl::encoding::ResultType<RingBufferGetVmoResponse, GetVmoError>>(
9233                result,
9234                self.tx_id,
9235                0x44c8f4f5680e853a,
9236                fidl::encoding::DynamicFlags::empty(),
9237            )
9238    }
9239}
9240
9241#[must_use = "FIDL methods require a response to be sent"]
9242#[derive(Debug)]
9243pub struct RingBufferStartResponder {
9244    control_handle: std::mem::ManuallyDrop<RingBufferControlHandle>,
9245    tx_id: u32,
9246}
9247
9248/// Set the the channel to be shutdown (see [`RingBufferControlHandle::shutdown`])
9249/// if the responder is dropped without sending a response, so that the client
9250/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
9251impl std::ops::Drop for RingBufferStartResponder {
9252    fn drop(&mut self) {
9253        self.control_handle.shutdown();
9254        // Safety: drops once, never accessed again
9255        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9256    }
9257}
9258
9259impl fdomain_client::fidl::Responder for RingBufferStartResponder {
9260    type ControlHandle = RingBufferControlHandle;
9261
9262    fn control_handle(&self) -> &RingBufferControlHandle {
9263        &self.control_handle
9264    }
9265
9266    fn drop_without_shutdown(mut self) {
9267        // Safety: drops once, never accessed again due to mem::forget
9268        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9269        // Prevent Drop from running (which would shut down the channel)
9270        std::mem::forget(self);
9271    }
9272}
9273
9274impl RingBufferStartResponder {
9275    /// Sends a response to the FIDL transaction.
9276    ///
9277    /// Sets the channel to shutdown if an error occurs.
9278    pub fn send(self, mut start_time: i64) -> Result<(), fidl::Error> {
9279        let _result = self.send_raw(start_time);
9280        if _result.is_err() {
9281            self.control_handle.shutdown();
9282        }
9283        self.drop_without_shutdown();
9284        _result
9285    }
9286
9287    /// Similar to "send" but does not shutdown the channel if an error occurs.
9288    pub fn send_no_shutdown_on_err(self, mut start_time: i64) -> Result<(), fidl::Error> {
9289        let _result = self.send_raw(start_time);
9290        self.drop_without_shutdown();
9291        _result
9292    }
9293
9294    fn send_raw(&self, mut start_time: i64) -> Result<(), fidl::Error> {
9295        self.control_handle.inner.send::<RingBufferStartResponse>(
9296            (start_time,),
9297            self.tx_id,
9298            0x5dd780a769a8892d,
9299            fidl::encoding::DynamicFlags::empty(),
9300        )
9301    }
9302}
9303
9304#[must_use = "FIDL methods require a response to be sent"]
9305#[derive(Debug)]
9306pub struct RingBufferStopResponder {
9307    control_handle: std::mem::ManuallyDrop<RingBufferControlHandle>,
9308    tx_id: u32,
9309}
9310
9311/// Set the the channel to be shutdown (see [`RingBufferControlHandle::shutdown`])
9312/// if the responder is dropped without sending a response, so that the client
9313/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
9314impl std::ops::Drop for RingBufferStopResponder {
9315    fn drop(&mut self) {
9316        self.control_handle.shutdown();
9317        // Safety: drops once, never accessed again
9318        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9319    }
9320}
9321
9322impl fdomain_client::fidl::Responder for RingBufferStopResponder {
9323    type ControlHandle = RingBufferControlHandle;
9324
9325    fn control_handle(&self) -> &RingBufferControlHandle {
9326        &self.control_handle
9327    }
9328
9329    fn drop_without_shutdown(mut self) {
9330        // Safety: drops once, never accessed again due to mem::forget
9331        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9332        // Prevent Drop from running (which would shut down the channel)
9333        std::mem::forget(self);
9334    }
9335}
9336
9337impl RingBufferStopResponder {
9338    /// Sends a response to the FIDL transaction.
9339    ///
9340    /// Sets the channel to shutdown if an error occurs.
9341    pub fn send(self) -> Result<(), fidl::Error> {
9342        let _result = self.send_raw();
9343        if _result.is_err() {
9344            self.control_handle.shutdown();
9345        }
9346        self.drop_without_shutdown();
9347        _result
9348    }
9349
9350    /// Similar to "send" but does not shutdown the channel if an error occurs.
9351    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
9352        let _result = self.send_raw();
9353        self.drop_without_shutdown();
9354        _result
9355    }
9356
9357    fn send_raw(&self) -> Result<(), fidl::Error> {
9358        self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
9359            (),
9360            self.tx_id,
9361            0x49a73d9cf1d4e110,
9362            fidl::encoding::DynamicFlags::empty(),
9363        )
9364    }
9365}
9366
9367#[must_use = "FIDL methods require a response to be sent"]
9368#[derive(Debug)]
9369pub struct RingBufferSetActiveChannelsResponder {
9370    control_handle: std::mem::ManuallyDrop<RingBufferControlHandle>,
9371    tx_id: u32,
9372}
9373
9374/// Set the the channel to be shutdown (see [`RingBufferControlHandle::shutdown`])
9375/// if the responder is dropped without sending a response, so that the client
9376/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
9377impl std::ops::Drop for RingBufferSetActiveChannelsResponder {
9378    fn drop(&mut self) {
9379        self.control_handle.shutdown();
9380        // Safety: drops once, never accessed again
9381        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9382    }
9383}
9384
9385impl fdomain_client::fidl::Responder for RingBufferSetActiveChannelsResponder {
9386    type ControlHandle = RingBufferControlHandle;
9387
9388    fn control_handle(&self) -> &RingBufferControlHandle {
9389        &self.control_handle
9390    }
9391
9392    fn drop_without_shutdown(mut self) {
9393        // Safety: drops once, never accessed again due to mem::forget
9394        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9395        // Prevent Drop from running (which would shut down the channel)
9396        std::mem::forget(self);
9397    }
9398}
9399
9400impl RingBufferSetActiveChannelsResponder {
9401    /// Sends a response to the FIDL transaction.
9402    ///
9403    /// Sets the channel to shutdown if an error occurs.
9404    pub fn send(self, mut result: Result<i64, i32>) -> Result<(), fidl::Error> {
9405        let _result = self.send_raw(result);
9406        if _result.is_err() {
9407            self.control_handle.shutdown();
9408        }
9409        self.drop_without_shutdown();
9410        _result
9411    }
9412
9413    /// Similar to "send" but does not shutdown the channel if an error occurs.
9414    pub fn send_no_shutdown_on_err(self, mut result: Result<i64, i32>) -> Result<(), fidl::Error> {
9415        let _result = self.send_raw(result);
9416        self.drop_without_shutdown();
9417        _result
9418    }
9419
9420    fn send_raw(&self, mut result: Result<i64, i32>) -> Result<(), fidl::Error> {
9421        self.control_handle.inner.send::<fidl::encoding::ResultType<
9422            RingBufferSetActiveChannelsResponse,
9423            i32,
9424        >>(
9425            result.map(|set_time| (set_time,)),
9426            self.tx_id,
9427            0x605464c1d384f309,
9428            fidl::encoding::DynamicFlags::empty(),
9429        )
9430    }
9431}
9432
9433#[must_use = "FIDL methods require a response to be sent"]
9434#[derive(Debug)]
9435pub struct RingBufferWatchDelayInfoResponder {
9436    control_handle: std::mem::ManuallyDrop<RingBufferControlHandle>,
9437    tx_id: u32,
9438}
9439
9440/// Set the the channel to be shutdown (see [`RingBufferControlHandle::shutdown`])
9441/// if the responder is dropped without sending a response, so that the client
9442/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
9443impl std::ops::Drop for RingBufferWatchDelayInfoResponder {
9444    fn drop(&mut self) {
9445        self.control_handle.shutdown();
9446        // Safety: drops once, never accessed again
9447        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9448    }
9449}
9450
9451impl fdomain_client::fidl::Responder for RingBufferWatchDelayInfoResponder {
9452    type ControlHandle = RingBufferControlHandle;
9453
9454    fn control_handle(&self) -> &RingBufferControlHandle {
9455        &self.control_handle
9456    }
9457
9458    fn drop_without_shutdown(mut self) {
9459        // Safety: drops once, never accessed again due to mem::forget
9460        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9461        // Prevent Drop from running (which would shut down the channel)
9462        std::mem::forget(self);
9463    }
9464}
9465
9466impl RingBufferWatchDelayInfoResponder {
9467    /// Sends a response to the FIDL transaction.
9468    ///
9469    /// Sets the channel to shutdown if an error occurs.
9470    pub fn send(self, mut delay_info: &DelayInfo) -> Result<(), fidl::Error> {
9471        let _result = self.send_raw(delay_info);
9472        if _result.is_err() {
9473            self.control_handle.shutdown();
9474        }
9475        self.drop_without_shutdown();
9476        _result
9477    }
9478
9479    /// Similar to "send" but does not shutdown the channel if an error occurs.
9480    pub fn send_no_shutdown_on_err(self, mut delay_info: &DelayInfo) -> Result<(), fidl::Error> {
9481        let _result = self.send_raw(delay_info);
9482        self.drop_without_shutdown();
9483        _result
9484    }
9485
9486    fn send_raw(&self, mut delay_info: &DelayInfo) -> Result<(), fidl::Error> {
9487        self.control_handle
9488            .inner
9489            .send::<fidl::encoding::FlexibleType<RingBufferWatchDelayInfoResponse>>(
9490                fidl::encoding::Flexible::new((delay_info,)),
9491                self.tx_id,
9492                0x6c1248db213fcf9f,
9493                fidl::encoding::DynamicFlags::FLEXIBLE,
9494            )
9495    }
9496}
9497
9498#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
9499pub struct StreamConfigMarker;
9500
9501impl fdomain_client::fidl::ProtocolMarker for StreamConfigMarker {
9502    type Proxy = StreamConfigProxy;
9503    type RequestStream = StreamConfigRequestStream;
9504
9505    const DEBUG_NAME: &'static str = "(anonymous) StreamConfig";
9506}
9507
9508pub trait StreamConfigProxyInterface: Send + Sync {
9509    type GetHealthStateResponseFut: std::future::Future<Output = Result<HealthState, fidl::Error>>
9510        + Send;
9511    fn r#get_health_state(&self) -> Self::GetHealthStateResponseFut;
9512    fn r#signal_processing_connect(
9513        &self,
9514        protocol: fdomain_client::fidl::ServerEnd<
9515            fdomain_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
9516        >,
9517    ) -> Result<(), fidl::Error>;
9518    type GetPropertiesResponseFut: std::future::Future<Output = Result<StreamProperties, fidl::Error>>
9519        + Send;
9520    fn r#get_properties(&self) -> Self::GetPropertiesResponseFut;
9521    type GetSupportedFormatsResponseFut: std::future::Future<Output = Result<Vec<SupportedFormats>, fidl::Error>>
9522        + Send;
9523    fn r#get_supported_formats(&self) -> Self::GetSupportedFormatsResponseFut;
9524    fn r#create_ring_buffer(
9525        &self,
9526        format: &Format,
9527        ring_buffer: fdomain_client::fidl::ServerEnd<RingBufferMarker>,
9528    ) -> Result<(), fidl::Error>;
9529    type WatchGainStateResponseFut: std::future::Future<Output = Result<GainState, fidl::Error>>
9530        + Send;
9531    fn r#watch_gain_state(&self) -> Self::WatchGainStateResponseFut;
9532    fn r#set_gain(&self, target_state: &GainState) -> Result<(), fidl::Error>;
9533    type WatchPlugStateResponseFut: std::future::Future<Output = Result<PlugState, fidl::Error>>
9534        + Send;
9535    fn r#watch_plug_state(&self) -> Self::WatchPlugStateResponseFut;
9536}
9537
9538#[derive(Debug, Clone)]
9539pub struct StreamConfigProxy {
9540    client: fidl::client::Client<fdomain_client::fidl::FDomainResourceDialect>,
9541}
9542
9543impl fdomain_client::fidl::Proxy for StreamConfigProxy {
9544    type Protocol = StreamConfigMarker;
9545
9546    fn from_channel(inner: fdomain_client::Channel) -> Self {
9547        Self::new(inner)
9548    }
9549
9550    fn into_channel(self) -> Result<fdomain_client::Channel, Self> {
9551        self.client.into_channel().map_err(|client| Self { client })
9552    }
9553
9554    fn as_channel(&self) -> &fdomain_client::Channel {
9555        self.client.as_channel()
9556    }
9557}
9558
9559impl StreamConfigProxy {
9560    /// Create a new Proxy for fuchsia.hardware.audio/StreamConfig.
9561    pub fn new(channel: fdomain_client::Channel) -> Self {
9562        let protocol_name =
9563            <StreamConfigMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME;
9564        Self { client: fidl::client::Client::new(channel, protocol_name) }
9565    }
9566
9567    /// Get a Stream of events from the remote end of the protocol.
9568    ///
9569    /// # Panics
9570    ///
9571    /// Panics if the event stream was already taken.
9572    pub fn take_event_stream(&self) -> StreamConfigEventStream {
9573        StreamConfigEventStream { event_receiver: self.client.take_event_receiver() }
9574    }
9575
9576    /// Retrieves top level health state.
9577    /// A driver not responding promptly can be used as an indication of an unhealthy driver.
9578    pub fn r#get_health_state(
9579        &self,
9580    ) -> fidl::client::QueryResponseFut<HealthState, fdomain_client::fidl::FDomainResourceDialect>
9581    {
9582        StreamConfigProxyInterface::r#get_health_state(self)
9583    }
9584
9585    /// Connect to a `SignalProcessing` protocol.
9586    /// Multiple connections may be supported, if a new connection request is not supported, i.e.
9587    /// the maximum number of connections have already been created, for instance one, then the
9588    /// `protocol` channel (not the channel upon which `SignalProcessingConnect` is being called)
9589    /// will be closed with a `ZX_ERR_ALREADY_BOUND` epitaph.
9590    /// If signal processing is not supported at all, then the `protocol` channel (again, not the
9591    /// channel upon which `SignalProcessingConnect` is being called) will be closed with a
9592    /// `ZX_ERR_NOT_SUPPORTED` epitaph.
9593    /// This method is named `SignalProcessingConnect` instead of `Connect` because this protocol
9594    /// is intended to be composed, and hence the more verbose name allows differentiation and
9595    /// improved clarity.
9596    pub fn r#signal_processing_connect(
9597        &self,
9598        mut protocol: fdomain_client::fidl::ServerEnd<
9599            fdomain_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
9600        >,
9601    ) -> Result<(), fidl::Error> {
9602        StreamConfigProxyInterface::r#signal_processing_connect(self, protocol)
9603    }
9604
9605    /// Retrieves top level static properties.
9606    pub fn r#get_properties(
9607        &self,
9608    ) -> fidl::client::QueryResponseFut<
9609        StreamProperties,
9610        fdomain_client::fidl::FDomainResourceDialect,
9611    > {
9612        StreamConfigProxyInterface::r#get_properties(self)
9613    }
9614
9615    /// Gets formats supported by a given driver. When not all combinations supported by the
9616    /// driver can be described with one `SupportedFormats`, the driver returns more than one
9617    /// `SupportedFormats` in the returned vector. For example, if one `SupportedFormats` allows
9618    /// for 32 bits samples at 48KHz, and 16 bits samples at 96KHz, but not 32 bits samples at
9619    /// 96KHz, then the driver replies with 2 `SupportedFormats`: <<32bits>,<48KHz>> and
9620    /// <<16bits>,<96KHz>>. For simplicity, this example ignores parameters other than rate and
9621    /// bits per sample. In the case where the driver supports either 16 or 32 bits samples at
9622    /// either 48 or 96KHz, the driver would reply with 1 `SupportedFormats`:
9623    /// <<16bits,32bits>,<48KHz,96KHz>>.
9624    pub fn r#get_supported_formats(
9625        &self,
9626    ) -> fidl::client::QueryResponseFut<
9627        Vec<SupportedFormats>,
9628        fdomain_client::fidl::FDomainResourceDialect,
9629    > {
9630        StreamConfigProxyInterface::r#get_supported_formats(self)
9631    }
9632
9633    /// `CreateRingBuffer` is sent by clients to select a stream format based on information that
9634    /// the driver provides in `GetSupportedFormats` what is supported by the client, and any other
9635    /// requirement. The `ring_buffer` channel is used to control the audio buffer, if a previous
9636    /// ring buffer channel had been established and was still active, the driver must close that
9637    /// (ring buffer) channel and make every attempt to gracefully quiesce any on-going streaming
9638    /// operations in the process.
9639    pub fn r#create_ring_buffer(
9640        &self,
9641        mut format: &Format,
9642        mut ring_buffer: fdomain_client::fidl::ServerEnd<RingBufferMarker>,
9643    ) -> Result<(), fidl::Error> {
9644        StreamConfigProxyInterface::r#create_ring_buffer(self, format, ring_buffer)
9645    }
9646
9647    /// Get the gain state via a hanging get. The driver will reply to the first `WatchGainState`
9648    /// sent by the client and this reply must include a `gain_db` set to 0dB or lower. The driver
9649    /// will not respond to subsequent client `WatchGainState` calls until the gain state changes
9650    /// from what was most recently reported.
9651    /// If `WatchGainState` is called for a second time before the first call has completed, then
9652    /// the protocol channel must be closed with the error `ZX_ERR_BAD_STATE`.
9653    pub fn r#watch_gain_state(
9654        &self,
9655    ) -> fidl::client::QueryResponseFut<GainState, fdomain_client::fidl::FDomainResourceDialect>
9656    {
9657        StreamConfigProxyInterface::r#watch_gain_state(self)
9658    }
9659
9660    /// Client update of the gain state.
9661    pub fn r#set_gain(&self, mut target_state: &GainState) -> Result<(), fidl::Error> {
9662        StreamConfigProxyInterface::r#set_gain(self, target_state)
9663    }
9664
9665    /// Get the plug detect state via a hanging get. The driver will reply to the first
9666    /// `WatchPlugState` sent by the client. The driver will not respond to subsequent client
9667    /// `WatchPlugState` calls until the plug state changes from what was most recently reported.
9668    /// If `WatchPlugState` is called for a second time before the first call has completed, then
9669    /// the protocol channel must be closed with the error `ZX_ERR_BAD_STATE`.
9670    pub fn r#watch_plug_state(
9671        &self,
9672    ) -> fidl::client::QueryResponseFut<PlugState, fdomain_client::fidl::FDomainResourceDialect>
9673    {
9674        StreamConfigProxyInterface::r#watch_plug_state(self)
9675    }
9676}
9677
9678impl StreamConfigProxyInterface for StreamConfigProxy {
9679    type GetHealthStateResponseFut =
9680        fidl::client::QueryResponseFut<HealthState, fdomain_client::fidl::FDomainResourceDialect>;
9681    fn r#get_health_state(&self) -> Self::GetHealthStateResponseFut {
9682        fn _decode(
9683            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
9684        ) -> Result<HealthState, fidl::Error> {
9685            let _response = fidl::client::decode_transaction_body::<
9686                HealthGetHealthStateResponse,
9687                fdomain_client::fidl::FDomainResourceDialect,
9688                0x4e146d6bca733a84,
9689            >(_buf?)?;
9690            Ok(_response.state)
9691        }
9692        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, HealthState>(
9693            (),
9694            0x4e146d6bca733a84,
9695            fidl::encoding::DynamicFlags::empty(),
9696            _decode,
9697        )
9698    }
9699
9700    fn r#signal_processing_connect(
9701        &self,
9702        mut protocol: fdomain_client::fidl::ServerEnd<
9703            fdomain_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
9704        >,
9705    ) -> Result<(), fidl::Error> {
9706        self.client.send::<fdomain_fuchsia_hardware_audio_signalprocessing::ConnectorSignalProcessingConnectRequest>(
9707            (protocol,),
9708            0xa81907ce6066295,
9709            fidl::encoding::DynamicFlags::empty(),
9710        )
9711    }
9712
9713    type GetPropertiesResponseFut = fidl::client::QueryResponseFut<
9714        StreamProperties,
9715        fdomain_client::fidl::FDomainResourceDialect,
9716    >;
9717    fn r#get_properties(&self) -> Self::GetPropertiesResponseFut {
9718        fn _decode(
9719            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
9720        ) -> Result<StreamProperties, fidl::Error> {
9721            let _response = fidl::client::decode_transaction_body::<
9722                StreamConfigGetPropertiesResponse,
9723                fdomain_client::fidl::FDomainResourceDialect,
9724                0x7d89c02f3e2d3c01,
9725            >(_buf?)?;
9726            Ok(_response.properties)
9727        }
9728        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, StreamProperties>(
9729            (),
9730            0x7d89c02f3e2d3c01,
9731            fidl::encoding::DynamicFlags::empty(),
9732            _decode,
9733        )
9734    }
9735
9736    type GetSupportedFormatsResponseFut = fidl::client::QueryResponseFut<
9737        Vec<SupportedFormats>,
9738        fdomain_client::fidl::FDomainResourceDialect,
9739    >;
9740    fn r#get_supported_formats(&self) -> Self::GetSupportedFormatsResponseFut {
9741        fn _decode(
9742            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
9743        ) -> Result<Vec<SupportedFormats>, fidl::Error> {
9744            let _response = fidl::client::decode_transaction_body::<
9745                StreamConfigGetSupportedFormatsResponse,
9746                fdomain_client::fidl::FDomainResourceDialect,
9747                0x448efa7850cafe7e,
9748            >(_buf?)?;
9749            Ok(_response.supported_formats)
9750        }
9751        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Vec<SupportedFormats>>(
9752            (),
9753            0x448efa7850cafe7e,
9754            fidl::encoding::DynamicFlags::empty(),
9755            _decode,
9756        )
9757    }
9758
9759    fn r#create_ring_buffer(
9760        &self,
9761        mut format: &Format,
9762        mut ring_buffer: fdomain_client::fidl::ServerEnd<RingBufferMarker>,
9763    ) -> Result<(), fidl::Error> {
9764        self.client.send::<StreamConfigCreateRingBufferRequest>(
9765            (format, ring_buffer),
9766            0x2afb19dd13faa1ba,
9767            fidl::encoding::DynamicFlags::empty(),
9768        )
9769    }
9770
9771    type WatchGainStateResponseFut =
9772        fidl::client::QueryResponseFut<GainState, fdomain_client::fidl::FDomainResourceDialect>;
9773    fn r#watch_gain_state(&self) -> Self::WatchGainStateResponseFut {
9774        fn _decode(
9775            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
9776        ) -> Result<GainState, fidl::Error> {
9777            let _response = fidl::client::decode_transaction_body::<
9778                StreamConfigWatchGainStateResponse,
9779                fdomain_client::fidl::FDomainResourceDialect,
9780                0x4772506136ab65c1,
9781            >(_buf?)?;
9782            Ok(_response.gain_state)
9783        }
9784        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, GainState>(
9785            (),
9786            0x4772506136ab65c1,
9787            fidl::encoding::DynamicFlags::empty(),
9788            _decode,
9789        )
9790    }
9791
9792    fn r#set_gain(&self, mut target_state: &GainState) -> Result<(), fidl::Error> {
9793        self.client.send::<StreamConfigSetGainRequest>(
9794            (target_state,),
9795            0x3943b41498c6a384,
9796            fidl::encoding::DynamicFlags::empty(),
9797        )
9798    }
9799
9800    type WatchPlugStateResponseFut =
9801        fidl::client::QueryResponseFut<PlugState, fdomain_client::fidl::FDomainResourceDialect>;
9802    fn r#watch_plug_state(&self) -> Self::WatchPlugStateResponseFut {
9803        fn _decode(
9804            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
9805        ) -> Result<PlugState, fidl::Error> {
9806            let _response = fidl::client::decode_transaction_body::<
9807                StreamConfigWatchPlugStateResponse,
9808                fdomain_client::fidl::FDomainResourceDialect,
9809                0x497345a6f048b2a6,
9810            >(_buf?)?;
9811            Ok(_response.plug_state)
9812        }
9813        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, PlugState>(
9814            (),
9815            0x497345a6f048b2a6,
9816            fidl::encoding::DynamicFlags::empty(),
9817            _decode,
9818        )
9819    }
9820}
9821
9822pub struct StreamConfigEventStream {
9823    event_receiver: fidl::client::EventReceiver<fdomain_client::fidl::FDomainResourceDialect>,
9824}
9825
9826impl std::marker::Unpin for StreamConfigEventStream {}
9827
9828impl futures::stream::FusedStream for StreamConfigEventStream {
9829    fn is_terminated(&self) -> bool {
9830        self.event_receiver.is_terminated()
9831    }
9832}
9833
9834impl futures::Stream for StreamConfigEventStream {
9835    type Item = Result<StreamConfigEvent, fidl::Error>;
9836
9837    fn poll_next(
9838        mut self: std::pin::Pin<&mut Self>,
9839        cx: &mut std::task::Context<'_>,
9840    ) -> std::task::Poll<Option<Self::Item>> {
9841        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
9842            &mut self.event_receiver,
9843            cx
9844        )?) {
9845            Some(buf) => std::task::Poll::Ready(Some(StreamConfigEvent::decode(buf))),
9846            None => std::task::Poll::Ready(None),
9847        }
9848    }
9849}
9850
9851#[derive(Debug)]
9852pub enum StreamConfigEvent {}
9853
9854impl StreamConfigEvent {
9855    /// Decodes a message buffer as a [`StreamConfigEvent`].
9856    fn decode(
9857        mut buf: <fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
9858    ) -> Result<StreamConfigEvent, fidl::Error> {
9859        let (bytes, _handles) = buf.split_mut();
9860        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
9861        debug_assert_eq!(tx_header.tx_id, 0);
9862        match tx_header.ordinal {
9863            _ => Err(fidl::Error::UnknownOrdinal {
9864                ordinal: tx_header.ordinal,
9865                protocol_name:
9866                    <StreamConfigMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
9867            }),
9868        }
9869    }
9870}
9871
9872/// A Stream of incoming requests for fuchsia.hardware.audio/StreamConfig.
9873pub struct StreamConfigRequestStream {
9874    inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
9875    is_terminated: bool,
9876}
9877
9878impl std::marker::Unpin for StreamConfigRequestStream {}
9879
9880impl futures::stream::FusedStream for StreamConfigRequestStream {
9881    fn is_terminated(&self) -> bool {
9882        self.is_terminated
9883    }
9884}
9885
9886impl fdomain_client::fidl::RequestStream for StreamConfigRequestStream {
9887    type Protocol = StreamConfigMarker;
9888    type ControlHandle = StreamConfigControlHandle;
9889
9890    fn from_channel(channel: fdomain_client::Channel) -> Self {
9891        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
9892    }
9893
9894    fn control_handle(&self) -> Self::ControlHandle {
9895        StreamConfigControlHandle { inner: self.inner.clone() }
9896    }
9897
9898    fn into_inner(
9899        self,
9900    ) -> (::std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>, bool)
9901    {
9902        (self.inner, self.is_terminated)
9903    }
9904
9905    fn from_inner(
9906        inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
9907        is_terminated: bool,
9908    ) -> Self {
9909        Self { inner, is_terminated }
9910    }
9911}
9912
9913impl futures::Stream for StreamConfigRequestStream {
9914    type Item = Result<StreamConfigRequest, fidl::Error>;
9915
9916    fn poll_next(
9917        mut self: std::pin::Pin<&mut Self>,
9918        cx: &mut std::task::Context<'_>,
9919    ) -> std::task::Poll<Option<Self::Item>> {
9920        let this = &mut *self;
9921        if this.inner.check_shutdown(cx) {
9922            this.is_terminated = true;
9923            return std::task::Poll::Ready(None);
9924        }
9925        if this.is_terminated {
9926            panic!("polled StreamConfigRequestStream after completion");
9927        }
9928        fidl::encoding::with_tls_decode_buf::<_, fdomain_client::fidl::FDomainResourceDialect>(
9929            |bytes, handles| {
9930                match this.inner.channel().read_etc(cx, bytes, handles) {
9931                    std::task::Poll::Ready(Ok(())) => {}
9932                    std::task::Poll::Pending => return std::task::Poll::Pending,
9933                    std::task::Poll::Ready(Err(None)) => {
9934                        this.is_terminated = true;
9935                        return std::task::Poll::Ready(None);
9936                    }
9937                    std::task::Poll::Ready(Err(Some(e))) => {
9938                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
9939                            e.into(),
9940                        ))));
9941                    }
9942                }
9943
9944                // A message has been received from the channel
9945                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
9946
9947                std::task::Poll::Ready(Some(match header.ordinal {
9948                    0x4e146d6bca733a84 => {
9949                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
9950                        let mut req = fidl::new_empty!(
9951                            fidl::encoding::EmptyPayload,
9952                            fdomain_client::fidl::FDomainResourceDialect
9953                        );
9954                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
9955                        let control_handle =
9956                            StreamConfigControlHandle { inner: this.inner.clone() };
9957                        Ok(StreamConfigRequest::GetHealthState {
9958                            responder: StreamConfigGetHealthStateResponder {
9959                                control_handle: std::mem::ManuallyDrop::new(control_handle),
9960                                tx_id: header.tx_id,
9961                            },
9962                        })
9963                    }
9964                    0xa81907ce6066295 => {
9965                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
9966                        let mut req = fidl::new_empty!(fdomain_fuchsia_hardware_audio_signalprocessing::ConnectorSignalProcessingConnectRequest, fdomain_client::fidl::FDomainResourceDialect);
9967                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<fdomain_fuchsia_hardware_audio_signalprocessing::ConnectorSignalProcessingConnectRequest>(&header, _body_bytes, handles, &mut req)?;
9968                        let control_handle =
9969                            StreamConfigControlHandle { inner: this.inner.clone() };
9970                        Ok(StreamConfigRequest::SignalProcessingConnect {
9971                            protocol: req.protocol,
9972
9973                            control_handle,
9974                        })
9975                    }
9976                    0x7d89c02f3e2d3c01 => {
9977                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
9978                        let mut req = fidl::new_empty!(
9979                            fidl::encoding::EmptyPayload,
9980                            fdomain_client::fidl::FDomainResourceDialect
9981                        );
9982                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
9983                        let control_handle =
9984                            StreamConfigControlHandle { inner: this.inner.clone() };
9985                        Ok(StreamConfigRequest::GetProperties {
9986                            responder: StreamConfigGetPropertiesResponder {
9987                                control_handle: std::mem::ManuallyDrop::new(control_handle),
9988                                tx_id: header.tx_id,
9989                            },
9990                        })
9991                    }
9992                    0x448efa7850cafe7e => {
9993                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
9994                        let mut req = fidl::new_empty!(
9995                            fidl::encoding::EmptyPayload,
9996                            fdomain_client::fidl::FDomainResourceDialect
9997                        );
9998                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
9999                        let control_handle =
10000                            StreamConfigControlHandle { inner: this.inner.clone() };
10001                        Ok(StreamConfigRequest::GetSupportedFormats {
10002                            responder: StreamConfigGetSupportedFormatsResponder {
10003                                control_handle: std::mem::ManuallyDrop::new(control_handle),
10004                                tx_id: header.tx_id,
10005                            },
10006                        })
10007                    }
10008                    0x2afb19dd13faa1ba => {
10009                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
10010                        let mut req = fidl::new_empty!(
10011                            StreamConfigCreateRingBufferRequest,
10012                            fdomain_client::fidl::FDomainResourceDialect
10013                        );
10014                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<StreamConfigCreateRingBufferRequest>(&header, _body_bytes, handles, &mut req)?;
10015                        let control_handle =
10016                            StreamConfigControlHandle { inner: this.inner.clone() };
10017                        Ok(StreamConfigRequest::CreateRingBuffer {
10018                            format: req.format,
10019                            ring_buffer: req.ring_buffer,
10020
10021                            control_handle,
10022                        })
10023                    }
10024                    0x4772506136ab65c1 => {
10025                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
10026                        let mut req = fidl::new_empty!(
10027                            fidl::encoding::EmptyPayload,
10028                            fdomain_client::fidl::FDomainResourceDialect
10029                        );
10030                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
10031                        let control_handle =
10032                            StreamConfigControlHandle { inner: this.inner.clone() };
10033                        Ok(StreamConfigRequest::WatchGainState {
10034                            responder: StreamConfigWatchGainStateResponder {
10035                                control_handle: std::mem::ManuallyDrop::new(control_handle),
10036                                tx_id: header.tx_id,
10037                            },
10038                        })
10039                    }
10040                    0x3943b41498c6a384 => {
10041                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
10042                        let mut req = fidl::new_empty!(
10043                            StreamConfigSetGainRequest,
10044                            fdomain_client::fidl::FDomainResourceDialect
10045                        );
10046                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<StreamConfigSetGainRequest>(&header, _body_bytes, handles, &mut req)?;
10047                        let control_handle =
10048                            StreamConfigControlHandle { inner: this.inner.clone() };
10049                        Ok(StreamConfigRequest::SetGain {
10050                            target_state: req.target_state,
10051
10052                            control_handle,
10053                        })
10054                    }
10055                    0x497345a6f048b2a6 => {
10056                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
10057                        let mut req = fidl::new_empty!(
10058                            fidl::encoding::EmptyPayload,
10059                            fdomain_client::fidl::FDomainResourceDialect
10060                        );
10061                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
10062                        let control_handle =
10063                            StreamConfigControlHandle { inner: this.inner.clone() };
10064                        Ok(StreamConfigRequest::WatchPlugState {
10065                            responder: StreamConfigWatchPlugStateResponder {
10066                                control_handle: std::mem::ManuallyDrop::new(control_handle),
10067                                tx_id: header.tx_id,
10068                            },
10069                        })
10070                    }
10071                    _ => Err(fidl::Error::UnknownOrdinal {
10072                        ordinal: header.ordinal,
10073                        protocol_name:
10074                            <StreamConfigMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
10075                    }),
10076                }))
10077            },
10078        )
10079    }
10080}
10081
10082/// For an overview see
10083/// [Audio Driver Streaming Interface](https://fuchsia.dev/fuchsia-src/concepts/drivers/driver_architectures/audio_drivers/audio_streaming)
10084/// # Deprecation
10085///
10086/// Not supported anymore, instead use an
10087/// [Audio Composite](https://fuchsia.dev/fuchsia-src/development/audio/drivers/composite)
10088/// with one Ring Buffer, see
10089/// [Audio Drivers Architecture](https://fuchsia.dev/fuchsia-src/development/audio/drivers/architecture)
10090#[derive(Debug)]
10091pub enum StreamConfigRequest {
10092    /// Retrieves top level health state.
10093    /// A driver not responding promptly can be used as an indication of an unhealthy driver.
10094    GetHealthState { responder: StreamConfigGetHealthStateResponder },
10095    /// Connect to a `SignalProcessing` protocol.
10096    /// Multiple connections may be supported, if a new connection request is not supported, i.e.
10097    /// the maximum number of connections have already been created, for instance one, then the
10098    /// `protocol` channel (not the channel upon which `SignalProcessingConnect` is being called)
10099    /// will be closed with a `ZX_ERR_ALREADY_BOUND` epitaph.
10100    /// If signal processing is not supported at all, then the `protocol` channel (again, not the
10101    /// channel upon which `SignalProcessingConnect` is being called) will be closed with a
10102    /// `ZX_ERR_NOT_SUPPORTED` epitaph.
10103    /// This method is named `SignalProcessingConnect` instead of `Connect` because this protocol
10104    /// is intended to be composed, and hence the more verbose name allows differentiation and
10105    /// improved clarity.
10106    SignalProcessingConnect {
10107        protocol: fdomain_client::fidl::ServerEnd<
10108            fdomain_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
10109        >,
10110        control_handle: StreamConfigControlHandle,
10111    },
10112    /// Retrieves top level static properties.
10113    GetProperties { responder: StreamConfigGetPropertiesResponder },
10114    /// Gets formats supported by a given driver. When not all combinations supported by the
10115    /// driver can be described with one `SupportedFormats`, the driver returns more than one
10116    /// `SupportedFormats` in the returned vector. For example, if one `SupportedFormats` allows
10117    /// for 32 bits samples at 48KHz, and 16 bits samples at 96KHz, but not 32 bits samples at
10118    /// 96KHz, then the driver replies with 2 `SupportedFormats`: <<32bits>,<48KHz>> and
10119    /// <<16bits>,<96KHz>>. For simplicity, this example ignores parameters other than rate and
10120    /// bits per sample. In the case where the driver supports either 16 or 32 bits samples at
10121    /// either 48 or 96KHz, the driver would reply with 1 `SupportedFormats`:
10122    /// <<16bits,32bits>,<48KHz,96KHz>>.
10123    GetSupportedFormats { responder: StreamConfigGetSupportedFormatsResponder },
10124    /// `CreateRingBuffer` is sent by clients to select a stream format based on information that
10125    /// the driver provides in `GetSupportedFormats` what is supported by the client, and any other
10126    /// requirement. The `ring_buffer` channel is used to control the audio buffer, if a previous
10127    /// ring buffer channel had been established and was still active, the driver must close that
10128    /// (ring buffer) channel and make every attempt to gracefully quiesce any on-going streaming
10129    /// operations in the process.
10130    CreateRingBuffer {
10131        format: Format,
10132        ring_buffer: fdomain_client::fidl::ServerEnd<RingBufferMarker>,
10133        control_handle: StreamConfigControlHandle,
10134    },
10135    /// Get the gain state via a hanging get. The driver will reply to the first `WatchGainState`
10136    /// sent by the client and this reply must include a `gain_db` set to 0dB or lower. The driver
10137    /// will not respond to subsequent client `WatchGainState` calls until the gain state changes
10138    /// from what was most recently reported.
10139    /// If `WatchGainState` is called for a second time before the first call has completed, then
10140    /// the protocol channel must be closed with the error `ZX_ERR_BAD_STATE`.
10141    WatchGainState { responder: StreamConfigWatchGainStateResponder },
10142    /// Client update of the gain state.
10143    SetGain { target_state: GainState, control_handle: StreamConfigControlHandle },
10144    /// Get the plug detect state via a hanging get. The driver will reply to the first
10145    /// `WatchPlugState` sent by the client. The driver will not respond to subsequent client
10146    /// `WatchPlugState` calls until the plug state changes from what was most recently reported.
10147    /// If `WatchPlugState` is called for a second time before the first call has completed, then
10148    /// the protocol channel must be closed with the error `ZX_ERR_BAD_STATE`.
10149    WatchPlugState { responder: StreamConfigWatchPlugStateResponder },
10150}
10151
10152impl StreamConfigRequest {
10153    #[allow(irrefutable_let_patterns)]
10154    pub fn into_get_health_state(self) -> Option<(StreamConfigGetHealthStateResponder)> {
10155        if let StreamConfigRequest::GetHealthState { responder } = self {
10156            Some((responder))
10157        } else {
10158            None
10159        }
10160    }
10161
10162    #[allow(irrefutable_let_patterns)]
10163    pub fn into_signal_processing_connect(
10164        self,
10165    ) -> Option<(
10166        fdomain_client::fidl::ServerEnd<
10167            fdomain_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
10168        >,
10169        StreamConfigControlHandle,
10170    )> {
10171        if let StreamConfigRequest::SignalProcessingConnect { protocol, control_handle } = self {
10172            Some((protocol, control_handle))
10173        } else {
10174            None
10175        }
10176    }
10177
10178    #[allow(irrefutable_let_patterns)]
10179    pub fn into_get_properties(self) -> Option<(StreamConfigGetPropertiesResponder)> {
10180        if let StreamConfigRequest::GetProperties { responder } = self {
10181            Some((responder))
10182        } else {
10183            None
10184        }
10185    }
10186
10187    #[allow(irrefutable_let_patterns)]
10188    pub fn into_get_supported_formats(self) -> Option<(StreamConfigGetSupportedFormatsResponder)> {
10189        if let StreamConfigRequest::GetSupportedFormats { responder } = self {
10190            Some((responder))
10191        } else {
10192            None
10193        }
10194    }
10195
10196    #[allow(irrefutable_let_patterns)]
10197    pub fn into_create_ring_buffer(
10198        self,
10199    ) -> Option<(
10200        Format,
10201        fdomain_client::fidl::ServerEnd<RingBufferMarker>,
10202        StreamConfigControlHandle,
10203    )> {
10204        if let StreamConfigRequest::CreateRingBuffer { format, ring_buffer, control_handle } = self
10205        {
10206            Some((format, ring_buffer, control_handle))
10207        } else {
10208            None
10209        }
10210    }
10211
10212    #[allow(irrefutable_let_patterns)]
10213    pub fn into_watch_gain_state(self) -> Option<(StreamConfigWatchGainStateResponder)> {
10214        if let StreamConfigRequest::WatchGainState { responder } = self {
10215            Some((responder))
10216        } else {
10217            None
10218        }
10219    }
10220
10221    #[allow(irrefutable_let_patterns)]
10222    pub fn into_set_gain(self) -> Option<(GainState, StreamConfigControlHandle)> {
10223        if let StreamConfigRequest::SetGain { target_state, control_handle } = self {
10224            Some((target_state, control_handle))
10225        } else {
10226            None
10227        }
10228    }
10229
10230    #[allow(irrefutable_let_patterns)]
10231    pub fn into_watch_plug_state(self) -> Option<(StreamConfigWatchPlugStateResponder)> {
10232        if let StreamConfigRequest::WatchPlugState { responder } = self {
10233            Some((responder))
10234        } else {
10235            None
10236        }
10237    }
10238
10239    /// Name of the method defined in FIDL
10240    pub fn method_name(&self) -> &'static str {
10241        match *self {
10242            StreamConfigRequest::GetHealthState { .. } => "get_health_state",
10243            StreamConfigRequest::SignalProcessingConnect { .. } => "signal_processing_connect",
10244            StreamConfigRequest::GetProperties { .. } => "get_properties",
10245            StreamConfigRequest::GetSupportedFormats { .. } => "get_supported_formats",
10246            StreamConfigRequest::CreateRingBuffer { .. } => "create_ring_buffer",
10247            StreamConfigRequest::WatchGainState { .. } => "watch_gain_state",
10248            StreamConfigRequest::SetGain { .. } => "set_gain",
10249            StreamConfigRequest::WatchPlugState { .. } => "watch_plug_state",
10250        }
10251    }
10252}
10253
10254#[derive(Debug, Clone)]
10255pub struct StreamConfigControlHandle {
10256    inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
10257}
10258
10259impl StreamConfigControlHandle {
10260    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
10261        self.inner.shutdown_with_epitaph(status.into())
10262    }
10263}
10264
10265impl fdomain_client::fidl::ControlHandle for StreamConfigControlHandle {
10266    fn shutdown(&self) {
10267        self.inner.shutdown()
10268    }
10269
10270    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
10271        self.inner.shutdown_with_epitaph(status)
10272    }
10273
10274    fn is_closed(&self) -> bool {
10275        self.inner.channel().is_closed()
10276    }
10277    fn on_closed(&self) -> fdomain_client::OnFDomainSignals {
10278        self.inner.channel().on_closed()
10279    }
10280}
10281
10282impl StreamConfigControlHandle {}
10283
10284#[must_use = "FIDL methods require a response to be sent"]
10285#[derive(Debug)]
10286pub struct StreamConfigGetHealthStateResponder {
10287    control_handle: std::mem::ManuallyDrop<StreamConfigControlHandle>,
10288    tx_id: u32,
10289}
10290
10291/// Set the the channel to be shutdown (see [`StreamConfigControlHandle::shutdown`])
10292/// if the responder is dropped without sending a response, so that the client
10293/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
10294impl std::ops::Drop for StreamConfigGetHealthStateResponder {
10295    fn drop(&mut self) {
10296        self.control_handle.shutdown();
10297        // Safety: drops once, never accessed again
10298        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
10299    }
10300}
10301
10302impl fdomain_client::fidl::Responder for StreamConfigGetHealthStateResponder {
10303    type ControlHandle = StreamConfigControlHandle;
10304
10305    fn control_handle(&self) -> &StreamConfigControlHandle {
10306        &self.control_handle
10307    }
10308
10309    fn drop_without_shutdown(mut self) {
10310        // Safety: drops once, never accessed again due to mem::forget
10311        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
10312        // Prevent Drop from running (which would shut down the channel)
10313        std::mem::forget(self);
10314    }
10315}
10316
10317impl StreamConfigGetHealthStateResponder {
10318    /// Sends a response to the FIDL transaction.
10319    ///
10320    /// Sets the channel to shutdown if an error occurs.
10321    pub fn send(self, mut state: &HealthState) -> Result<(), fidl::Error> {
10322        let _result = self.send_raw(state);
10323        if _result.is_err() {
10324            self.control_handle.shutdown();
10325        }
10326        self.drop_without_shutdown();
10327        _result
10328    }
10329
10330    /// Similar to "send" but does not shutdown the channel if an error occurs.
10331    pub fn send_no_shutdown_on_err(self, mut state: &HealthState) -> Result<(), fidl::Error> {
10332        let _result = self.send_raw(state);
10333        self.drop_without_shutdown();
10334        _result
10335    }
10336
10337    fn send_raw(&self, mut state: &HealthState) -> Result<(), fidl::Error> {
10338        self.control_handle.inner.send::<HealthGetHealthStateResponse>(
10339            (state,),
10340            self.tx_id,
10341            0x4e146d6bca733a84,
10342            fidl::encoding::DynamicFlags::empty(),
10343        )
10344    }
10345}
10346
10347#[must_use = "FIDL methods require a response to be sent"]
10348#[derive(Debug)]
10349pub struct StreamConfigGetPropertiesResponder {
10350    control_handle: std::mem::ManuallyDrop<StreamConfigControlHandle>,
10351    tx_id: u32,
10352}
10353
10354/// Set the the channel to be shutdown (see [`StreamConfigControlHandle::shutdown`])
10355/// if the responder is dropped without sending a response, so that the client
10356/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
10357impl std::ops::Drop for StreamConfigGetPropertiesResponder {
10358    fn drop(&mut self) {
10359        self.control_handle.shutdown();
10360        // Safety: drops once, never accessed again
10361        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
10362    }
10363}
10364
10365impl fdomain_client::fidl::Responder for StreamConfigGetPropertiesResponder {
10366    type ControlHandle = StreamConfigControlHandle;
10367
10368    fn control_handle(&self) -> &StreamConfigControlHandle {
10369        &self.control_handle
10370    }
10371
10372    fn drop_without_shutdown(mut self) {
10373        // Safety: drops once, never accessed again due to mem::forget
10374        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
10375        // Prevent Drop from running (which would shut down the channel)
10376        std::mem::forget(self);
10377    }
10378}
10379
10380impl StreamConfigGetPropertiesResponder {
10381    /// Sends a response to the FIDL transaction.
10382    ///
10383    /// Sets the channel to shutdown if an error occurs.
10384    pub fn send(self, mut properties: &StreamProperties) -> Result<(), fidl::Error> {
10385        let _result = self.send_raw(properties);
10386        if _result.is_err() {
10387            self.control_handle.shutdown();
10388        }
10389        self.drop_without_shutdown();
10390        _result
10391    }
10392
10393    /// Similar to "send" but does not shutdown the channel if an error occurs.
10394    pub fn send_no_shutdown_on_err(
10395        self,
10396        mut properties: &StreamProperties,
10397    ) -> Result<(), fidl::Error> {
10398        let _result = self.send_raw(properties);
10399        self.drop_without_shutdown();
10400        _result
10401    }
10402
10403    fn send_raw(&self, mut properties: &StreamProperties) -> Result<(), fidl::Error> {
10404        self.control_handle.inner.send::<StreamConfigGetPropertiesResponse>(
10405            (properties,),
10406            self.tx_id,
10407            0x7d89c02f3e2d3c01,
10408            fidl::encoding::DynamicFlags::empty(),
10409        )
10410    }
10411}
10412
10413#[must_use = "FIDL methods require a response to be sent"]
10414#[derive(Debug)]
10415pub struct StreamConfigGetSupportedFormatsResponder {
10416    control_handle: std::mem::ManuallyDrop<StreamConfigControlHandle>,
10417    tx_id: u32,
10418}
10419
10420/// Set the the channel to be shutdown (see [`StreamConfigControlHandle::shutdown`])
10421/// if the responder is dropped without sending a response, so that the client
10422/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
10423impl std::ops::Drop for StreamConfigGetSupportedFormatsResponder {
10424    fn drop(&mut self) {
10425        self.control_handle.shutdown();
10426        // Safety: drops once, never accessed again
10427        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
10428    }
10429}
10430
10431impl fdomain_client::fidl::Responder for StreamConfigGetSupportedFormatsResponder {
10432    type ControlHandle = StreamConfigControlHandle;
10433
10434    fn control_handle(&self) -> &StreamConfigControlHandle {
10435        &self.control_handle
10436    }
10437
10438    fn drop_without_shutdown(mut self) {
10439        // Safety: drops once, never accessed again due to mem::forget
10440        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
10441        // Prevent Drop from running (which would shut down the channel)
10442        std::mem::forget(self);
10443    }
10444}
10445
10446impl StreamConfigGetSupportedFormatsResponder {
10447    /// Sends a response to the FIDL transaction.
10448    ///
10449    /// Sets the channel to shutdown if an error occurs.
10450    pub fn send(self, mut supported_formats: &[SupportedFormats]) -> Result<(), fidl::Error> {
10451        let _result = self.send_raw(supported_formats);
10452        if _result.is_err() {
10453            self.control_handle.shutdown();
10454        }
10455        self.drop_without_shutdown();
10456        _result
10457    }
10458
10459    /// Similar to "send" but does not shutdown the channel if an error occurs.
10460    pub fn send_no_shutdown_on_err(
10461        self,
10462        mut supported_formats: &[SupportedFormats],
10463    ) -> Result<(), fidl::Error> {
10464        let _result = self.send_raw(supported_formats);
10465        self.drop_without_shutdown();
10466        _result
10467    }
10468
10469    fn send_raw(&self, mut supported_formats: &[SupportedFormats]) -> Result<(), fidl::Error> {
10470        self.control_handle.inner.send::<StreamConfigGetSupportedFormatsResponse>(
10471            (supported_formats,),
10472            self.tx_id,
10473            0x448efa7850cafe7e,
10474            fidl::encoding::DynamicFlags::empty(),
10475        )
10476    }
10477}
10478
10479#[must_use = "FIDL methods require a response to be sent"]
10480#[derive(Debug)]
10481pub struct StreamConfigWatchGainStateResponder {
10482    control_handle: std::mem::ManuallyDrop<StreamConfigControlHandle>,
10483    tx_id: u32,
10484}
10485
10486/// Set the the channel to be shutdown (see [`StreamConfigControlHandle::shutdown`])
10487/// if the responder is dropped without sending a response, so that the client
10488/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
10489impl std::ops::Drop for StreamConfigWatchGainStateResponder {
10490    fn drop(&mut self) {
10491        self.control_handle.shutdown();
10492        // Safety: drops once, never accessed again
10493        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
10494    }
10495}
10496
10497impl fdomain_client::fidl::Responder for StreamConfigWatchGainStateResponder {
10498    type ControlHandle = StreamConfigControlHandle;
10499
10500    fn control_handle(&self) -> &StreamConfigControlHandle {
10501        &self.control_handle
10502    }
10503
10504    fn drop_without_shutdown(mut self) {
10505        // Safety: drops once, never accessed again due to mem::forget
10506        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
10507        // Prevent Drop from running (which would shut down the channel)
10508        std::mem::forget(self);
10509    }
10510}
10511
10512impl StreamConfigWatchGainStateResponder {
10513    /// Sends a response to the FIDL transaction.
10514    ///
10515    /// Sets the channel to shutdown if an error occurs.
10516    pub fn send(self, mut gain_state: &GainState) -> Result<(), fidl::Error> {
10517        let _result = self.send_raw(gain_state);
10518        if _result.is_err() {
10519            self.control_handle.shutdown();
10520        }
10521        self.drop_without_shutdown();
10522        _result
10523    }
10524
10525    /// Similar to "send" but does not shutdown the channel if an error occurs.
10526    pub fn send_no_shutdown_on_err(self, mut gain_state: &GainState) -> Result<(), fidl::Error> {
10527        let _result = self.send_raw(gain_state);
10528        self.drop_without_shutdown();
10529        _result
10530    }
10531
10532    fn send_raw(&self, mut gain_state: &GainState) -> Result<(), fidl::Error> {
10533        self.control_handle.inner.send::<StreamConfigWatchGainStateResponse>(
10534            (gain_state,),
10535            self.tx_id,
10536            0x4772506136ab65c1,
10537            fidl::encoding::DynamicFlags::empty(),
10538        )
10539    }
10540}
10541
10542#[must_use = "FIDL methods require a response to be sent"]
10543#[derive(Debug)]
10544pub struct StreamConfigWatchPlugStateResponder {
10545    control_handle: std::mem::ManuallyDrop<StreamConfigControlHandle>,
10546    tx_id: u32,
10547}
10548
10549/// Set the the channel to be shutdown (see [`StreamConfigControlHandle::shutdown`])
10550/// if the responder is dropped without sending a response, so that the client
10551/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
10552impl std::ops::Drop for StreamConfigWatchPlugStateResponder {
10553    fn drop(&mut self) {
10554        self.control_handle.shutdown();
10555        // Safety: drops once, never accessed again
10556        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
10557    }
10558}
10559
10560impl fdomain_client::fidl::Responder for StreamConfigWatchPlugStateResponder {
10561    type ControlHandle = StreamConfigControlHandle;
10562
10563    fn control_handle(&self) -> &StreamConfigControlHandle {
10564        &self.control_handle
10565    }
10566
10567    fn drop_without_shutdown(mut self) {
10568        // Safety: drops once, never accessed again due to mem::forget
10569        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
10570        // Prevent Drop from running (which would shut down the channel)
10571        std::mem::forget(self);
10572    }
10573}
10574
10575impl StreamConfigWatchPlugStateResponder {
10576    /// Sends a response to the FIDL transaction.
10577    ///
10578    /// Sets the channel to shutdown if an error occurs.
10579    pub fn send(self, mut plug_state: &PlugState) -> Result<(), fidl::Error> {
10580        let _result = self.send_raw(plug_state);
10581        if _result.is_err() {
10582            self.control_handle.shutdown();
10583        }
10584        self.drop_without_shutdown();
10585        _result
10586    }
10587
10588    /// Similar to "send" but does not shutdown the channel if an error occurs.
10589    pub fn send_no_shutdown_on_err(self, mut plug_state: &PlugState) -> Result<(), fidl::Error> {
10590        let _result = self.send_raw(plug_state);
10591        self.drop_without_shutdown();
10592        _result
10593    }
10594
10595    fn send_raw(&self, mut plug_state: &PlugState) -> Result<(), fidl::Error> {
10596        self.control_handle.inner.send::<StreamConfigWatchPlugStateResponse>(
10597            (plug_state,),
10598            self.tx_id,
10599            0x497345a6f048b2a6,
10600            fidl::encoding::DynamicFlags::empty(),
10601        )
10602    }
10603}
10604
10605#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
10606pub struct StreamConfigConnectorMarker;
10607
10608impl fdomain_client::fidl::ProtocolMarker for StreamConfigConnectorMarker {
10609    type Proxy = StreamConfigConnectorProxy;
10610    type RequestStream = StreamConfigConnectorRequestStream;
10611
10612    const DEBUG_NAME: &'static str = "(anonymous) StreamConfigConnector";
10613}
10614
10615pub trait StreamConfigConnectorProxyInterface: Send + Sync {
10616    fn r#connect(
10617        &self,
10618        protocol: fdomain_client::fidl::ServerEnd<StreamConfigMarker>,
10619    ) -> Result<(), fidl::Error>;
10620}
10621
10622#[derive(Debug, Clone)]
10623pub struct StreamConfigConnectorProxy {
10624    client: fidl::client::Client<fdomain_client::fidl::FDomainResourceDialect>,
10625}
10626
10627impl fdomain_client::fidl::Proxy for StreamConfigConnectorProxy {
10628    type Protocol = StreamConfigConnectorMarker;
10629
10630    fn from_channel(inner: fdomain_client::Channel) -> Self {
10631        Self::new(inner)
10632    }
10633
10634    fn into_channel(self) -> Result<fdomain_client::Channel, Self> {
10635        self.client.into_channel().map_err(|client| Self { client })
10636    }
10637
10638    fn as_channel(&self) -> &fdomain_client::Channel {
10639        self.client.as_channel()
10640    }
10641}
10642
10643impl StreamConfigConnectorProxy {
10644    /// Create a new Proxy for fuchsia.hardware.audio/StreamConfigConnector.
10645    pub fn new(channel: fdomain_client::Channel) -> Self {
10646        let protocol_name =
10647            <StreamConfigConnectorMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME;
10648        Self { client: fidl::client::Client::new(channel, protocol_name) }
10649    }
10650
10651    /// Get a Stream of events from the remote end of the protocol.
10652    ///
10653    /// # Panics
10654    ///
10655    /// Panics if the event stream was already taken.
10656    pub fn take_event_stream(&self) -> StreamConfigConnectorEventStream {
10657        StreamConfigConnectorEventStream { event_receiver: self.client.take_event_receiver() }
10658    }
10659
10660    /// Connect to a `StreamConfig` protocol.
10661    /// This method allows a component to serve FIDL outside the devhost's control.
10662    pub fn r#connect(
10663        &self,
10664        mut protocol: fdomain_client::fidl::ServerEnd<StreamConfigMarker>,
10665    ) -> Result<(), fidl::Error> {
10666        StreamConfigConnectorProxyInterface::r#connect(self, protocol)
10667    }
10668}
10669
10670impl StreamConfigConnectorProxyInterface for StreamConfigConnectorProxy {
10671    fn r#connect(
10672        &self,
10673        mut protocol: fdomain_client::fidl::ServerEnd<StreamConfigMarker>,
10674    ) -> Result<(), fidl::Error> {
10675        self.client.send::<StreamConfigConnectorConnectRequest>(
10676            (protocol,),
10677            0x22051ff3021eafec,
10678            fidl::encoding::DynamicFlags::empty(),
10679        )
10680    }
10681}
10682
10683pub struct StreamConfigConnectorEventStream {
10684    event_receiver: fidl::client::EventReceiver<fdomain_client::fidl::FDomainResourceDialect>,
10685}
10686
10687impl std::marker::Unpin for StreamConfigConnectorEventStream {}
10688
10689impl futures::stream::FusedStream for StreamConfigConnectorEventStream {
10690    fn is_terminated(&self) -> bool {
10691        self.event_receiver.is_terminated()
10692    }
10693}
10694
10695impl futures::Stream for StreamConfigConnectorEventStream {
10696    type Item = Result<StreamConfigConnectorEvent, fidl::Error>;
10697
10698    fn poll_next(
10699        mut self: std::pin::Pin<&mut Self>,
10700        cx: &mut std::task::Context<'_>,
10701    ) -> std::task::Poll<Option<Self::Item>> {
10702        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
10703            &mut self.event_receiver,
10704            cx
10705        )?) {
10706            Some(buf) => std::task::Poll::Ready(Some(StreamConfigConnectorEvent::decode(buf))),
10707            None => std::task::Poll::Ready(None),
10708        }
10709    }
10710}
10711
10712#[derive(Debug)]
10713pub enum StreamConfigConnectorEvent {}
10714
10715impl StreamConfigConnectorEvent {
10716    /// Decodes a message buffer as a [`StreamConfigConnectorEvent`].
10717    fn decode(
10718        mut buf: <fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
10719    ) -> Result<StreamConfigConnectorEvent, fidl::Error> {
10720        let (bytes, _handles) = buf.split_mut();
10721        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
10722        debug_assert_eq!(tx_header.tx_id, 0);
10723        match tx_header.ordinal {
10724            _ => Err(fidl::Error::UnknownOrdinal {
10725                ordinal: tx_header.ordinal,
10726                protocol_name: <StreamConfigConnectorMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
10727            })
10728        }
10729    }
10730}
10731
10732/// A Stream of incoming requests for fuchsia.hardware.audio/StreamConfigConnector.
10733pub struct StreamConfigConnectorRequestStream {
10734    inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
10735    is_terminated: bool,
10736}
10737
10738impl std::marker::Unpin for StreamConfigConnectorRequestStream {}
10739
10740impl futures::stream::FusedStream for StreamConfigConnectorRequestStream {
10741    fn is_terminated(&self) -> bool {
10742        self.is_terminated
10743    }
10744}
10745
10746impl fdomain_client::fidl::RequestStream for StreamConfigConnectorRequestStream {
10747    type Protocol = StreamConfigConnectorMarker;
10748    type ControlHandle = StreamConfigConnectorControlHandle;
10749
10750    fn from_channel(channel: fdomain_client::Channel) -> Self {
10751        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
10752    }
10753
10754    fn control_handle(&self) -> Self::ControlHandle {
10755        StreamConfigConnectorControlHandle { inner: self.inner.clone() }
10756    }
10757
10758    fn into_inner(
10759        self,
10760    ) -> (::std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>, bool)
10761    {
10762        (self.inner, self.is_terminated)
10763    }
10764
10765    fn from_inner(
10766        inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
10767        is_terminated: bool,
10768    ) -> Self {
10769        Self { inner, is_terminated }
10770    }
10771}
10772
10773impl futures::Stream for StreamConfigConnectorRequestStream {
10774    type Item = Result<StreamConfigConnectorRequest, fidl::Error>;
10775
10776    fn poll_next(
10777        mut self: std::pin::Pin<&mut Self>,
10778        cx: &mut std::task::Context<'_>,
10779    ) -> std::task::Poll<Option<Self::Item>> {
10780        let this = &mut *self;
10781        if this.inner.check_shutdown(cx) {
10782            this.is_terminated = true;
10783            return std::task::Poll::Ready(None);
10784        }
10785        if this.is_terminated {
10786            panic!("polled StreamConfigConnectorRequestStream after completion");
10787        }
10788        fidl::encoding::with_tls_decode_buf::<_, fdomain_client::fidl::FDomainResourceDialect>(
10789            |bytes, handles| {
10790                match this.inner.channel().read_etc(cx, bytes, handles) {
10791                    std::task::Poll::Ready(Ok(())) => {}
10792                    std::task::Poll::Pending => return std::task::Poll::Pending,
10793                    std::task::Poll::Ready(Err(None)) => {
10794                        this.is_terminated = true;
10795                        return std::task::Poll::Ready(None);
10796                    }
10797                    std::task::Poll::Ready(Err(Some(e))) => {
10798                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
10799                            e.into(),
10800                        ))));
10801                    }
10802                }
10803
10804                // A message has been received from the channel
10805                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
10806
10807                std::task::Poll::Ready(Some(match header.ordinal {
10808                0x22051ff3021eafec => {
10809                    header.validate_request_tx_id(fidl::MethodType::OneWay)?;
10810                    let mut req = fidl::new_empty!(StreamConfigConnectorConnectRequest, fdomain_client::fidl::FDomainResourceDialect);
10811                    fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<StreamConfigConnectorConnectRequest>(&header, _body_bytes, handles, &mut req)?;
10812                    let control_handle = StreamConfigConnectorControlHandle {
10813                        inner: this.inner.clone(),
10814                    };
10815                    Ok(StreamConfigConnectorRequest::Connect {protocol: req.protocol,
10816
10817                        control_handle,
10818                    })
10819                }
10820                _ => Err(fidl::Error::UnknownOrdinal {
10821                    ordinal: header.ordinal,
10822                    protocol_name: <StreamConfigConnectorMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
10823                }),
10824            }))
10825            },
10826        )
10827    }
10828}
10829
10830/// For an overview see
10831/// [Audio Driver Streaming Interface](https://fuchsia.dev/fuchsia-src/concepts/drivers/driver_architectures/audio_drivers/audio_streaming).
10832/// # Deprecation
10833///
10834/// Not supported anymore, instead use an
10835/// [Audio Composite](https://fuchsia.dev/fuchsia-src/development/audio/drivers/composite)
10836/// with one Ring Buffer, see
10837/// [Audio Drivers Architecture](https://fuchsia.dev/fuchsia-src/development/audio/drivers/architecture)
10838#[derive(Debug)]
10839pub enum StreamConfigConnectorRequest {
10840    /// Connect to a `StreamConfig` protocol.
10841    /// This method allows a component to serve FIDL outside the devhost's control.
10842    Connect {
10843        protocol: fdomain_client::fidl::ServerEnd<StreamConfigMarker>,
10844        control_handle: StreamConfigConnectorControlHandle,
10845    },
10846}
10847
10848impl StreamConfigConnectorRequest {
10849    #[allow(irrefutable_let_patterns)]
10850    pub fn into_connect(
10851        self,
10852    ) -> Option<(
10853        fdomain_client::fidl::ServerEnd<StreamConfigMarker>,
10854        StreamConfigConnectorControlHandle,
10855    )> {
10856        if let StreamConfigConnectorRequest::Connect { protocol, control_handle } = self {
10857            Some((protocol, control_handle))
10858        } else {
10859            None
10860        }
10861    }
10862
10863    /// Name of the method defined in FIDL
10864    pub fn method_name(&self) -> &'static str {
10865        match *self {
10866            StreamConfigConnectorRequest::Connect { .. } => "connect",
10867        }
10868    }
10869}
10870
10871#[derive(Debug, Clone)]
10872pub struct StreamConfigConnectorControlHandle {
10873    inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
10874}
10875
10876impl StreamConfigConnectorControlHandle {
10877    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
10878        self.inner.shutdown_with_epitaph(status.into())
10879    }
10880}
10881
10882impl fdomain_client::fidl::ControlHandle for StreamConfigConnectorControlHandle {
10883    fn shutdown(&self) {
10884        self.inner.shutdown()
10885    }
10886
10887    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
10888        self.inner.shutdown_with_epitaph(status)
10889    }
10890
10891    fn is_closed(&self) -> bool {
10892        self.inner.channel().is_closed()
10893    }
10894    fn on_closed(&self) -> fdomain_client::OnFDomainSignals {
10895        self.inner.channel().on_closed()
10896    }
10897}
10898
10899impl StreamConfigConnectorControlHandle {}
10900
10901mod internal {
10902    use super::*;
10903
10904    impl fidl::encoding::ResourceTypeMarker for CodecConnectorConnectRequest {
10905        type Borrowed<'a> = &'a mut Self;
10906        fn take_or_borrow<'a>(
10907            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10908        ) -> Self::Borrowed<'a> {
10909            value
10910        }
10911    }
10912
10913    unsafe impl fidl::encoding::TypeMarker for CodecConnectorConnectRequest {
10914        type Owned = Self;
10915
10916        #[inline(always)]
10917        fn inline_align(_context: fidl::encoding::Context) -> usize {
10918            4
10919        }
10920
10921        #[inline(always)]
10922        fn inline_size(_context: fidl::encoding::Context) -> usize {
10923            4
10924        }
10925    }
10926
10927    unsafe impl
10928        fidl::encoding::Encode<
10929            CodecConnectorConnectRequest,
10930            fdomain_client::fidl::FDomainResourceDialect,
10931        > for &mut CodecConnectorConnectRequest
10932    {
10933        #[inline]
10934        unsafe fn encode(
10935            self,
10936            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
10937            offset: usize,
10938            _depth: fidl::encoding::Depth,
10939        ) -> fidl::Result<()> {
10940            encoder.debug_check_bounds::<CodecConnectorConnectRequest>(offset);
10941            // Delegate to tuple encoding.
10942            fidl::encoding::Encode::<CodecConnectorConnectRequest, fdomain_client::fidl::FDomainResourceDialect>::encode(
10943                (
10944                    <fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<CodecMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.codec_protocol),
10945                ),
10946                encoder, offset, _depth
10947            )
10948        }
10949    }
10950    unsafe impl<
10951        T0: fidl::encoding::Encode<
10952                fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<CodecMarker>>,
10953                fdomain_client::fidl::FDomainResourceDialect,
10954            >,
10955    >
10956        fidl::encoding::Encode<
10957            CodecConnectorConnectRequest,
10958            fdomain_client::fidl::FDomainResourceDialect,
10959        > for (T0,)
10960    {
10961        #[inline]
10962        unsafe fn encode(
10963            self,
10964            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
10965            offset: usize,
10966            depth: fidl::encoding::Depth,
10967        ) -> fidl::Result<()> {
10968            encoder.debug_check_bounds::<CodecConnectorConnectRequest>(offset);
10969            // Zero out padding regions. There's no need to apply masks
10970            // because the unmasked parts will be overwritten by fields.
10971            // Write the fields.
10972            self.0.encode(encoder, offset + 0, depth)?;
10973            Ok(())
10974        }
10975    }
10976
10977    impl fidl::encoding::Decode<Self, fdomain_client::fidl::FDomainResourceDialect>
10978        for CodecConnectorConnectRequest
10979    {
10980        #[inline(always)]
10981        fn new_empty() -> Self {
10982            Self {
10983                codec_protocol: fidl::new_empty!(
10984                    fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<CodecMarker>>,
10985                    fdomain_client::fidl::FDomainResourceDialect
10986                ),
10987            }
10988        }
10989
10990        #[inline]
10991        unsafe fn decode(
10992            &mut self,
10993            decoder: &mut fidl::encoding::Decoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
10994            offset: usize,
10995            _depth: fidl::encoding::Depth,
10996        ) -> fidl::Result<()> {
10997            decoder.debug_check_bounds::<Self>(offset);
10998            // Verify that padding bytes are zero.
10999            fidl::decode!(
11000                fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<CodecMarker>>,
11001                fdomain_client::fidl::FDomainResourceDialect,
11002                &mut self.codec_protocol,
11003                decoder,
11004                offset + 0,
11005                _depth
11006            )?;
11007            Ok(())
11008        }
11009    }
11010
11011    impl fidl::encoding::ResourceTypeMarker for CompositeConnectorConnectRequest {
11012        type Borrowed<'a> = &'a mut Self;
11013        fn take_or_borrow<'a>(
11014            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11015        ) -> Self::Borrowed<'a> {
11016            value
11017        }
11018    }
11019
11020    unsafe impl fidl::encoding::TypeMarker for CompositeConnectorConnectRequest {
11021        type Owned = Self;
11022
11023        #[inline(always)]
11024        fn inline_align(_context: fidl::encoding::Context) -> usize {
11025            4
11026        }
11027
11028        #[inline(always)]
11029        fn inline_size(_context: fidl::encoding::Context) -> usize {
11030            4
11031        }
11032    }
11033
11034    unsafe impl
11035        fidl::encoding::Encode<
11036            CompositeConnectorConnectRequest,
11037            fdomain_client::fidl::FDomainResourceDialect,
11038        > for &mut CompositeConnectorConnectRequest
11039    {
11040        #[inline]
11041        unsafe fn encode(
11042            self,
11043            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
11044            offset: usize,
11045            _depth: fidl::encoding::Depth,
11046        ) -> fidl::Result<()> {
11047            encoder.debug_check_bounds::<CompositeConnectorConnectRequest>(offset);
11048            // Delegate to tuple encoding.
11049            fidl::encoding::Encode::<CompositeConnectorConnectRequest, fdomain_client::fidl::FDomainResourceDialect>::encode(
11050                (
11051                    <fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<CompositeMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.composite_protocol),
11052                ),
11053                encoder, offset, _depth
11054            )
11055        }
11056    }
11057    unsafe impl<
11058        T0: fidl::encoding::Encode<
11059                fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<CompositeMarker>>,
11060                fdomain_client::fidl::FDomainResourceDialect,
11061            >,
11062    >
11063        fidl::encoding::Encode<
11064            CompositeConnectorConnectRequest,
11065            fdomain_client::fidl::FDomainResourceDialect,
11066        > for (T0,)
11067    {
11068        #[inline]
11069        unsafe fn encode(
11070            self,
11071            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
11072            offset: usize,
11073            depth: fidl::encoding::Depth,
11074        ) -> fidl::Result<()> {
11075            encoder.debug_check_bounds::<CompositeConnectorConnectRequest>(offset);
11076            // Zero out padding regions. There's no need to apply masks
11077            // because the unmasked parts will be overwritten by fields.
11078            // Write the fields.
11079            self.0.encode(encoder, offset + 0, depth)?;
11080            Ok(())
11081        }
11082    }
11083
11084    impl fidl::encoding::Decode<Self, fdomain_client::fidl::FDomainResourceDialect>
11085        for CompositeConnectorConnectRequest
11086    {
11087        #[inline(always)]
11088        fn new_empty() -> Self {
11089            Self {
11090                composite_protocol: fidl::new_empty!(
11091                    fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<CompositeMarker>>,
11092                    fdomain_client::fidl::FDomainResourceDialect
11093                ),
11094            }
11095        }
11096
11097        #[inline]
11098        unsafe fn decode(
11099            &mut self,
11100            decoder: &mut fidl::encoding::Decoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
11101            offset: usize,
11102            _depth: fidl::encoding::Depth,
11103        ) -> fidl::Result<()> {
11104            decoder.debug_check_bounds::<Self>(offset);
11105            // Verify that padding bytes are zero.
11106            fidl::decode!(
11107                fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<CompositeMarker>>,
11108                fdomain_client::fidl::FDomainResourceDialect,
11109                &mut self.composite_protocol,
11110                decoder,
11111                offset + 0,
11112                _depth
11113            )?;
11114            Ok(())
11115        }
11116    }
11117
11118    impl fidl::encoding::ResourceTypeMarker for CompositeCreatePacketStreamRequest {
11119        type Borrowed<'a> = &'a mut Self;
11120        fn take_or_borrow<'a>(
11121            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11122        ) -> Self::Borrowed<'a> {
11123            value
11124        }
11125    }
11126
11127    unsafe impl fidl::encoding::TypeMarker for CompositeCreatePacketStreamRequest {
11128        type Owned = Self;
11129
11130        #[inline(always)]
11131        fn inline_align(_context: fidl::encoding::Context) -> usize {
11132            8
11133        }
11134
11135        #[inline(always)]
11136        fn inline_size(_context: fidl::encoding::Context) -> usize {
11137            32
11138        }
11139    }
11140
11141    unsafe impl
11142        fidl::encoding::Encode<
11143            CompositeCreatePacketStreamRequest,
11144            fdomain_client::fidl::FDomainResourceDialect,
11145        > for &mut CompositeCreatePacketStreamRequest
11146    {
11147        #[inline]
11148        unsafe fn encode(
11149            self,
11150            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
11151            offset: usize,
11152            _depth: fidl::encoding::Depth,
11153        ) -> fidl::Result<()> {
11154            encoder.debug_check_bounds::<CompositeCreatePacketStreamRequest>(offset);
11155            // Delegate to tuple encoding.
11156            fidl::encoding::Encode::<
11157                CompositeCreatePacketStreamRequest,
11158                fdomain_client::fidl::FDomainResourceDialect,
11159            >::encode(
11160                (
11161                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.processing_element_id),
11162                    <Format2 as fidl::encoding::ValueTypeMarker>::borrow(&self.format),
11163                    <fidl::encoding::Endpoint<
11164                        fdomain_client::fidl::ServerEnd<PacketStreamControlMarker>,
11165                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
11166                        &mut self.packet_stream_control,
11167                    ),
11168                ),
11169                encoder,
11170                offset,
11171                _depth,
11172            )
11173        }
11174    }
11175    unsafe impl<
11176        T0: fidl::encoding::Encode<u64, fdomain_client::fidl::FDomainResourceDialect>,
11177        T1: fidl::encoding::Encode<Format2, fdomain_client::fidl::FDomainResourceDialect>,
11178        T2: fidl::encoding::Encode<
11179                fidl::encoding::Endpoint<
11180                    fdomain_client::fidl::ServerEnd<PacketStreamControlMarker>,
11181                >,
11182                fdomain_client::fidl::FDomainResourceDialect,
11183            >,
11184    >
11185        fidl::encoding::Encode<
11186            CompositeCreatePacketStreamRequest,
11187            fdomain_client::fidl::FDomainResourceDialect,
11188        > for (T0, T1, T2)
11189    {
11190        #[inline]
11191        unsafe fn encode(
11192            self,
11193            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
11194            offset: usize,
11195            depth: fidl::encoding::Depth,
11196        ) -> fidl::Result<()> {
11197            encoder.debug_check_bounds::<CompositeCreatePacketStreamRequest>(offset);
11198            // Zero out padding regions. There's no need to apply masks
11199            // because the unmasked parts will be overwritten by fields.
11200            unsafe {
11201                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(24);
11202                (ptr as *mut u64).write_unaligned(0);
11203            }
11204            // Write the fields.
11205            self.0.encode(encoder, offset + 0, depth)?;
11206            self.1.encode(encoder, offset + 8, depth)?;
11207            self.2.encode(encoder, offset + 24, depth)?;
11208            Ok(())
11209        }
11210    }
11211
11212    impl fidl::encoding::Decode<Self, fdomain_client::fidl::FDomainResourceDialect>
11213        for CompositeCreatePacketStreamRequest
11214    {
11215        #[inline(always)]
11216        fn new_empty() -> Self {
11217            Self {
11218                processing_element_id: fidl::new_empty!(
11219                    u64,
11220                    fdomain_client::fidl::FDomainResourceDialect
11221                ),
11222                format: fidl::new_empty!(Format2, fdomain_client::fidl::FDomainResourceDialect),
11223                packet_stream_control: fidl::new_empty!(
11224                    fidl::encoding::Endpoint<
11225                        fdomain_client::fidl::ServerEnd<PacketStreamControlMarker>,
11226                    >,
11227                    fdomain_client::fidl::FDomainResourceDialect
11228                ),
11229            }
11230        }
11231
11232        #[inline]
11233        unsafe fn decode(
11234            &mut self,
11235            decoder: &mut fidl::encoding::Decoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
11236            offset: usize,
11237            _depth: fidl::encoding::Depth,
11238        ) -> fidl::Result<()> {
11239            decoder.debug_check_bounds::<Self>(offset);
11240            // Verify that padding bytes are zero.
11241            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(24) };
11242            let padval = unsafe { (ptr as *const u64).read_unaligned() };
11243            let mask = 0xffffffff00000000u64;
11244            let maskedval = padval & mask;
11245            if maskedval != 0 {
11246                return Err(fidl::Error::NonZeroPadding {
11247                    padding_start: offset + 24 + ((mask as u64).trailing_zeros() / 8) as usize,
11248                });
11249            }
11250            fidl::decode!(
11251                u64,
11252                fdomain_client::fidl::FDomainResourceDialect,
11253                &mut self.processing_element_id,
11254                decoder,
11255                offset + 0,
11256                _depth
11257            )?;
11258            fidl::decode!(
11259                Format2,
11260                fdomain_client::fidl::FDomainResourceDialect,
11261                &mut self.format,
11262                decoder,
11263                offset + 8,
11264                _depth
11265            )?;
11266            fidl::decode!(
11267                fidl::encoding::Endpoint<
11268                    fdomain_client::fidl::ServerEnd<PacketStreamControlMarker>,
11269                >,
11270                fdomain_client::fidl::FDomainResourceDialect,
11271                &mut self.packet_stream_control,
11272                decoder,
11273                offset + 24,
11274                _depth
11275            )?;
11276            Ok(())
11277        }
11278    }
11279
11280    impl fidl::encoding::ResourceTypeMarker for CompositeCreateRingBufferRequest {
11281        type Borrowed<'a> = &'a mut Self;
11282        fn take_or_borrow<'a>(
11283            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11284        ) -> Self::Borrowed<'a> {
11285            value
11286        }
11287    }
11288
11289    unsafe impl fidl::encoding::TypeMarker for CompositeCreateRingBufferRequest {
11290        type Owned = Self;
11291
11292        #[inline(always)]
11293        fn inline_align(_context: fidl::encoding::Context) -> usize {
11294            8
11295        }
11296
11297        #[inline(always)]
11298        fn inline_size(_context: fidl::encoding::Context) -> usize {
11299            32
11300        }
11301    }
11302
11303    unsafe impl
11304        fidl::encoding::Encode<
11305            CompositeCreateRingBufferRequest,
11306            fdomain_client::fidl::FDomainResourceDialect,
11307        > for &mut CompositeCreateRingBufferRequest
11308    {
11309        #[inline]
11310        unsafe fn encode(
11311            self,
11312            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
11313            offset: usize,
11314            _depth: fidl::encoding::Depth,
11315        ) -> fidl::Result<()> {
11316            encoder.debug_check_bounds::<CompositeCreateRingBufferRequest>(offset);
11317            // Delegate to tuple encoding.
11318            fidl::encoding::Encode::<CompositeCreateRingBufferRequest, fdomain_client::fidl::FDomainResourceDialect>::encode(
11319                (
11320                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.processing_element_id),
11321                    <Format2 as fidl::encoding::ValueTypeMarker>::borrow(&self.format),
11322                    <fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<RingBufferMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.ring_buffer),
11323                ),
11324                encoder, offset, _depth
11325            )
11326        }
11327    }
11328    unsafe impl<
11329        T0: fidl::encoding::Encode<u64, fdomain_client::fidl::FDomainResourceDialect>,
11330        T1: fidl::encoding::Encode<Format2, fdomain_client::fidl::FDomainResourceDialect>,
11331        T2: fidl::encoding::Encode<
11332                fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<RingBufferMarker>>,
11333                fdomain_client::fidl::FDomainResourceDialect,
11334            >,
11335    >
11336        fidl::encoding::Encode<
11337            CompositeCreateRingBufferRequest,
11338            fdomain_client::fidl::FDomainResourceDialect,
11339        > for (T0, T1, T2)
11340    {
11341        #[inline]
11342        unsafe fn encode(
11343            self,
11344            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
11345            offset: usize,
11346            depth: fidl::encoding::Depth,
11347        ) -> fidl::Result<()> {
11348            encoder.debug_check_bounds::<CompositeCreateRingBufferRequest>(offset);
11349            // Zero out padding regions. There's no need to apply masks
11350            // because the unmasked parts will be overwritten by fields.
11351            unsafe {
11352                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(24);
11353                (ptr as *mut u64).write_unaligned(0);
11354            }
11355            // Write the fields.
11356            self.0.encode(encoder, offset + 0, depth)?;
11357            self.1.encode(encoder, offset + 8, depth)?;
11358            self.2.encode(encoder, offset + 24, depth)?;
11359            Ok(())
11360        }
11361    }
11362
11363    impl fidl::encoding::Decode<Self, fdomain_client::fidl::FDomainResourceDialect>
11364        for CompositeCreateRingBufferRequest
11365    {
11366        #[inline(always)]
11367        fn new_empty() -> Self {
11368            Self {
11369                processing_element_id: fidl::new_empty!(
11370                    u64,
11371                    fdomain_client::fidl::FDomainResourceDialect
11372                ),
11373                format: fidl::new_empty!(Format2, fdomain_client::fidl::FDomainResourceDialect),
11374                ring_buffer: fidl::new_empty!(
11375                    fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<RingBufferMarker>>,
11376                    fdomain_client::fidl::FDomainResourceDialect
11377                ),
11378            }
11379        }
11380
11381        #[inline]
11382        unsafe fn decode(
11383            &mut self,
11384            decoder: &mut fidl::encoding::Decoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
11385            offset: usize,
11386            _depth: fidl::encoding::Depth,
11387        ) -> fidl::Result<()> {
11388            decoder.debug_check_bounds::<Self>(offset);
11389            // Verify that padding bytes are zero.
11390            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(24) };
11391            let padval = unsafe { (ptr as *const u64).read_unaligned() };
11392            let mask = 0xffffffff00000000u64;
11393            let maskedval = padval & mask;
11394            if maskedval != 0 {
11395                return Err(fidl::Error::NonZeroPadding {
11396                    padding_start: offset + 24 + ((mask as u64).trailing_zeros() / 8) as usize,
11397                });
11398            }
11399            fidl::decode!(
11400                u64,
11401                fdomain_client::fidl::FDomainResourceDialect,
11402                &mut self.processing_element_id,
11403                decoder,
11404                offset + 0,
11405                _depth
11406            )?;
11407            fidl::decode!(
11408                Format2,
11409                fdomain_client::fidl::FDomainResourceDialect,
11410                &mut self.format,
11411                decoder,
11412                offset + 8,
11413                _depth
11414            )?;
11415            fidl::decode!(
11416                fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<RingBufferMarker>>,
11417                fdomain_client::fidl::FDomainResourceDialect,
11418                &mut self.ring_buffer,
11419                decoder,
11420                offset + 24,
11421                _depth
11422            )?;
11423            Ok(())
11424        }
11425    }
11426
11427    impl fidl::encoding::ResourceTypeMarker for DaiConnectorConnectRequest {
11428        type Borrowed<'a> = &'a mut Self;
11429        fn take_or_borrow<'a>(
11430            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11431        ) -> Self::Borrowed<'a> {
11432            value
11433        }
11434    }
11435
11436    unsafe impl fidl::encoding::TypeMarker for DaiConnectorConnectRequest {
11437        type Owned = Self;
11438
11439        #[inline(always)]
11440        fn inline_align(_context: fidl::encoding::Context) -> usize {
11441            4
11442        }
11443
11444        #[inline(always)]
11445        fn inline_size(_context: fidl::encoding::Context) -> usize {
11446            4
11447        }
11448    }
11449
11450    unsafe impl
11451        fidl::encoding::Encode<
11452            DaiConnectorConnectRequest,
11453            fdomain_client::fidl::FDomainResourceDialect,
11454        > for &mut DaiConnectorConnectRequest
11455    {
11456        #[inline]
11457        unsafe fn encode(
11458            self,
11459            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
11460            offset: usize,
11461            _depth: fidl::encoding::Depth,
11462        ) -> fidl::Result<()> {
11463            encoder.debug_check_bounds::<DaiConnectorConnectRequest>(offset);
11464            // Delegate to tuple encoding.
11465            fidl::encoding::Encode::<DaiConnectorConnectRequest, fdomain_client::fidl::FDomainResourceDialect>::encode(
11466                (
11467                    <fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<DaiMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.dai_protocol),
11468                ),
11469                encoder, offset, _depth
11470            )
11471        }
11472    }
11473    unsafe impl<
11474        T0: fidl::encoding::Encode<
11475                fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<DaiMarker>>,
11476                fdomain_client::fidl::FDomainResourceDialect,
11477            >,
11478    >
11479        fidl::encoding::Encode<
11480            DaiConnectorConnectRequest,
11481            fdomain_client::fidl::FDomainResourceDialect,
11482        > for (T0,)
11483    {
11484        #[inline]
11485        unsafe fn encode(
11486            self,
11487            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
11488            offset: usize,
11489            depth: fidl::encoding::Depth,
11490        ) -> fidl::Result<()> {
11491            encoder.debug_check_bounds::<DaiConnectorConnectRequest>(offset);
11492            // Zero out padding regions. There's no need to apply masks
11493            // because the unmasked parts will be overwritten by fields.
11494            // Write the fields.
11495            self.0.encode(encoder, offset + 0, depth)?;
11496            Ok(())
11497        }
11498    }
11499
11500    impl fidl::encoding::Decode<Self, fdomain_client::fidl::FDomainResourceDialect>
11501        for DaiConnectorConnectRequest
11502    {
11503        #[inline(always)]
11504        fn new_empty() -> Self {
11505            Self {
11506                dai_protocol: fidl::new_empty!(
11507                    fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<DaiMarker>>,
11508                    fdomain_client::fidl::FDomainResourceDialect
11509                ),
11510            }
11511        }
11512
11513        #[inline]
11514        unsafe fn decode(
11515            &mut self,
11516            decoder: &mut fidl::encoding::Decoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
11517            offset: usize,
11518            _depth: fidl::encoding::Depth,
11519        ) -> fidl::Result<()> {
11520            decoder.debug_check_bounds::<Self>(offset);
11521            // Verify that padding bytes are zero.
11522            fidl::decode!(
11523                fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<DaiMarker>>,
11524                fdomain_client::fidl::FDomainResourceDialect,
11525                &mut self.dai_protocol,
11526                decoder,
11527                offset + 0,
11528                _depth
11529            )?;
11530            Ok(())
11531        }
11532    }
11533
11534    impl fidl::encoding::ResourceTypeMarker for DaiCreateRingBufferRequest {
11535        type Borrowed<'a> = &'a mut Self;
11536        fn take_or_borrow<'a>(
11537            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11538        ) -> Self::Borrowed<'a> {
11539            value
11540        }
11541    }
11542
11543    unsafe impl fidl::encoding::TypeMarker for DaiCreateRingBufferRequest {
11544        type Owned = Self;
11545
11546        #[inline(always)]
11547        fn inline_align(_context: fidl::encoding::Context) -> usize {
11548            8
11549        }
11550
11551        #[inline(always)]
11552        fn inline_size(_context: fidl::encoding::Context) -> usize {
11553            72
11554        }
11555    }
11556
11557    unsafe impl
11558        fidl::encoding::Encode<
11559            DaiCreateRingBufferRequest,
11560            fdomain_client::fidl::FDomainResourceDialect,
11561        > for &mut DaiCreateRingBufferRequest
11562    {
11563        #[inline]
11564        unsafe fn encode(
11565            self,
11566            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
11567            offset: usize,
11568            _depth: fidl::encoding::Depth,
11569        ) -> fidl::Result<()> {
11570            encoder.debug_check_bounds::<DaiCreateRingBufferRequest>(offset);
11571            // Delegate to tuple encoding.
11572            fidl::encoding::Encode::<DaiCreateRingBufferRequest, fdomain_client::fidl::FDomainResourceDialect>::encode(
11573                (
11574                    <DaiFormat as fidl::encoding::ValueTypeMarker>::borrow(&self.dai_format),
11575                    <Format as fidl::encoding::ValueTypeMarker>::borrow(&self.ring_buffer_format),
11576                    <fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<RingBufferMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.ring_buffer),
11577                ),
11578                encoder, offset, _depth
11579            )
11580        }
11581    }
11582    unsafe impl<
11583        T0: fidl::encoding::Encode<DaiFormat, fdomain_client::fidl::FDomainResourceDialect>,
11584        T1: fidl::encoding::Encode<Format, fdomain_client::fidl::FDomainResourceDialect>,
11585        T2: fidl::encoding::Encode<
11586                fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<RingBufferMarker>>,
11587                fdomain_client::fidl::FDomainResourceDialect,
11588            >,
11589    >
11590        fidl::encoding::Encode<
11591            DaiCreateRingBufferRequest,
11592            fdomain_client::fidl::FDomainResourceDialect,
11593        > for (T0, T1, T2)
11594    {
11595        #[inline]
11596        unsafe fn encode(
11597            self,
11598            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
11599            offset: usize,
11600            depth: fidl::encoding::Depth,
11601        ) -> fidl::Result<()> {
11602            encoder.debug_check_bounds::<DaiCreateRingBufferRequest>(offset);
11603            // Zero out padding regions. There's no need to apply masks
11604            // because the unmasked parts will be overwritten by fields.
11605            unsafe {
11606                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(64);
11607                (ptr as *mut u64).write_unaligned(0);
11608            }
11609            // Write the fields.
11610            self.0.encode(encoder, offset + 0, depth)?;
11611            self.1.encode(encoder, offset + 48, depth)?;
11612            self.2.encode(encoder, offset + 64, depth)?;
11613            Ok(())
11614        }
11615    }
11616
11617    impl fidl::encoding::Decode<Self, fdomain_client::fidl::FDomainResourceDialect>
11618        for DaiCreateRingBufferRequest
11619    {
11620        #[inline(always)]
11621        fn new_empty() -> Self {
11622            Self {
11623                dai_format: fidl::new_empty!(
11624                    DaiFormat,
11625                    fdomain_client::fidl::FDomainResourceDialect
11626                ),
11627                ring_buffer_format: fidl::new_empty!(
11628                    Format,
11629                    fdomain_client::fidl::FDomainResourceDialect
11630                ),
11631                ring_buffer: fidl::new_empty!(
11632                    fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<RingBufferMarker>>,
11633                    fdomain_client::fidl::FDomainResourceDialect
11634                ),
11635            }
11636        }
11637
11638        #[inline]
11639        unsafe fn decode(
11640            &mut self,
11641            decoder: &mut fidl::encoding::Decoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
11642            offset: usize,
11643            _depth: fidl::encoding::Depth,
11644        ) -> fidl::Result<()> {
11645            decoder.debug_check_bounds::<Self>(offset);
11646            // Verify that padding bytes are zero.
11647            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(64) };
11648            let padval = unsafe { (ptr as *const u64).read_unaligned() };
11649            let mask = 0xffffffff00000000u64;
11650            let maskedval = padval & mask;
11651            if maskedval != 0 {
11652                return Err(fidl::Error::NonZeroPadding {
11653                    padding_start: offset + 64 + ((mask as u64).trailing_zeros() / 8) as usize,
11654                });
11655            }
11656            fidl::decode!(
11657                DaiFormat,
11658                fdomain_client::fidl::FDomainResourceDialect,
11659                &mut self.dai_format,
11660                decoder,
11661                offset + 0,
11662                _depth
11663            )?;
11664            fidl::decode!(
11665                Format,
11666                fdomain_client::fidl::FDomainResourceDialect,
11667                &mut self.ring_buffer_format,
11668                decoder,
11669                offset + 48,
11670                _depth
11671            )?;
11672            fidl::decode!(
11673                fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<RingBufferMarker>>,
11674                fdomain_client::fidl::FDomainResourceDialect,
11675                &mut self.ring_buffer,
11676                decoder,
11677                offset + 64,
11678                _depth
11679            )?;
11680            Ok(())
11681        }
11682    }
11683
11684    impl fidl::encoding::ResourceTypeMarker for PacketStreamControlAllocateVmosResponse {
11685        type Borrowed<'a> = &'a mut Self;
11686        fn take_or_borrow<'a>(
11687            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11688        ) -> Self::Borrowed<'a> {
11689            value
11690        }
11691    }
11692
11693    unsafe impl fidl::encoding::TypeMarker for PacketStreamControlAllocateVmosResponse {
11694        type Owned = Self;
11695
11696        #[inline(always)]
11697        fn inline_align(_context: fidl::encoding::Context) -> usize {
11698            8
11699        }
11700
11701        #[inline(always)]
11702        fn inline_size(_context: fidl::encoding::Context) -> usize {
11703            16
11704        }
11705    }
11706
11707    unsafe impl
11708        fidl::encoding::Encode<
11709            PacketStreamControlAllocateVmosResponse,
11710            fdomain_client::fidl::FDomainResourceDialect,
11711        > for &mut PacketStreamControlAllocateVmosResponse
11712    {
11713        #[inline]
11714        unsafe fn encode(
11715            self,
11716            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
11717            offset: usize,
11718            _depth: fidl::encoding::Depth,
11719        ) -> fidl::Result<()> {
11720            encoder.debug_check_bounds::<PacketStreamControlAllocateVmosResponse>(offset);
11721            // Delegate to tuple encoding.
11722            fidl::encoding::Encode::<PacketStreamControlAllocateVmosResponse, fdomain_client::fidl::FDomainResourceDialect>::encode(
11723                (
11724                    <fidl::encoding::Vector<VmoInfo, 256> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.vmos),
11725                ),
11726                encoder, offset, _depth
11727            )
11728        }
11729    }
11730    unsafe impl<
11731        T0: fidl::encoding::Encode<
11732                fidl::encoding::Vector<VmoInfo, 256>,
11733                fdomain_client::fidl::FDomainResourceDialect,
11734            >,
11735    >
11736        fidl::encoding::Encode<
11737            PacketStreamControlAllocateVmosResponse,
11738            fdomain_client::fidl::FDomainResourceDialect,
11739        > for (T0,)
11740    {
11741        #[inline]
11742        unsafe fn encode(
11743            self,
11744            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
11745            offset: usize,
11746            depth: fidl::encoding::Depth,
11747        ) -> fidl::Result<()> {
11748            encoder.debug_check_bounds::<PacketStreamControlAllocateVmosResponse>(offset);
11749            // Zero out padding regions. There's no need to apply masks
11750            // because the unmasked parts will be overwritten by fields.
11751            // Write the fields.
11752            self.0.encode(encoder, offset + 0, depth)?;
11753            Ok(())
11754        }
11755    }
11756
11757    impl fidl::encoding::Decode<Self, fdomain_client::fidl::FDomainResourceDialect>
11758        for PacketStreamControlAllocateVmosResponse
11759    {
11760        #[inline(always)]
11761        fn new_empty() -> Self {
11762            Self {
11763                vmos: fidl::new_empty!(fidl::encoding::Vector<VmoInfo, 256>, fdomain_client::fidl::FDomainResourceDialect),
11764            }
11765        }
11766
11767        #[inline]
11768        unsafe fn decode(
11769            &mut self,
11770            decoder: &mut fidl::encoding::Decoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
11771            offset: usize,
11772            _depth: fidl::encoding::Depth,
11773        ) -> fidl::Result<()> {
11774            decoder.debug_check_bounds::<Self>(offset);
11775            // Verify that padding bytes are zero.
11776            fidl::decode!(fidl::encoding::Vector<VmoInfo, 256>, fdomain_client::fidl::FDomainResourceDialect, &mut self.vmos, decoder, offset + 0, _depth)?;
11777            Ok(())
11778        }
11779    }
11780
11781    impl fidl::encoding::ResourceTypeMarker for RingBufferGetVmoResponse {
11782        type Borrowed<'a> = &'a mut Self;
11783        fn take_or_borrow<'a>(
11784            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11785        ) -> Self::Borrowed<'a> {
11786            value
11787        }
11788    }
11789
11790    unsafe impl fidl::encoding::TypeMarker for RingBufferGetVmoResponse {
11791        type Owned = Self;
11792
11793        #[inline(always)]
11794        fn inline_align(_context: fidl::encoding::Context) -> usize {
11795            4
11796        }
11797
11798        #[inline(always)]
11799        fn inline_size(_context: fidl::encoding::Context) -> usize {
11800            8
11801        }
11802    }
11803
11804    unsafe impl
11805        fidl::encoding::Encode<
11806            RingBufferGetVmoResponse,
11807            fdomain_client::fidl::FDomainResourceDialect,
11808        > for &mut RingBufferGetVmoResponse
11809    {
11810        #[inline]
11811        unsafe fn encode(
11812            self,
11813            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
11814            offset: usize,
11815            _depth: fidl::encoding::Depth,
11816        ) -> fidl::Result<()> {
11817            encoder.debug_check_bounds::<RingBufferGetVmoResponse>(offset);
11818            // Delegate to tuple encoding.
11819            fidl::encoding::Encode::<
11820                RingBufferGetVmoResponse,
11821                fdomain_client::fidl::FDomainResourceDialect,
11822            >::encode(
11823                (
11824                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.num_frames),
11825                    <fidl::encoding::HandleType<
11826                        fdomain_client::Vmo,
11827                        { fidl::ObjectType::VMO.into_raw() },
11828                        2147483648,
11829                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
11830                        &mut self.ring_buffer
11831                    ),
11832                ),
11833                encoder,
11834                offset,
11835                _depth,
11836            )
11837        }
11838    }
11839    unsafe impl<
11840        T0: fidl::encoding::Encode<u32, fdomain_client::fidl::FDomainResourceDialect>,
11841        T1: fidl::encoding::Encode<
11842                fidl::encoding::HandleType<
11843                    fdomain_client::Vmo,
11844                    { fidl::ObjectType::VMO.into_raw() },
11845                    2147483648,
11846                >,
11847                fdomain_client::fidl::FDomainResourceDialect,
11848            >,
11849    >
11850        fidl::encoding::Encode<
11851            RingBufferGetVmoResponse,
11852            fdomain_client::fidl::FDomainResourceDialect,
11853        > for (T0, T1)
11854    {
11855        #[inline]
11856        unsafe fn encode(
11857            self,
11858            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
11859            offset: usize,
11860            depth: fidl::encoding::Depth,
11861        ) -> fidl::Result<()> {
11862            encoder.debug_check_bounds::<RingBufferGetVmoResponse>(offset);
11863            // Zero out padding regions. There's no need to apply masks
11864            // because the unmasked parts will be overwritten by fields.
11865            // Write the fields.
11866            self.0.encode(encoder, offset + 0, depth)?;
11867            self.1.encode(encoder, offset + 4, depth)?;
11868            Ok(())
11869        }
11870    }
11871
11872    impl fidl::encoding::Decode<Self, fdomain_client::fidl::FDomainResourceDialect>
11873        for RingBufferGetVmoResponse
11874    {
11875        #[inline(always)]
11876        fn new_empty() -> Self {
11877            Self {
11878                num_frames: fidl::new_empty!(u32, fdomain_client::fidl::FDomainResourceDialect),
11879                ring_buffer: fidl::new_empty!(fidl::encoding::HandleType<fdomain_client::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fdomain_client::fidl::FDomainResourceDialect),
11880            }
11881        }
11882
11883        #[inline]
11884        unsafe fn decode(
11885            &mut self,
11886            decoder: &mut fidl::encoding::Decoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
11887            offset: usize,
11888            _depth: fidl::encoding::Depth,
11889        ) -> fidl::Result<()> {
11890            decoder.debug_check_bounds::<Self>(offset);
11891            // Verify that padding bytes are zero.
11892            fidl::decode!(
11893                u32,
11894                fdomain_client::fidl::FDomainResourceDialect,
11895                &mut self.num_frames,
11896                decoder,
11897                offset + 0,
11898                _depth
11899            )?;
11900            fidl::decode!(fidl::encoding::HandleType<fdomain_client::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fdomain_client::fidl::FDomainResourceDialect, &mut self.ring_buffer, decoder, offset + 4, _depth)?;
11901            Ok(())
11902        }
11903    }
11904
11905    impl fidl::encoding::ResourceTypeMarker for StreamConfigConnectorConnectRequest {
11906        type Borrowed<'a> = &'a mut Self;
11907        fn take_or_borrow<'a>(
11908            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11909        ) -> Self::Borrowed<'a> {
11910            value
11911        }
11912    }
11913
11914    unsafe impl fidl::encoding::TypeMarker for StreamConfigConnectorConnectRequest {
11915        type Owned = Self;
11916
11917        #[inline(always)]
11918        fn inline_align(_context: fidl::encoding::Context) -> usize {
11919            4
11920        }
11921
11922        #[inline(always)]
11923        fn inline_size(_context: fidl::encoding::Context) -> usize {
11924            4
11925        }
11926    }
11927
11928    unsafe impl
11929        fidl::encoding::Encode<
11930            StreamConfigConnectorConnectRequest,
11931            fdomain_client::fidl::FDomainResourceDialect,
11932        > for &mut StreamConfigConnectorConnectRequest
11933    {
11934        #[inline]
11935        unsafe fn encode(
11936            self,
11937            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
11938            offset: usize,
11939            _depth: fidl::encoding::Depth,
11940        ) -> fidl::Result<()> {
11941            encoder.debug_check_bounds::<StreamConfigConnectorConnectRequest>(offset);
11942            // Delegate to tuple encoding.
11943            fidl::encoding::Encode::<StreamConfigConnectorConnectRequest, fdomain_client::fidl::FDomainResourceDialect>::encode(
11944                (
11945                    <fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<StreamConfigMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.protocol),
11946                ),
11947                encoder, offset, _depth
11948            )
11949        }
11950    }
11951    unsafe impl<
11952        T0: fidl::encoding::Encode<
11953                fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<StreamConfigMarker>>,
11954                fdomain_client::fidl::FDomainResourceDialect,
11955            >,
11956    >
11957        fidl::encoding::Encode<
11958            StreamConfigConnectorConnectRequest,
11959            fdomain_client::fidl::FDomainResourceDialect,
11960        > for (T0,)
11961    {
11962        #[inline]
11963        unsafe fn encode(
11964            self,
11965            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
11966            offset: usize,
11967            depth: fidl::encoding::Depth,
11968        ) -> fidl::Result<()> {
11969            encoder.debug_check_bounds::<StreamConfigConnectorConnectRequest>(offset);
11970            // Zero out padding regions. There's no need to apply masks
11971            // because the unmasked parts will be overwritten by fields.
11972            // Write the fields.
11973            self.0.encode(encoder, offset + 0, depth)?;
11974            Ok(())
11975        }
11976    }
11977
11978    impl fidl::encoding::Decode<Self, fdomain_client::fidl::FDomainResourceDialect>
11979        for StreamConfigConnectorConnectRequest
11980    {
11981        #[inline(always)]
11982        fn new_empty() -> Self {
11983            Self {
11984                protocol: fidl::new_empty!(
11985                    fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<StreamConfigMarker>>,
11986                    fdomain_client::fidl::FDomainResourceDialect
11987                ),
11988            }
11989        }
11990
11991        #[inline]
11992        unsafe fn decode(
11993            &mut self,
11994            decoder: &mut fidl::encoding::Decoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
11995            offset: usize,
11996            _depth: fidl::encoding::Depth,
11997        ) -> fidl::Result<()> {
11998            decoder.debug_check_bounds::<Self>(offset);
11999            // Verify that padding bytes are zero.
12000            fidl::decode!(
12001                fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<StreamConfigMarker>>,
12002                fdomain_client::fidl::FDomainResourceDialect,
12003                &mut self.protocol,
12004                decoder,
12005                offset + 0,
12006                _depth
12007            )?;
12008            Ok(())
12009        }
12010    }
12011
12012    impl fidl::encoding::ResourceTypeMarker for StreamConfigCreateRingBufferRequest {
12013        type Borrowed<'a> = &'a mut Self;
12014        fn take_or_borrow<'a>(
12015            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
12016        ) -> Self::Borrowed<'a> {
12017            value
12018        }
12019    }
12020
12021    unsafe impl fidl::encoding::TypeMarker for StreamConfigCreateRingBufferRequest {
12022        type Owned = Self;
12023
12024        #[inline(always)]
12025        fn inline_align(_context: fidl::encoding::Context) -> usize {
12026            8
12027        }
12028
12029        #[inline(always)]
12030        fn inline_size(_context: fidl::encoding::Context) -> usize {
12031            24
12032        }
12033    }
12034
12035    unsafe impl
12036        fidl::encoding::Encode<
12037            StreamConfigCreateRingBufferRequest,
12038            fdomain_client::fidl::FDomainResourceDialect,
12039        > for &mut StreamConfigCreateRingBufferRequest
12040    {
12041        #[inline]
12042        unsafe fn encode(
12043            self,
12044            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
12045            offset: usize,
12046            _depth: fidl::encoding::Depth,
12047        ) -> fidl::Result<()> {
12048            encoder.debug_check_bounds::<StreamConfigCreateRingBufferRequest>(offset);
12049            // Delegate to tuple encoding.
12050            fidl::encoding::Encode::<StreamConfigCreateRingBufferRequest, fdomain_client::fidl::FDomainResourceDialect>::encode(
12051                (
12052                    <Format as fidl::encoding::ValueTypeMarker>::borrow(&self.format),
12053                    <fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<RingBufferMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.ring_buffer),
12054                ),
12055                encoder, offset, _depth
12056            )
12057        }
12058    }
12059    unsafe impl<
12060        T0: fidl::encoding::Encode<Format, fdomain_client::fidl::FDomainResourceDialect>,
12061        T1: fidl::encoding::Encode<
12062                fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<RingBufferMarker>>,
12063                fdomain_client::fidl::FDomainResourceDialect,
12064            >,
12065    >
12066        fidl::encoding::Encode<
12067            StreamConfigCreateRingBufferRequest,
12068            fdomain_client::fidl::FDomainResourceDialect,
12069        > for (T0, T1)
12070    {
12071        #[inline]
12072        unsafe fn encode(
12073            self,
12074            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
12075            offset: usize,
12076            depth: fidl::encoding::Depth,
12077        ) -> fidl::Result<()> {
12078            encoder.debug_check_bounds::<StreamConfigCreateRingBufferRequest>(offset);
12079            // Zero out padding regions. There's no need to apply masks
12080            // because the unmasked parts will be overwritten by fields.
12081            unsafe {
12082                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
12083                (ptr as *mut u64).write_unaligned(0);
12084            }
12085            // Write the fields.
12086            self.0.encode(encoder, offset + 0, depth)?;
12087            self.1.encode(encoder, offset + 16, depth)?;
12088            Ok(())
12089        }
12090    }
12091
12092    impl fidl::encoding::Decode<Self, fdomain_client::fidl::FDomainResourceDialect>
12093        for StreamConfigCreateRingBufferRequest
12094    {
12095        #[inline(always)]
12096        fn new_empty() -> Self {
12097            Self {
12098                format: fidl::new_empty!(Format, fdomain_client::fidl::FDomainResourceDialect),
12099                ring_buffer: fidl::new_empty!(
12100                    fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<RingBufferMarker>>,
12101                    fdomain_client::fidl::FDomainResourceDialect
12102                ),
12103            }
12104        }
12105
12106        #[inline]
12107        unsafe fn decode(
12108            &mut self,
12109            decoder: &mut fidl::encoding::Decoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
12110            offset: usize,
12111            _depth: fidl::encoding::Depth,
12112        ) -> fidl::Result<()> {
12113            decoder.debug_check_bounds::<Self>(offset);
12114            // Verify that padding bytes are zero.
12115            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
12116            let padval = unsafe { (ptr as *const u64).read_unaligned() };
12117            let mask = 0xffffffff00000000u64;
12118            let maskedval = padval & mask;
12119            if maskedval != 0 {
12120                return Err(fidl::Error::NonZeroPadding {
12121                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
12122                });
12123            }
12124            fidl::decode!(
12125                Format,
12126                fdomain_client::fidl::FDomainResourceDialect,
12127                &mut self.format,
12128                decoder,
12129                offset + 0,
12130                _depth
12131            )?;
12132            fidl::decode!(
12133                fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<RingBufferMarker>>,
12134                fdomain_client::fidl::FDomainResourceDialect,
12135                &mut self.ring_buffer,
12136                decoder,
12137                offset + 16,
12138                _depth
12139            )?;
12140            Ok(())
12141        }
12142    }
12143
12144    impl PacketStreamControlSetPacketStreamSinkRequest {
12145        #[inline(always)]
12146        fn max_ordinal_present(&self) -> u64 {
12147            if let Some(_) = self.stream {
12148                return 1;
12149            }
12150            0
12151        }
12152    }
12153
12154    impl fidl::encoding::ResourceTypeMarker for PacketStreamControlSetPacketStreamSinkRequest {
12155        type Borrowed<'a> = &'a mut Self;
12156        fn take_or_borrow<'a>(
12157            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
12158        ) -> Self::Borrowed<'a> {
12159            value
12160        }
12161    }
12162
12163    unsafe impl fidl::encoding::TypeMarker for PacketStreamControlSetPacketStreamSinkRequest {
12164        type Owned = Self;
12165
12166        #[inline(always)]
12167        fn inline_align(_context: fidl::encoding::Context) -> usize {
12168            8
12169        }
12170
12171        #[inline(always)]
12172        fn inline_size(_context: fidl::encoding::Context) -> usize {
12173            16
12174        }
12175    }
12176
12177    unsafe impl
12178        fidl::encoding::Encode<
12179            PacketStreamControlSetPacketStreamSinkRequest,
12180            fdomain_client::fidl::FDomainResourceDialect,
12181        > for &mut PacketStreamControlSetPacketStreamSinkRequest
12182    {
12183        unsafe fn encode(
12184            self,
12185            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
12186            offset: usize,
12187            mut depth: fidl::encoding::Depth,
12188        ) -> fidl::Result<()> {
12189            encoder.debug_check_bounds::<PacketStreamControlSetPacketStreamSinkRequest>(offset);
12190            // Vector header
12191            let max_ordinal: u64 = self.max_ordinal_present();
12192            encoder.write_num(max_ordinal, offset);
12193            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
12194            // Calling encoder.out_of_line_offset(0) is not allowed.
12195            if max_ordinal == 0 {
12196                return Ok(());
12197            }
12198            depth.increment()?;
12199            let envelope_size = 8;
12200            let bytes_len = max_ordinal as usize * envelope_size;
12201            #[allow(unused_variables)]
12202            let offset = encoder.out_of_line_offset(bytes_len);
12203            let mut _prev_end_offset: usize = 0;
12204            if 1 > max_ordinal {
12205                return Ok(());
12206            }
12207
12208            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12209            // are envelope_size bytes.
12210            let cur_offset: usize = (1 - 1) * envelope_size;
12211
12212            // Zero reserved fields.
12213            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12214
12215            // Safety:
12216            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
12217            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
12218            //   envelope_size bytes, there is always sufficient room.
12219            fidl::encoding::encode_in_envelope_optional::<
12220                fidl::encoding::Endpoint<fdomain_client::fidl::ClientEnd<PacketStreamSinkMarker>>,
12221                fdomain_client::fidl::FDomainResourceDialect,
12222            >(
12223                self.stream.as_mut().map(
12224                    <fidl::encoding::Endpoint<
12225                        fdomain_client::fidl::ClientEnd<PacketStreamSinkMarker>,
12226                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
12227                ),
12228                encoder,
12229                offset + cur_offset,
12230                depth,
12231            )?;
12232
12233            _prev_end_offset = cur_offset + envelope_size;
12234
12235            Ok(())
12236        }
12237    }
12238
12239    impl fidl::encoding::Decode<Self, fdomain_client::fidl::FDomainResourceDialect>
12240        for PacketStreamControlSetPacketStreamSinkRequest
12241    {
12242        #[inline(always)]
12243        fn new_empty() -> Self {
12244            Self::default()
12245        }
12246
12247        unsafe fn decode(
12248            &mut self,
12249            decoder: &mut fidl::encoding::Decoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
12250            offset: usize,
12251            mut depth: fidl::encoding::Depth,
12252        ) -> fidl::Result<()> {
12253            decoder.debug_check_bounds::<Self>(offset);
12254            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
12255                None => return Err(fidl::Error::NotNullable),
12256                Some(len) => len,
12257            };
12258            // Calling decoder.out_of_line_offset(0) is not allowed.
12259            if len == 0 {
12260                return Ok(());
12261            };
12262            depth.increment()?;
12263            let envelope_size = 8;
12264            let bytes_len = len * envelope_size;
12265            let offset = decoder.out_of_line_offset(bytes_len)?;
12266            // Decode the envelope for each type.
12267            let mut _next_ordinal_to_read = 0;
12268            let mut next_offset = offset;
12269            let end_offset = offset + bytes_len;
12270            _next_ordinal_to_read += 1;
12271            if next_offset >= end_offset {
12272                return Ok(());
12273            }
12274
12275            // Decode unknown envelopes for gaps in ordinals.
12276            while _next_ordinal_to_read < 1 {
12277                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12278                _next_ordinal_to_read += 1;
12279                next_offset += envelope_size;
12280            }
12281
12282            let next_out_of_line = decoder.next_out_of_line();
12283            let handles_before = decoder.remaining_handles();
12284            if let Some((inlined, num_bytes, num_handles)) =
12285                fidl::encoding::decode_envelope_header(decoder, next_offset)?
12286            {
12287                let member_inline_size = <fidl::encoding::Endpoint<
12288                    fdomain_client::fidl::ClientEnd<PacketStreamSinkMarker>,
12289                > as fidl::encoding::TypeMarker>::inline_size(
12290                    decoder.context
12291                );
12292                if inlined != (member_inline_size <= 4) {
12293                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
12294                }
12295                let inner_offset;
12296                let mut inner_depth = depth.clone();
12297                if inlined {
12298                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12299                    inner_offset = next_offset;
12300                } else {
12301                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12302                    inner_depth.increment()?;
12303                }
12304                let val_ref = self.stream.get_or_insert_with(|| {
12305                    fidl::new_empty!(
12306                        fidl::encoding::Endpoint<
12307                            fdomain_client::fidl::ClientEnd<PacketStreamSinkMarker>,
12308                        >,
12309                        fdomain_client::fidl::FDomainResourceDialect
12310                    )
12311                });
12312                fidl::decode!(
12313                    fidl::encoding::Endpoint<
12314                        fdomain_client::fidl::ClientEnd<PacketStreamSinkMarker>,
12315                    >,
12316                    fdomain_client::fidl::FDomainResourceDialect,
12317                    val_ref,
12318                    decoder,
12319                    inner_offset,
12320                    inner_depth
12321                )?;
12322                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12323                {
12324                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
12325                }
12326                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12327                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12328                }
12329            }
12330
12331            next_offset += envelope_size;
12332
12333            // Decode the remaining unknown envelopes.
12334            while next_offset < end_offset {
12335                _next_ordinal_to_read += 1;
12336                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12337                next_offset += envelope_size;
12338            }
12339
12340            Ok(())
12341        }
12342    }
12343
12344    impl PacketStreamControlGetPacketStreamSinkResponse {
12345        #[inline(always)]
12346        fn max_ordinal_present(&self) -> u64 {
12347            if let Some(_) = self.stream {
12348                return 1;
12349            }
12350            0
12351        }
12352    }
12353
12354    impl fidl::encoding::ResourceTypeMarker for PacketStreamControlGetPacketStreamSinkResponse {
12355        type Borrowed<'a> = &'a mut Self;
12356        fn take_or_borrow<'a>(
12357            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
12358        ) -> Self::Borrowed<'a> {
12359            value
12360        }
12361    }
12362
12363    unsafe impl fidl::encoding::TypeMarker for PacketStreamControlGetPacketStreamSinkResponse {
12364        type Owned = Self;
12365
12366        #[inline(always)]
12367        fn inline_align(_context: fidl::encoding::Context) -> usize {
12368            8
12369        }
12370
12371        #[inline(always)]
12372        fn inline_size(_context: fidl::encoding::Context) -> usize {
12373            16
12374        }
12375    }
12376
12377    unsafe impl
12378        fidl::encoding::Encode<
12379            PacketStreamControlGetPacketStreamSinkResponse,
12380            fdomain_client::fidl::FDomainResourceDialect,
12381        > for &mut PacketStreamControlGetPacketStreamSinkResponse
12382    {
12383        unsafe fn encode(
12384            self,
12385            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
12386            offset: usize,
12387            mut depth: fidl::encoding::Depth,
12388        ) -> fidl::Result<()> {
12389            encoder.debug_check_bounds::<PacketStreamControlGetPacketStreamSinkResponse>(offset);
12390            // Vector header
12391            let max_ordinal: u64 = self.max_ordinal_present();
12392            encoder.write_num(max_ordinal, offset);
12393            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
12394            // Calling encoder.out_of_line_offset(0) is not allowed.
12395            if max_ordinal == 0 {
12396                return Ok(());
12397            }
12398            depth.increment()?;
12399            let envelope_size = 8;
12400            let bytes_len = max_ordinal as usize * envelope_size;
12401            #[allow(unused_variables)]
12402            let offset = encoder.out_of_line_offset(bytes_len);
12403            let mut _prev_end_offset: usize = 0;
12404            if 1 > max_ordinal {
12405                return Ok(());
12406            }
12407
12408            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12409            // are envelope_size bytes.
12410            let cur_offset: usize = (1 - 1) * envelope_size;
12411
12412            // Zero reserved fields.
12413            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12414
12415            // Safety:
12416            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
12417            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
12418            //   envelope_size bytes, there is always sufficient room.
12419            fidl::encoding::encode_in_envelope_optional::<
12420                fidl::encoding::Endpoint<fdomain_client::fidl::ClientEnd<PacketStreamSinkMarker>>,
12421                fdomain_client::fidl::FDomainResourceDialect,
12422            >(
12423                self.stream.as_mut().map(
12424                    <fidl::encoding::Endpoint<
12425                        fdomain_client::fidl::ClientEnd<PacketStreamSinkMarker>,
12426                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
12427                ),
12428                encoder,
12429                offset + cur_offset,
12430                depth,
12431            )?;
12432
12433            _prev_end_offset = cur_offset + envelope_size;
12434
12435            Ok(())
12436        }
12437    }
12438
12439    impl fidl::encoding::Decode<Self, fdomain_client::fidl::FDomainResourceDialect>
12440        for PacketStreamControlGetPacketStreamSinkResponse
12441    {
12442        #[inline(always)]
12443        fn new_empty() -> Self {
12444            Self::default()
12445        }
12446
12447        unsafe fn decode(
12448            &mut self,
12449            decoder: &mut fidl::encoding::Decoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
12450            offset: usize,
12451            mut depth: fidl::encoding::Depth,
12452        ) -> fidl::Result<()> {
12453            decoder.debug_check_bounds::<Self>(offset);
12454            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
12455                None => return Err(fidl::Error::NotNullable),
12456                Some(len) => len,
12457            };
12458            // Calling decoder.out_of_line_offset(0) is not allowed.
12459            if len == 0 {
12460                return Ok(());
12461            };
12462            depth.increment()?;
12463            let envelope_size = 8;
12464            let bytes_len = len * envelope_size;
12465            let offset = decoder.out_of_line_offset(bytes_len)?;
12466            // Decode the envelope for each type.
12467            let mut _next_ordinal_to_read = 0;
12468            let mut next_offset = offset;
12469            let end_offset = offset + bytes_len;
12470            _next_ordinal_to_read += 1;
12471            if next_offset >= end_offset {
12472                return Ok(());
12473            }
12474
12475            // Decode unknown envelopes for gaps in ordinals.
12476            while _next_ordinal_to_read < 1 {
12477                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12478                _next_ordinal_to_read += 1;
12479                next_offset += envelope_size;
12480            }
12481
12482            let next_out_of_line = decoder.next_out_of_line();
12483            let handles_before = decoder.remaining_handles();
12484            if let Some((inlined, num_bytes, num_handles)) =
12485                fidl::encoding::decode_envelope_header(decoder, next_offset)?
12486            {
12487                let member_inline_size = <fidl::encoding::Endpoint<
12488                    fdomain_client::fidl::ClientEnd<PacketStreamSinkMarker>,
12489                > as fidl::encoding::TypeMarker>::inline_size(
12490                    decoder.context
12491                );
12492                if inlined != (member_inline_size <= 4) {
12493                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
12494                }
12495                let inner_offset;
12496                let mut inner_depth = depth.clone();
12497                if inlined {
12498                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12499                    inner_offset = next_offset;
12500                } else {
12501                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12502                    inner_depth.increment()?;
12503                }
12504                let val_ref = self.stream.get_or_insert_with(|| {
12505                    fidl::new_empty!(
12506                        fidl::encoding::Endpoint<
12507                            fdomain_client::fidl::ClientEnd<PacketStreamSinkMarker>,
12508                        >,
12509                        fdomain_client::fidl::FDomainResourceDialect
12510                    )
12511                });
12512                fidl::decode!(
12513                    fidl::encoding::Endpoint<
12514                        fdomain_client::fidl::ClientEnd<PacketStreamSinkMarker>,
12515                    >,
12516                    fdomain_client::fidl::FDomainResourceDialect,
12517                    val_ref,
12518                    decoder,
12519                    inner_offset,
12520                    inner_depth
12521                )?;
12522                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12523                {
12524                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
12525                }
12526                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12527                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12528                }
12529            }
12530
12531            next_offset += envelope_size;
12532
12533            // Decode the remaining unknown envelopes.
12534            while next_offset < end_offset {
12535                _next_ordinal_to_read += 1;
12536                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12537                next_offset += envelope_size;
12538            }
12539
12540            Ok(())
12541        }
12542    }
12543
12544    impl PacketStreamSinkPutPacketRequest {
12545        #[inline(always)]
12546        fn max_ordinal_present(&self) -> u64 {
12547            if let Some(_) = self.payload {
12548                return 1;
12549            }
12550            0
12551        }
12552    }
12553
12554    impl fidl::encoding::ResourceTypeMarker for PacketStreamSinkPutPacketRequest {
12555        type Borrowed<'a> = &'a mut Self;
12556        fn take_or_borrow<'a>(
12557            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
12558        ) -> Self::Borrowed<'a> {
12559            value
12560        }
12561    }
12562
12563    unsafe impl fidl::encoding::TypeMarker for PacketStreamSinkPutPacketRequest {
12564        type Owned = Self;
12565
12566        #[inline(always)]
12567        fn inline_align(_context: fidl::encoding::Context) -> usize {
12568            8
12569        }
12570
12571        #[inline(always)]
12572        fn inline_size(_context: fidl::encoding::Context) -> usize {
12573            16
12574        }
12575    }
12576
12577    unsafe impl
12578        fidl::encoding::Encode<
12579            PacketStreamSinkPutPacketRequest,
12580            fdomain_client::fidl::FDomainResourceDialect,
12581        > for &mut PacketStreamSinkPutPacketRequest
12582    {
12583        unsafe fn encode(
12584            self,
12585            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
12586            offset: usize,
12587            mut depth: fidl::encoding::Depth,
12588        ) -> fidl::Result<()> {
12589            encoder.debug_check_bounds::<PacketStreamSinkPutPacketRequest>(offset);
12590            // Vector header
12591            let max_ordinal: u64 = self.max_ordinal_present();
12592            encoder.write_num(max_ordinal, offset);
12593            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
12594            // Calling encoder.out_of_line_offset(0) is not allowed.
12595            if max_ordinal == 0 {
12596                return Ok(());
12597            }
12598            depth.increment()?;
12599            let envelope_size = 8;
12600            let bytes_len = max_ordinal as usize * envelope_size;
12601            #[allow(unused_variables)]
12602            let offset = encoder.out_of_line_offset(bytes_len);
12603            let mut _prev_end_offset: usize = 0;
12604            if 1 > max_ordinal {
12605                return Ok(());
12606            }
12607
12608            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12609            // are envelope_size bytes.
12610            let cur_offset: usize = (1 - 1) * envelope_size;
12611
12612            // Zero reserved fields.
12613            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12614
12615            // Safety:
12616            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
12617            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
12618            //   envelope_size bytes, there is always sufficient room.
12619            fidl::encoding::encode_in_envelope_optional::<
12620                DataTransfer,
12621                fdomain_client::fidl::FDomainResourceDialect,
12622            >(
12623                self.payload
12624                    .as_mut()
12625                    .map(<DataTransfer as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
12626                encoder,
12627                offset + cur_offset,
12628                depth,
12629            )?;
12630
12631            _prev_end_offset = cur_offset + envelope_size;
12632
12633            Ok(())
12634        }
12635    }
12636
12637    impl fidl::encoding::Decode<Self, fdomain_client::fidl::FDomainResourceDialect>
12638        for PacketStreamSinkPutPacketRequest
12639    {
12640        #[inline(always)]
12641        fn new_empty() -> Self {
12642            Self::default()
12643        }
12644
12645        unsafe fn decode(
12646            &mut self,
12647            decoder: &mut fidl::encoding::Decoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
12648            offset: usize,
12649            mut depth: fidl::encoding::Depth,
12650        ) -> fidl::Result<()> {
12651            decoder.debug_check_bounds::<Self>(offset);
12652            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
12653                None => return Err(fidl::Error::NotNullable),
12654                Some(len) => len,
12655            };
12656            // Calling decoder.out_of_line_offset(0) is not allowed.
12657            if len == 0 {
12658                return Ok(());
12659            };
12660            depth.increment()?;
12661            let envelope_size = 8;
12662            let bytes_len = len * envelope_size;
12663            let offset = decoder.out_of_line_offset(bytes_len)?;
12664            // Decode the envelope for each type.
12665            let mut _next_ordinal_to_read = 0;
12666            let mut next_offset = offset;
12667            let end_offset = offset + bytes_len;
12668            _next_ordinal_to_read += 1;
12669            if next_offset >= end_offset {
12670                return Ok(());
12671            }
12672
12673            // Decode unknown envelopes for gaps in ordinals.
12674            while _next_ordinal_to_read < 1 {
12675                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12676                _next_ordinal_to_read += 1;
12677                next_offset += envelope_size;
12678            }
12679
12680            let next_out_of_line = decoder.next_out_of_line();
12681            let handles_before = decoder.remaining_handles();
12682            if let Some((inlined, num_bytes, num_handles)) =
12683                fidl::encoding::decode_envelope_header(decoder, next_offset)?
12684            {
12685                let member_inline_size =
12686                    <DataTransfer as fidl::encoding::TypeMarker>::inline_size(decoder.context);
12687                if inlined != (member_inline_size <= 4) {
12688                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
12689                }
12690                let inner_offset;
12691                let mut inner_depth = depth.clone();
12692                if inlined {
12693                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12694                    inner_offset = next_offset;
12695                } else {
12696                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12697                    inner_depth.increment()?;
12698                }
12699                let val_ref = self.payload.get_or_insert_with(|| {
12700                    fidl::new_empty!(DataTransfer, fdomain_client::fidl::FDomainResourceDialect)
12701                });
12702                fidl::decode!(
12703                    DataTransfer,
12704                    fdomain_client::fidl::FDomainResourceDialect,
12705                    val_ref,
12706                    decoder,
12707                    inner_offset,
12708                    inner_depth
12709                )?;
12710                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12711                {
12712                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
12713                }
12714                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12715                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12716                }
12717            }
12718
12719            next_offset += envelope_size;
12720
12721            // Decode the remaining unknown envelopes.
12722            while next_offset < end_offset {
12723                _next_ordinal_to_read += 1;
12724                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12725                next_offset += envelope_size;
12726            }
12727
12728            Ok(())
12729        }
12730    }
12731
12732    impl RegisterVmosConfig {
12733        #[inline(always)]
12734        fn max_ordinal_present(&self) -> u64 {
12735            if let Some(_) = self.vmo_infos {
12736                return 1;
12737            }
12738            0
12739        }
12740    }
12741
12742    impl fidl::encoding::ResourceTypeMarker for RegisterVmosConfig {
12743        type Borrowed<'a> = &'a mut Self;
12744        fn take_or_borrow<'a>(
12745            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
12746        ) -> Self::Borrowed<'a> {
12747            value
12748        }
12749    }
12750
12751    unsafe impl fidl::encoding::TypeMarker for RegisterVmosConfig {
12752        type Owned = Self;
12753
12754        #[inline(always)]
12755        fn inline_align(_context: fidl::encoding::Context) -> usize {
12756            8
12757        }
12758
12759        #[inline(always)]
12760        fn inline_size(_context: fidl::encoding::Context) -> usize {
12761            16
12762        }
12763    }
12764
12765    unsafe impl
12766        fidl::encoding::Encode<RegisterVmosConfig, fdomain_client::fidl::FDomainResourceDialect>
12767        for &mut RegisterVmosConfig
12768    {
12769        unsafe fn encode(
12770            self,
12771            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
12772            offset: usize,
12773            mut depth: fidl::encoding::Depth,
12774        ) -> fidl::Result<()> {
12775            encoder.debug_check_bounds::<RegisterVmosConfig>(offset);
12776            // Vector header
12777            let max_ordinal: u64 = self.max_ordinal_present();
12778            encoder.write_num(max_ordinal, offset);
12779            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
12780            // Calling encoder.out_of_line_offset(0) is not allowed.
12781            if max_ordinal == 0 {
12782                return Ok(());
12783            }
12784            depth.increment()?;
12785            let envelope_size = 8;
12786            let bytes_len = max_ordinal as usize * envelope_size;
12787            #[allow(unused_variables)]
12788            let offset = encoder.out_of_line_offset(bytes_len);
12789            let mut _prev_end_offset: usize = 0;
12790            if 1 > max_ordinal {
12791                return Ok(());
12792            }
12793
12794            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12795            // are envelope_size bytes.
12796            let cur_offset: usize = (1 - 1) * envelope_size;
12797
12798            // Zero reserved fields.
12799            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12800
12801            // Safety:
12802            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
12803            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
12804            //   envelope_size bytes, there is always sufficient room.
12805            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<VmoInfo, 256>, fdomain_client::fidl::FDomainResourceDialect>(
12806            self.vmo_infos.as_mut().map(<fidl::encoding::Vector<VmoInfo, 256> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
12807            encoder, offset + cur_offset, depth
12808        )?;
12809
12810            _prev_end_offset = cur_offset + envelope_size;
12811
12812            Ok(())
12813        }
12814    }
12815
12816    impl fidl::encoding::Decode<Self, fdomain_client::fidl::FDomainResourceDialect>
12817        for RegisterVmosConfig
12818    {
12819        #[inline(always)]
12820        fn new_empty() -> Self {
12821            Self::default()
12822        }
12823
12824        unsafe fn decode(
12825            &mut self,
12826            decoder: &mut fidl::encoding::Decoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
12827            offset: usize,
12828            mut depth: fidl::encoding::Depth,
12829        ) -> fidl::Result<()> {
12830            decoder.debug_check_bounds::<Self>(offset);
12831            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
12832                None => return Err(fidl::Error::NotNullable),
12833                Some(len) => len,
12834            };
12835            // Calling decoder.out_of_line_offset(0) is not allowed.
12836            if len == 0 {
12837                return Ok(());
12838            };
12839            depth.increment()?;
12840            let envelope_size = 8;
12841            let bytes_len = len * envelope_size;
12842            let offset = decoder.out_of_line_offset(bytes_len)?;
12843            // Decode the envelope for each type.
12844            let mut _next_ordinal_to_read = 0;
12845            let mut next_offset = offset;
12846            let end_offset = offset + bytes_len;
12847            _next_ordinal_to_read += 1;
12848            if next_offset >= end_offset {
12849                return Ok(());
12850            }
12851
12852            // Decode unknown envelopes for gaps in ordinals.
12853            while _next_ordinal_to_read < 1 {
12854                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12855                _next_ordinal_to_read += 1;
12856                next_offset += envelope_size;
12857            }
12858
12859            let next_out_of_line = decoder.next_out_of_line();
12860            let handles_before = decoder.remaining_handles();
12861            if let Some((inlined, num_bytes, num_handles)) =
12862                fidl::encoding::decode_envelope_header(decoder, next_offset)?
12863            {
12864                let member_inline_size = <fidl::encoding::Vector<VmoInfo, 256> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
12865                if inlined != (member_inline_size <= 4) {
12866                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
12867                }
12868                let inner_offset;
12869                let mut inner_depth = depth.clone();
12870                if inlined {
12871                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12872                    inner_offset = next_offset;
12873                } else {
12874                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12875                    inner_depth.increment()?;
12876                }
12877                let val_ref =
12878                self.vmo_infos.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<VmoInfo, 256>, fdomain_client::fidl::FDomainResourceDialect));
12879                fidl::decode!(fidl::encoding::Vector<VmoInfo, 256>, fdomain_client::fidl::FDomainResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
12880                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12881                {
12882                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
12883                }
12884                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12885                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12886                }
12887            }
12888
12889            next_offset += envelope_size;
12890
12891            // Decode the remaining unknown envelopes.
12892            while next_offset < end_offset {
12893                _next_ordinal_to_read += 1;
12894                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12895                next_offset += envelope_size;
12896            }
12897
12898            Ok(())
12899        }
12900    }
12901
12902    impl VmoInfo {
12903        #[inline(always)]
12904        fn max_ordinal_present(&self) -> u64 {
12905            if let Some(_) = self.vmo {
12906                return 2;
12907            }
12908            if let Some(_) = self.id {
12909                return 1;
12910            }
12911            0
12912        }
12913    }
12914
12915    impl fidl::encoding::ResourceTypeMarker for VmoInfo {
12916        type Borrowed<'a> = &'a mut Self;
12917        fn take_or_borrow<'a>(
12918            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
12919        ) -> Self::Borrowed<'a> {
12920            value
12921        }
12922    }
12923
12924    unsafe impl fidl::encoding::TypeMarker for VmoInfo {
12925        type Owned = Self;
12926
12927        #[inline(always)]
12928        fn inline_align(_context: fidl::encoding::Context) -> usize {
12929            8
12930        }
12931
12932        #[inline(always)]
12933        fn inline_size(_context: fidl::encoding::Context) -> usize {
12934            16
12935        }
12936    }
12937
12938    unsafe impl fidl::encoding::Encode<VmoInfo, fdomain_client::fidl::FDomainResourceDialect>
12939        for &mut VmoInfo
12940    {
12941        unsafe fn encode(
12942            self,
12943            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
12944            offset: usize,
12945            mut depth: fidl::encoding::Depth,
12946        ) -> fidl::Result<()> {
12947            encoder.debug_check_bounds::<VmoInfo>(offset);
12948            // Vector header
12949            let max_ordinal: u64 = self.max_ordinal_present();
12950            encoder.write_num(max_ordinal, offset);
12951            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
12952            // Calling encoder.out_of_line_offset(0) is not allowed.
12953            if max_ordinal == 0 {
12954                return Ok(());
12955            }
12956            depth.increment()?;
12957            let envelope_size = 8;
12958            let bytes_len = max_ordinal as usize * envelope_size;
12959            #[allow(unused_variables)]
12960            let offset = encoder.out_of_line_offset(bytes_len);
12961            let mut _prev_end_offset: usize = 0;
12962            if 1 > max_ordinal {
12963                return Ok(());
12964            }
12965
12966            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12967            // are envelope_size bytes.
12968            let cur_offset: usize = (1 - 1) * envelope_size;
12969
12970            // Zero reserved fields.
12971            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12972
12973            // Safety:
12974            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
12975            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
12976            //   envelope_size bytes, there is always sufficient room.
12977            fidl::encoding::encode_in_envelope_optional::<
12978                u64,
12979                fdomain_client::fidl::FDomainResourceDialect,
12980            >(
12981                self.id.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
12982                encoder,
12983                offset + cur_offset,
12984                depth,
12985            )?;
12986
12987            _prev_end_offset = cur_offset + envelope_size;
12988            if 2 > max_ordinal {
12989                return Ok(());
12990            }
12991
12992            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12993            // are envelope_size bytes.
12994            let cur_offset: usize = (2 - 1) * envelope_size;
12995
12996            // Zero reserved fields.
12997            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12998
12999            // Safety:
13000            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
13001            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
13002            //   envelope_size bytes, there is always sufficient room.
13003            fidl::encoding::encode_in_envelope_optional::<
13004                fidl::encoding::HandleType<
13005                    fdomain_client::Vmo,
13006                    { fidl::ObjectType::VMO.into_raw() },
13007                    2147483648,
13008                >,
13009                fdomain_client::fidl::FDomainResourceDialect,
13010            >(
13011                self.vmo.as_mut().map(
13012                    <fidl::encoding::HandleType<
13013                        fdomain_client::Vmo,
13014                        { fidl::ObjectType::VMO.into_raw() },
13015                        2147483648,
13016                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
13017                ),
13018                encoder,
13019                offset + cur_offset,
13020                depth,
13021            )?;
13022
13023            _prev_end_offset = cur_offset + envelope_size;
13024
13025            Ok(())
13026        }
13027    }
13028
13029    impl fidl::encoding::Decode<Self, fdomain_client::fidl::FDomainResourceDialect> for VmoInfo {
13030        #[inline(always)]
13031        fn new_empty() -> Self {
13032            Self::default()
13033        }
13034
13035        unsafe fn decode(
13036            &mut self,
13037            decoder: &mut fidl::encoding::Decoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
13038            offset: usize,
13039            mut depth: fidl::encoding::Depth,
13040        ) -> fidl::Result<()> {
13041            decoder.debug_check_bounds::<Self>(offset);
13042            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
13043                None => return Err(fidl::Error::NotNullable),
13044                Some(len) => len,
13045            };
13046            // Calling decoder.out_of_line_offset(0) is not allowed.
13047            if len == 0 {
13048                return Ok(());
13049            };
13050            depth.increment()?;
13051            let envelope_size = 8;
13052            let bytes_len = len * envelope_size;
13053            let offset = decoder.out_of_line_offset(bytes_len)?;
13054            // Decode the envelope for each type.
13055            let mut _next_ordinal_to_read = 0;
13056            let mut next_offset = offset;
13057            let end_offset = offset + bytes_len;
13058            _next_ordinal_to_read += 1;
13059            if next_offset >= end_offset {
13060                return Ok(());
13061            }
13062
13063            // Decode unknown envelopes for gaps in ordinals.
13064            while _next_ordinal_to_read < 1 {
13065                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13066                _next_ordinal_to_read += 1;
13067                next_offset += envelope_size;
13068            }
13069
13070            let next_out_of_line = decoder.next_out_of_line();
13071            let handles_before = decoder.remaining_handles();
13072            if let Some((inlined, num_bytes, num_handles)) =
13073                fidl::encoding::decode_envelope_header(decoder, next_offset)?
13074            {
13075                let member_inline_size =
13076                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
13077                if inlined != (member_inline_size <= 4) {
13078                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
13079                }
13080                let inner_offset;
13081                let mut inner_depth = depth.clone();
13082                if inlined {
13083                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
13084                    inner_offset = next_offset;
13085                } else {
13086                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
13087                    inner_depth.increment()?;
13088                }
13089                let val_ref = self.id.get_or_insert_with(|| {
13090                    fidl::new_empty!(u64, fdomain_client::fidl::FDomainResourceDialect)
13091                });
13092                fidl::decode!(
13093                    u64,
13094                    fdomain_client::fidl::FDomainResourceDialect,
13095                    val_ref,
13096                    decoder,
13097                    inner_offset,
13098                    inner_depth
13099                )?;
13100                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
13101                {
13102                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
13103                }
13104                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
13105                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
13106                }
13107            }
13108
13109            next_offset += envelope_size;
13110            _next_ordinal_to_read += 1;
13111            if next_offset >= end_offset {
13112                return Ok(());
13113            }
13114
13115            // Decode unknown envelopes for gaps in ordinals.
13116            while _next_ordinal_to_read < 2 {
13117                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13118                _next_ordinal_to_read += 1;
13119                next_offset += envelope_size;
13120            }
13121
13122            let next_out_of_line = decoder.next_out_of_line();
13123            let handles_before = decoder.remaining_handles();
13124            if let Some((inlined, num_bytes, num_handles)) =
13125                fidl::encoding::decode_envelope_header(decoder, next_offset)?
13126            {
13127                let member_inline_size = <fidl::encoding::HandleType<
13128                    fdomain_client::Vmo,
13129                    { fidl::ObjectType::VMO.into_raw() },
13130                    2147483648,
13131                > as fidl::encoding::TypeMarker>::inline_size(
13132                    decoder.context
13133                );
13134                if inlined != (member_inline_size <= 4) {
13135                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
13136                }
13137                let inner_offset;
13138                let mut inner_depth = depth.clone();
13139                if inlined {
13140                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
13141                    inner_offset = next_offset;
13142                } else {
13143                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
13144                    inner_depth.increment()?;
13145                }
13146                let val_ref =
13147                self.vmo.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fdomain_client::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fdomain_client::fidl::FDomainResourceDialect));
13148                fidl::decode!(fidl::encoding::HandleType<fdomain_client::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fdomain_client::fidl::FDomainResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
13149                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
13150                {
13151                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
13152                }
13153                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
13154                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
13155                }
13156            }
13157
13158            next_offset += envelope_size;
13159
13160            // Decode the remaining unknown envelopes.
13161            while next_offset < end_offset {
13162                _next_ordinal_to_read += 1;
13163                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13164                next_offset += envelope_size;
13165            }
13166
13167            Ok(())
13168        }
13169    }
13170
13171    impl VmoTransfer {
13172        #[inline(always)]
13173        fn max_ordinal_present(&self) -> u64 {
13174            if let Some(_) = self.payload_size {
13175                return 3;
13176            }
13177            if let Some(_) = self.vmo_offset {
13178                return 2;
13179            }
13180            if let Some(_) = self.vmo_id {
13181                return 1;
13182            }
13183            0
13184        }
13185    }
13186
13187    impl fidl::encoding::ResourceTypeMarker for VmoTransfer {
13188        type Borrowed<'a> = &'a mut Self;
13189        fn take_or_borrow<'a>(
13190            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
13191        ) -> Self::Borrowed<'a> {
13192            value
13193        }
13194    }
13195
13196    unsafe impl fidl::encoding::TypeMarker for VmoTransfer {
13197        type Owned = Self;
13198
13199        #[inline(always)]
13200        fn inline_align(_context: fidl::encoding::Context) -> usize {
13201            8
13202        }
13203
13204        #[inline(always)]
13205        fn inline_size(_context: fidl::encoding::Context) -> usize {
13206            16
13207        }
13208    }
13209
13210    unsafe impl fidl::encoding::Encode<VmoTransfer, fdomain_client::fidl::FDomainResourceDialect>
13211        for &mut VmoTransfer
13212    {
13213        unsafe fn encode(
13214            self,
13215            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
13216            offset: usize,
13217            mut depth: fidl::encoding::Depth,
13218        ) -> fidl::Result<()> {
13219            encoder.debug_check_bounds::<VmoTransfer>(offset);
13220            // Vector header
13221            let max_ordinal: u64 = self.max_ordinal_present();
13222            encoder.write_num(max_ordinal, offset);
13223            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
13224            // Calling encoder.out_of_line_offset(0) is not allowed.
13225            if max_ordinal == 0 {
13226                return Ok(());
13227            }
13228            depth.increment()?;
13229            let envelope_size = 8;
13230            let bytes_len = max_ordinal as usize * envelope_size;
13231            #[allow(unused_variables)]
13232            let offset = encoder.out_of_line_offset(bytes_len);
13233            let mut _prev_end_offset: usize = 0;
13234            if 1 > max_ordinal {
13235                return Ok(());
13236            }
13237
13238            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
13239            // are envelope_size bytes.
13240            let cur_offset: usize = (1 - 1) * envelope_size;
13241
13242            // Zero reserved fields.
13243            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
13244
13245            // Safety:
13246            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
13247            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
13248            //   envelope_size bytes, there is always sufficient room.
13249            fidl::encoding::encode_in_envelope_optional::<
13250                u64,
13251                fdomain_client::fidl::FDomainResourceDialect,
13252            >(
13253                self.vmo_id.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
13254                encoder,
13255                offset + cur_offset,
13256                depth,
13257            )?;
13258
13259            _prev_end_offset = cur_offset + envelope_size;
13260            if 2 > max_ordinal {
13261                return Ok(());
13262            }
13263
13264            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
13265            // are envelope_size bytes.
13266            let cur_offset: usize = (2 - 1) * envelope_size;
13267
13268            // Zero reserved fields.
13269            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
13270
13271            // Safety:
13272            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
13273            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
13274            //   envelope_size bytes, there is always sufficient room.
13275            fidl::encoding::encode_in_envelope_optional::<
13276                u64,
13277                fdomain_client::fidl::FDomainResourceDialect,
13278            >(
13279                self.vmo_offset.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
13280                encoder,
13281                offset + cur_offset,
13282                depth,
13283            )?;
13284
13285            _prev_end_offset = cur_offset + envelope_size;
13286            if 3 > max_ordinal {
13287                return Ok(());
13288            }
13289
13290            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
13291            // are envelope_size bytes.
13292            let cur_offset: usize = (3 - 1) * envelope_size;
13293
13294            // Zero reserved fields.
13295            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
13296
13297            // Safety:
13298            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
13299            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
13300            //   envelope_size bytes, there is always sufficient room.
13301            fidl::encoding::encode_in_envelope_optional::<
13302                u64,
13303                fdomain_client::fidl::FDomainResourceDialect,
13304            >(
13305                self.payload_size.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
13306                encoder,
13307                offset + cur_offset,
13308                depth,
13309            )?;
13310
13311            _prev_end_offset = cur_offset + envelope_size;
13312
13313            Ok(())
13314        }
13315    }
13316
13317    impl fidl::encoding::Decode<Self, fdomain_client::fidl::FDomainResourceDialect> for VmoTransfer {
13318        #[inline(always)]
13319        fn new_empty() -> Self {
13320            Self::default()
13321        }
13322
13323        unsafe fn decode(
13324            &mut self,
13325            decoder: &mut fidl::encoding::Decoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
13326            offset: usize,
13327            mut depth: fidl::encoding::Depth,
13328        ) -> fidl::Result<()> {
13329            decoder.debug_check_bounds::<Self>(offset);
13330            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
13331                None => return Err(fidl::Error::NotNullable),
13332                Some(len) => len,
13333            };
13334            // Calling decoder.out_of_line_offset(0) is not allowed.
13335            if len == 0 {
13336                return Ok(());
13337            };
13338            depth.increment()?;
13339            let envelope_size = 8;
13340            let bytes_len = len * envelope_size;
13341            let offset = decoder.out_of_line_offset(bytes_len)?;
13342            // Decode the envelope for each type.
13343            let mut _next_ordinal_to_read = 0;
13344            let mut next_offset = offset;
13345            let end_offset = offset + bytes_len;
13346            _next_ordinal_to_read += 1;
13347            if next_offset >= end_offset {
13348                return Ok(());
13349            }
13350
13351            // Decode unknown envelopes for gaps in ordinals.
13352            while _next_ordinal_to_read < 1 {
13353                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13354                _next_ordinal_to_read += 1;
13355                next_offset += envelope_size;
13356            }
13357
13358            let next_out_of_line = decoder.next_out_of_line();
13359            let handles_before = decoder.remaining_handles();
13360            if let Some((inlined, num_bytes, num_handles)) =
13361                fidl::encoding::decode_envelope_header(decoder, next_offset)?
13362            {
13363                let member_inline_size =
13364                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
13365                if inlined != (member_inline_size <= 4) {
13366                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
13367                }
13368                let inner_offset;
13369                let mut inner_depth = depth.clone();
13370                if inlined {
13371                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
13372                    inner_offset = next_offset;
13373                } else {
13374                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
13375                    inner_depth.increment()?;
13376                }
13377                let val_ref = self.vmo_id.get_or_insert_with(|| {
13378                    fidl::new_empty!(u64, fdomain_client::fidl::FDomainResourceDialect)
13379                });
13380                fidl::decode!(
13381                    u64,
13382                    fdomain_client::fidl::FDomainResourceDialect,
13383                    val_ref,
13384                    decoder,
13385                    inner_offset,
13386                    inner_depth
13387                )?;
13388                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
13389                {
13390                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
13391                }
13392                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
13393                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
13394                }
13395            }
13396
13397            next_offset += envelope_size;
13398            _next_ordinal_to_read += 1;
13399            if next_offset >= end_offset {
13400                return Ok(());
13401            }
13402
13403            // Decode unknown envelopes for gaps in ordinals.
13404            while _next_ordinal_to_read < 2 {
13405                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13406                _next_ordinal_to_read += 1;
13407                next_offset += envelope_size;
13408            }
13409
13410            let next_out_of_line = decoder.next_out_of_line();
13411            let handles_before = decoder.remaining_handles();
13412            if let Some((inlined, num_bytes, num_handles)) =
13413                fidl::encoding::decode_envelope_header(decoder, next_offset)?
13414            {
13415                let member_inline_size =
13416                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
13417                if inlined != (member_inline_size <= 4) {
13418                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
13419                }
13420                let inner_offset;
13421                let mut inner_depth = depth.clone();
13422                if inlined {
13423                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
13424                    inner_offset = next_offset;
13425                } else {
13426                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
13427                    inner_depth.increment()?;
13428                }
13429                let val_ref = self.vmo_offset.get_or_insert_with(|| {
13430                    fidl::new_empty!(u64, fdomain_client::fidl::FDomainResourceDialect)
13431                });
13432                fidl::decode!(
13433                    u64,
13434                    fdomain_client::fidl::FDomainResourceDialect,
13435                    val_ref,
13436                    decoder,
13437                    inner_offset,
13438                    inner_depth
13439                )?;
13440                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
13441                {
13442                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
13443                }
13444                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
13445                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
13446                }
13447            }
13448
13449            next_offset += envelope_size;
13450            _next_ordinal_to_read += 1;
13451            if next_offset >= end_offset {
13452                return Ok(());
13453            }
13454
13455            // Decode unknown envelopes for gaps in ordinals.
13456            while _next_ordinal_to_read < 3 {
13457                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13458                _next_ordinal_to_read += 1;
13459                next_offset += envelope_size;
13460            }
13461
13462            let next_out_of_line = decoder.next_out_of_line();
13463            let handles_before = decoder.remaining_handles();
13464            if let Some((inlined, num_bytes, num_handles)) =
13465                fidl::encoding::decode_envelope_header(decoder, next_offset)?
13466            {
13467                let member_inline_size =
13468                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
13469                if inlined != (member_inline_size <= 4) {
13470                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
13471                }
13472                let inner_offset;
13473                let mut inner_depth = depth.clone();
13474                if inlined {
13475                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
13476                    inner_offset = next_offset;
13477                } else {
13478                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
13479                    inner_depth.increment()?;
13480                }
13481                let val_ref = self.payload_size.get_or_insert_with(|| {
13482                    fidl::new_empty!(u64, fdomain_client::fidl::FDomainResourceDialect)
13483                });
13484                fidl::decode!(
13485                    u64,
13486                    fdomain_client::fidl::FDomainResourceDialect,
13487                    val_ref,
13488                    decoder,
13489                    inner_offset,
13490                    inner_depth
13491                )?;
13492                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
13493                {
13494                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
13495                }
13496                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
13497                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
13498                }
13499            }
13500
13501            next_offset += envelope_size;
13502
13503            // Decode the remaining unknown envelopes.
13504            while next_offset < end_offset {
13505                _next_ordinal_to_read += 1;
13506                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13507                next_offset += envelope_size;
13508            }
13509
13510            Ok(())
13511        }
13512    }
13513
13514    impl fidl::encoding::ResourceTypeMarker for DataTransfer {
13515        type Borrowed<'a> = &'a mut Self;
13516        fn take_or_borrow<'a>(
13517            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
13518        ) -> Self::Borrowed<'a> {
13519            value
13520        }
13521    }
13522
13523    unsafe impl fidl::encoding::TypeMarker for DataTransfer {
13524        type Owned = Self;
13525
13526        #[inline(always)]
13527        fn inline_align(_context: fidl::encoding::Context) -> usize {
13528            8
13529        }
13530
13531        #[inline(always)]
13532        fn inline_size(_context: fidl::encoding::Context) -> usize {
13533            16
13534        }
13535    }
13536
13537    unsafe impl fidl::encoding::Encode<DataTransfer, fdomain_client::fidl::FDomainResourceDialect>
13538        for &mut DataTransfer
13539    {
13540        #[inline]
13541        unsafe fn encode(
13542            self,
13543            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
13544            offset: usize,
13545            _depth: fidl::encoding::Depth,
13546        ) -> fidl::Result<()> {
13547            encoder.debug_check_bounds::<DataTransfer>(offset);
13548            encoder.write_num::<u64>(self.ordinal(), offset);
13549            match self {
13550                DataTransfer::VmoTransfer(ref mut val) => fidl::encoding::encode_in_envelope::<
13551                    VmoTransfer,
13552                    fdomain_client::fidl::FDomainResourceDialect,
13553                >(
13554                    <VmoTransfer as fidl::encoding::ResourceTypeMarker>::take_or_borrow(val),
13555                    encoder,
13556                    offset + 8,
13557                    _depth,
13558                ),
13559                DataTransfer::InlineData(ref val) => fidl::encoding::encode_in_envelope::<
13560                    fidl::encoding::Vector<u8, 8192>,
13561                    fdomain_client::fidl::FDomainResourceDialect,
13562                >(
13563                    <fidl::encoding::Vector<u8, 8192> as fidl::encoding::ValueTypeMarker>::borrow(
13564                        val,
13565                    ),
13566                    encoder,
13567                    offset + 8,
13568                    _depth,
13569                ),
13570                DataTransfer::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
13571            }
13572        }
13573    }
13574
13575    impl fidl::encoding::Decode<Self, fdomain_client::fidl::FDomainResourceDialect> for DataTransfer {
13576        #[inline(always)]
13577        fn new_empty() -> Self {
13578            Self::__SourceBreaking { unknown_ordinal: 0 }
13579        }
13580
13581        #[inline]
13582        unsafe fn decode(
13583            &mut self,
13584            decoder: &mut fidl::encoding::Decoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
13585            offset: usize,
13586            mut depth: fidl::encoding::Depth,
13587        ) -> fidl::Result<()> {
13588            decoder.debug_check_bounds::<Self>(offset);
13589            #[allow(unused_variables)]
13590            let next_out_of_line = decoder.next_out_of_line();
13591            let handles_before = decoder.remaining_handles();
13592            let (ordinal, inlined, num_bytes, num_handles) =
13593                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
13594
13595            let member_inline_size = match ordinal {
13596                1 => <VmoTransfer as fidl::encoding::TypeMarker>::inline_size(decoder.context),
13597                2 => <fidl::encoding::Vector<u8, 8192> as fidl::encoding::TypeMarker>::inline_size(
13598                    decoder.context,
13599                ),
13600                0 => return Err(fidl::Error::UnknownUnionTag),
13601                _ => num_bytes as usize,
13602            };
13603
13604            if inlined != (member_inline_size <= 4) {
13605                return Err(fidl::Error::InvalidInlineBitInEnvelope);
13606            }
13607            let _inner_offset;
13608            if inlined {
13609                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
13610                _inner_offset = offset + 8;
13611            } else {
13612                depth.increment()?;
13613                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
13614            }
13615            match ordinal {
13616                1 => {
13617                    #[allow(irrefutable_let_patterns)]
13618                    if let DataTransfer::VmoTransfer(_) = self {
13619                        // Do nothing, read the value into the object
13620                    } else {
13621                        // Initialize `self` to the right variant
13622                        *self = DataTransfer::VmoTransfer(fidl::new_empty!(
13623                            VmoTransfer,
13624                            fdomain_client::fidl::FDomainResourceDialect
13625                        ));
13626                    }
13627                    #[allow(irrefutable_let_patterns)]
13628                    if let DataTransfer::VmoTransfer(ref mut val) = self {
13629                        fidl::decode!(
13630                            VmoTransfer,
13631                            fdomain_client::fidl::FDomainResourceDialect,
13632                            val,
13633                            decoder,
13634                            _inner_offset,
13635                            depth
13636                        )?;
13637                    } else {
13638                        unreachable!()
13639                    }
13640                }
13641                2 => {
13642                    #[allow(irrefutable_let_patterns)]
13643                    if let DataTransfer::InlineData(_) = self {
13644                        // Do nothing, read the value into the object
13645                    } else {
13646                        // Initialize `self` to the right variant
13647                        *self = DataTransfer::InlineData(
13648                            fidl::new_empty!(fidl::encoding::Vector<u8, 8192>, fdomain_client::fidl::FDomainResourceDialect),
13649                        );
13650                    }
13651                    #[allow(irrefutable_let_patterns)]
13652                    if let DataTransfer::InlineData(ref mut val) = self {
13653                        fidl::decode!(fidl::encoding::Vector<u8, 8192>, fdomain_client::fidl::FDomainResourceDialect, val, decoder, _inner_offset, depth)?;
13654                    } else {
13655                        unreachable!()
13656                    }
13657                }
13658                #[allow(deprecated)]
13659                ordinal => {
13660                    for _ in 0..num_handles {
13661                        decoder.drop_next_handle()?;
13662                    }
13663                    *self = DataTransfer::__SourceBreaking { unknown_ordinal: ordinal };
13664                }
13665            }
13666            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
13667                return Err(fidl::Error::InvalidNumBytesInEnvelope);
13668            }
13669            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
13670                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
13671            }
13672            Ok(())
13673        }
13674    }
13675}